検索

カレンダー

2011年3月
« 2月   4月 »
 123456
78910111213
14151617181920
21222324252627
28293031  

広告

ブログランキング・にほんブログ村へ
にほんブログ村

東電電力供給情報

カテゴリー

最近のコメント

リンク

Scientific Linux 6で自宅サーバー構築 その3 Scientific Linux 6インストール後の初期設定

投稿者:yasu 更新日時:2011年3月7日 19時52分04秒
カテゴリLinux, Scientific Linux, 自宅サーバー

今回はScientific Linux 6(以下SL6)の初期設定を実施します。

yumリポジトリ追加

標準リポジトリにはないパッケージをyumで導入する場合にリポジトリを追加します。

riken

[root@sl6 ~]# vi /etc/yum.repos.d/sl-riken.repo
[riken]
name=Scientific Linux $releasever - $basearch
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el6/en/$basearch/dag
gpgcheck=1
enabled=0
gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

# 保存してviエディタを終了します

RPMForge

[root@sl6 ~]# yum -y install rpmforge-release
sl | 3.2 kB 00:00
sl-security | 1.9 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package rpmforge-release.x86_64 0:0.5.2-2.el6.rf set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================
Package Arch Version Repository Size
=============================================================
Installing:
rpmforge-release x86_64 0.5.2-2.el6.rf sl 12 k

Transaction Summary
=============================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 12 k
Installed size: 13 k
Downloading Packages:
rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm | 12 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : rpmforge-release-0.5.2-2.el6.rf.x86_64 1/1

Installed:
rpmforge-release.x86_64 0:0.5.2-2.el6.rf

Complete!

[root@sl6 ~]# vi /etc/yum.repos.d/rpmforge.repo
### Name: RPMforge RPM Repository for RHEL 6 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 0 # 1から0に変更
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

[rpmforge-extras]
name = RHEL $releasever - RPMforge.net - extras
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/extras
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge-extras
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

[rpmforge-testing]
name = RHEL $releasever - RPMforge.net - testing
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/testing
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge-testing
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-testing
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

# 保存してviエディタを終了します

# RPMforgeを使ってパッケージをインストールする場合
[root@sl6 ~]# yum --enablerepo=rpmforge install [パッケージ名]

EPEL

[root@sl6 ~]# yum -y install epel-release
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================
Package Arch Version Repository Size
=============================================================
Installing:
epel-release noarch 6-5 sl 13 k

Transaction Summary
=============================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 13 k
Installed size: 22 k
Downloading Packages:
epel-release-6-5.noarch.rpm | 13 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : epel-release-6-5.noarch 1/1

Installed:
epel-release.noarch 0:6-5

Complete!

[root@sl6 ~]# vi /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=0 # 1から0に変更
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

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

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

# 保存してviエディタを終了します

# EPELリポジトリを利用する場合
[root@sl6 ~]# yum --enablerepo=epel install [パッケージ名]

# ATrpms

[root@sl6 ~]# yum -y install atrpms-repo
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package atrpms-repo.x86_64 0:6-5.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================
Package Arch Version Repository Size
=============================================================
Installing:
atrpms-repo x86_64 6-5.el6 sl-security 7.4 k

Transaction Summary
=============================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 7.4 k
Installed size: 6.0 k
Downloading Packages:
atrpms-repo-6-5.el6.x86_64.rpm | 7.4 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : atrpms-repo-6-5.el6.x86_64 1/1

Installed:
atrpms-repo.x86_64 0:6-5.el6

Complete!

[root@sl6 ~]# vi /etc/yum.repos.d/atrpms.repo
[atrpms]
name=Red Hat Enterprise Linux 6 - $basearch - ATrpms
failovermethod=priority
baseurl=http://dl.atrpms.net/el6-$basearch/atrpms/stable
enabled=0 # 1から0に変更
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-atrpms

[atrpms-debuginfo]
name=Red Hat Enterprise Linux 6 - $basearch - ATrpms - Debug
failovermethod=priority
baseurl=http://dl.atrpms.net/debug/el6-$basearch/atrpms/stable
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-atrpms

[atrpms-source]
name=Red Hat Enterprise Linux 6 - $basearch - ATrpms - Source
failovermethod=priority
baseurl=http://dl.atrpms.net/src/el6-$basearch/atrpms/stable
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-atrpms

# 保存してviエディタを終了します

# ATrpmsリポジトリを利用する場合
[root@sl6 ~]# yum --enablerepo=atrpms install [パッケージ名]

# ELRepo

[root@sl6 ~]# rpm -Uvh http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm
http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm を取得中
警告: /var/tmp/rpm-tmp.ao7Mjb: ヘッダ V4 DSA/SHA1 Signature, key ID baadae52: NOKEY
準備中... ########################################### [100%]
1:elrepo-release ########################################### [100%]

[root@sl6 ~]# vi /etc/yum.repos.d/elrepo.repo
### Name: ELRepo.org Community Enterprise Linux Repository for el6
### URL: http://elrepo.org/

[elrepo]
name=ELRepo.org Community Enterprise Linux Repository - el6
baseurl=http://elrepo.org/linux/elrepo/el6/$basearch/
mirrorlist=http://elrepo.org/mirrors-elrepo.el6
enabled=0 # 1から0に変更
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

[elrepo-testing]
name=ELRepo.org Community Enterprise Linux Testing Repository - el6
baseurl=http://elrepo.org/linux/testing/el6/$basearch/
mirrorlist=http://elrepo.org/mirrors-elrepo-testing.el6
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

