The Best Way to Setup MySQL Replication

In this case, I have 2 servers installed with MySQL 5 and running in CentOS 5. Assuming Server1 is master server and currently host a database called db1 and Server2 is slave server and have nothing inside.

Variable used in this case:

Server1 IP=
Server2 IP=
Database name=db1
Replication user=replicator
Replication user password=slavepass

Now we configure Server1 first. Login to the server and do following:

1. Login to Server1 and open MySQL configuration file, /etc/my.cnf and add following lines under [mysqld] section:


2. Restart MySQL:

service mysqld restart

3. Create a user account so slave can use to connect to this master server:

mysql> GRANT REPLICATION SLAVE on *.* to 'replicator'@'%' IDENTIFIED BY 'slavepass';

4. Dump the database so we can bring the database to the slave server:

mysqldump -u[root] -p[password] --master-data --single-transaction db1 > db1.sql

Continue reading “The Best Way to Setup MySQL Replication” »

Debian/Ubuntu – Make SSH Terminal Run with Colors

For those who actually get used to have colors in SSH terminal session, will surely feels weird if you SSH into Debian/Ubuntu because by default, the terminal session will NOT run with color-enabled mode. It might be small issue but it will help you a lot in administrating and managing the Linux box when you can see and differentiate things with colors.

What you need to do is replace following content into /root/.bashrc or /home/any_user/.bashrc file (this is actually an extended version with some tweak for your .bashrc file to enable colors):

Continue reading “Debian/Ubuntu – Make SSH Terminal Run with Colors” »

cPanel – Update ClamAV

If you facing below error when running clamscan especially in cPanel:

LibClamAV Warning: ***********************************************************
LibClamAV Warning: *** This version of the ClamAV engine is outdated. ***
LibClamAV Warning: *** DON'T PANIC! Read ***
LibClamAV Warning: ***********************************************************

Which means the new stable ClamAV version has been released and recommended for you to upgrade. Below is the steps need to follow:

1. Download the latest stable version of ClamAV by go to


2. Extract the download file:

tar -xzf clamav-*

3. Compile the sources:

cd clamav-*
if [ -d "/usr/lib64" ]; then libdir="--libdir=/usr/lib64" ; fi ; ./configure --prefix=/usr $libdir --sysconfdir=/etc --disable-ipv6 --disable-zlib-vcheck
make install

4. Update virus definitions:


Public Key for SSH Authentication

Password-less SSH can really help server administrator on accessing from different node to another. This is possible by setting up the public key for SSH authentication in source and destination server.

1. Create your public and private key pair by typing:

ssh-keygen -t dsa

2. The key generator will ask you where you want to save your key. Press Enter to accept the default.

3. Next, the generator will prompt you to enter a passphrase. Press Enter without entering a passphrase. (You must leave this blank to make sure that destination server will not prompt out anything when authenticating SSH user)

You will need to copy your public key to your destination server. Do this by entering the following command (you will need to enter your password just this one time after you press Enter):

ssh-copy-id -i ~/.ssh/id_dsa [email protected]

*user = the username of your destination server
*serverIP = the IP address of your destination server

Test your setup by entering: ssh user@serverIP. If you’ve set this up correctly, you shouldn’t have to enter any login details, and now you are ready to connect to the destination server without hassle of remembering the password.

WHM/Cpanel Logs in Details

cPanel/WHM Initial Installation Errors:
Location : /var/log/cpanel*install*
Description : These log files contain cPanel installation logs & should be referenced first for any issues resulting from new cPanel installations.


Cpanel/WHM Accounting Logs:
Location : /var/cpanel/accounting.log
Description : Contains a list of accounting functions performed through WHM, including account removal and creation.


Cpanel/WHM Service Status Logs:
Location : /var/log/chkservd.log
Description :The service monitoring demon (chkservd) logs all service checks here. Failed service are represented with a [-] and active services are represented by [+].


cPanel error logs:
Location : /usr/local/cpanel/logs/error_log
Description : cPanel logs any error it incurs here. This should be checked when you encounter errors or strange behavior in cPanel/WHM.


cPanel License Error Logs:
Location : /usr/local/cpanel/logs/license_log
Description : All license update attempts are logged here. If you run into any errors related to license when logging in, check here.


Stats Daemon Logs:
Location : /usr/local/cpanel/logs/stats_log
Description : The stats daemon (cpanellogd) logs the output from all stats generators (Awstats, Webalizer, Analog) here.


Client Information, Requested URL Logs:
Location : /usr/local/cpanel/logs/access_log
Description : General information related to access cPanel requests is logged here.


