Wordpress migration

Wordpress installation and migration from previous server

Pre requisites:-

1. Linux VPS [Server2]
2. Access to previous server [Server1]
3. Database dump of current wordpress configuration
4. Public IP

Steps:-

1. Install Apache on VPS

for debian/ubuntu  – #apt install apache2
for fedora/CentOS  – #yum install httpd


2. Install Mysql server
for debian/ubuntu –  #apt-get install mysql-server
for fedora/CentOS – Go to
https://dev.mysql.com/downloads/repo/yum/   and download rpm file. Install rpm with
                                     #rpm –ivh (filename).rpm


3. Install PHP package
for Debian/Ubuntu  – #apt-get install php libapache2-mod-php php-mcrypt php-mysql
For Fedora/CentOS – #yum install epel-release yum-utils
                                      #yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
                                      #yum-config-manager --enable remi-php7.3
                                      #yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd


4. Enable apache2 and mysql as well as start these service if not started.
#systemctl enable apache2      (for Fedora/CentOS replace apache2 with httpd)
#systemctl enable mysql
#/etc/init.d/apache2 start        (for Fedora/CentOS replace apache2 with httpd)
#/etc/init./mysql start

5. 
Set password to root in mysql. Create another user in mysql and an empty database. Grant all privileges of the database to the user.

6. Log in to Server1 and read wp-config.php file. Check database used for Wordpress. With credentials mentioned in file, take dump (backup) of database. Copy whole wordpress directory. Transfer database dump and wordpress dirctory to Server2 to directory /tmp/
#cp /var/www/html/* /tmp/
#mysqldump (current_db_name) > /tmp/(dump_name).sql
#
cp wp-config.php wp-config.php.copy
#cd /tmp/
#rsync –avz /tmp/* -e ssh root@(serve2-IP):/tmp/

7. On Server2, go to /tmp/ and download Wordpress from Website. Extract tar file and move extracted folder “wordpress” to /var/www/html/
#tar -xzvf wordpress-5.3.2.tar.gz
#mv wordpress /var/www/html/

8. In Server2, restore database dump with empty database created
#mysql –u (username) –p (empty_db_name) < /tmp/(dump_name).sql

9. Go to /var/ww/html/ and delete file “index.html”. Copy wp-admin, wp-content from tmp folder to /var/www/html/.
#cd /var/www/html/
#rm –rf index.html
#cp /tmp/wp-content /var/www/html/

#cp /tmp/wp-admin /var/www/html/

#cp /tmp/wp-config.php /var/www/html/
#
mv wp-config.php.copy wp-config.php
Edit wp-config.php.copy with following fields.

#vim /var/www/html/wp-config.php
define('DB_NAME', 'mysql_db_name');
define('DB_USER', 'mysql_user');
define('DB_PASSWORD', 'mysql_user_password';

10. Restart Apache and mysql.
#/etc/init.d/apache2 restart     (for Fedora/CentOS replace apache2 with httpd)
#/etc/init.d/mysql restart

Check marks:- 

Open Browser in Private/Incognito mode, enter public IP provided and search. Website hosted on Server1 should be opened.





Common issues and troubleshooting

 

Wordpress may face some issues after deployment. They are easy to identify and solve.

1. Permalinks of the websites are not working (Main website landing page works fine but other sub-pages return '404 not found error')

To solve the issue, login to the wordpress admin dashboard, go to settings and then Permalinks. Simply "save changes" option and permalinks will start to work. If this does not work, then go to Apache configuration of the website by logging in to the server and add below fields in the file (if not already present)

 

<Directory /path/to/wordpress/directory>
        Options FollowSymLinks
        AllowOverride None
</Directory>

 

Save the changes and restart the apache. It will work

 

2. Error establishing database connection

This issue states the problem in itself. The database service is not running. Hence, login to the server and start the DB service.

 

3. "xyz' extension is missing

This issue occurs if the website requires some specific php extension to run like imagick or zip. To solve the issue, log in to the server and run following command

apt install php-(package name) 

e.g apt install php-imagick

 

 

 

 

 

 

 

 

 

 

  • 0 Uživatelům pomohlo
Byla tato odpověď nápomocná?

Související články

New joinee induction checklist

  Induction checklist of New Joinee                 Name of New...

Requirement Gathering

  Whenever we are discussing with client and understanding their needs, few things...

Setup Tally on Cloud

  Hi, Setting up Tally on Cloud is simple task task. Following are steps to follow 1.     Set...

Gaming - setting up server

  Hi, Setting up windows server for gaming is very crucial step when it come to game renderning....

Gaming - order processing

  Once there is an order placed by user for gaming, it will be notified via email and in WHMCS...

Powered by WHMCompleteSolution