Web Server移機筆記
01.伺服器安裝方法
http://liaozi.blogspot.tw/2012/08/ubuntu1204serverdrupalusbinstall.html
02.將 /var/www 資料夾同步
$ ssh-keygen -t dsa [產生ssh金鑰]
$ cd .ssh/
$ scp id_dsa.pub host2_id@host2:~/id_dsa_host1.pub [傳送金鑰至host2主機]
$ ssh host2_id@host2 [登入host2主機]
$ cat id_dsa_host1.pub >> .ssh/authorized_keys [滙入金鑰]
$ exit [退出遠端host2主機]
$ sudo rsync -av --delete -e "ssh -i /home/username/.ssh/id_dsa" host2_id@host2:/var/www /var/ [同步/var/www 指令]
03.還原資料庫
$ mysqladmin -u root create data1 [建立資料庫]
$ mysql -u root data1 < data1.sql [還原資料庫]
$ mysqladmin -u root drop data1 [假如要刪除就這樣子寫]
04.記得apache的conf檔也要同步,再restart apache
$ sudo rsync -av --delete -e "ssh -i /home/username/.ssh/id_dsa" host2_id@host2:/etc/apache2/conf.d/virtualhost.conf /etc/apache2/conf.d/virtualhost.conf
大概就是這樣子,要特別注意php,mysql的版本,最好作業系統用同樣的版次 Ubuntu LTS ( Desktop or Server )
http://liaozi.blogspot.tw/2012/08/ubuntu1204serverdrupalusbinstall.html
02.將 /var/www 資料夾同步
$ ssh-keygen -t dsa [產生ssh金鑰]
$ cd .ssh/
$ scp id_dsa.pub host2_id@host2:~/id_dsa_host1.pub [傳送金鑰至host2主機]
$ ssh host2_id@host2 [登入host2主機]
$ cat id_dsa_host1.pub >> .ssh/authorized_keys [滙入金鑰]
$ exit [退出遠端host2主機]
$ sudo rsync -av --delete -e "ssh -i /home/username/.ssh/id_dsa" host2_id@host2:/var/www /var/ [同步/var/www 指令]
03.還原資料庫
$ mysqladmin -u root create data1 [建立資料庫]
$ mysql -u root data1 < data1.sql [還原資料庫]
$ mysqladmin -u root drop data1 [假如要刪除就這樣子寫]
04.記得apache的conf檔也要同步,再restart apache
$ sudo rsync -av --delete -e "ssh -i /home/username/.ssh/id_dsa" host2_id@host2:/etc/apache2/conf.d/virtualhost.conf /etc/apache2/conf.d/virtualhost.conf
大概就是這樣子,要特別注意php,mysql的版本,最好作業系統用同樣的版次 Ubuntu LTS ( Desktop or Server )
留言