概要. CentOS導入直後の初期設定を行う。

1.rootの設定
コマンドラインでviが使えるように、環境を設定する。

# vi /root/.bashrc

以下の1行を追加する。

set -o vi

2. テンプレートディレクトリーの作成
ユーザーを作成した時に、HOMEディレクトリーに自動的に作成されるテンプレートのディレクトリーを今後導入するシステムに応じて作成しておく。

# cd /etc/skel/
# mkdir Maildir ← qmailでMaildir形式のメールボックスを使用する場合。
# mkdir Maildir/cur
# mkdir Maildir/new
# mkdir Maildir/tmp
# chmod -R 700 Maildir ← メールボックスの権限は700とする。
# mkdir .ssh ← SSHで公開鍵を使用する場合。
# chmod -R 700 .ssh ← 公開鍵のディレクトリーの権限は700とする。
# mkdir public_html ← 一般ユーザーにホームページスペースを提供する場合。
# mkdir samba ← 各ユーザーにsambaでWindowsファイルサーバーのディレクトリーを割当てる場合。
# mkdir etc ← FTPサーバー構築でホームディレクトリより上層へはアクセスできないようにする場合。
# cp -p /etc/localtime /etc/skel/etc/

3. グループの作成
DB管理者グループ : dbadminの作成

# groupadd -g 200 dbadmin

4. ユーザの作成

役割ユーザーIDグループ
DB管理者ユーザーmysqladmdbadmin,wheel
開発ユーザーdeveloperdbadmin,wheel
システム管理者admindbadmin,wheel
# useradd -u 200 -g mysqladm dbadmin
# usermod -G wheel dbadmin
# passwd dbadmin
Changing password for user dbadmin.
New UNIX password: xxxxxxxx
Retype new UNIX password: xxxxxxxx
passwd: all authentication tokens updated successfully.
 
# useradd -u 500 -g dbadmin developer
# passwd developer
Changing password for user developer.
New UNIX password: xxxxxxxx
Retype new UNIX password: xxxxxxxx
passwd: all authentication tokens updated successfully.
 
# useradd -g dbadmin admin
# passwd admin
Changing password for user admin.
New UNIX password: xxxxxxxx
Retype new UNIX password: xxxxxxxx
passwd: all authentication tokens updated successfully.
# usermod -G wheel admin

5. rootになれるユーザを管理者のみにする

  1. ) suの設定変更
    # vi /etc/pam.d/su
    
    #auth       required     pam_wheel.so use_uid
     
    auth       required     pam_wheel.so use_uid ← コメント解除
    
    管理者用一般ユーザからはrootになれて、管理者以外の一般ユーザからはrootになれないことを確認する。
  2. ) su出来ないことを確認する。
    # su - developer ← 一般ユーザdeveloperになる。
    $ su -
    パスワード:
    su: パスワードが違います
    
  3. ) su出来ることを確認する。
    $ exit ← rootに戻る。
    # usermod -G wheel developer ← ユーザdeveloperに管理者権限を与える。
    # su - developer
    $ su -
    パスワード:
    #
    

6. パッケージ管理システム設定
rpm形式パッケージを対象にしたパッケージ管理ツールのyumの初期設定を行う。

  1. ) yum-updatesdの削除
    yum-updatesdはデフォルトで1時間ごとにアップデートチェックを行うようになっており、手動によるパッケージインストールと競合するとインストールが失敗するので削除する。
    # /etc/rc.d/init.d/yum-updatesd stop ← yum-updatesd停止
    Stopping yum-updates:                                      [  OK  ]
    # yum -y remove yum-updatesd ← yum-updatesd削除
    
  2. ) fastestmirrorのインストール
    インストールパッケージダウンロード時の最適ミラーサイトを自動選択するようにする。
    # yum -y install yum-fastestmirror
    
  3. ) インストール済パッケージの一括アップデート
    # yum -y update
    
    注:大量のパッケージのダウンロード/アップデートを行うため時間がかかる
  4. ) yum-cronのインストール
    夜間にパッケージを自動更新するようにする。
    # yum -y install yum-cron
    # /etc/rc.d/init.d/yum-cron start ← パッケージ自動更新起動
    Enabling nightly yum update:                               [  OK  ]
    # chkconfig yum-cron on ← パッケージ自動更新自動起動設定
    # chkconfig --list yum-cron
    yum-cron        0:off   1:off   2:on    3:on    4:on    5:on    6:off
    

7. 作業ディレクトリーの作成

# mkdir /tmp/work

作業が終了したら適時ダウンロードや展開したファイルを削除する。

# rm -rf /tmp/work

最終更新のRSS
Last-modified: 2014-03-11 (火) 01:59:57 (3696d)