Migrating your existing WordPress install might be a headache especially if you are not a developer or run a high traffic site. EE is currently used by many high traffic WordPress sites globally. In addition to this headache playing with containers is not everyone’s cup of tea. Let’s find out how you can migrate your existing WordPress install to EE v4 without much efforts.
Step 1: Backup you existing WP files and its respective Database
All you need is a wp-content directory as a backup and your DB backup. There is absolutely no need to copy all files and folders simply because all of your plugins, themes and images are stored in wp-content directory.
Simply take a backup of wp-content directory in a tar.gz file format and your DB in sql file format. Place this file in your html directory or a directory which is exposed to port 80.
Note: if you have played with wp-content or wp architecture for custom development, you need to make the necessary changes and migrated those files / folders accordingly.
Step 2: Install EE v4 on a brand new server
In order to install EE v4, you need a new server which does not have any other tools or scripts preinstalled. We use and recommend Ubuntu 18.04 LTS server from Digital Ocean.
Login into your new server and copy paste the following command as below:
wget -qO ee rt.cx/ee4 && sudo bash ee
This will automatically download EE v4 scripts, Docker etc and also install them. Now, create site with your existing site name using
ee site create example.com --type=wp --php=7.3 --cache --ssl=le
The above command will create site with your domain and install WP as well as setup Redis for you. It will also setup SSL for your domain. Just save the site info in Notepad which includes WordPress and DB credentials.
Login into PhpMyAdmin using DB credentials from your browser through the following url
http://domain.com/ee-admin/pma/ and select all tables from the DB and drop them.
Step 3: Migrate your existing WP
After you drop all the tables from DB either import your existing db backup from phpmyadmin if the size of your .sql file is in few MBs. Else, import it using the following command through CLI
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root –password=root DATABASE
All of your WP Files and Folders are located here /opt/easyengine/sites/example.com/app/htdocs
Now, change directory using
cd opt/easyengine/sites/example.com/app/htdocs
and delete existing wp-content using
rm -rf wp-content
Download your existing backup in the same directory using
wget http://example.com/file.tar.gz
Extract the file using
tar -zxvf file.tar.gz
Now, change ownership and permission of wp-content directory by using
chown -R www-data:www-data wp-content
Lastly, edit your wp-config.php file and ensure that you replace table prefix with your current table prefix used in your DB and save the necessary changes.
Change NameServers or A record IP to the new one. Login into your wp dashboard and just save permalinks once.
Its Done. Your site is now live on your new server.