Issue with modules on EasyApache 4

You may find that after removing some plugins such as xVarnish or cPnginx that there are issues with Apache (httpd) service. To correct the issue with some software not uninstalling properly, you can do the following:

mv /etc/apache2/conf.modules.d/999_mod_xvarnish.conf /etc/apache2/conf.modules.d/999_mod_xvarnish.conf.bkp

You can do the same with any module, just replace the module name accordingly.

Common OpenVZ & SolusVM commands

Shows all VMs on the VPS node

vzlist -a

Shows VMs starting with the highest load at the top

vzlist -o vpsid,laverage

Same as the previous command but with the hostname included

vzlist -o laverage,vpsid,hostname

This is a very useful command as it shows you which VM is using the most diskspace

vzlist -a -o ctid,hostname,diskspace -s diskspace

This command allows you to enter a VM from the main VPS node

vzctl enter

Restore cPanel data from a Backup Server

You can configure backups on a cPanel server and then run the command /usr/local/cpanel/bin/backup --force to generate the backups.

Once the backups exist on the backup server you can then send copies of all cPanel accounts from, for example, the folder named /home/username/daily on the backup server to the folder /home/daily on the new server.

Then if you wanted to restore all cPanel accounts from the folder named /home/username/daily on the backup server to the folder /home/backup on the new server, you may run the following command via SSH on the source server:

rsync -avp --progress -e "ssh -p 2500" /home/backup root@IP-ADDRESS:/home/username/daily

chmod, chown & remove

Set permissions on all directories under the folder server1 to 755

chmod -R 755 /usr/home/username/server1/

Remove all data (file and directories) from the folder server1

rm -rf /usr/home/username/server1/*

Set the user and group to example:example for all data (files and directories) on/under the directory accounts

chown -R example:example /home/username/public_html/test/accounts

Install ClamAV

Main >> cPanel >> Manage Plugins >> clamavconnector – Check ‘Install and Keep Updated’ box and the press ‘Save’ button at the bottom of the page.

Update Database

freshclam

Scan /Home Dir and output results to text file name .logs.txt

clamscan -ir /home > logs.txt

If you get -bash: clamscan: command not found

Run:

/scripts/restartsrv_clamd

If you get Unable to locate clamd

Follow the steps as given below:

# Red Hat Enterprise Linux 5 / i386:
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# Red Hat Enterprise Linux 5 / x86_64:
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Then install it through yum:

yum install clamd

And finally restart clamd service:

/scripts/restartsrv_clamd

Situation : clamAV installed from WHM, but not working on the command line.

FIX:
If you have have already installed ClamAV through WHM, check to make sure that your executables are here
#ls -lah /usr/local/cpanel/3rdparty/bin/*clam*
If they are, make sure that there are no current ClamAV files in /usr/local/bin:
# ls -l /usr/local/bin/*clam*
If both of those check out, you can create symlinks in /usr/local/bin to make scanning your server easier.
ln -s /usr/local/cpanel/3rdparty/bin/freshclam /usr/local/bin/freshclam
ln -s /usr/local/cpanel/3rdparty/bin/clamscan /usr/local/bin/clamscan
ln -s /usr/local/cpanel/3rdparty/bin/clamd /usr/local/bin/clamd
ln -s /usr/local/cpanel/3rdparty/bin/clamav-config /usr/local/bin/clamav-config
Double check your work with this command:
# ls -l /usr/local/bin/*clam*
Then you can scan your server’s public_html folders with this command
clamscan -ir /home/*/public_html > /usr/local/src/scan.txt [The scan results will get saved to the “scan.txt” file]

View Results

cat /usr/local/src/scan.txt