サーバ構築メモ書き

「サーバ構築」というカテゴリを追加して、新しいサーバに設定したことを忘れないように覚え書き。でも、このブログを公開するのが新しいサーバなので、缶詰の中に缶切り状態(^^ゞ

BIOSの設定。M/BはASUSのP5Q-EM。BIOSはv02.61

  • MainのStorage Configuration
    Configure SATA as [RAID]
  • AdvancedのCPU Configurationで以下を全て[Enabled]
    • C1E Support
    • Intel(R) Virtualization Tech
    • CPU TM Function
    • Execute Disable Bit
    • Intel(R) SpeedStep(TM) Tech
    • Intel(R) C-STATE Tech
  • AdvancedのOnboard Devices Configurationで以下を[Disabled]
    • High Definition Audio
    • Agere 1394 Controller
    • Marvell IDE Controller
    • Realteck LAN Boot ROMを[Enabled]
  • BootのBoot Device Priorityで
    • 1st Boot Deviceに[RAID:INTEL SSDSA2MH080G1G]を設定。これは後でRAIDを有効にすると、このように表示されるようになる。HDDの順番がいけてないときは、BootのHard Disk Drivesで順番を変える。
  • ToolsのExpress Gateは[Disabled]

Intel(R) Matrix Storage Managerのスプラッシュが表示されたら[ctrl]+[i]で設定画面。まあ、よくあるRAIDツールなので。これでBIOS関連は終了。

不要なサービスの停止。一旦全部止めてから、必要なものだけアップするのがウホッ、いい鯖管(おとこ)。

# chkconfig --list | grep 5:on | awk '{print $1}'
acpid
anacron
atd
auditd
autofs
cpuspeed
crond
haldaemon
iptables
irqbalance
kdump
lvm2-monitor
messagebus
microcode_ctl
netfs
network
ntpd
restorecond
rhnsd
setroubleshoot
sshd
syslog
sysstat
vncserver
xfs
xinetd
yum-updatesd

となるように。まあ、後で追加するものとかさらに停止するものとかあるだろうけど。

grub.confのkernel行からrhgbとquietは取る。rhgbを取るだけで数秒は起動が短くなる。Xを2度も起動する意味が分からない。quietを付けるのは素人、玄人にはオススメできない(笑)。

kernel /vmlinuz-2.6.18-92.1.18.el5 ro root=/dev/VolGroup01/LogVol01 crashkernel=128M@16M

floppyって何? 4秒ぐらい待つんだよねぇudev。kexec仕込めば関係無いけど、気になるのでコメントアウト。

# cat /etc/sysconfig/modules/udev-stw.modules 
#!/bin/sh
#for i in nvram floppy parport lp snd-powermac;do
#        modprobe $i >/dev/null 2>&1
#done

どうせ、Fake SCSIしか無いから初期化なんて待たなくて良くね?

# vi /sbin/mkinitrd
1405 #    if [ "$module" = "usb-storage" -o "$module" = "ub" ]; then
1406 #       emit "echo Waiting for driver initialization."
1407 #       emit "stabilized /proc/bus/usb/devices"
1408 #    fi

1437 #if [ -n "$scsi" ]; then
1438 #    emit "echo Waiting for driver initialization."
1439 #    emit "stabilized --hash --interval 250 /proc/scsi/scsi"
1440 #fi

# mkinitrd ./initrd-2.6.18-92.1.18.el5.img `uname -r`
# \mv initrd-2.6.18-92.1.18.el5.img /boot/
# restorecon /boot/initrd-2.6.18-92.1.18.el5.img

先に書いたようにとりあえずr8168にしてある。5.2の途中でr8169が使えるようになったけど、カーネルがストールするのでr8168に戻した。

# cat /etc/modprobe.conf 
alias eth0 r8168
alias scsi_hostadapter ahci
alias scsi_hostadapter1 usb-storage

# I2C module options
alias char-major-89 i2c-dev

結局、dmraidの件はmkinitrdを色々修正してみて、そもそもの問題がdmraidだけにあるわけでは無さそう(lvscanかなぁ…)に見えることから、ワークアラウンドで回避。まだ、rc.localはキレイな状態(笑)。

# cat /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

uname=`uname -r`
kexec -l /boot/vmlinuz-$uname --initrd=/boot/initrd-$uname.img --append='`cat /proc/cmdline`'

echo "deadline" > /sys/block/sda/queue/scheduler
echo "deadline" > /sys/block/sdb/queue/scheduler
dmraid -ay
partprobe /dev/mapper/isw_hbhggdhig_Volume0
mount /dev/mapper/isw_hbhggdhig_Volume0p1 /opt

# I2C adapter drivers
modprobe i2c-i801
# I2C chip drivers
modprobe eeprom
# sleep 2 # optional
/usr/bin/sensors -s # recommended

1000baseになってくれないし。

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.0.255
HWADDR=00:23:54:79:00:55
IPADDR=192.168.0.6
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
ETHTOOL_OPTS="speed 1000 duplex full"

ちなみに、lm_sensors関連でモジュールを突っ込んでるけれど、RHEL5.2には/lib/modules/2.6.18-92.1.18.el5/kernel/drivers/hwmon/にcoretemp.koが無いので、Core 2 Duoの温度計測は出来ない。5.3で追加かな。

/etc/aliasesはrootに。marcって誰だよ…、逮捕されたよ、小室プロデューサー。

95 # Person who should get root's mail
96 #root:          marc
97 root:           root

「みんな嫌い、だいっキライ!」と言いながら/etc/hosts.denyを設定するのが正しい。これぞATフィールド。

# cat /etc/hosts.allow 
#
# hosts.allow	This file describes the names of the hosts which are
#		allowed to use the local INET services, as decided
#		by the '/usr/sbin/tcpd' server.
#
ALL : 127.0.0.1
ALL : 192.168.0.0/255.255.255.0

# cat /etc/hosts.deny 
#
# hosts.deny	This file describes the names of the hosts which are
#		*not* allowed to use the local INET services, as decided
#		by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!
ALL : ALL

vncserverは必須。でもランレベルは3にするという…。通常はsshなんだが、サーバ上でFirefoxを使いたいことがどうしてもある。

# vncserver

You will require a password to access your desktops.

Password:
Verify:

New 'hoge.rio.st:2 (root)' desktop is hoge.rio.st:2

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/hoge.rio.st:2.log

# cat .vnc/xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

# cat /etc/sysconfig/vncservers
20 VNCSERVERS="1:root"
21 VNCSERVERARGS[1]="-geometry 1280x800"

vncserverへのアクセスを許可。

# cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

ネットワーク関係をとりあえずチューニング。ftpで計測するとシャア専用倍ぐらいになる。細かいのはnetperfをかけながら時間のある時にやる。

# vi /etc/sysctl.conf
37 net.core.netdev_max_backlog = 2500
38 net.ipv4.tcp_syncookies = 1
39 net.core.rmem_default = 32768
40 net.core.rmem_max = 16777216
41 net.core.wmem_default = 32768
42 net.core.wmem_max = 16777216
43 net.ipv4.tcp_wmem = 4096 65536 16777216
44 net.ipv4.tcp_rmem = 4096 87380 16777216
45 net.ipv4.tcp_mem = 32768 32768 32768
46 net.ipv4.tcp_rfc1337 = 1
47 net.ipv4.ip_no_pmtu_disc = 0
48 net.ipv4.tcp_sack = 1
49 net.ipv4.tcp_fack = 1
50 net.ipv4.tcp_window_scaling = 1
51 net.ipv4.tcp_timestamps = 1
52 net.ipv4.tcp_ecn = 0
53 net.ipv4.route.flush = 1

# sysctl -p
タイトルとURLをコピーしました