This is for CentOS/RHEL based servers.
Steps in WHM:
- Log into WHM and go to Basic cPanel & WHM Setup
- Change the Primary IP here with the option that says “The IP address (only one address) that will be used for setting up shared IP virtual hosts“
- Note: This might not actually be necessary.
Log in to SSH, and do the following:
- Edit /etc/sysconfig/network-scripts/ifcfg-eth0
- Change the IPADDR and GATEWAY lines to match the new IP and Gateway for the new ip
- Edit /etc/sysconfig/network
- Change the GATEWAY line here if it does not exist in the ifcfg-* file.
- Edit /etc/ips
- Remove the new primary IP from this file if it is present
- Add the old primary IP to this file with the format ::
- Edit /var/cpanel/mainip
- Replace the old primary IP with the new primary IP
- Edit /etc/hosts
- Replace the old primary IP with the new one if needed. The hostname’s dns will need to be updated too
- Restart the network service to make the new IP the primary
- service network restart
- Note: You’re probably going to be disconnected at this point, and have to log in to ssh using the new primary ip.
- Restart the ipaliases script to bring up the additional IP
- service ipaliases restart
- Run ifconfig and make sure all IPs show up correctly
- Update the cpanel license to the new primary IP
- Verify you can still log in to WHM and there is no license warning
The file that actually handles WHM > DNS Functions > Nameserver IPs area is at /var/cpanel/nameserverips.yaml location.
If you want this to be changed, you’d want to make a backup of that file first and then modify it:
cp nameserverips.yaml nameserverips.yaml.back
If rpm / yum command hangs during operations or you see error messages – it means your rpm database corrupted. /var/lib/rpm/ stores rpm database just delete the same and rebuild rpm database:
Command to rebuild rpm database
rm -f /var/lib/rpm/__db*
rpm --rebuilddb -v -v
Forcing the restore of a transfered cPanel account , even if the new system says the username is all ready in use
/scripts/restorepkg –force –skipres <account.tar.gz>
When installing the CSF firewall on your CentOS server, you need to make sure that you have libwww-perl installed
This is easily done by installed it with yum on CentOS 5
yum install perl-libwww-perl
Want to remove Tomcat from cPanel?
Log-into your server as root using ssh:
Execute the following command to stop the Tomcat process:
…and to remove the next files, enter:
# rm -f /usr/sbin/starttomcat
# rm -f /usr/sbin/startomcat
# rm -f /usr/sbin/stoptomcat
Finally, remove all mod_jk lines from httpd.conf, including addmodule, loadmodule, and include lines.
Issues with suhosin or mod_security , then best check your Apache error logs
tail -f /usr/local/apache/logs/error_log
A Linux Server is not Windows XP and if reboot fail you usually still connect by SSH and do something. This commands will show you how to remotely hard reboot machine. Hard reboot mean that shutdown scripts will not run and machine reboot immediately without syncing hard disk drives, shutdown applications etc, it’s more like hitting the reset button.
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger
This commands enable sysrq and after this calls fast reboot. If you want to force shutdown machine try this.
echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger
This came handy, when I had a server that had some IO error and it can no longer read from disk, only few cached binaries into memory kept it running (kernel, SSHD, bash), I could still access the machine via SSH but can no longer do anything, forcing the reboot as mentioned above was my only resort, and it worked like charm…
How can I repair corrupt MySQL tables?
Every so often, MySQL
tables have a way of corrupting themselves. MySQL offers a quick and
painless method of repairing those tables.
Continue reading How can I repair corrupt MySQL tables?
How To Mount A Drive In Linux
This simple step by step guide will show you how to mount a new hard drive or partitions onto your Linux server
Continue reading How to mount and unmount a drive in linux