-
一応,サーバとして立ち上げるのを目的としているので,「サーバインストール」を選択する.
そういう選択肢がなければ,気にしない.
その後,必要な(or あると便利な)パッケージとしては,
-
X Window
Gnome
httpd
postfix
vnc-server
vsftpd
telnet
emacs
Fedoraシリーズでの場合も,多少違いはあるが,似たような感じである.
-
以下での説明は,マシンの設定は仮に,
| マシン名 | Hoge |
| IPアドレス | 192.168.1.10 |
| ドメイン名 | hoge.fuga.com |
-
新しいPCにFedoraをインストールした場合に,古いPCからユーザ情報をコピーしたいことがある.
その場合,ユーザ情報とパスワードを比較的簡単にコピーできる.
-
古いPCの /etc/passwd, /etc/shadow を,新しいPCのどこか見えるところにコピー
新しいPCで groupadd, adduser を使って,グループとユーザを追加
新しくできたユーザに対応するパスワードを,古い /etc/shadow の該当箇所を新しい /etc/shadow にコピー
-
古いPCで 'pdbedit -w ユーザ名 > hogehoge.smb' と実行して,Sambaのパスワードを取得
hogehoge.smb を,新しいPCのどこか見えるところ(たとえば /root)にコピー
新しいPCで 'pdbedit -i smbpasswd:/root/hogehoge.smb' を実行
-
カーネルアップデートは先にやっておいたほうがいい.
RedHat9 の最終カーネルは??
-
Fedora Core では,Windows Updateのような感じで,自動でアップデートパッチをダウンロード&インストールできる.
それには,yumというコマンドを利用する.
yum -y updateプロキシサーバを利用する場合には,先に http_proxy を設定しておく.
export http_proxy=http://xxxx.xxxx.xxxx.xxxx:port/ yum -y updateプロキシサーバの認証が必要であれば,次のように設定する.
export http_proxy=http://user:pass@xxxx.xxxx.xxxx.xxxx:port/ yum -y update
-
各種サービスを起動停止させる.
特にセキュリティのため,不要なサービスは停止させる.
-
以下は,RedHat9を想定している.
Fedora Core に使われているSamba3では,ほとんど設定の必要はなし.
'/etc/samba/smb.conf' の以下の部分を変更・追加する.
[global]
...
workgroup = HOGEFUGA
server string = Hoge -- Samba Server
hosts allow = 192.168.1.
local master = yes
os level = 65
domain master = yes
preferred master = yes
client code page = 932
...
[homes]
...
create mode = 0644
directory mode = 0755
...
[Share]
comment = Share Space at Apple
path = /home/Share
writeable = yes
printable = no
create mode = 0644
invalid users = %S
directory mode = 0755
-
ユーザを追加するには,Samba Version 2 までは,'smbadduser ユーザ名' を使います.
新しい Samba Version 3 では,'pdbedit -a ユーザ名' を使います.
-
VNC Server を Linuxで準備しておくと,Windowsからコンソール操作ができ,とても便利.
'/etc/services' の設定をする.
... vnc0 5950/tcp # VNC service vnc1 5951/tcp # VNC service vnc2 5952/tcp # VNC service vnc3 5953/tcp # VNC service vnc4 5954/tcp # VNC service vnc5 5955/tcp # VNC service vnc6 5956/tcp # VNC service vnc7 5957/tcp # VNC service ...そして,'/etc/xinetd' の下に以下のようなファイル 'vnc0' 〜 'vnc7' を作成する.
# VNC Server
# Window Size : 1280x1024
# Color Depth : 24bit
service vnc0
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/bin/Xvnc
server_args = -inetd -query 192.168.1.10 -once -depth 24 -geometry 1280x1024
log_on_failure += USERID
disable = no
}
Fedore Core に使われている VNC Version4 を使う場合は,以下のように設定する.
# VNC Server
# Window Size : 1280x1024
# Color Depth : 24bit
service vnc0
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/bin/Xvnc
server_args = -inetd -query 192.168.1.10 -once -depth 24 -geometry 1280x1024 -SecurityTypes None
log_on_failure += USERID
disable = no
}
また,'/etc/X11/gdm/gdm.conf' を変更する.... [xdmcp] ... Enable=true ... [daemon] ... KillInitClients=false ...
-
Fedora Core 4の場合は,'/etc/services' は同じであるが,'/etc/xinetd' の下のファイルの中身が異なる.
'/etc/xinetd' の下に以下のようなファイル 'vnc0' 〜 'vnc7' を作成する.
# VNC Server
# Window Size : 1280x1024
# Color Depth : 24bit
service vnc0
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/bin/Xvnc
server_args = -inetd -query 192.168.1.10 -once -depth 24 -geometry 1280x1024 -SecurityTypes None
log_on_failure += USERID
disable = no
}
また,'/etc/X11/gdm/gdm.conf' の変更に関しては同じ.-
Fedora 7 では,'/etc/X11/gdm/gdm.conf' というファイルではなくなり,'/etc/gdm/custom.conf' というファイルを設定する.
他の項目に関しては,Fedora Core 4 と同じ.
... [daemon] GtkModulesList= AddGtkModules=false RemoteGreeter=/usr/libexec/gdmgreeter [security] AllowRemoteRoot=true [xdmcp] Enable=true ...あと,xinetdもインストールされていないので,インストールする.
yum install xinetdほかにも,tcsh(csh)もインストールされていないので,使いたい場合はインストールする.
yum install tcsh
-
メール送信用のサーバは Postfix が使いやすい.
'redhat-switch-mail' で postfix を選択する.
POPサーバは,RedHat9ではipop3dというデーモンが利用できる.
Fedora Coreの場合には,dovecotというPOP/IMAPデーモンを利用できる.
'/etc/postfix/main.cf' を次のように変更する.
... myhostname = hoge.fuga.com mydomain = fuga.com myorigin = $mydomain inet_interfaces = all mydestination = $myhostname, localhost.$mydomain, $mydomain mail_spool_directory = /var/spool/mail ...'pop-before-smtp' をインストールする.(Fedora Core では必要かどうか不明)
/usr/share/doc/pop-before-smtp-x.xx/README.QUICKSTART にあるように,perl -MCPAN -e 'install ...' を実行する.
'/etc/postfix/main.cf' の最後に,次の部分を追加する.
# Pop before SMTP
smtpd_recipient_restrictions = permit_mynetworks,reject_non_fqdn_recipient,
check_client_access hash:/etc/postfix/pop-before-smtp,
check_relay_domains
ISPのメールサーバが,"Outbound Port25 Blocking" を実施していて,Port587のSubmissionポートを利用するようになっている場合は,次のように設定を行う.
'/etc/postfix/main.cf' の設定
relayhost = [mailserver-address]:587 smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/isp_pass smtp_sasl_security_option=noanonymous smtp_sasl_mechanism_filter=plain,login,cram-md5'/etc/postfix/isp_pass' の設定
[mailserver-address] user:passwordこのパスワードファイルをDB化するために,
postmap /etc/postfix/isp_passを実行する.
Fedora Core の POP/IMAP サーバは,dovecot というデーモンを立ち上げると簡単.
'/etc/dovecot.conf' の以下の部分を設定.
... default_mail_env = mbox:/var/spool/mail/%u ...
-
'~/.Xresources' に次のように書く.
!emacs*Background: DarkSlateGray !emacs*Foreground: Wheat !emacs*pointerColor: Orchid !emacs*cursorColor: Orchid emacs*bitmapIcon: on emacs*font: fixed emacs.geometry: 80x40xrdb ~/.Xresources を実行する.
-
'/etc/hosts.deny' に次のように記入する.
ALL: ALL'/etc/hosts.allow' に次のように記入する.
ALL: 192.168.1. vsftpd: ALL sendmail: ALL postfix: ALL dovecot: ALL pop3: ALL
-
'/etc/vsftpd/vsftpd.conf' を次のように変更する.
... # anonymous_enable=YES ascii_upload_enable=YES ascii_download_enable=YES chroot_local_user=YES chroot_list_enable=YES ...
-
'/etc/httpd/conf/httpd.conf' を次のように変更する.
ディレクトリ構成はお好みで.
...
ServerAdmin shiraki@hoge.fuga.com
DocumentRoot "/home/shiraki/httpd/html"
<Directory "/home/shiraki/httpd/html">
<LocationMatch "^/$>
# UserDir disable
UserDir enabled ユーザ名
UserDir public_html
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
<Directory /home/*/public_html/cgi-bin>
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
Alias /icons/ "/home/shiraki/httpd/icons/"
<Directory "/home/shiraki/httpd/icons">
Alias /manual "/home/shiraki/httpd/manual"
<Directory "/home/shiraki/httpd/manual">
ScriptAlias /cgi-bin/ "/home/shiraki/httpd/cgi-bin/"
<Directory "/home/shiraki/httpd/cgi-bin">
AddDefaultCharset Shift_JIS
Alias /error/ "/home/shiraki/httpd/error/"
<Directory "/home/shiraki/httpd/error">
また,Fedoraでは,SELinuxによるセキュリティ制御がおこなわれるようになった.
httpdのデフォルトは,/var/www がルートになっているが,それを /home/httpd 等の別の場所にするには,'chcon' というコマンドでアクセス権を設定する必要がある.
'ls -lZL /var/www' とすると,SELinux関連の設定を見ることができるので,それを /home/httpd 等,自分で設定したいルートにも 'chcon -R xxx /home/httpd' というように設定する.
-
'Image::Size' を利用する.
モジュールがインストールされていない場合は,
perl -MCPAN -e 'install Image::Size;'を実行する.
-
'/etc/sysconfig/harddisks' の次のところ変更する.
EXTRA_PARAMS="-S 60"(60x5=300秒で停止する設定)
-
'/etc/sysconfig/harddisks' の次のところ変更する.
EXTRA_PARAMS="-S 60"(60x5=300秒で停止する設定)
Fedora Core 4では,'/etc/sysconfig/harddisks' を読み込まなくなった模様. それを読み込ませるために,以下の設定を '/etc/rc.sysinit' に追加する.
# Turn on harddisk optimization
# There is only one file /etc/sysconfig/harddisks for all disks
# after installing the hdparm-RPM. If you need different hdparm parameters
# for each of your disks, copy /etc/sysconfig/harddisks to
# /etc/sysconfig/harddiskhda (hdb, hdc...) and modify it.
# Each disk which has no special parameters will use the defaults.
# Each non-disk which has no special parameters will be ignored.
#
disk[0]=s;
disk[1]=hda; disk[2]=hdb; disk[3]=hdc; disk[4]=hdd;
disk[5]=hde; disk[6]=hdf; disk[7]=hdg; disk[8]=hdh;
disk[9]=hdi; disk[10]=hdj; disk[11]=hdk; disk[12]=hdl;
disk[13]=hdm; disk[14]=hdn; disk[15]=hdo; disk[16]=hdp;
disk[17]=hdq; disk[18]=hdr; disk[19]=hds; disk[20]=hdt;
if [ -x /sbin/hdparm ]; then
for device in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
unset MULTIPLE_IO USE_DMA EIDE_32BIT LOOKAHEAD EXTRA_PARAMS
if [ -f /etc/sysconfig/harddisk${disk[$device]} ]; then
. /etc/sysconfig/harddisk${disk[$device]}
HDFLAGS[$device]=
if [ -n "$MULTIPLE_IO" ]; then
HDFLAGS[$device]="-q -m$MULTIPLE_IO"
fi
if [ -n "$USE_DMA" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} -q -d$USE_DMA"
fi
if [ -n "$EIDE_32BIT" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} -q -c$EIDE_32BIT"
fi
if [ -n "$LOOKAHEAD" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} -q -A$LOOKAHEAD"
fi
if [ -n "$EXTRA_PARAMS" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} $EXTRA_PARAMS"
fi
else
HDFLAGS[$device]="${HDFLAGS[0]}"
fi
if [ -e "/proc/ide/${disk[$device]}/media" ]; then
hdmedia=`cat /proc/ide/${disk[$device]}/media`
if [ "$hdmedia" = "disk" -o -f "/etc/sysconfig/harddisk${disk[$device]}" ]; then
if [ -n "${HDFLAGS[$device]}" ]; then
action $"Setting hard drive parameters for ${disk[$device]}: "
/sbin/hdparm ${HDFLAGS[$device]} /dev/${disk[$device]}
fi
fi
fi
done
fi
※ '# Boot time profiles. Yes, this should be somewhere else.' という行の前あたりがよさそう.この設定は,RedHat9.0 より拝借.
-
Fedora 7 では,さらに変更されている模様.
そのため,'/etc/rc.sysinit' に次の設定を追加する.
if [ -x /sbin/hdparm ]; then
for device in sda sdb hda hdb; do
if [ -e /dev/$device ]; then
/sbin/hdparm -S 60 /dev/$device
fi
done
fi
-
HDDの温度が高すぎると,HDDが壊れやすくなる.
そのため,HDD温度を計測するツールを使うと便利.
サーバの場合,定期的に温度チェックを行うようにしておくと,とても安心.
温度測定に使うツールは,hddtemp が簡単で便利. Fedora の場合,導入は非常に簡単で,
yum install hddtempで導入できる.
使い方もいたって簡単で,
hddtemp /dev/hdaのように,デバイスを指定するだけで,温度がわかる.
-
'crontab -e' を実行,その後以下のような設定を記入する.
もちろん,設定はお好みで.
30 * * * * /usr/sbin/ntpdate ntp.nc.u-tokyo.ac.jp > /dev/null 2>&1 15 5 * * 1 /sbin/reboot > /dev/null 2>&1
-
'/etc/ntp.conf' を以下のように編集する.
# -- CLIENT NETWORK ------- # Permit systems on this network to synchronize with this # time service. Do not permit those systems to modify the # configuration of this service. Also, do not use those # systems as peers for synchronization. # restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap
-
DyDns.orgを使っているので(2009年時点ではもう使っていない),ddclientを使ってIPアドレスを登録する.
ddclient-x.x.x.tar.gz を取得し,解凍する.
続いてスクリプトと設定ファイルをコピーする.
cp ddclient /usr/sbin/ cp sample-etc_ddclient.conf /etc/ddclient.conf設定ファイル(ddclient.conf)を編集する.
use=web, web=checkip.dyndns.org/, web-skip='IP Address' # found after IP Address login=shiraki # default login password=xxxxxx # default password server=members.dyndns.org, \ protocol=dyndns2 \ hoge.fuga.comデーモンの自動起動を設定する.
cp sample-etc_rc.d_init.d_ddclient /etc/rc.d/init.d/ddclient /sbin/chkconfig --add ddclient /etc/rc.d/init.d/ddclient start








