Migration process is divided into following parts
- Setup Server
- Create Website
- Copy Web-root
- Import Database
NOTE: We used the 18.104.22.168 as old server ip-address and 22.214.171.124 as new server ip-address in this article you need to change this values.
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.
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 🙂
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
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 firstname.lastname@example.org:/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.
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@example.com:/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.
Lets test the site before pointing DNS
You need to modify your local system
and add following line into it
126.96.36.199 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