早一星期因為一個一不少心,在upgrade Ubuntu時忙了用SSH做release upgrade是一件中度風險事情(雖然每次都無事),最後server instance就因為session timeout 而brick了. 搞了一大輪.最後只可以rebuild server instance及wordpress. 說起wordpress, 我早前好在買了Duplicator Pro作為backup用途, 今次正正用了 Duplicator Pro 來重建我的Wordpress.
事緣是甘的- 每次做”do-release-upgrade”時, Ubuntu總會提醒sysop可用port 1022進入backup SSH, 當然我無想過有需要經1022進入console. 但今次居然係”唔成功”, 而且就連ssh port 1022 及 rescue mode都入唔到console. 連data centre都同我講已經GG(Good Games, 即係玩完), 最後我只有選擇rebuild OS及Duplicator Pro重建Wordpress contents.
Rebuild OS其實相當簡單, 只需在web hosting個admin page幾下clicks再等約10分鐘就完成. 之後要做的就係reinstall返所有software package, 我通常會用LAMP stack +postfix + fail2ban 做foundations. 安裝既command大政如下:
apt-get update -y;apt-get upgrade -y apt-get install apache2 mysql-server mysql-client php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php php7.0-mbstring php7.0-gd lynx htop php-mysql php-xml php-dom fail2ban postfix
完成了基本LAMP stack既installation, 當然是需要在mysql建設 database instance, 在command-line先打 mysql -u root -p進入mysql後打輸入:
create database wordpress; create user 'wordpressuser'@'localhost' identified by '123456dfscdverZ7890'; grant all privileges on wordpress.* to 'wordpressuser'@'localhost';
重建了mysql後就可以安裝wordpress了, 安裝wordpress其實很簡單步驟大致是:
Step 1 -先download最新的tgz files:
cd /tmp wget https://wordpress.org/latest.tar.gz
Step 2 – 再解壓
tar -xzvf latest.tar.gz
Step 3 – 再搬家及改ownership
mv wordpress /var/www/html/ chown -R www-data:www-data /var/www/html/wordpress
Step 4 – 安裝 Let’s Eencrypted SSL cert
流程勁簡單, 可以直接fast forward去offcial page
https://certbot.eff.org/
Step 5 – 修改apache 個configuration files
vi /etc/apache2/sites-enabled/*.conf
做起上面好幾個steps基本上wordpress已經可以進入configration mode, 例如: https://unixwise.xyz/wordpress/?admin, 再次輸入database parameter就可以完成wordpress既installation及使用Duplicator Pro rebuild wordpress既contents
Host: localhost Database: wordpress User: wordpressuser Password: 123456dfscdverZ7890