cPanel/WHM Update Logs:
Location : /var/cpanel/updatelogs/update-[TIMESTAMP].log
Description : Contains all output from each cPanel update [upcp]. It’s named with the timestamp at which the upcp process was initiated.


Bandwidth Logs:
Location : /var/cpanel/bandwidth
Description : Files contain a list of the bandwidth history for each account. Each named after their respective user.


Tailwatchd [New]:
Location : /usr/local/cpanel/logs/tailwatchd_log
Description : Logs for daemon configuired under tailwatchd ie. cPBandwd, Eximstats, Antirelayd.


Apache Logs:.

General Error and Auditing Logs:
Location : /usr/local/apache/logs/error_log
Description : All exceptions caught by httpd along with standard error output from CGI applications are logged here.
The first place you should look when httpd crashes or you incur errors when accessing website.

Continue reading “WHM/Cpanel Logs in Details” »

Shrink MSSQL Database Transaction Logs

Have you ever encounter problem when managing MSSQL databases, the transactions logs is eating up your hard disk if you not initially configured to be limit in growth value. So, when you see this kind of problem, you actually can shrink the transaction log, and then change the limit of growth value using MSSQL Management Studio.

1. Open MSSQL Management Studio

2. Open the SQL command windows and put following lines

USE <DatabaseName>
DBCC SHRINKFILE(<TransactionLogName>, 1)
DBCC SHRINKFILE(<TransactionLogName>, 1)

Replace the <DatabaseName> and <TransactionLogName> with respective value and execute the SQL. Now your transaction logs will be shrinked and you will save a lot of disk space. Do not forget to do the prevention action afterwards!

User Manual: cPanel + WHM in PDF

cPanel is no doubt to be well-known in the Linux hosting control panel. They have good online documentation, active communities especially in forum and also reliable on technical/sales support. But, we hardly find the documentation in PDF version which downloadable and can be print out as a book.

Here’s I share with you on the cPanel and WHM user manual. I found these some where in Internet but I cant remember which site I get it from (sorry for no credit back to the author). You can click following links to download:

cPanel_11_User_Manual – 402 KB – 189 pages

WHM_Administrator_Manual – 1.01 MB – 352 pages

Note: It is not as update as the latest version

Installation – Standalone Spam Assassin Server

This is my way on installing dedicated spam assassin server to be integrated with my internal mail server. This server better be run as virtual machine due to easy deployment and not heavy resources needed (depending on how many spam process you want it to run). In this case, we will use CentOS 5.5 64bit.

1. Install required RPM

yum install -y db4 db4-devel gcc libstdc++ libstdc++-devel

2. Update kernel, and others

yum update kernel
yum update

3. Reboot

4. Open Perl shell and install required perl modules

perl -MCPAN -e shell

(for first time user, you might need to accept default value if prompted)

install HTML::Parser
install NetAddr::IP
install Net::DNS::Resolver::Programmable
install Net::Ident
install Net::DNS
install DB_File
install Digest::SHA1
install Time::HiRes
install MIME::Base64
install Getopt::Long
install File::Copy
install Mail::SPF
install Mail::SPF::Query
install Mail::DKIM
install IP::Country
install IO::Socket::INET6
install IO::Socket::SSL
install Compress::Zlib
install LWP::UserAgent
install HTTP::Date
install Archive::Tar
install IO::Zlib
install Encode::Detect
install URI::Escape

Continue reading “Installation – Standalone Spam Assassin Server” »

Plesk – DNS error (Error code 80)

Error code:

Set default component failed: defpackagemng failed: Execute dnsmng.exe REMOVE * failed: The file exists. (Error code 80) at GetTempFileName in C:\Program Files\Parallels\Plesk\admin\db
Execute dnsmng.exe UPDATE * failed: The file exists. (Error code 80) at GetTempFileName in C:\Program Files\Parallels\Plesk\admin\db


Set default component failed: defpackagemng failed: Execute dnsmng.exe REMOVE * failed: The file exists. (Error code 80) at GetTempFileName in C:\Windows\Temp
Execute dnsmng.exe UPDATE * failed: The file exists. (Error code 80) at GetTempFileName in C:\Windows\Temp

DNS Server is switched off or unavailable to lookup DNS zone

Remove the temporary files by navigate to correct path and run delete the Plesk temporary files. In this case, we will use CMD to solve error no 1:

cd "C:\Program Files\Parallels\Plesk\admin\db"
del /F /S /Q tmp*.tmp

Try adding back the DNS server by login into Plesk > Settings > Server Components > DNS Server, select BIND and click OK.