Migration process is divided into following parts
- Setup Server
- Create Website
- Copy Web-root
- Import Database
- DNS
NOTE: We used the 1.1.1.1 as old server ip-address and 2.2.2.2 as new server ip-address in this article you need to change this values.
Setup Server
First log in to new server and install EasyEngine
wget -qO ee rt.cx/ee && sudo bash ee ee stack install
Above two commands install all the dependency and EasyEngine.
Create Website
By default, EasyEngine automatically created database, MySQL user/password for the domain name like example_com
We can simply force EasyEngine to ask us for the database, MySQL user/pass so we can used same credential we used in old server to avoid manual modification in wp-config.php file.
Lets modify the /etc/easyengine/ee.conf file to avoid later manual work 🙂
vim /etc/ee/ee.conf
and set following values
# Custom Database Name db-name = True # Custom Database User db-user = True
Lets create a example.com on new server
ee site create example.com --wp
It will output as follows
Creating example.com, Please Wait... Creating Symbolic Link For example.com Creating htdocs & logs Directory Creating Symbolic Link For Logs Downloading WordPress, Please Wait... Enter The MySQL Database Name [example_com]: example.com Enter The MySQL Database Username [example_com]: exampleuser Enter The MySQL Database Password [73kWK4MpRiXjuvo]: mypass Setting Up WordPress, Please Wait... Updating WordPress Permalink, Please Wait... Installing Nginx Helper Plugin, Please Wait... Changing Ownership Reloading Nginx Configuration, Please Wait... Take /etc/nginx Configuration In Git Version Control... WordPress Admin Username: admin WordPress Admin Password: HelloExample Successfully Created New Website: http://example.com
Copy Webroot
Now example.com is ready on new server but we still need old server data
Lets copy the web-root from old server to the new server
cd /var/www/example.com/htdocs rm -rf * rsync -avz --progress [email protected]:/var/www/example.com/htdocs/* .
Note: do not forget the “.” dot at the end.
Now we copy the web-root from old server to the new server.
Import Database
Take mysqldump on old server
mysqldump -u root -p example.com > /tmp/example.com.sql
Lets copy and import the MySQL dump on new server
rsync -avz --progress [email protected]:/tmp/example.com.sql /tmp pv /tmp/example.com.sql | mysql example.com
As of now we have same web-root and database as old server.
Point DNS
Lets test the site before pointing DNS
You need to modify your local system /etc/hosts
file
vim /etc/hosts
and add following line into it
2.2.2.2 example.com www.example.com
Lets open example.com in your web-browser to test and if all looks good point DNS to the new server ip-address.
As per our roadmap the EasyEngine Migration Release do all the above stuff with single command like
ee site copy old-server-ip new-server-ip
NOTE: This feature is not yet completed
I’m stuck at rsync.
I get: Permission denied (publickey)
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [Receiver=3.1.2]
We’d request you to please create a ticket at https://community.easyengine.io/c/v4 for troubleshooting support. 🙂
Hi, I’m using EasyEngine 4 and I’m unable to access my “example.com” site trough IP, even changing my hosts file. I get ERR_CONNECTION_REFUSED. The only way I can access my site trough IP is installing it with ee site create 2.2.2.2
We’d request you to please create a ticket at https://community.easyengine.io/c/v4 for troubleshooting support. 🙂