Est. reading time: 2 minutes
Migrate Website from Shared Hosting To VPS

How to Migrate Website from Shared Hosting To VPS

There are two methods to migrate a website from shared hosting to VPS. This guide will show you how to migrate your website from cPanel to your VPS that you’ve setup, by manually creating a full backup of your website files and using web migration. To prepare for site migration, you need to ensure you have access to your old web host via cPanel, as well as your new server via SSH. Your new server should be setup and ready to host a website before beginning, and your website should be put in frozen state or maintenance mode.

Steps to migrate website from shared hosting to VPS

To begin, make sure you are logged in to your old host cPanel area. Either also login to your new server via SSH now or be ready to do so after Step 1. Make sure you are logged in to your new server with root privilege.

  1. Create a backup of all your files. In File Manager in cPanel, select all files and folders (you may choose to exclude certain files or folders such as cgi-bin or .ftpquota), click the Compress icon and select Zip Archive as the compression type.
  2. In your new server, go to the root folder of your site’s document and enter the command wget, where ‘domain’ is your domain name and ‘’ is your backup file you’ve just created.
  3. Extract the backup file using unzip command: unzip then typing “Is” and hitting Enter.
  4. Copy your site’s database link. In your old host cPanel area, select the Backup Wizard > Backup > Select Partial Backup > MySQL Databases. Right-click the relevant database link and select Copy Link Location.
  5. Move your site’s database. In your SSH client, issue the following command:
    wget –user=cpaneluser –password=’cpanelpass’ where ‘cpaneluser’ is your old host cPanel username, ‘cpanelpass’ is your cPanel password, and ‘’ is the database link you just copied in Step 4.
  6. Extract your database using gzip -d You should get sql from this.
  7. Import your .sql file to your server’s database. Create a new MySQL database and MySQL user on your new server with full access granted. Then use the command mysql -u MYSQL_USER -p DATABASE_NAME < DATABASE_NAME.sql where ‘MYSQL_USER’ is your MySQL username, ‘DATABASE_NAME’ is your database name, and ‘DATABASE_NAME.sql’ is the .sql file you transferred in the previous steps.

The final stages

Once you’ve completed the above steps to migrate your website from shared hosting to VPS, you can edit your script to reflect the new server settings, such as database name, user and password. Don’t forget to also change the NS entries of your domain with the new server’s IP to ensure your domain name resolves to your new server. For more help, contact HOSTAFRICA today.

Related posts