A Hostinger Virtual Private Server (VPS) provides a dedicated environment where you have full control over the configuration and data. When moving your projects from an external provider or another Hostinger VPS, you must manually transfer your files and databases to the new instance.
This guide covers the essential steps for a smooth migration between Linux-based servers. While specific commands may vary slightly depending on your distribution, these instructions generally apply to most Linux operating systems.
If you are moving from a web hosting plan rather than a VPS, follow this tutorial instead: How to migrate from shared hosting to VPS.
Preparations
Before initiating the migration process, ensure you have the following
- An active Hostinger VPS plan with the same or higher capacity than your current server to ensure sufficient resources.
- Root access to both the source and destination servers.
- An FTP client (for SFTP) or an SSH client/terminal (for the SSH method).
Consider performing the migration during low-traffic periods to minimize the impact on your visitors. Also allow a few additional hours for DNS propagation.
Step 1 – Prepare your backups on the source server
To ensure all data is moved, package your data on your current server.
- Log in to your source server and create a compressed archive (e.g.,
archive.tar.gz) of your project files. - Generate a database dump file. For MySQL or MariaDB, run the following command in your terminal:
- For a single database:
mysqldump -u username -p database_name > backup.sql - For multiple databases, run the following command to export all databases into a single file:
mysqldump -u username -p --all-databases > all_databases.sql
- For a single database:
- Verify the file paths for your archive and the
.sqlfiles.
NOTE
- On CyberPanel, you have the option to back up to Google Drive.
Step 2 – Set up the destination Hostinger VPS
Prepare the new environment to receive your project data:
- Log in to your Hostinger hPanel and verify that your VPS order is set up and active.
- Ensure the operating system matches your project’s requirements. You can change it in the VPS dashboard if needed.
- Install the necessary software stack (e.g., Apache/Nginx, PHP, and MariaDB/MySQL). Some OS templates include these pre-installed.
- Install any additional tools required, such as Redis, Node.js, or OpenLiteSpeed.
- If moving to a different Linux distribution (e.g., from CentOS to Ubuntu), ensure that you install the equivalent software dependencies on your new Hostinger VPS to avoid application errors.
- Create a new, empty database and a database user with full privileges on the Hostinger VPS for each database you intend to import.
NOTES
- If your Hostinger VPS is not empty, some or all of its content may be overwritten as part of the migration process.
- If your old server used an outdated operating system, consider installing the latest version on your new VPS.
Step 3 – Transfer data to the Hostinger VPS
Choose one of the following methods to move your data to Hostinger.
Option 1 – Transfer via SSH (Recommended)
SSH is the most efficient method because it enables a direct server-to-server transfer. This is significantly faster than other methods and does not rely on your local internet upload speed.
- Log in to your source (old) server via SSH.
- Use the
scp(Secure Copy) command to send your files and database dumps directly to the Hostinger VPS IP address:
scp /path/to/archive.tar.gz root@your_vps_ip:/home/
Replace/path/to/with the file location andyour_vps_ipwith the IP address of your Hostinger VPS. Enter your Hostinger VPS root password when prompted to begin the transfer.- Repeat to import your databases.
For individual databases, run the following command for each one:
mysql -u username -p database_name < backup.sql
To import all databases at once if you have a single.sqlfile:
scp /path/to/all_databases.sql root@your_vps_ip:/home/ - Navigate to your web root directory (typically /var/www/html/) and run the following command to extract your project files:
tar -xvzf /home/archive.tar.gz -C /var/www/html/
The-xflag extracts,-vshows progress,-zhandles the compression, and-fspecifies the file.
Option 2 – Transfer via SFTP
Use this method if you prefer a graphical user interface (GUI), do not have direct SSH access between servers, or if your previous VPS is no longer active and you have a local backup.
- Connect to your source server using an SFTP client (e.g., FileZilla or WinSCP) and download the project archive and database files to your local computer.
- Disconnect from your old server, and then connect to your Hostinger VPS using its IP address and root credentials.
- Upload the files (both
.tar.gzand.sql) from your local computer to the/home/or/var/www/html/directory on the new server depending on your configuration. - Extract the
.tar.gzfile.
Option 3 – Use a control panel transfer tool
If both your old provider and your new Hostinger VPS use the same control panel, you can use built-in migration tools if available.
- cPanel/WHM: Use the Transfer Tool to fetch data from the remote server.
- DirectAdmin: Navigate to the Admin Backup/Transfer section. You can restore backups from the same or other panels (like cPanel) by uploading the backup file to your server and using the Restore tool. Ensure the backup file is renamed to match a valid username on the system.
- CyberPanel: Use the Remote Transfer feature to migrate websites between CyberPanel instances.
Step 4 – Update configurations
After restoring your backups:
- Open your application’s configuration files (e.g.,
wp-config.phpor.env) and update them with the new database name, user, and password. - Verify that your applications load correctly by entering your Hostinger VPS IP address in a web browser (or edit your local hosts file for domain testing).
- Point your domain’s DNS records to the new Hostinger VPS IP and allow 24 hours for propagation.
- Once the domain points to the VPS, secure your site with an SSL certificate.
Your migration is complete once your domain points to the new server. To ensure you see the latest version of your site, clear your browser cache or use an incognito window.
NOTES
- If you encounter technical difficulties, use Kodee, our AI assistant for guidance.
- For hands-on help, consider reaching out to a trusted developer or freelancer.
- If you are running an independent mail server, ensure you also migrate your mail spools, user credentials, and update your SPF, DKIM, and DMARC records.
Additional resources
-
Explore more of our VPS-related articles to help you manage and optimize your server.