このエントリーをはてなブックマークに追加

CentOS5ンストール後の初期設定

CentOS 5.4をインストールした時の備忘録です。
5.4で作業をしたときの備忘録ですが、5.xであれば問題ないと思います。


関連記事

サービスの停止

不必要なサービスが動いていますので停止させます。

  • GUI 停止させる方法は「システム」→「管理」→「サービス」の順で操作が可能です。
    centos-setting-01.gif
     
  • CUI
    • サービス一覧の確認
      chkconfig --list
    • 次回起動時に実行されないようにする
      chkconfig サービス名 off
    • 次回起動時に実行するようにする
      chkconfig サービス名 on
       

ネットワーク関連の設定

ホスト名の変更

管理者権限で/etc/sysconfig/networkファイルを修正する。
の部分がホスト名になる。
以下の例ではホスト名をcentosにしている。
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=centos

centos-setting-02.gif
 

ネットワークデバイスの再起動

ネットワーク関連の修正をした場合、以下のコマンドでネットワークデバイスを再起動する。

/etc/rc.d/init.d/network restart
 

パッケージ管理の設定(yum関連)

CentOSをデスクトップとして利用する場合、ベースリポジトリに存在しないパッケージがたくさんあります。
そこで、RPMForgeやEPELのリポジトリ追加を行います。
パッケージ追加作業に関してですがサーバ運用であれば、他のリポジトリ追加により弊害がでる可能性があるので追加しない方がよいと思いますよ。

CentOSPlusを必要に応じて有効にする

rootになり/etc/yum.repos.d/CentOS-Base.repoファイルを修正します。
修正点はenabled=0をenabled=1に変更。

/etc/yum.repos.d/CentOS-Base.repo抜粋

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
 

RPMforge リポジトリを追加

以下URLより対応するrpmをダウンロードする。
http://dag.wieers.com/rpm/packages/rpmforge-release/
http://pkgs.repoforge.org/rpmforge-release/

当方の環境はi386だったのでrpmforge-release-0.3.6-1.el5.rf.i386.rpmをダウンロードしインストールした。(2010/1/15現在)

追記(2013/1/13)
rpmforgeのリポジトリを確認したところ、最新は以下の通りでした。(2013/1/13)

  • RHEL5 and CentOS-5 x86 32bit
    rpmforge-release-0.5.2-2.el5.rf.i386.rpm 13-Nov-2010 05:12 12K RHEL5 and CentOS-5 x86 32bit
  • RHEL5 and CentOS-5 x86 64bit
    [[rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm]>http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm] 13-Nov-2010 05:12   12K  RHEL5 and CentOS-5 x86 64bit

Fedora EPEL リポジトリを追加

EPEL : http://fedoraproject.org/wiki/EPEL/ja
以下URLより対応するrpmをダウンロードする。
http://download.fedora.redhat.com/pub/epel/5/i386/

epel-release-5-3.noarch.rpmをダウンロードしインストールした。(2010/1/15現在)

epel-release-5-4.noarch.rpm (2012/6/20現在)

リポジトリ追加後の作業

リポジトリの追加により同一パッケージが各リポジトリに存在した場合、上書きされてしまう可能性があります。
このようなことを防ぐために各リポジトリに優先順位(priority)を設定します。

  1. yum-prioritiesをインストール
    rootになり以下のコマンドでyum-prioritiesをインストールします。
    yum install yum-priorities
  2. 各リポジトリファイルを修正します。
    yum-prioritiesのインストールが完了したらrootのままで下記のファイルを修正します。
    赤字の部分が追記した部分です。 CentOS wikiの通り設定します。
    CentOS wiki抜粋
    [base], [addons], [updates], [extras] ... priority=1 
    
    [centosplus],[contrib] ... priority=2
    
    Third Party Repos ... priority=N  (where N is > 10 and based on your preference)
     
    1. /etc/yum.repos.d/CentOS-Base.repo
       
      # CentOS-Base.repo
      #
      # The mirror system uses the connecting IP address of the client and the
      # update status of each mirror to pick mirrors that are updated to and
      # geographically close to the client. You should use this for CentOS updates
      # unless you are manually picking other mirrors.
      #
      # If the mirrorlist= does not work for you, as a fall back you can try the
      # remarked out baseurl= line instead.
      #
      #

      [base]
      name=CentOS-$releasever - Base
      mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
      #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
      gpgcheck=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
      priority=1

      #released updates
      [updates]
      name=CentOS-$releasever - Updates
      mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
      #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
      gpgcheck=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
      priority=1

      #packages used/produced in the build but not released
      [addons]
      name=CentOS-$releasever - Addons
      mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
      #baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
      gpgcheck=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
      priority=1

      #additional packages that may be useful
      [extras]
      name=CentOS-$releasever - Extras
      mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
      #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
      gpgcheck=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
      priority=1

      #additional packages that extend functionality of existing packages
      [centosplus]
      name=CentOS-$releasever - Plus
      mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
      #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
      gpgcheck=1
      enabled=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
      priority=2

      #contrib - packages by Centos Users
      [contrib]
      name=CentOS-$releasever - Contrib
      mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
      #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
      gpgcheck=1
      enabled=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
      priority=2
       
    2. /etc/yum.repos.d/rpmforge.repo
      priority値を21にしました。この値は任意で指定できます。
       
      ### Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag
      ### URL: http://rpmforge.net/
      [rpmforge]
      name = Red Hat Enterprise $releasever - RPMforge.net - dag
      baseurl = http://apt.sw.be/redhat/el5/en/$basearch/rpmforge
      mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
      #mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
      enabled = 1
      protect = 0
      gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
      gpgcheck = 1
      priority=21
       
    3. /etc/yum.repos.d/epel.repo
      priority値を31にしました。この値は任意で指定できます。
       
      [epel]
      name=Extra Packages for Enterprise Linux 5 - $basearch
      #baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
      mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
      failovermethod=priority
      enabled=1
      gpgcheck=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
      priority=31

      [epel-debuginfo]
      name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
      #baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
      mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
      failovermethod=priority
      enabled=0
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
      gpgcheck=1

      [epel-source]
      name=Extra Packages for Enterprise Linux 5 - $basearch - Source
      #baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
      mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
      failovermethod=priority
      enabled=0
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
      gpgcheck=1
       
      上記[epel-debuginfo], [epel-source]にはpriorityを設定していません。
      理由はenabled=0のため有効になっていないためpriorityを設定していません。
       
  3. その他repoファイル
    RPMforge, EPELのリポジトリをインストールするとrpmforge-testing.repo, epel-testing.repoもインストールされています。
    しかし、enabledに0(無効)が設定されているのでpriorityは設定していません。
     
    以上でリポジトリの設定が完了です。

以後、yum check-update や yum updateにてシステムの確認や更新を行ってください。

 

 

添付ファイル: filecentos-setting-01.gif 581件 [詳細] filecentos-setting-02.gif 620件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2015-03-20 (金) 22:30:31