[elrepo-kernel]
name=ELRepo.org Community Enterprise Linux Kernel Repository - el6
baseurl=http://elrepo.org/linux/kernel/el6/$basearch/
mirrorlist=http://elrepo.org/mirrors-elrepo-kernel.el6
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

[elrepo-extras]
name=ELRepo.org Community Enterprise Linux Repository - el6
baseurl=http://elrepo.org/linux/extras/el6/$basearch/
mirrorlist=http://elrepo.org/mirrors-elrepo-extras.el6
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

# 保存してviエディタを終了します

# ELRepoリポジトリを利用する場合
[root@sl6 ~]# yum --enablerepo=elrepo install [パッケージ名]

システムアップデートシェル作成

# システムアップデートシェルを作成します
[root@sl6 ~]# vi /etc/cron.daily/systemupdate.sh
#!/bin/sh
echo "***** yum system update start `date` *****" > /var/log/systemupdate.log 2>&1
echo "# yum list" >> /var/log/systemupdate.log 2>&1
yum list >> /var/log/systemupdate.log 2>&1
echo "" >> /var/log/systemupdate.log 2>&1
echo "# yum check-update" >> /var/log/systemupdate.log 2>&1
yum check-update >> /var/log/systemupdate.log 2>&1
echo "" >> /var/log/systemupdate.log 2>&1
echo "# yum update" >> /var/log/systemupdate.log 2>&1
yum -y update >> /var/log/systemupdate.log 2>&1
echo "" >> /var/log/systemupdate.log 2>&1
echo "***** yum system update end `date` *****" >> /var/log/systemupdate.log 2>&1

# 保存してviエディタを終了します([:]キー[w]キー[q]キー[Enter]キーの順に押下します)

# システムアップデートシェルに実行権限を付与します
[root@sl6 ~]# chmod 755 /etc/cron.daily/systemupdate.sh

# システムアップデートシェルの権限を確認します
[root@sl6 ~]# ls -la /etc/cron.daily/systemupdate.sh
-rwxr-xr-x. 1 root root 611 6月 18 13:25 2011 /etc/cron.daily/systemupdate.sh ← 権限がrwxr-xr-xになっていることを確認します

# yum-autoupdateの実行権限を剥奪します
[root@sl6 ~]# chmod 644 /etc/cron.daily/yum-autoupdate

# yum-autoupdateの権限を確認します
[root@sl6 ~]# ls -la /etc/cron.daily/yum-autoupdate
-rw-r--r--. 1 root root 7334 2月 17 07:19 2011 /etc/cron.daily/yum-autoupdate ← 権限がrw-r--r--になっていることを確認します

SELinuxの無効化

有効活用できると強固なセキュリティを持ったサーバー構築ができるのでしょうけど、逆にSELinux使いこなしてる人なんているの?
ってくらいわけわかりません。(自分だけ??)
CentOS5の構築時はSELinuxを有効にしていましたが、自由自在に設定ができなくて(自分の技術がないから)ミドルウェアの設定に苦労しました。
ということで今回Scientific LinuxではSELinuxを無効にします。

# SELinuxの設定ファイルを編集します
[root@sl6 ~]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled # enforcingからdisabledに変更します
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

# OSを再起動します
[root@sl6 ~]# reboot

■関連記事
Scientific Linux 6で自宅サーバー構築 その1 サーバー機Express 5800 GT110bのオンボードRAIDでRAID1設定
Scientific Linux 6で自宅サーバー構築 その2 Scientific Linux 6をExpress5800/GT110bにインストール
Scientific Linux 6で自宅サーバー構築 その3 Scientific Linux 6インストール後の初期設定
Scientific Linux 6で自宅サーバー構築 番外編その1 Scientific Linux 6のcronについて
Scientific Linux 6で自宅サーバー構築 その4 Scientific Linux 6 にClamAVをインストールしてウィルス対策
Scientific Linux 6で自宅サーバー構築 その5 Scientific Linux 6 にTripwireをインストールしてファイル改ざんを検知する
Scientific Linux 6で自宅サーバー構築 その6 Scientific Linux 6 にchkrootkitをインストールしてrootkit感染を検知する
Scientific Linux 6で自宅サーバー構築 その7 NTPサーバーで自動時刻合わせ
Scientific Linux 6で自宅サーバー構築 その8 バッファオーバーフロー攻撃対策を行う
Scientific Linux 6で自宅サーバー構築 その9 logwatchでサーバー監視
Scientific Linux 6で自宅サーバー構築 その10 DNSサーバーを構築
Scientific Linux 6で自宅サーバー構築 番外編その2 Scientific Linuxを6.0から6.1にアップグレードする
Scientific Linux 6で自宅サーバー構築 その11 PostfixとDovecotとSMTP-AUTHでメールサーバーを構築する
Scientific Linux 6で自宅サーバー構築 その12 メールサーバーにSSLを導入する
Scientific Linux 6で自宅サーバー構築 その13 Apache PHP MySQLをインストール
Scientific Linux 6で自宅サーバー構築 その14 WebサーバーにSSLを導入する
Scientific Linux 6で自宅サーバー構築 その15 WordPressを導入する
Scientific Linux 6で自宅サーバー構築 その16 Piwikでアクセスログ集計
Scientific Linux 6で自宅サーバー構築 その17 Squidをインストール
Scientific Linux 6で自宅サーバー構築 その18 sshで鍵認証を導入
Scientific Linux 6で自宅サーバー構築 その19 WebDavの設定
Scientific Linux 6で自宅サーバー構築 その20 lm_sensorをインストール

“Scientific Linux 6で自宅サーバー構築 その3 Scientific Linux 6インストール後の初期設定”にコメントはありません

コメントする