CentOS 6.2インストール後の設定

yum設定

# yum -y update

vimの設定

  • vimの全体設定を変更して利用しやすくします。
# vi /etc/vimrc
# ファイルの最後に下記3行を追加します。
set ts=4
set nu
autocmd FileType * set formatoptions-=ro
    • 「set ts=4」 :タブの幅をスペース4つ分に設定する
    • 「set nu」  :行番号を表示する
    • 「autocmd…」:改行時に自動でコメントを挿入しない

ユーザー追加

  • ユーザーを作成
# adduser [ユーザー名]
  • 作成したユーザーにパスワードを設定する
# passwd [ユーザー名]

SSH設定

  • 設定ファイル「/etc/ssh/sshd_config」を以下のように変更します。
# vim /etc/ssh/sshd_config
# 42行目:rootでのログインを禁止する コメントを解除
PermitRootLogin no

# 65行目:パスワード無しのログインを禁止する コメントを解除
PermitEmptyPasswords no

# 最終行に追加:ユーザ[ユーザー名]のみ接続許可をする(不特定多数にSSHを利用させない)
AllowUsers [ユーザー名]
  • 設定変更を有効にするためサービスを再起動します
# /etc/init.d/sshd restart

sudoでパスワードを求めないようにする

# chmod 640 /etc/sudoers
# vim /etc/sudoers
root    ALL=(ALL)   ALL
[ユーザー名]    ALL=(ALL) NOPASSWD: ALL
# chmod 440 /etc/sudoers

NTP設定

$ sudo yum install -y ntp
$ sudo sed -i -e "s/server 0.centos.pool.ntp.org/server ntp.nict.jp iburst/g" /etc/ntp.conf
$ sudo sed -i -e "s/server 1.centos.pool.ntp.org/server ntp.nict.jp iburst/g" /etc/ntp.conf
$ sudo sed -i -e "s/server 2.centos.pool.ntp.org/server ntp.nict.jp iburst/g" /etc/ntp.conf
$ sudo service ntpd stop
$ sudo ntpdate ntp.nict.jp
$ sudo service ntpd start

SELinux Disabled

$ sudo sed -i -e "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
$ sudo reboot

リブート後に起動すると、CentOS6.3 になっていました。

iptablesの設定