-
近期文章
近期留言
彙整
分類
其他操作
-
修改resolv.conf的方法﹕
編輯文件﹕
/etc/resolvconf/resolv.conf.d/head
並在那裹加上名稱服務器 (例如﹕Google open dns)
nameserver 8.8.8.8
保存文件並執行﹕
sudo resolvconf -u
sudo service network-manager restart
在/etc/resolv.conf中的最上端便加上﹕
nameserver 8.8.8.8
由零開始至建成加密網站及中央儲存中心
分以下幾部份論述
01 組裝小型電腦
02 安裝作業系統
03 安裝LAMP伺服器
04 安裝Drupal構建網站
05 安裝Wordpress構建綱詀
06 安裝Certbot將網詀加密
07 安裝NFSD、SMBD、及VSFTPD
08 簡單總結
01 組裝小型電腦
早在2016年我在HKEPC發表過組裝三部小型電腦過程,可在以下連結參閱﹕
https://www.hkepc.com/forum/viewthread.php?tid=2311276
02 安裝作業系統
在2017年發表過介紹安裝不同Linux作業系統,可參閱﹕
https://www.hkepc.com/forum/viewthread.php?fid=24&tid=2354949&extra=&page=3dor
安裝ArchLinux全紀錄﹕
https://www.hkepc.com/forum/viewthread.php?tid=2367798
安裝BSD三兄弟全紀錄﹕
https://www.hkepc.com/forum/viewthread.php?tid=2419279
https://www.hkepc.com/forum/viewthread.php?tid=2419080
https://www.hkepc.com/forum/viewthread.php?tid=2418406
最受歡迎及容易使用的應是﹕Ubuntu、Linux Mint、Fedora、Centos….
選擇多人用的會有比較好的網上支緩。
03 安裝LAMP
今次我用Linux Mint搭載LAMP
安裝 LAMP
sudo apt-get install lamp-server^ -y
測試 Apache
http://localhost
測試 PHP
sudo nano /var/www/html/info.php
加入以下一行
Then CTRL+X then y and Enter
溜灠器𨧞入:
http://localhost/info.php
安裝 PHPMyAdmin
sudo apt-get install phpmyadmin -y
預設的使用者是phpmyadmin
進入mysql設定root的密碼
Login to mysql
sudo mysql -u root
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘new-password’;
增加使用者並取得所有權限﹕
Grant privileges to a new user execute below command in mysql interface:
“replace new-user with the name you need”
CREATE USER ‘new-user’@’localhost’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON *.* TO ‘new-user’@’localhost’;
FLUSH PRIVILEGES;
登出sql
exit
04 安裝Drupal構建網站
https://www.hkepc.com/forum/viewthread.php?tid=2598106
05 安裝Wordpress構建綱站
https://www.hkepc.com/forum/viewthread.php?tid=2598491
06 安裝Certbot將網詀加密
https://www.hkepc.com/forum/viewthread.php?tid=2598824
07 安裝NFSD、SMBD、及VSFTPD
https://www.hkepc.com/forum/viewthread.php?tid=2599047
08 簡單總結
以上都是我在HKEPC已發表的內容,均是「實戢」所得,所有內容都是真實操作過,將由零至建作加密網站來一個𢑥整,方便查閱。
在Linux Mint 20 安裝certbot
sudo apt-get install certbot python3-certbot-apache
獲取認證
sudo certbot –apache
檢查certbot的情況
sudo systemctl status certbot.timer
檢查更新情況
sudo certbot renew –dry-run
檢查ufw情況
sudo ufw status
加入規則﹕如准許Apache及OpenSSH
sudo ufw allow ‘Apache Full’
sudo ufw allow ‘OpenSSH’
在Linux Mint 18 安裝certbot
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-apache apache2
取得認證
sudo certbot –apache
設定如下﹕
sudo chown www-data:www-data -R /var/www/html/wordpress
sudo chmod 755 -R /var/www/html/wordpress
便可以解決不能上載更新wordpress問題
在linux mint 加裝文泉驛字型﹕
sudo apt-get install fonts-wqy-zenhei
鍵入以上安裝即可。
在linux mint 20安裝vsftpd後,發覺vsftpd不能啟動。解決方法﹕
修改/etc/vsftpd.conf如以下﹕
listen=YES
# listen_ipv6=YES
修改後存檔及重啟vsftpd便可。
另若架有wordpress網站,要將wordpress設定如下﹕
sudo chown -R www-data:www-data wordpress
否則不能用vsftpd去更新,因為無寫入wordpress創建資料夾權限。
使用composer來更新Drupal最為方便,故先安裝composer
1. 創建composer.sh
touch composer.sh
2. 使用任一文字編輯軟件打開composer.sh,在內加入以下內容,存檔及登出。
EXPECTED_SIGNATURE=$(wget -q -O – https://composer.github.io/installer.sig)
php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”
ACTUAL_SIGNATURE=$(php -r “echo hash_file(‘SHA384’, ‘composer-setup.php’);”)
if [ “$EXPECTED_SIGNATURE” != “$ACTUAL_SIGNATURE” ]
then
>&2 echo ‘ERROR: Invalid installer signature’
rm composer-setup.php
exit 1
fi
php composer-setup.php –quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
3. 設定composer.sh可以執行
sudo chmod +x composer.sh
4. 執行composer.sh
./composer.sh
5. 搬移composer.phar使composer能在系統任何地方都可使用
sudo mv composer.phar /usr/local/bin/composer
6. 執行composer,確認已成功安裝
composer
+++ 大功告 +++
在安裝或更新wordpress插件時,時有出現”cURL error 28: Connection timed out”,請檢視以下幾點﹕
1. 是否已使用最新的php及cURL
2. 嘗試增加系統記憶體及上載大小設定
3. 檢查/etc/hosts,直接加入download.wordpress.org的DNS