Category Archives: Linux Tutorial

Adding multiple alternative SMTP Port in cPanel

By default, cPanel only support one additional alternative SMTP port. However, if you need multiple port, follow the steps below:

1) Disable “exim on another port” in WHM -> Service Manager
2) Go to WHM-> Exim Configuration Editor -> Advanced Editor -> at the first text box, add in “daemon_smtp_ports = 25 : 26 : 587” without “”.
3) Save.

Custom php.ini on suPHP using .htaccess

Remove the lines that begin with “php_value” and “php_flag”. You will need to move these files to a file named php.ini and upload php.ini into your public_html directory. Then, add the following line into the .htaccess file in your public_html:

suPHP_ConfigPath /home/username/public_html

where “username” is your cPanel username. You will need to remove php_value and php_flag from ALL .htaccess files you may have. However, you only need to add the suPHP_ConfigPath line in the .htaccess file in your public_html directory only.

Please note that you will need to change the format of your php_value and php_flag lines into the php.ini format

[HowTo] Update Timezone on CentOS/RedHat

This tutorial shows you how to update timezone on your CentOS/Redhat machine. Run the command below to install system-config-date.

[root]# yum install system-config-date
[root]# setup

Go-to -> Timezone configuration -> Select your local time zone -> Click OK -> Quit.

To check your current timezone:
[root]# date
Sun Mar 15 23:50:42 MYT 2009

[How-to]Install DOM XML on Directadmin

Below is the tutorial on how-to install DOM-XML in DirectAdmin using customapache.

# yum install libxml2-devel libxslt-devel libgcrypt-devel
# cd /usr/local/directadmin/customapache
# vi configure.php

Add this to configure.php before –with-gd \ :
–with-dom=/usr/lib \
–with-dom-exslt=/usr/lib \
–with-dom-xslt=/usr/lib \

# ./build clean
# ./build php n
# service httpd restart

[DirectAdmin-Problem] Fix DirectAdmin Installation on CentOS 64bit

Make sure you install these before installing DirectAdmin

yum install gcc-c++ libxml2-devel libjpeg-devel libpng-devel -y

As you notice on 64-bit, you have /lib and /lib64. It’s just the dynamic linking in the installer is a bit skewed, now run the command below:

ln -sf /usr/lib64/ /usr/lib/

ln -sf /usr/lib64/ /usr/lib/

ln -sf /usr/lib64/ /usr/lib/

ln -sf /lib64/ /usr/lib/

ln -sf /usr/lib64/ /usr/lib/

ln -sf /usr/lib64/ /usr/lib/

ln -sf /usr/lib64/ /usr/lib/

[HOWTO] Adding new harddisk in Linux

This guide shows you how to add a new hard disk in linux OS. This allow user to easily add and boot
up the hard disk without any pain.

This howto is a practical guide without any warranty – it doesn’t cover the theoretical backgrounds.
There are many ways to set up a new harddisk.

First you need to list out the hard disk that are installed in Linux. Assume I added a new SATA drive as secondary drive.

[root]# fdisk -l
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 38913 312464250 8e Linux LVM

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

[root]# fdisk /dev/sdb
Command (m for help): m (Enter the letter “m” to get list of commands)
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-2654, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2654, default 2654):
Using default value 2654

Command (m for help): p

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 19457 156288321 83 Linux

Command (m for help): w (Write and save partition table)

[root]# mkfs -t ext3 /dev/sdb1
mke2fs 1.27 (8-May-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2508352 inodes, 5016052 blocks
250802 blocks (5.00%) reserved for the super user
First data block=0
154 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root]# mkdir /opt2
[root]# mount -t ext3 /dev/sdb1 /opt2

File: /etc/fstab
Enter the drive into the fstab file so that it is recognized and mounted upon system boot.

File: /etc/fstab Red Hat 9.0

LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/shm                tmpfs   defaults        0 0
/dev/hda2               swap                    swap    defaults        0 0
/dev/sdb1               /opt2                   ext3    defaults        1 2
/dev/cdrom              /mnt/cdrom              iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0                /mnt/floppy             auto    noauto,owner,kudzu 0 0

The digits “1 2” refer to whether the mount point should be backed up when the dump command is used and disk integrity checks using fsck. The “1” states that it should be backed up when the dump command is issued (0=no). The “2” refers to the order in which “fsck” should check the mount points. The digit “1” identifies the root (“/”) of the filesystem. All others should be “2”. (0=no check)

Securing your DNS server (BIND)

Below is the tutorial on how to secure your dns server (bind).

nano -w /etc/named.conf

Then add this section of code to the top of named.conf. Replace with your own IP.

acl “trusted” {;;

Then add these line to “options{}” after this line “directory “/var/named”;”.

version “not currently available”;
allow-recursion { trusted; };
allow-notify { trusted; };
allow-transfer { trusted; };

That’s it. Save and exit and restart your bind service.