Login to your server as root via SSH and run below command:
To start Apache
service httpd start
To stop Apache
service httpd stop
To restart Apache
service httpd restart
In this tutorial I will show you how we can transfer / restore a cPanel website using full cPanel backup from SSH.
Sometimes, cPanel to cPanel transfer may not work as expected. So, in this case you can manually create full cPanel backup, transfer to new server and restore on new server.
Create a full cPanel backup from cPanel >> Files >> Backup
Name of backup file will be something like backup-username.tar.gz
Upload the full cpanel backup file on new server in /home directory.
You can do server to server transfer from SSH using wget or scp command.
When you have uploaded the full cPabel backup file in /home directory of new server, login as root via SSH and run following command:
In above command, change username to your actual cPanel username which you are transferring.
It will take sometime to restore the account depending on size of the backup file.
You can also restore account from:
WHm Home >> Backup >> Restore a Full Backup/cpmove File
If you have many websites / accounts on your server, and you want to make backup of all mySQL via a single command, here is how you can do. Creating regular full mySQL backup of all accounts is a very good practice. Creating full MySQL backup is also recommended before performing any mysql upgrade.
Login as root via SSH and execute following command:
mysqldump --add-drop-table --all-databases | gzip > /home/alldatabases.sql.gz
This will create a SQL-based backup of everything in MySQL and save it into your /home directory. The name of your backup file will be alldatabases.sql.gz
You may change the backup file name and location where it will be saved.
To restore a full MySQL backup file, you will need root MySQL password. Run following command to get root mySQL password
The above command will show the root MySQL password. When you have password, run following command:
gunzip < /home/alldatabases.sql.gz | mysql -u root -p
If your saved full mysql backup is at different location, change the path in above command. If the name of your full mysql backup file is different, please change in above command.
You will be asked to enter password. So, enter the password that you have got above from tail /root/.my.cnf command.
Done!! It will take sometime to restore all database depending on size of database file.
If any script which requires perl is not working properly on your server, you may wish to check if perl is installed or not on your server.
Login in your server as root via SSH and execute following command:
If perl is installed on your server, it will show you the version that is installed. If its not installed, it will show some error message.
Enter following command
After this enter l, this will show you all installed perl modules on your server.
Following command will display the perl version installed on server:
CentOS is most popular operating system on Linux servers. If you want to check the CentOS version installed on your server, please refer to our following tutorial page:
How to find CentOS version installed
If you want to check centOs installed on your server is 32-bit or 64-bit, here is how you can find.
Login in your server via SSH as root and execute following command.
If the output shows i686 or i386, this means its a CentOS 32-bit.
And if the output shows x86_64, this means its a CentOs 64-bit.
chown command is used to change owner of a file on a Linux server.
chown user:group filename
Suppose you want to change owner of following file to a new user whose username is lophost
Login to your server as root via SSH, and execute following command:
chown lophost:lophost /home/mywebsite/public_html/filename.zip
You can also use user ID of the user. Let’s say you want to change ownership of file to user ID 526. So, our SSH command will be:
chown 526:716 /home/mywebsite/public_html/filename.zip
Where 526 is user ID of that user.
And 716 is usergroup of that user.
eAccelerator is a popular PHP accelerator and optimizer. It improves and increases the performance of PHP scripts by caching them. eAccelerator can typically reduces server load and increases the speed of your PHP code by 1-10 times.
By default eAccelerator saves cache in /var/cache/eaccelerator directory. But eAccelerator cache directory can be different on some server. Like it may can be /tmp/eaccelerator
Sometimes, you may need to clear eAccelerator cache to free up some space in /var or /tmp directory.
Here is how you can delete / clear / flush eAccelerator cache.
Login in server as root via SSH, and execute following command.
If eAccelerator cache directory is /tmp/eaccelerator, use below command to delete all cache older than 24 hours.
tmpwatch --mtime --all 24 /tmp/eaccelerator
If eAccelerator cache directory is /var/cache/eaccelerator, use below command to delete all cache older than 24 hours.
tmpwatch --mtime --all 24 /var/cache/eaccelerator
Error_log file saves the error logs of a account / user / website. There can be multiple error_log file under one user / account / website.
These error_log files may consume lots of space on your server. Sometimes the size of error_log files are in GB. So, you may want to delete all error_log files to free up some space on server.
Login in server via SSH as root and execute following command:
The above command will search for error_log files in /home directory and delete them. Thus it will delete all error_log files under all users / accounts / cPanel accounts / websites.
1) This command can take lots of time to complete depending on size of your /home directory. Sometimes it may take 10-30 minutes to complete.
2) If required server will automatically create new error_log files.
SSH is the fastest and easiest way to delete multiple files or a complete folder on a server. Please take maximum care while deleting a file or folder.
Use rm command to delete a file.
Suppose you want to delete /home/filename.txt file. To delete this file, execute following command in SSH:
Suppose you want to delete /home/foldername folder and all files/folders inside this directory.
For this execute following command in SSH: