CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server) - Page 4

8 Quota

(If you have chosen a different partitioning scheme than I did, you must adjust this chapter so that quota applies to the partitions where you need it.)

To install quota, we run this command:

yum install quota

Edit /etc/fstab and add ,usrquota,grpquota to the / partition (/dev/VolGroup00/LogVol00):

vi /etc/fstab

/dev/VolGroup00/LogVol00 /                       ext3    defaults,usrquota,grpquota        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0

Then run

touch /aquota.user /aquota.group
chmod 600 /aquota.*
mount -o remount /
quotacheck -avugm
quotaon -avug

to enable quota.


9 Install A Chrooted DNS Server (BIND9)

To install a chrooted BIND9, we do this:

yum install bind-chroot

Then do this:

chmod 755 /var/named/
chmod 775 /var/named/chroot/
chmod 775 /var/named/chroot/var/
chmod 775 /var/named/chroot/var/named/
chmod 775 /var/named/chroot/var/run/
chmod 777 /var/named/chroot/var/run/named/
cd /var/named/chroot/var/named/
ln -s ../../ chroot
cp /usr/share/doc/bind-9.3.3/sample/var/named/named.local /var/named/chroot/var/named/named.local
cp /usr/share/doc/bind-9.3.3/sample/var/named/named.root /var/named/chroot/var/named/named.root
touch /var/named/chroot/etc/named.conf
chkconfig --levels 235 named on
/etc/init.d/named start

BIND will run in a chroot jail under /var/named/chroot/var/named/. I will use ISPConfig to configure BIND (zones, etc.).


10 MySQL (5.0)

To install MySQL, we do this:

yum install mysql mysql-devel mysql-server

Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

Now check that networking is enabled. Run

netstat -tap | grep mysql

It should show a line like this:

[root@server1 named]# netstat -tap | grep mysql
tcp        0      0 *:mysql                     *:*                         LISTEN      2470/mysqld
[root@server1 named]#

If it does not, edit /etc/my.cnf and comment out the option skip-networking:

vi /etc/my.cnf


and restart your MySQL server:

/etc/init.d/mysqld restart


mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword

to set a password for the user root (otherwise anybody can access your MySQL database!).

Share this page:

16 Comment(s)

Add comment


From: Richard at: 2009-02-01 10:26:37

Thanks, just moved over to Centos from Windows Server 2003 (I KNOW) and you made it a hell of a lot easier. Thanks man! Now I can start hosting my free online store service :D

From: Nanda at: 2011-01-29 16:00:32

Nice tutorial

From: teddy at: 2009-02-07 18:34:21

[root@teddy ~]# /etc/init.d/proftpd start
Starting proftpd:  - warning: unable to determine IP address of 'teddy'
 - error: no valid servers configured
 - Fatal: error processing configuration file '/etc/proftpd.conf'

what's wrong with my configuration ???

please help me ....

send to my email t.eddy.mi04@gmail.com


From: Anonymous at: 2009-02-12 19:23:54

Seems that you haven't asigned an ip to you network interface, and tries to get an ip trought DHCP with no luck.  You asign ip's in the first page of this tutorial ( http://images.howtoforge.com/images/perfect_server_centos_5.1/10.png ).

From: shytex.com at: 2010-10-13 07:26:08
From: at: 2008-08-04 13:06:11

With CentOS 5.2 the new Bind version is 9.3.4 so the commands to configure it should be modified as:

chmod 755 /var/named/
chmod 775 /var/named/chroot/
chmod 775 /var/named/chroot/var/
chmod 775 /var/named/chroot/var/named/
chmod 775 /var/named/chroot/var/run/
chmod 777 /var/named/chroot/var/run/named/
cd /var/named/chroot/var/named/
ln -s ../../ chroot
cp /usr/share/doc/bind-9.3.4/sample/var/named/named.local /var/named/chroot/var/named/named.local
cp /usr/share/doc/bind-9.3.4/sample/var/named/named.root /var/named/chroot/var/named/named.root
touch /var/named/chroot/etc/named.conf
chkconfig --levels 235 named on
/etc/init.d/named start


From: Jon Pastore at: 2008-11-14 20:53:31

I'm trying to set this up in a VE under open vz.

The /etc/fstab file only contains:

# cat /etc/fstab
none    /dev/pts        devpts  rw      0 0

How do I enable quotas?



From: Anonymous at: 2010-03-04 13:15:10

Dont worry, that package version keeps changing.

While we have CentOS 5.3  the package is 9.3.6 and so on.

From: David at: 2008-12-06 22:10:58

I had to install php-mysql also. Being a newbie to Linux this took a little searching around to find. Might want to add that to the list of things to do for other newbies... Thanks

From: EnKK at: 2008-12-25 10:12:47

On CentOS, there are three root accounts for MySQL:

root@localhost - pass set by the first command

root@server1.example.com - pass set by the second command

root@ - the password for this should be set like

# mysqladmin -h -u root password xxxxxx

Check your accounts:

# mysql -p -u root
mysql> select host,user,password from mysql.user;

From: Anonymous at: 2011-10-12 20:22:37

Far better (IF your doing this for production) is to use the provided command:


Asks you to set a root password / Disable root remote access / Remove test DB / Remove annonymous user

A lot more secure :)



From: Anonymous at: 2009-04-23 05:20:02

What if it does not start?

 trying ::1 ...

connect to address ::1 Connection Refused


From: at: 2008-01-30 13:51:12

Since you are running dovecot, you can eliminate saslauthd all together and run postfix with dovecot sasl. The you run less services and eliminate a service that runs as root (saslauthd).

From: at: 2008-04-20 14:43:38

If you receive the following dovecot error:

dovecot: imap-login: imap-login: error while loading shared libraries: libsepol.so.1: failed to map segment from shared object: Cannot allocate memory

See this link for details: 


It saved me a lot of time!

Thanks, Falko, for the excellent ISPConfig and the how-to!

From: Martin at: 2011-06-07 09:23:57

How To import cert in windows outlook express ?

From: Ton Poppe at: 2010-09-25 07:42:45

Beste falko,

 Ik zag in het script /etc/init.d/proftpd het volgende staan
config: /etc/proftp.conf
moet dit niet zijn??
config: /etc/proftpd.conf

Mvg, Ton