建加密網站

由零開始至建成加密網站及中央儲存中心

分以下幾部份論述

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篇 | 發佈留言

使用certbot加密網站

在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

分類: Linux篇 | 發佈留言

安裝tlp

安裝tlp

sudo apt-get install tlp

便可以用指令控制 wifi開關

wifi on
wifi off

分類: Linux篇 | 發佈留言

簡單設定wordpress權限

設定如下﹕

sudo chown www-data:www-data -R /var/www/html/wordpress

sudo chmod 755 -R /var/www/html/wordpress

便可以解決不能上載更新wordpress問題

分類: 遊山玩水 | 發佈留言

Linux Mint加裝文泉驛字型

在linux mint 加裝文泉驛字型﹕

sudo apt-get install fonts-wqy-zenhei

鍵入以上安裝即可。

分類: Linux篇 | 發佈留言

linux mint 20 安裝 vsftpd 不能啟動

在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創建資料夾權限。

分類: Linux篇 | 發佈留言

在Linux Mint 安裝composer

使用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

+++ 大功告 +++

分類: Linux篇 | 發佈留言

修復”cURL error 28: Connection timed out”

在安裝或更新wordpress插件時,時有出現”cURL error 28: Connection timed out”,請檢視以下幾點﹕

1. 是否已使用最新的php及cURL

2. 嘗試增加系統記憶體及上載大小設定

3. 檢查/etc/hosts,直接加入download.wordpress.org的DNS

分類: Linux篇 | 發佈留言

修正phpmyadmin匯出檔案錯誤

Warning in ./libraries/plugin_interface.lib.php#532

count(): Parameter must be an array or an object that implements Countable
的錯誤

解決方法如下:
修改 plugin_interface.lib.php
位置是:/usr/share/phpmyadmin/libraries/plugin_interface.lib.php
行數是532,原始code如下:

if ($options != null && count($options) > 0) {
將其修改為
if ($options != null && count((array)$options) > 0) {
即可解決

若出現sql.lib.php#601出錯﹕
用nano编辑 sql.lib.php

sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php
按CTRL+ W 搜索 (count($analyzed_sql_results[‘select_expr’] == 1)

替换为 ((count($analyzed_sql_results[‘select_expr’]) == 1)

分類: Linux篇 | 發佈留言

Mount a SMB Share in Linux

Step 1:
sudo apt-get install cifs-utils

Step 2:
sudo mkdir /mnt/local_share

Step 3:
sudo mount -t cifs //vpsa_ip_address/export_share /mnt/local_share

備註:export_share不是路徑,是共享的資料夾名稱。

若要開機自動掛載,在客戶端/etc/fstab下,加入下列一句﹕
//vpsa_ip_address/export_share /mnt/local_share cifs rw,x-gvfs-show,user

分類: Linux篇 | 發佈留言