Saturday, April 11, 2009

lamp/bind/ntp

Install CentOS 5.2 as a server (LAMP/Bind/ntp)
Posted by aristomagnus on Oct 28, 2008 in Featured, HowTo - Linux • 8 comments
Partition:

/dev/sda1 => ext3 -> /boot -> 128MB

/dev/sda2 => ext3 -> / -> 32768MB

/dev/sda3 => swap -> 2048MB

/dev/sda4 => ext3 -> /tmp -> Space left.

Disable IPv6 support if not needed.

-PACKAGE CONFIGURATION:
* Choose SERVER Templates.
* In the bottom, check CUSTOMIZE NOW.

-PACKAGES CUSTOMIZATION:
* In DEVELOPMENT: add DEVELOPMENT LIBRARIES, DEVELOPMENT TOOLS, LEGACY SOFTWARE DEVELOPMENT.
* In SERVER: uncheck everything (remove all packages).

* In BASE SYSTEM: add LEGACY SOFTWARE SUPPORT.

reboot

Edit /etc/selinux/config

Change the line:

SELINUX=enforcing

to

SELINUX=disabled

OR

system-config-securitylevel

Disable Security Level and SeLinux disabled

save and reboot

yum -y update

reboot

Disable service: ip6tables iptables bluetooth

chkconfig –levels 0123456 ip6tables off

chkconfig –levels 0123456 iptables off

chkconfig –levels 0123456 bluetooth off

To install a DNS server

yum -y install bind-chroot

To install MySQL server

yum -y install mysql mysql-devel mysql-server

To install php and perl:

yum -y install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel perl

Configure BIND9 (chrooted DNS Server)

BIND will run in a chroot jail under /var/named/chroot/var/named/ to allow BIND management via ISPConfig.

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

Enter chkconfig –levels 235 named on

Configure MySQL

Enter chkconfig –levels 235 mysqld on

Note: Consider reviewing the MySQL Tuning guide and Low memory MySQL / Apache configurations for additional MySQL configuration suggestions.

Configure Apache

Modify the DirectoryIndex directive in your httpd.conf file:

vi /etc/httpd/conf/httpd.conf

Locate the DirectoryIndex for your web root

Modify the line to read as follows:

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl

Find the line

Options Indexes FollowSymLinks

Remove Indexes from that line

Options FollowSymLinks

Exit vi

chkconfig –levels 235 httpd on

to start Apache whenever your server boots

Test Your Configuration

BIND

/etc/init.d/named restart

MySQL

/etc/init.d/mysqld start

netstat -tap | grep mysql

- if a line with the word LISTEN displays, MySQL was configured successfully and is now running

mysqladmin -u root password

(where is the unique password for your MySQL root account)

clear history

history -c

Add repository to yum:

Howto Repo: http://wiki.centos.org/AdditionalResources/Repositories

—————

FROM RPMforge: http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

1. CentOS 5

You should make sure that you have Priorities installed.

1.1. Priorities

yum install yum-priorities

i386 http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

x86_64 http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

(You can find a complete list of rpmforge-release package packages at http://dag.wieers.com/packages/rpmforge-release/ but it is recommended that you use one of the two listed above).

x64:

rpm -ivh http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Test with this command:

yum check-update

yum update

yum -y install phpmyadmin php-mcrypt php-mbstring

vi /usr/share/phpmyadmin/config.inc.php

Fine the line :

$cfg['blowfish_secret'] = ”; /* YOU MUST FILL IN THIS FOR COOKIE

AUTH! */

add a secret in the bracket. save the file.

Now you need to configure the access of phpmyadmin:

vi /etc/httpd/conf.d/phpmyadmin.conf


Order Deny,Allow
#Deny from all
Allow from all


/etc/init.d/httpd restart

Try it: http://ipoftheserver/phpmyadmin

user: root

passwd: your password

Synchronize The System Clock

If you want to have the system clock synchronized with an NTP server do the following:

yum install ntp

chkconfig –levels 235 ntpd on

ntpdate 0.pool.ntp.org

/etc/init.d/ntpd start

Install Webmin

cd /tmp

wget http://prdownloads.sourceforge.net/webadmin/webmin-1.441-1.noarch.rpm

rpm -ivh webmin-1.441-1.noarch.rpm

access webmin:

https://ipoftheserver:10000

Some infos are from: http://wiki.vpslink.com/HOWTO:_CentOS_5_setup_for_LAMP_and_ISPconfig#Step-by-step_Installation_Guide

Some infos are from: http://howtoforge.net/perfect-server-centos-5.2-x86_64