Sunday 9 February 2014

Clam Scan Manual Installation


cd /usr/local/src
rm -Rf clamav-*
wget http://downloads.sourceforge.net/clamav/clamav-0.96.tar.gz
tar -xzf clamav-*
cd clamav-*
if [ -d "/usr/lib64" ]; then libdir=”–libdir=/usr/lib64″ ; fi ; ./configure –prefix=/usr $libdir –sysconfdir=/etc –disable-ipv6 –disable-zlib-  vcheck
make
make install
freshclam
echo “ClamAV update complete!”



Reset Mysql Root password 


Recover a MySQL root password via the folowing steps :

Stop the MySQL server process :

/etc/init.d/mysql stop

Start again with no grant tables.

mysqld_safe --skip-grant-tables &

Login to MySQL as root.

mysql -u root
use mysql;

Set new password.

update user set password=PASSWORD("newrootpassword") where User='root';
flush privileges;
quit

Exit MySQL and restart MySQL server.

/etc/init.d/mysql stop
/etc/init.d/mysql start

Install Php Module yaml in Cpanel server


Try installing yaml using pecl :

pec install yaml

You may encounter an error:

configure: error: Please install libyaml

wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz

tar -xvzf yaml-0.1.4.tar.gz

cd yaml-0.1.4

./configure

make

make install

Then run pecl again :

pec install yaml

Then verify it from php -m :

# php -m | grep yaml
yaml

Editing different Document Root for Cpanel domain


You can follow the below steps for changing the document root other than public_html for a cpanel domain.

Change the document root in the following files.

/var/cpanel/userdata/user/domain.com

/usr/local/apache/conf/httpd.conf

Then:

/usr/local/cpanel/bin/apache_conf_distiller –update
/usr/local/cpanel/bin/build_apache_conf



Find the number of  HTTP connections to the server


netstat -plane | grep :80 | awk {'print$5'} | cut -f1 -d ':' | sort | uniq -c | sort -n




Cpanel shows 0 MB size for all databases after migration



vi /var/cpanel/cpanel.config

Change : 

disk_usage_include_sqldbs=1

And run the following command :

/scripts/update_db_cache

Find Max apache connections to a domain from IPs



cat /usr/local/apache/domlogs/domain.com  | awk '{print $1}'|cut -d'@' -f2|sort|uniq -c|sort -nr


Clear Memory Cache on Linux servers


After loging in to the server type the following command :

sync; echo 3 > /proc/sys/vm/drop_caches

======================================