How to transfer a website from virtual hosting to VPS using LAMP

watch 3m, 49s
views 2

11:12, 01.06.2022

Article Content
arrow

  • How to install LAMP
  • Creating a database backup
  • Copying site files to VPS/VDS
  • Setting up Virtual Hosting
  • Changing the domain A-record

One of the most reliable and proven ways to transfer a website from a virtual hosting on the VPS is a LAMP stack – with this software you can sequentially:

  • create a backup database;
  • transfer files to VPS;
  • set up a new hosting;
  • delimit access rights for users;
  • create a database;
  • configure and prepare the site for operation;
  • check the correctness of the transfer.

In the example we are considering now, the site will run under WordPress, and the transfer is carried out on the Ubuntu 18.04 operating system. This is one of the most popular bundles, so the guide will be relevant for most network administrators.

How to install LAMP

The LAMP complex is necessary to ensure the operation of most web servers. It includes 4 key software products:

  1. Apache Web Server.
  2. OS Linux.
  3. MariaDB or MySQL database management system.
  4. The PHP language pack required for web applications to work.

To install LAMP on Ubuntu, it is enough to enter a series of commands sequentially:

sudo apt install apache2
sudo apt install mysql-server
sudo apt install php7.2 libapache2-mod-php7.2 php-mysql
sudo apt install php-curl php-json php-cgi php-gd php-zip php-mbstring php-xml php-xmlrpc

If desired, you can also order an additional LAMP installation service at the stage of choosing a tariff plan from HostZealot. 

Also, after installation, you must allow access to your server from the outside, add its port to the exceptions with the command:

sudo ufw allow in 80/tcp

If your port number is different, we change the command accordingly.

Above we described the manual way to install LAMP components, but there are other, simpler options – most often the stack can be installed automatically through the control panel. This feature is not available on all PU, so we considered it necessary to describe the manual installation method. Now let's look directly at how to transfer a website from virtual hosting to VPS.

Creating a database backup

If you are using the cPanel control panel, open it and go to the "Backup" section. There is nothing complicated here – just click on the "Download a Full Account Backup" button and specify the place where to save the archive. Transfer the saved copy of the database to another computer or VPS. Yes, you can immediately export it to a virtual private server using the FTP, SFTP, or SSH protocol.

how to transfer a website from virtual hosting to vps using lamp

Copying site files to VPS/VDS

On the VPS server where you want to transfer a copy of the database, you need to open the control panel on behalf of a user with root access rights.  Then, in the "Data Recovery" section, you need to select the previously created archive and confirm the action.

As a result of your actions, all the data that was previously on the virtual hosting will be deployed on the server – site files, databases, mail, and even cron tasks.

The sequence of actions may vary slightly, depending on the control panel used, but in all cases it looks similar. Create a full copy of all data on the old server, transfer it to the new VPS and restore, simple as that. 

Setting up Virtual Hosting

First of all, you need to configure the web server so that it functions correctly in a new place. To do this, edit the configuration file wp-config.php by changing the details of the MySQL database in it to new ones. Open it in edit mode and use the keyboard shortcut "Ctrl+F" to find the key "MySQL settings". You will see something like this in front of you:

// ** MySQL settings - You can get this info from your web host ** //
 /** The name of the database for WordPress */
 define('DB_NAME', 'u694443746_meryr');/** MySQL database username */
 define('DB_USER', 'u694443746_tatym');/** MySQL database password */
 define('DB_PASSWORD', 'fjg#fKLO033j');/** MySQL hostname */
 define('DB_HOST', 'mysql');

Here you need to update the values:

  • DB_NAME is the name of the MySQL database.
  • DB_USER is the MySQL user name.
  • DB_PASSWORD is the password for the database.
  • DB_HOST – here we simply register localhost, because our database is located on the same server.

Save the changes, the final touch is to update the A-record.

Changing the domain A-record

To do this, go to the "DNS Zone Editor" section in the control panel and specify the IP address of your new VPS server, and then save the changes. This completes the transfer of the virtual server to the VPS, everything should work properly. If you still have questions or difficulties, feel free to contact us using the telephone numbers listed on the website or by writing to Livechat.

Share

Was this article helpful to you?

VPS popular offers

-12.3%

CPU
CPU
6 Xeon Cores
RAM
RAM
16 GB
Space
Space
150 GB SSD
Bandwidth
Bandwidth
Unlimited
10Ge-wKVM-SSD 16384 Windows

237 /mo

/mo

Billed annually

-10%

CPU
CPU
4 Xeon Cores
RAM
RAM
8 GB
Space
Space
100 GB SSD
Bandwidth
Bandwidth
Unlimited
10Ge-KVM-SSD 8192 Linux

115.5 /mo

/mo

Billed annually

-15.6%

CPU
CPU
3 Xeon Cores
RAM
RAM
1 GB
Space
Space
20 GB SSD
Bandwidth
Bandwidth
30 Mbps
DDoS Protected SSD-KVM 1024 Linux

38 /mo

/mo

Billed annually

-10%

CPU
CPU
6 Xeon Cores
RAM
RAM
16 GB
Space
Space
400 GB HDD
Bandwidth
Bandwidth
Unlimited
KVM-HDD 16384 Linux

50 /mo

/mo

Billed annually

-8.1%

CPU
CPU
6 Xeon Cores
RAM
RAM
8 GB
Space
Space
200 GB HDD
Bandwidth
Bandwidth
Unlimited
wKVM-HDD 8192 Windows

31.25 /mo

/mo

Billed annually

-5%

CPU
CPU
3 Xeon Cores
RAM
RAM
1 GB
Space
Space
40 GB HDD
Bandwidth
Bandwidth
Unlimited
wKVM-HDD 1024 Windows

12.1 /mo

/mo

Billed annually

-18.4%

CPU
CPU
4 Xeon Cores
RAM
RAM
2 GB
Space
Space
75 GB SSD
Bandwidth
Bandwidth
2 TB
wKVM-SSD 2048 Metered Windows

24 /mo

/mo

Billed annually

-16.3%

CPU
CPU
4 Xeon Cores
RAM
RAM
2 GB
Space
Space
30 GB SSD
Bandwidth
Bandwidth
40 Mbps
DDoS Protected SSD-KVM 2048 Linux

48 /mo

/mo

Billed annually

-10%

CPU
CPU
3 Xeon Cores
RAM
RAM
1 GB
Space
Space
40 GB HDD
Bandwidth
Bandwidth
Unlimited
KVM-HDD 1024 Linux

6.1 /mo

/mo

Billed annually

CPU
CPU
8 Epyc Cores
RAM
RAM
32 GB
Space
Space
200 GB NVMe
Bandwidth
Bandwidth
Unlimited
Keitaro KVM 32768
OS
CentOS
Software
Software
Keitaro
/mo

Billed monthly

Other articles on this topic

Two-factor authentication
How to configure a Linux VPS
Two-factor authentication
How to configure a Linux VPS
cookie

Accept cookies & privacy policy?

We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the HostZealot website.