CentOSの不要なサービスを停止する
インストールされているサービスの一覧を表示する
標準のランレベルは3なので3の値を確認する
$ chkconfig --list NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off avahi-daemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off avahi-dnsconfd 0:off 1:off 2:off 3:off 4:off 5:off 6:off bluetooth 0:off 1:off 2:on 3:on 4:on 5:on 6:off capi 0:off 1:off 2:off 3:off 4:off 5:off 6:off conman 0:off 1:off 2:off 3:off 4:off 5:off 6:off cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off dnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:off dund 0:off 1:off 2:off 3:off 4:off 5:off 6:off firstboot 0:off 1:off 2:off 3:on 4:off 5:on 6:off gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off hidd 0:off 1:off 2:on 3:on 4:on 5:on 6:off ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off irda 0:off 1:off 2:off 3:off 4:off 5:off 6:off irqbalance 0:off 1:off 2:on 3:on 4:on 5:on 6:off isdn 0:off 1:off 2:on 3:on 4:on 5:on 6:off kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off mcstrans 0:off 1:off 2:on 3:on 4:on 5:on 6:off mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off mdmpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off messagebus 0:off 1:off 2:off 3:on 4:on 5:on 6:off microcode_ctl 0:off 1:off 2:on 3:on 4:on 5:on 6:off multipathd 0:off 1:off 2:off 3:off 4:off 5:off 6:off netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off netplugd 0:off 1:off 2:off 3:off 4:off 5:off 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off nscd 0:off 1:off 2:off 3:off 4:off 5:off 6:off oddjobd 0:off 1:off 2:off 3:off 4:off 5:off 6:off pand 0:off 1:off 2:off 3:off 4:off 5:off 6:off pcscd 0:off 1:off 2:on 3:on 4:on 5:on 6:off portmap 0:off 1:off 2:off 3:on 4:on 5:on 6:off psacct 0:off 1:off 2:off 3:off 4:off 5:off 6:off rawdevices 0:off 1:off 2:off 3:on 4:on 5:on 6:off rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off readahead_early 0:off 1:off 2:on 3:on 4:on 5:on 6:off readahead_later 0:off 1:off 2:off 3:off 4:off 5:on 6:off restorecond 0:off 1:off 2:on 3:on 4:on 5:on 6:off rpcgssd 0:off 1:off 2:off 3:on 4:on 5:on 6:off rpcidmapd 0:off 1:off 2:off 3:on 4:on 5:on 6:off rpcsvcgssd 0:off 1:off 2:off 3:off 4:off 5:off 6:off saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off smartd 0:off 1:off 2:on 3:on 4:on 5:on 6:off sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off tcsd 0:off 1:off 2:off 3:off 4:off 5:off 6:off vmware-tools 0:off 1:off 2:on 3:on 4:off 5:on 6:off wpa_supplicant 0:off 1:off 2:off 3:off 4:off 5:off 6:off xfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off ypbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off yum-updatesd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
サービスを停止するためのシェルスクリプトを作成する
#!/bin/sh /sbin/chkconfig NetworkManager off #ネットワークの自動設定を行う /sbin/chkconfig acpid on #電源管理(offにすると電源ボタンでシャットダウンできなくなる) /sbin/chkconfig anacron on #cronの補助的な役割を持つ /sbin/chkconfig atd on #atコマンドで登録されたタスクを管理する /sbin/chkconfig auditd off #システム監査結果のログ保存などを行う /sbin/chkconfig autofs off #ファイルシステムの自動マウントを行う /sbin/chkconfig avahi-daemon off #LAN内でのネットワーク自動構成を行う /sbin/chkconfig avahi-dnsconfd off #同上 /sbin/chkconfig bluetooth off #bluetoothに対応させる /sbin/chkconfig capi off # /sbin/chkconfig conman off #複数コンソールを管理する /sbin/chkconfig cpuspeed on #省電力の為のCPU速度管理を行う /sbin/chkconfig crond on #cron /sbin/chkconfig cups off #印刷の管理を行う /sbin/chkconfig dnsmasq off #DNSキャッシュサーバ /sbin/chkconfig dund off #bluetoothを使ってダイアルアップを行う /sbin/chkconfig firstboot off #インストール直後に呼び出される(その後は/etc/sysconfig/firstbootを作成し、意味のないサービスになる) /sbin/chkconfig gpm off #コンソールマウス機能 /sbin/chkconfig haldaemon off #D-BUSサポートを行う /sbin/chkconfig hidd off #bluetoothのキーボードやマウスを対応させる /sbin/chkconfig ip6tables on /sbin/chkconfig iptables on /sbin/chkconfig irda off #赤外線通信 /sbin/chkconfig irqbalance on #マルチCPU時の割り込み管理を行う(シングルCPUの場合は不要) /sbin/chkconfig isdn off #ISDN用のサービス。ただし海外向け /sbin/chkconfig kudzu off #ハードウェアの構成変更を検知する /sbin/chkconfig lvm2-monitor off #LVMの障害監視を行う /sbin/chkconfig mcstrans off #SELinuxの運用サポート /sbin/chkconfig mdmonitor off #mdデバイスの監視を行う /sbin/chkconfig mdmpd off #mdデバイスを複数インターフェースで利用する際の管理を行う /sbin/chkconfig messagebus off #D-BUSサポートを行う /sbin/chkconfig microcode_ctl on #インテル系CPUのマイクロコードの更新を行う /sbin/chkconfig multipathd off #DeviceMapperの管理を行う /sbin/chkconfig netconsole off #カーネルエラー発生時に、その内容を他のホストへ送信する /sbin/chkconfig netfs off #NFSクライアント /sbin/chkconfig netplugd off #DHCPの補助 /sbin/chkconfig network on #ネットワーク。必ず有効にする /sbin/chkconfig nfs off #NFSサーバ /sbin/chkconfig nfslock off #NFSロック /sbin/chkconfig nscd off #DNSキャッシュサーバ /sbin/chkconfig oddjobd off #D-BUSサポートを行う /sbin/chkconfig pand off #bluetoothのネットワーク対応を行う /sbin/chkconfig pcscd off #スマートカードの管理 /sbin/chkconfig portmap off #RPCのポートマッパー /sbin/chkconfig psacct off #アカウンティングを行う /sbin/chkconfig rawdevices off #ハードディスクをブロックデバイスとして利用する際の補助 /sbin/chkconfig rdisc off #経路監視 /sbin/chkconfig readahead_early on #起動を速くする /sbin/chkconfig readahead_later off /sbin/chkconfig restorecond off #SELinuxの運用サポート /sbin/chkconfig rpcgssd off #RPCサポート /sbin/chkconfig rpcidmapd off #RPCサポート /sbin/chkconfig rpcsvcgssd off #RPCサポート /sbin/chkconfig saslauthd off #SASL認証のサポート /sbin/chkconfig sendmail off /sbin/chkconfig smartd off #S.M.A.R.Tのサポート /sbin/chkconfig sshd on /sbin/chkconfig syslog on /sbin/chkconfig tcsd off #TCGのサポート /sbin/chkconfig vmware-tools on /sbin/chkconfig wpa_supplicant off #無線LANにおけるWPAをサポート /sbin/chkconfig xfs off #X-Window System用のフォントサーバ /sbin/chkconfig ypbind off #NISクライアント /sbin/chkconfig yum-updatesd off #CentOSの自動アップデートを行う
作成したシェルスクリプトを実行する
$ chmod 755 service.sh $ sudo ./service.sh