Latest Entries

Install CenOS 5.4 for stable and highload server #4 httpd and php

[root@idm named]# yum -y install httpd php php-mbstring php-mysql php-devel

ok first we will look to httpd.conf

[root@idm named]# vi /etc/httpd/conf/httpd.conf

check these setting

ServerTokens Prod
Timeout 30
KeepAlive On
MaxKeepAliveRequests 1024
KeepAliveTimeout 2


StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0

after checked now just make it run at start up
[root@idm ~]# chkconfig httpd on
[root@idm ~]# service httpd start

seems everything work check by test on browser. now we will tune it to use fastcgi and apache mode worker for better performance.

Make sure required packages are installed (httpd-devel and apr-devel required to compile mod_fastcgi), enter:
# yum install libtool httpd-devel apr-devel apr

Next, grab the latest mod_fastcgi source code, enter:
# cd /opt
# wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz

Untar tar ball, type:
# tar -zxvf mod_fastcgi-current.tar.gz
# cd mod_fastcgi-2.4.6/

Make a copy of Makefile.AP2, enter:
# cp Makefile.AP2 Makefile

Compile and install mod_fastcgi for 32 bit system, enter:
# make top_dir=/usr/lib/httpd
# make install top_dir=/usr/lib/httpd

Compile and install mod_fastcgi for 64 bit system, enter:
# make top_dir=/usr/lib64/httpd
# make install top_dir=/usr/lib64/httpd

Configure mod_fastcgi

Open /etc/httpd/conf.d/mod_fastcgi.conf file
# vi /etc/httpd/conf.d/mod_fastcgi.conf

Add an entry to it like this:
LoadModule fastcgi_module modules/mod_fastcgi.so

Save and close the file. Restart httpd, enter:
# service httpd restart

next check on config on this page Page

now we will set httpd to be use MPM worker
# vi /etc/sysconfig/httpd

Uncomment this line
HTTPD=/usr/sbin/httpd.worker

# service httpd restart

ok now install zend PAge

then install xcache via this page Page

Install CenOS 5.4 for stable and highload server #2 Setup and Config

After reboot system login with root, We will add user for perform as root later with “su” for better security

[root@idm ~]# useradd thaigaming // add a user 'thaigaming'
[root@idm ~]# passwd thaigaming // add password for user 'thaigaming'
Changing password for user thaigaming.
New UNIX password: // input password you want to set
Retype new UNIX password: // verify
passwd: all authentication tokens updated successfully.
[root@idm ~]# exit // logout current root

now try to switch to new user that just creat

idm login: thaigaming // input user name
password: // input password
[thaigaming@idm ~]$ su - // switch to root and can use all command
Password: // input password for root
[root@idm ~]# // done to switching to root

make latest user that just add to be only user that can change to root


[root@idm ~]#vi /etc/group // open the file with vi
wheel:x:10:root,thaigaming // line 11: add user


[root@idm ~]#vi /etc/pam.d/su
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
auth required pam_wheel.so use_uid // remove '#' that was on the head of line
auth include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session optional pam_xauth.so


[root@idm ~]#vi /etc/login.defs
SU_WHEEL_ONLY yes // add this line at the bottom

set alias for alias mail root to user


[root@idm ~]#vi /etc/aliases
# Person who should get root's mail
root:thaigaming // at bottom of file: remove '#' and add user name
[root@idm ~]#newaliases // set new aliases
/etc/aliases: 77 aliases, longest 10 bytes, 776 bytes total

disable ipv6

[root@idm ~]# chkconfig ip6tables off

now make sure to disable SELINUX from running too

[root@idm ~]# vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled // set to disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

then edit grub boot mode to complete disable selinux
usally /boot/grub/grub.conf, if you’re using the GRUB boot loader. On the kernel line, add selinux=0

now need to disable unneccessory that default load to memory, first we need to list them

[root@idm ~]# chkconfig --list

for example the unneccessory service is yum-updatesd you can see on the list then stop it

[root@idm ~]# /etc/rc.d/init.d/yum-updatesd stop

addition it is better to remove from your server too

[root@idm ~]# rpm -e yum-updatesd

below are list of service and information the mark with * is my setting to load on start

NetworkManager The NetworkManager daemon attempts to keep an active network connection available at all times.  
NetworkManagerDispatcher The NetworkManagerDispatcher daemon runs commands in the /etc/NetworkManager/dispatcher.d directory in response to interfaces coming up and down.  
acpid Advanced Configuration and Power Interface event daemon.  
anacron Anacron can be used to execute commands periodically, with a frequency specified in days.  
apmd Advanced Power Management (APM) BIOS utilities for laptops.  
atd atd runs jobs queued by at.  
auditd The audit package contains the user space utilities for storing and searching the audit records generate by the audit subsystem in the Linux 2.6 kernel. *
autofs autofs controls the operation of the automount(8) daemons running on the Linux system.  
avahi-daemon Avahi mDNS/DNS-SD daemon Avahi is a fully LGPL framework for Multicast DNS Service Discovery.  
avahi-dnsconfd avahi-dnsconfd is a small daemon which may be used to configure conventional DNS servers using mDNS in a DHCP-like fashion.  
bluetooth It provids wireless connections among computers.  
conman ConMan is a serial console management program designed to support a large number of console devices and simultaneous users.  
cpuspeed This program monitors the system idle percentage and reduces or raises the CPUs clock speeds and voltages accordingly to minimize power consumption when idle and maximize perfor-mance when needed.  
crond The daemon to execute scheduled commands. *
cups It’s the print system.  
dund It’s BlueZ Bluetooth dial-up networking daemon.  
firstboot It’s a tool that we can configure basic settings ofthe system by it.  
gpm It’s a cut and paste utility and mouse server for virtual consoles.  
haldaemon It searches infomations for hardwares.  
hidd It’s Bluetooth HID daemon.  
ibmasm IBM Advanced System Management software Group.  
ip6tables It’s IPv6 packet filter administration.  
iptables It’s administration tool for IPv4 packet filtering and NAT.  
irda IrDA is a complete implementation of the various IrDA protocols and IrDA drivers for Linux.  
irqbalance It distributes hardware interrupts across processors on a multiprocessor system. *
kudzu It detects and configures new and/or changed hardware on a system.  
mcstrans It’s the daemon for SELinux.  
mdmonitor It watches software-based RAID.  
mdmpd It watches software-based RAID.  
messagebus It sends messages between apprications. *
microcode_ctl It’s microcode utility for Intel IA32 processors. *
netfs It’s NFS client.  
netplugd It’s the daemon for network cable hotplug management.  
network It’s the daemon for network system. *
nfs It’s NFS server.  
nfslock It provids file lock function for NFS server.  
nscd Nscd is a daemon that provides a cache for the most common name service requests.  
oddjobd The oddjobd daemon provides the com.redhat.oddjob service on the system-wide message bus.  
pand The pand PAN daemon allows your computer to connect to ethernet networks using Bluetooth.  
pcscd It’s PC/SC Smart Card Daemon.  
portmap Portmap is a server that converts RPC program numbers into DARPA protocol port numbers.  
psacct PSACCT is a standard process running on each node that generates daily usage logs containing information on the jobs that ran and how many resources they consumed.  
rawdevices bind a Linux raw character device *
rdisc ??????? Sorry, I don’t know. it is already off  
readahead_early It reads files in page cache early. *
readahead_later It reads files in page cache early when system is running in GUI mode.  
restorecond It’s the daemon that watches for file creation and then sets the default SELinux file context.  
rpcgssd It’s the daemon which is used for network filesystem like NIS or NFS.  
rpcidmapd It’s the daemon which is used for network filesystem like NIS or NFS.  
rpcsvcgssd It’s the daemon which is used for network filesystem like NIS or NFS.  
saslauthd saslauthd is a daemon process that handles plaintext authentication requests on behalf of the SASL library.  
sendmail It’s SMTP server.  
smartd It’s SMART Disk Monitoring Daemon.  
sshd It’s OpenSSH SSH daemon. *
syslog It reads and/or clears kernel message ring buffer; set console_loglevel. *
wpa_supplicant It’s Wi-Fi Protected Access client and IEEE 802.1X supplicant.  
xfs It’s X fonts server.  
ypbind ypbind finds the server for NIS domains and maintains the NIS binding information.  
yum-updatesd yum-updatesd provides notification of updates which are available to be applied to your system.  

credit: information from server-world.info
please check to disable all unnecessory service such as bluetooth, print service etc. to run on server.
mark with green mean let them load on startup
mark with red that is service I have decided to remove from server with rpm -e

Now we going to set server up-to-date, but we need to set it to look fastest mirror

[root@idm ~]# yum -y install yum-fastestmirror

let’s go update server.

[root@idm ~]# yum -y update

Install CenOS 5.4 for stable and highload server #1 Install OS

First of all, let’s install OS to the box. I have choose Centos because they are flexible and free. many of resource. and come with useful repo. also I have very good experince with it. Get the Centos here CentOS Mirrors

My goal is for stable and good performance for web and database server, that running website Thaigaming.com. so other unneccessory will not install at this setup. I’ve choose X86_64 version.

1. First setup boot from dvd rom and you will get the first screen

2. I will not deep in basic install, the alternate for me is not install so many software at start, you can customize later then unselect all package and tick “customize now”

3. Just check on Development Tools like below

4. Check a box ‘Base’ and go Next.

5. Just next and do basic installation.

6. Installation has finished. Click ‘Reboot’ button.

7. After reboot we will get this screen

8. First of all we will disable firewall and selinux function

9. Finish. Then leave installation

My server setup procedure will be blog here

The setup of Thaigaming.com website server. will be provide here. It is Centos 5.4 x86_64

and will setup apache php mysql ftp squid xcache zend etc..

anyway, I’ll test posting code now.

<div style="text-align:center;">
some here
just another sometext
</div>