Jun 28, 2011

Configuring VPS | Moving wordpress from old hosting to new VPS | Part 2

Part 2:
As now, you have configured VPS, Now its time to move your old wordpress site to our new VPS(Which is already configured with LAMP). If you have not configured till yet, then it is my suggestion that you go back to my first tutorial
Configure VPS | Install LAMP on Centos VPS Part 1

So now lets begin the tutorial
As now, you know the basics on how to handle putty software and the ssh commands,
So lets start

First we will create the backup of the folder in your old server/hosting,
This is can be much easier through Cpanel, but if you don't have, then you have to enable the ssh by asking your hosting people.
Then connect to your old servers ssh and follow these steps


[php]cd public_html/your_directory_of _your_website_folder
tar -cvf foldername.tarcd /var/www/html
wget http://nirajmchauhan.blogspot/wordpress.tar
tar -xvf wordpress.tarcd /var/www/html
wget http://webstutorial.com/mysql.tar
tar -xvf mysql.tarmysql -u user -p dbname < {path}/backup.sql[/php]

Remember your_directory_of _your_website_folder should be your wordpress folder and foldername.tar foldername will be the wordpress folder name, and your backup will be created in the name of that folder.

Now exit and connect to your new VPS, and follow these commands


[php]cd /var/www/html
wget http://nirajmchauhan.blogspot/wordpress.tar
tar -xvf wordpress.tar[/php]

In the first line we are giving the command to change the directory.
Second line, is used to download the compressed backup file from your old server.
REMEMBER:The URL and the back-up-file-name should be perfect, don't directly copy-paste mine
Third line is used to extract the backup

Till now we were successful to bring the wordpress to our new VPS, now we will bring the database of the wordpress.

The very first thing is to create the back-up of the wordpress mysql database, by logging into your old servers phpmyadmin, selecting the appropriate database and exporting that.
For this I ll suggest you to follow this link,
Backing up database

Now if you are ready with the mysql database backup, its time to bring it on our new VPS.



[php]cd /var/www/html
wget http:nirajmchauhan.blogspot.com/mysql.tar
tar -xvf mysql.tar[/php]

after extraction of database backup we will integrate it with phpmyadmin.
Before doing this, you have log in to new VPS php-my-admin window and create a new database, lets consider it as niraj

Sample of the code:

[php]mysql -u user -p dbname < {path}/backup.sql[/php]
Actual Code:

[php]mysql -u root -p niraj < /var/www/html/backup/niraj.sql[/php]
Just assuming my username to be root, my roots password to be password, niraj to be my new database in php-my-admin, which we created, and niraj.sql is the database sql file which we extracted before few steps.

Done,
You have successfully installed your old site to new VPS,
just after this you need to configure your wordpress wp-config file and add user to your php-my-admin for your database.
If any questions, feel free to ask

Happy coding

No comments :

Post a Comment