from 和ジオ

Fedora CORE (2) Linux 設定 (yum / samba / CVS / Apache / NTP / wizd)

Linux 環境構築

Fedora CORE (2) Linux 設定 (yum / samba / CVS / Apache / NTP / wizd)

Fedora CORE Linux は、積極的に最新パッケージを取り込んだ Linux ディストリビューションです。 使いたいなーとおもった ソフトウェアはほとんどの場合パッケージとして用意されて いるので、なにかしらの、Linux のソフトを使いたい場合 深く考えずに利用開始できるので非常に便利なディストリビューション だと思います。

積極的にパッケージを(機能追加)アップデートするので、サーバのように 安定稼働を目的とする場合にはあまり向きませんが、 最新パッケージの評価にはもってこいです。 ソフトウェアのインストールも、yum を使って簡単に システム状態を管理できます。

さて、便利な Fedora ですが、便利すぎていろいろやって いくうちに、なにをやったか思い出せなくなってきたので やったことを、メモっておくページです。設定ファイルだけ書いておきます。

yum の設定

yum を使ったときに参照するリリース/アップデートサーバを 日本のミラーサーバに変更する。

(2005/4)Fedora CORE 2 は、 Fedora legacyに移管したため 下記サーバは使えません。

$ pwd
/etc
$ cat yum.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
retries=20

exclude=cvs*

[base]
name=Fedora Core $releasever - $basearch - Base
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/
baseurl=ftp://ftp.riken.go.jp/pub/Linux/fedora/core/$releasever/$basearch/os

[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
baseurl=ftp://ftp.riken.go.jp/pub/Linux/fedora/core/updates/$releasever/$basearch

#[updates-testing]
#name=Fedora Core $releasever - $basearch - Unreleased Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/testing/$releasever/$basearch/

#[development]
#name=Fedora Core $releasever - Development Tree
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/development/$basearch/

sambaで Windowsファイル共有サーバにする

  1. netbiosサーバ名、コメントの設定
  2. ワークグループ名の設定
  3. public / backup という名前の共有フォルダを「みんな」にみせる

Fedora を Windowsからみた図

そんな感じの設定ファイル。(192.168.0.0/24 のネットワークで IPアドレス 192.168.0.100 をサーバに設定した例)

$ pwd
/etc/samba
$ cat smb.conf
[global]

#  Server configuration parameters
netbios name = repository
server string = Repository-Server
workgroup = workgroup

load printers = no
security = share

log file = /var/log/samba/%m.log
max log size = 50

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
interfaces = 192.168.0.100/24

# A publicly accessible directory, but read only, except for people in
# the "staff" group
[01.Public]
comment = Public Files
path = /home/samba/Public
public = yes
read only = no
write list = @nobody

[02.Backup]
comment = Backup Files
path = /home/samba/Backup
public = yes
read only = no
write list = @nobody

ディレクトリのパーミッション。(適当設定!!注意)

$ pwd
/home/samba
$ ls -alF
合計 16
drwxrwxrwx  4 root   root   4096 10月 23 23:10 ./
drwxr-xr-x  6 root   root   4096 10月 10 18:14 ../
drwxrwxrwx  4 nobody nobody 4096  9月 29 04:35 Backup/
drwxrwxrwx  7 nobody nobody 4096 12月 13 17:52 Public/

CVSサーバをたてる

ソースファイルの、履歴管理や共有管理を行う CVS の設定です。 xinitd スーパーサーバから cvs を呼び出します。

$ pwd
/etc/xinetd.d
$ cat cvspserver
service cvspserver
{
port = 2401
socket_type = stream
protocol = tcp
wait = no
user = root
passenv = PATH
server = /usr/bin/cvs
server_args = -f --allow-root=/cvs pserver
}

apache の設定

/var/www/html で、CGI と PHP を動くようにする。(抜粋)

$ pwd
/etc/httpd/conf
$cat httpd.conf

AddHandler cgi-script .cgi

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes IncludesNoExec ExecCGI FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

NTP 設定

時間を合わせる ntp の設定。 ntpd を使うと、サーバとクライアント両方動く。

福岡大学の ntp サーバの例。

$ cd /etc
$ cat ntp.conf
driftfile /var/lib/ntp/drift
server clock.nc.fukuoka-u.ac.jp
server clock.tl.fukuoka-u.ac.jp

福岡大学の ntp サーバは帯域いっぱいで大変そう(2005/01/21)なので、 あるのなら、ISP で提供している ntp を使いましょう。

http://pc5.2ch.net/test/read.cgi/linux/1008318869/500-

http://slashdot.jp/articles/05/01/21/0214236.shtml?topic=12

http://www.itmedia.co.jp/news/articles/0501/21/news059.html

プロバイダ別 ntp サーバリスト ( http://sonic64.hp.infoseek.co.jp/2004-12-02.html )

OCN の ntp サーバの例。

$ cd /etc
$ cat ntp.conf
driftfile /var/lib/ntp/drift
server ntp-tk01.ocn.ad.jp
server ntp-tk02.ocn.ad.jp
server ntp-os01.ocn.ad.jp

ntpd 動作確認。

# ntpq -p
    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
clock.nc.fukuok .STEP.          16 u    - 1024    0    0.000    0.000 4000.00
*clock.tl.fukuok .GPS.            1 u 1002 1024  377   39.713   -4.971   0.112

ntpdate コマンドで、その場で時間を合わせる場合。 ntpd が起動していると

the NTP socket is in use, exiting

と断られるので、ntpd は止めてから


# /etc/init.d/ntpd stop
ntpd を停止中:                                             [  OK  ]
# ntpdate ntp-tk01.ocn.ad.jp
Looking for host ntp-tk01.ocn.ad.jp and service ntp
host found : ntp-tk01.ocn.ad.jp
23 Dec 23:50:01 ntpdate[3456]: adjust time server 202.234.233.106 offset 0.006845 sec
# /etc/init.d/ntpd start
ntpd を起動中:                                             [  OK  ]

という感じで。

MediaWiz サーバ

MediaWiz用 サーバソフト、 wizd の設定。

自動起動シェル

$ pwd
/etc/init.d
$ cat wizd
#!/bin/sh
/usr/local/wizd/wizd
exit 0

wizd の設定(抜粋)

$ pwd
/usr/local/wizd
$ cat wizd.conf
## ===========================================================================
## wizd.conf
## wizd -- MediaWiz Server Daemon.  config file.
## ===========================================================================

document_root           /home/samba/Public/02.趣味/01.MP3/
server_language_code    utf8

その他

他にもやっていますが通常動かしているのは、たしかこれぐらいで全部だったと思われます・・・。