funini.com 自由研究 Debian

Debian/GNU Linux

インストールに失敗!?

Dellの新しいサーバーなんだけど、Etchのインストーラーが入れてくれるカーネルだと起動しない…
仕方ないからまずインストールして、「インストール終了しました。再起動しますか」画面でCtrl-Alt-F2を押して画面切り替えて、
# mount proc -t proc /target/proc
# chroot /target /bin/bash
として、sources.list(なぜかホスト名が引けないからIP直打ち)を編集して、カーネルのソースを落としてコンパイル。
# apt-get install kernel-package libncurses5-dev
# cd /usr/src
# apt-get install linux-source-2.6.17
# tar jxvf  linux-source-2.6.17.tar.bz2
# ln -s linux-source linux
# make menuconfig
(いろいろ設定)
# make-kpkg clean
# make-kpkg --append_to="-em64t-santax" --initrd --revision=1 kernel-image 
# cd ..
# dpkg -i linux-image-em64t-santax_2.6.17-9_amd64.deb
これでなんとかブート。一回目ブート後は普通に動いてます。
実はdebianCDにもレスキューモードがあって、起動時にrescueって打つとコンソールが使えたらしい。しかもchrootも自動でしてくれる。

apt-cacher

今ではapt-proxyよりこっちのほうが断然おすすめ。32bit/64bit, sarge/etchで一つのcacheサーバーを共用できるし、 過負荷にも強いみたい。
使い方はすごく簡単。
# apt-get install apt-caher
すると、そのサーバーの/apt-cacherというところにcgiが設置される。sources.listでこの後ろに接続したいaptサーバーのアドレスを書く。
deb http://localhost/apt-cacher/ftp.riken.go.jp/pub/Linux/debian/debian/ etch main
deb-src http://localhost/apt-cacher/ftp.riken.go.jp/pub/Linux/debian/debian/ etch main

deb http://localhost/apt-cacher/security.debian.org/ etch/updates main contrib
deb-src http://localhost/apt-cacher/security.debian.org/ etch/updates main contrib
みたいに。
localhostのところはapt-cacherサーバーを立てたホストで置換する。

apt-proxy

☆今では上のapt-cacherのがおすすめです。
debianではapt-get install ほげほげとするとパッケージが自動で入るが、そのときにパッケージはネットワークのどこかからダウンロードされてくる。LAN内に同じバージョンのdebianマシンがたくさんあるときは、
インストールは至って簡単。
# apt-get install apt-proxy
設定ファイルは/etc/apt-proxy/apt-proxy-v2.conf。-v2はパージョン2という意味で、これが無ければapt-proxy.confが読み込まれれる。
設定方法はドキュメントが/usr/share/doc/apt-proxy/にあるほか、man apt-proxyなどとしてわかる。とはいえ、サンプル見てれば大体分かる。
とりあえず、[debian]のbackendsのところに日本のサーバーを指定。
[debian]
;; The main Debian archive
;;... (中略)

backends =
        ftp://日本のdebianミラーの名前/debian
        http://ftp.us.debian.org/debian
        http://ftp.de.debian.org/debian
        http://ftp2.de.debian.org/debian
        ftp://ftp.uk.debian.org/debian


[debian-non-US]
;; Debian debian-non-US archive
;timeout will be the global value
backends =
        ftp://日本のdebianミラーの名前/
        http://ftp.uk.debian.org/debian-non-US
        http://ftp.de.debian.org/debian-non-US
        ftp://ftp.uk.debian.org/debian
設定が終わったら、デーモンを再起動して設定を読み込ませる。
# /etc/init.d/apt-proxy restart
あと、apt-getとかがこのapt-proxyを見に行くようにするために、/etc/apt/sourcers.listを書き換える。
deb http://localhost:9999/debian stable main

# あとは全部コメントアウトしてもOK

NIS

サーバー。
apt-get install nis
---
vi /etc/default/nis
----
 NISSERVER=master
 NISCLIENT=true
----
vi yp.conf
----
 domain ドメイン server サーバー名
----

vi ypserv.conf
----
 そのまま
----

/usr/lib/yp/ypinit -m
cd /var/yp
make
クライアント。
apt-get install nis
---
vi /etc/default/nis
----
 NISSERVER=false
 NISCLIENT=true
----
vi yp.conf
----
 server サーバー名
----
vi /etc/nsswitch.conf
----
 passwd:         compat
 group:          compat
 shadow:         files nis  
----

NFS

apt-get install nfs-kernel-server
vi /etc/exports
----
 /export host0.?.?.?(async,rw,no_subtree_check)
 /export host1.?.?.?(async,rw,no_subtree_check)
 ...
----
mkdir /export
mkdir /export/home
mkdir /export/home/kei
chown kei:kei /export/home/kei

apt-get install nfs-common
vi /etc/fstab
----
 123.4.56.7:/export/home /home nfs rw,hard,intr,rsize=8192,wsize=8192,async 0 0
----