看板Linux
标 题Debian/Etch vserver 建置笔记
发信站SayYA 资讯站 (Thu Apr 12 19:39:38 2007)
转信站ptt!ctu-reader!news.nctu!SayYa
一、环境准备 Debian/Etch
apt-get install linux-image-2.6.18-4-vserver-686
或是套用 xen & vserver 的环境
apt-get install xen-linux-system-2.6.18-4-xen-vserver-686
apt-get install vserver-debiantools utils-vserver
vserver-debiantools 仅适用 debian system
utils-vserver 则是 linux system 皆适用
二、设定预先排除程式
REMOVE_PACKAGES="sparc-utils,dhcp-client,lilo,makedev,pcmcia-cs,ppp,\
pppconfig,pppoe,pppoeconf,setserial,syslinux,fdutils,libpcap0,\
iptables,pciutils"
三、以 vserver 命令建立环境
范例一 建立 Debian/Etch 的 Guest OS
vserver etch build -m debootstrap \
--hostname etch --interface eth0:192.168.1.110/24 \
--interface lo:127.0.0.1/8 \
-- -d etch -m
http://ftp.tw.debian.org/debian/ \
-- --exclude=$REMOVE_PACKAGES
3.1.1 vserver 命令 後面定义的是该 Guest OS 的名称 etch
3.1.2 其 build 方式采用 debootstrap
3.1.3 host 定义为 etch
3.1.4 网路介面可定义为 eth0 或是 eth1 後面接的 24
表示该 netmask 为 255.255.255.0
记得定义 lo 127.0.0.1
欲定义 eth1 或是其他 nic 介面作为该 Guest OS 的 interface
可参考下一个范例
3.1.5 -d 表示使用的版本为 Debian/Etch 发行版
3.1.6 -m
http://ftp.tw.debian.org/debian/ 表示要从 ftp.tw.debian.org
下载所需要的档案
3.1.7 最後加上要预先排除的套件 --exclude=$REMOVE_PACKAGES
范例二
vserver sarge build -m debootstrap \
--hostname sarge --interface eth1:192.168.30.120/16 \
--interface lo:127.0.0.1/8 \
-- -d sarge -m
http://ftp.tw.debian.org/debian/ \
-- --exclude=$REMOVE_PACKAGES
3.2.1 vserver 命令 後面定义的是该 Guest OS 的名称 sarge
3.2.2 其 build 方式采用 debootstrap
3.2.3 hostname 定义为 sarge
3.2.4 网路介面可定义为 eth1 後面接的 16
表示该 netmask 为 255.255.0.0
记得定义 lo 127.0.0.1
同样若有 eth2 & eth3 也可以在建立时指定给该 Guest OS 当作其 nic
3.2.5 -d 表示使用的版本为 Debian/Sarge 发行版
3.2.6 -m
http://ftp.tw.debian.org/debian/ 表示要从 ftp.tw.debian.org
下载所需要的档案
3.2.7 最後加上要预先排除的套件 --exclude=$REMOVE_PACKAGES
四 基本操作
4.1 启动 Guest OS
vserver etch start
4.2 停止 Guest OS
vserver etch stop
4.3 进入 Guest OS
vserver etch enter
4.4 登出 Guest OS
按下 ~. 即可登出
或是 exit 亦可
4.5 观看个别 Guest OS 的状态
vserver etch status
4.6 终极破坏大法
vserver etch delete
4.7 观看 HOST OS 系统运作中的 Guest OS
vserver-stat
4.8 显示 Host OS 的相关资料
vserver-info
其他命令 可打 vserver "Guest OS name"+ enter 查询
或是 man vserver 查询更多说明
五 设定档跟 vserver guest OS 路径
5.1 设定档 /etc/vservers/
设定好後在 /etc/vservers/ 下会有两个 Guest OS 的设定目录出现
5.2 Guest OS 实体存放在 /var/lib/vservers/ 下
同样 /var/lib/vservers/ 下会有两个 Guest OS 的安装目录
六 附记
6.1 加装常用的小程式
apt-get install ssh locales vim ncftp sudo
6.2 记得设定 locale
locale-gen
6.3 Host & Guest OS 的 ssh 调整
未调整前 所有连往 Guest OS 的 ssh 连线要求都会被 Guest OS 拦截到
会造成连线失败
所以要作调整
6.3.1 Host OS
修改 /etc/ssh/sshd_config
将 ListenAddress 0.0.0.0 注解起来
ex:
#ListenAddress 0.0.0.0
改为 ListenAddress 192.168.1.10 (Host OS 的ip)
6.3.2 Guest OS
修改 /etc/ssh/sshd_config
将 ListenAddress 0.0.0.0 注解起来
ex:
#ListenAddress 0.0.0.0
改为 ListenAddress 192.168.1.110 (Guest OS 的ip)
6.4 Guest OS 可以执行 X 喔
所以想要尝鲜的人再也不用拿自己的工作机去装 unstable 的系统了
装烂了顶多砍掉重链 Guest OS
--
(__) 欢迎加入 GNU Debian Linux
(oo) msn:
[email protected]
/------\/
/ | ||
* /\---/\ ...."Have you mooed today?"...
~~ ~~
--
※ Origin: SayYA 资讯站 <bbs.sayya.org>
◆ From: 61.31.232.240