The Perfect Server - CentOS 4.8 Server i386 [ISPConfig 2] - Page 4

7 Quota

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

# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 /                       ext3    defaults,usrquota,grpquota        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/dev/hdc                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0

Then run

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

to enable quota.

 

8 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
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.).

 

9 MySQL (4.1)

To install MySQL, we do this:

yum install mysql mysql-devel mysql-server

The MySQL init script on CentOS might cause problems when you try to restart MySQL. In some cases it tries to start MySQL before the old MySQL process has stopped which leads to a failure. The solution is to edit the restart section of /etc/init.d/mysqld and add a few seconds delay between the stop and the start of MySQL.

Edit /etc/init.d/mysqld:

vi /etc/init.d/mysqld

and change this section:

[...]
restart(){
    stop
    start
}
[...]

so that it looks like this:

[...]
restart(){
    stop
    sleep 3
    start
}
[...]

This adds a three second delay between the stop and start of MySQL.

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 something like this:

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

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

vi /etc/my.cnf

[...]
#skip-networking
[...]

and restart your MySQL server:

/etc/init.d/mysqld restart

Run

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:

4 Comment(s)

Add comment

Comments

From: Anonymous at: 2009-09-11 13:34:24

...when 5.3 is available?  In fact, C5 is almost 16 months old.

From: Anonymous at: 2010-07-16 20:34:43

Actually, it will be a really bad idea to start with CenOS 4.8 on a fresh system when 5.x is already available. The path to 4.x->5.x upgrade is complicated and unreliable. I have a C4.8 installed a while ago, and it has lots of obsolete packages that cannot be upgraded beyond certain version.

 

 

From: Anonymous at: 2011-05-30 10:06:19

HI,

IT is always best to use new upgraded one.

I am not able install libmemcached on centos 4.3.9 

it is working in 5.5.3

http://www.lampdeveloperworld.in/

 

From: Tony Kammerer at: 2009-09-10 20:01:09

Nice job but I would strongly suggest updating this How-To so that it covers more current (ie secure) PHP and MySQL such as my current preference:
 
PHP 5.2.10
MySQL 5.0.67 (I'm not impressed by the 5.1.X line so far)
Remi Repository has great PHP/MySQL RPM's for easy install and updates:
http://blog.famillecollet.com/pages/Config-en
 
Last thing you want to contribute to the internet as a whole is a bunch of new "hosts" running outdated and insecure servers.
 
I would also recommend taking a look a either of the following great firewall management scripts: