http://tanaka.sakura.ad.jp/2011/05/centos-linux-apache-php-perl-mysql-lamp.html
これはマスターしたほうがよさそう。
yumのリポジトリを追加するとかなり便利なんだ。

1.CentOS5.5→CentOS5.6へバージョンアップ

  rpm -qa | grep centos-release #現行バージョンの確認

  yum upgrade #アップグレード

  rpm -qa | grep centos-release #バージョンアップ確認

2.yumリポジトリの追加
  Fedora EPELとremiとRPMForgeの追加

  2.1 Fedora EPELのダウンロード
      wget http://donwload.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

  2.2 remiのダウンロード
      http://rpms.famillecollet.com/el5.x86_64/remi-release-5-8.el5.remi.noarch.rpm

  2.3 RPMForgeのダウンロード
      wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

  2.4 3つのリポジトリの追加
      rpm -Uvh epel-release-5-4.noarch.rpm remi-release-5-8.el5.remi.noarch.rpm rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

  2.5 yum実行時以外にリポジトリが利用されることを防ぐ
      (remiは初期設定でそうなっているので、FedoraEPELとRPMForgeを設定する)

       vi /etc/yum.repos.d/epel.repo
       enabled=1を0に変更
       vi /etc/yum.repos.d/rpmforge.repo
       enabled=1を0に変更

  2.6 パッケージのインストール
      LAMP関連のソフトが一発でインストールできる
      yum --enablerepo=remi,epel,rpmforge install httpd-devel php-devel php-pear mysql-server phpmyadmin

  2.7Apacheの不要モジュールのコメントアウト
     不要モジュール
     mod_auth_digest
     mod_authn_file
     mod_authn_anon
     mod_authn_dbm
     mod_authn_default
     mod_authz_owner
     mod_authz_groupfile
     mod_authz_dbm
     mod_authz_default
     mod_ldap
     mod_authnz_ldap
     mod_logio
     mod_ext_filter
     mod_mine_magic
     mod_expires
     mod_deflate
     mod_usertrack
     mod_dav
     mod_dav_fs
     mod_vhost_alias
     mod_actions
     mod_speling
     mod_proxy_ftp
     mod_proxy_connct
     mod_disk_chache
     mod_file_chache
     mod_mem_chache

3.Apacheの同時接続数設定
1GB 2コア(さくらVPS 1Gプラン)
httpd.conf

</IfModule prefork.c>
    StartServers 10
    MinSpareServers 5
    MaxSpareServers 15
    ServerLimit 256
    MaxClients 40
    MaxRequestsPerChild 1000
</IfModule>
 
4.各サービス起動
 4.1 Apache起動
      service httpd starat

 4.2 MySQL起動
      service mysqld starat
      /user/bin/mysql_secure_installation #mysqlの設定用スクリプト

 4.3 phpmyadminの設定
      vi /user/share/phpmyadmin/conig.inc.php

5.再起動時の自動起動設定
   chkconfig --list | grep -E "httpd|mysql"
   chkconfig httpd on
   chkconfig mysqld on
   chkconfig --list | grep -E "httpd|mysql"

6.可能であれば再起動
  可能であれば再起動してサービスの状況を確認したほうがよい

以下のサイトを参考にCentOSの設定についてまとめました。
http://tanaka.sakura.ad.jp/archives/001065.html

 _____________________________________________________
| 1.SSHのポート番号変更        |
|                         |
| 2.公開鍵認証でのSSH接続      |
|                         |
| 3.iptablesの設定             |
|                         |
| 4.不要なデーモンのストップ      |
|                         |
| 5.いらないコンソールの無効化    |
|                         |
| 6.SELINUXの無効化          |
|                         |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1.SSHのポート番号変更
 /etc/ssh/sshd_config

#Post 22
Port 20222


2.公開鍵認証でのssh接続
  公開鍵を利用することでパスワードでログインできなくします。
  クライアントでキーペア(秘密鍵と公開鍵)を生成し、サーバーには公開鍵だけを登録する。
  キーペアの生成方法はクライアントによって異なる
    2.1 teratermの場合
      「設定」→「SSH鍵生成」
    2.2 OpenSSH
 
  /etc/ssh/sshd_configでパスワードでのログインを禁止することも忘れずに
   PermitRootLogin without-password

3.iptablesの設定
   sshとhttp以外はサーバーへアクセスできないようにするのが吉。
   /etc/sysconfig/iptables

4.不要なデーモンのストップ
   CentOSではびっくりするくらいの不要なデーモンが立ち上がっている
   以下のコマンドで不要デーモンをoffに

   chkconfig auditd off
   chkconfig autofs off
chkconfig avahi-daemon off
chkconfig buluetooth off
chkconfig cups off
chkconfig firstboot off
chkconfig gpm off
chkconfig haldaemon off
chkconfig hidd off
chkconfig isdn off
chkconfig kudzu off
chkconfig lvm2-monitor off
chkconfig mcstrans off
chkconfig mdmonitor off
chkconfig messagebus off
chkconfig netfs off
chkconfig nfslock off
chkconfig pcscd off
chkconfig portmap off
chkconfig rawdevices off
chkconfig restorecond off
chkconfig rpcgssd off
chkconfig rpcidmapd off
chkconfig smartd off
chkconfig xfs off
chkconfig yum-updatesd off

5.いらないコンソールを無効にする
/etc/inittab

#2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6

6.selinuxを無効にする
  /etc/sysconfig/selinux

SELINUX=disabled