cleaning up Cpanel RedHat servers – free some spaces.

We can clean up lots more spaces from cpanel or any linux web hosting servers. Few step we can always follows:

1. Clean the tmp folder. 

tmp folder / mount can be cleared manually by going
 to that folder and running command: 
$ cd /tmp
$ tmp> rm -rf *

Its better to use tmpwatch to clear tmp folders:

tmpwatch --mtime --all 1 /tmp
this command will remove all files more than a day old.

2. clean the access logs of the servers.

access_log for web host will built up over the time so its better to clean them time to time.

access files are located in /usr/local/apache/logs



best way to do this in cpanel server is to limiting the log file size from :

cPanel: Main >> Logs >> Raw Access Logs >> Configure Logs

make sure

Archive Logs in your home directory at the end of each stats run
Remove the previous month’s archived logs from your home directory at the end of each month” are checked.

others files like error_log, messages, stats logs can also be managed from:

a)WHM > Tweak Settings > Log Rotation Size Threshold 

b)WHM >Service Configuration>cPanel Log Rotation Configuration

c)cPanel > Logs > Raw Access Logs > Configure Logs

3) Backup files:

All the backup files will be placed in the cpanel backup directory which is normally /home/backup but depends on the server settings.

you should download your backup files and remove the backup from the folder by using rm backup_file_name.tar.gz

Reset RedHat root password

To reset the redhat root password follow the following steps:

1. Reboot / boot the redHat.

2. press any key like space bar.

3.Press a and you and will see following prompt or similar:

grub append> ro root=LABEL=/

4. add single to the above line to enter to single user linux mode and then press enter.

grub append> ro root=LABEL=/ single

5. Linux will go on boot and after a while you will be prompted by similar prompt.


6. type the following command to change the password.

sh-3.01b# passwd <your new password>

7. It will ask you to retype the password after confirm. you can reboot the system by typing reboot.

sh-3.01b# reboot