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

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Wed, 2007-12-05 18:19. ::

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

#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!).


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Wed, 2011-10-12 21:22.

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

/usr/bin/mysql_secure_installation

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

A lot more secure :)

 

 

Submitted by EnKK (not registered) on Thu, 2008-12-25 11:12.

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@127.0.0.1 - the password for this should be set like

# mysqladmin -h 127.0.0.1 -u root password xxxxxx

Check your accounts:

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

Submitted by David (not registered) on Sat, 2008-12-06 23:10.
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
Submitted by tundasrl (registered user) on Mon, 2008-08-04 14:06.

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

Regards
Submitted by Anonymous (not registered) on Thu, 2010-03-04 14:15.

Dont worry, that package version keeps changing.

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

Submitted by Jon Pastore (not registered) on Fri, 2008-11-14 21:53.

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?

 

-Jon