ML115のOS入れ替え(cent5からcent6へ)

数年ぶりにサーバのOSを入れ替えてみる。
以下、順番にやったことの列記

  • yum-plugin-priority
  • rpmforge repo add
  • epel repo add
  • rpmfusion repo add
  • clamd install

ComodoはGUIが主体ぽいのでやめ、clamd + freshclamをいれてみた

  • nmap install
  • nkf install
  • bind

bind-chrootは今回はやめ
chkconfig named onをわすれずにw

  • selinux enforcing(default)をpermissiveに変更

 sestatus,setenforceコマンド

  • etherwakeの整備

 -i interfaceオプションを追加しないと動かない場合があったぞ

  • iptablesをフラッシュしちまえ
  • ssh-keygenで鍵ペアを作成して、rootユーザでサーバ間をノーパスワードで渡れるようにする

Linux Server Hack #66にものってるね

  • sambaの追加

 まだ samba3
 昔書いたHatenaの記事(備忘録)を参照しすつつ
 samba,samba-client,samba-devel,samba-test,samba-swat

  • 忘れちゃいけないnmbd (わすれてたのは秘密です)
  • swatは xinetdからキックされてるんだな(わすれてた onlyfrom =にちうい)

smbclient //192.168.1.xx/hirasawa -U hirasawa とかでてすとできる(これもわすれてた orz)

  • smartmontools(smartd smartctl )

http://d.hatena.ne.jp/toshi_hirasawa/20130412/1365729065

[root@cent6-64-38 postfix]# diff main.cf.orig main.cf
44,49d43
< # The data_directory parameter specifies the location of Postfix-writable
< # data files (caches, random numbers). This directory must be owned
< # by the mail_owner account (see below).
< #
< data_directory = /var/lib/postfix
< 
113c107
< #inet_interfaces = all
---
> inet_interfaces = all
116,119c110
< inet_interfaces = localhost
< 
< # Enable IPv4, and IPv6 if supported
< inet_protocols = all
---
> #inet_interfaces = localhost
164c155
< mydestination = $myhostname, localhost.$mydomain, localhost
---
> mydestination = $myhostname, localhost.$mydomain, localhost hirasawa.local
264a256
> mynetworks = 168.100.189.0/28, 127.0.0.0/8 192.168.1.0/24
615c607
< 	 ddd $daemon_directory/$process_name $process_id & sleep 5
---
> 	 xxgdb $daemon_directory/$process_name $process_id & sleep 5
672c664
< sample_directory = /usr/share/doc/postfix-2.6.6/samples
---
> sample_directory = /usr/share/doc/postfix-2.3.3/samples
676c668,676
< readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
---
> readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
> 
> smtpd_sasl_auth_enable = yes
> smtpd_sasl_local_domain = $myhostname
> smtpd_recipient_restrictions =
>     permit_mynetworks
>     permit_sasl_authenticated
>     reject_unauth_destination
> 
[root@cent6-64-38 postfix]# 
  • エラーメールの通知をセットアップ(たとえば)
[root@cent6-64-38 ~]# cat text
From: my@mail.address (あなたのメールアドレス)
To: foo@example.com
Subject: This is test mail.
(ここに空行を入れる。ここまでがヘッダ。ここから先がボディ)
メールの内容
.(ドットのみの行を入力すると終了)
.
[root@cent6-64-38 ~]# cat text | sendmail hirasawa@hirasawa.local
[root@cent6-64-38 ~]# 
[root@cent6-64-38 ~]# cat text | nkf -s | sendmail hirasawa@hirasawa.local
[root@cent6-64-38 ~]# 
[root@cent6-64-38 ~]# cat text | nkf -w  | sendmail hirasawa@hirasawa.local

たとえばたとえば

[root@cent6-64-38 bin]# cat sendmail.sh 
#!/bin/sh


echo "----- touch test flag touch /export/testflag "
touch /export/project/testflag



DAY=`date +%Y/%m/%d`
HOST=`uname -n`
MAIL=hirasawa@hirasawa.local
SUB=$HOST-----$DAY
mail -s $SUB $MAIL  << _EOF_
----------------- date-----------
`date +%Y/%m/%d`
`date`
----------------- uname -n-----------
`uname -n`
----------------- find /export -mtime -2 result-----------
`find /export -mtime -2`
------------------find /home -mtime -2 ressult  ----------
`find /home -mtime -2`
----------------- df result-----------
`df`
----------------- tail -40 /var/log/clamav/clamd.log result-----------
`tail -40 /var/log/clamav/clamd.log`
----------------- tail -40 /var/log/clamav/freshclam.log result-----------
`tail -40 /var/log/clamav/freshclam.log`

----------------- restart/halt result-----------
`cat /var/log/messages | grep -E "restart|halt" `
----------------------

_EOF_
[root@cent6-64-38 bin]# 
  • dovecotのセッティはいろいろ変わっている様子

http://www.server-world.info/query?os=CentOS_6&p=mail&f=2
こちらを参考にさせていただきました。
詳細はこちら
http://d.hatena.ne.jp/toshi_hirasawa/20130901/1378013039

  • dhcpd をいれなきゃね
[root@cent6-64-38 etc]# cat /tmp/yumlist | grep dhcp
dhcp-common.x86_64                       12:4.1.1-34.P1.el6.centos      @anaconda-CentOS-201303020151.x86_64/6.4
dhcp.x86_64                              12:4.1.1-34.P1.el6.centos      base    
dhcp-devel.i686                          12:4.1.1-34.P1.el6.centos      base    
dhcp-devel.x86_64                        12:4.1.1-34.P1.el6.centos      base    
dhcpdump.x86_64                          1.7-1.el6.rf                   rpmforge
dhcping.x86_64                           1.2-4.el6                      epel    
nagios-plugins-dhcp.x86_64               1.4.16-5.el6                   epel    
sblim-cmpi-dhcp.i686                     1.0-1.el6                      base    
sblim-cmpi-dhcp.x86_64                   1.0-1.el6                      base    
sblim-cmpi-dhcp-devel.i686               1.0-1.el6                      base    
sblim-cmpi-dhcp-devel.x86_64             1.0-1.el6                      base    
sblim-cmpi-dhcp-test.x86_64              1.0-1.el6                      base    
[root@cent6-64-38 etc]# 
  • dynamic DNS (no-ip.comとか)