One demand remains always in trend to take backup when you are not having cPanel with you. Some formats won’t allow us to take backups at a time. It might lead you to restore cPanel backup using the command line. Some steps involved in moving out the content of the website, mail account, and database. You can say it is a manual backup! But it has more steps and you will end up with errors unexpectedly.
Why do you want to restore cPanel backup using the command line? It's important to maintain the server of cPanel so, you will get a pop-up stating cPanel backup restore.
Let’s do it with the help of SSH to restore the cPanel backup!
Step 1: Use the below command to transfer the backup of cPanel to the new server:
Step 2: Once you complete the process of transferring the cPanel backup to a new server, as a root user login to the account. Check the home directory where you can find the full backup.
Step 3: File extraction will be started and then it is possible to import all details from the cPanel to the new server.
Step 4: Ensure the location of website content and homedir. Transfer the file to the root of the website document.
Step 5: Start locating the database.sql, mysql files using the below command:
Step 6: Create the user database and allot the permission too!
Step 7: You can even find more files using the below path:
Step 8: In the new server, create an email account and then content from the old one to the new one.
Step 9: Finally, ensure permission and ownership. Check the details are correct or else make it the right way!
How to restore the cPanel account to the new cPanel server? Here, check the destination and source it has the same target point.
Step 1: The first step, get into the server where you need to migrate. Take the responsibility as a root user and then generate the backup using the command:
Step 2: Using the SCP command, you can send the backup to the new server:
Step 3: If you are done with step 2, just restore the cPanel backup with the following command:
Using this command, you can restore the database, files, and settings.
What are the ways to fix errors?
User duplication: When you restoring the cPanel backup, you will get the problem like the below:
Cannot restore. That user already exists on this system
TO search the user server, use the command:
Here’s the output:
In the command line, do a manual process to delete entries.
Ownership and permission: Because of the ownership and permission, there are more chances to get an error on the website. Only root users have ownership to access the files. It might create more problems for you! So, by setting the ownership 644 to the file and 755 to the directory, you can sort out this problem.
Why do you want to restore cPanel backup using the command line? It's important to maintain the server of cPanel so, you will get a pop-up stating cPanel backup restore.
- The server panel in destination won’t support allowing the format of cPanel backup
- The new server won’t have a control panel
- Unsupported servers don’t support migration
Let’s do it with the help of SSH to restore the cPanel backup!
Step 1: Use the below command to transfer the backup of cPanel to the new server:
Code:
scripts/pkgacct username
scp /home/cpmove-user.tar.gz root@x.x.x.x:/home
Code:
/home/cpmove-user.tar.gz
Step 4: Ensure the location of website content and homedir. Transfer the file to the root of the website document.
Step 5: Start locating the database.sql, mysql files using the below command:
Code:
mysql -u username -p databasename<database.sql
Code:
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
Code:
home/user/mail/yourdomainname.com/mailaccountname/
Step 9: Finally, ensure permission and ownership. Check the details are correct or else make it the right way!
How to restore the cPanel account to the new cPanel server? Here, check the destination and source it has the same target point.
Step 1: The first step, get into the server where you need to migrate. Take the responsibility as a root user and then generate the backup using the command:
Code:
/scripts/pkgacct username
Code:
scp /home/cpmove-user.tar.gz root@x.x.x.x:/home
Code:
/scripts/restorepkg username
What are the ways to fix errors?
User duplication: When you restoring the cPanel backup, you will get the problem like the below:
Cannot restore. That user already exists on this system
TO search the user server, use the command:
Code:
find / -name "username"
Code:
/var/spool/cron/username
/var/cagefs/16/username
/home/virtfs/jeyaprak/var/spool/cron/username
/home/virtfs/jeyaprak/var/cagefs/16/username
/etc/proftpd/username
Ownership and permission: Because of the ownership and permission, there are more chances to get an error on the website. Only root users have ownership to access the files. It might create more problems for you! So, by setting the ownership 644 to the file and 755 to the directory, you can sort out this problem.