ubuntu 12.04无盘工作站
注釋:該篇博文是借鑒下列文章加上自己實踐總結(jié)得來,其它文件系統(tǒng)相關(guān)參考我的博客:https://www.whyfi.top/blog/ubuntu-remote-file-system/;
a.http://forum.ubuntu.org.cn/viewtopic.php?f=77&t=117754
b.http://blog.chinaunix.net/uid-20164485-id-3324492.html
說明:無盤工作站建立的前提如下:
a. 兩臺以上計算機(jī)
b. 計算機(jī)網(wǎng)卡(指有線網(wǎng)卡)具備PXE功能。
c. 若需要建立2臺及其以上客戶端機(jī)的無盤工作站需要交換機(jī)。
d. 主機(jī)(上面說的計算機(jī))具備較強(qiáng)的運算能力,較大的存儲空間,網(wǎng)卡傳輸能力為100M或者1000M以上
e. 主機(jī)的配置需要連接網(wǎng)絡(luò)(主機(jī)最好有無線網(wǎng)卡)
正文:服務(wù)器與客戶機(jī)的相關(guān)配置
1. 服務(wù)器(有線)配置成DHCP服務(wù)器
a. sudo apt-get installdhcpd3-server
b.配置isc-dhcp-server(/etc/default/isc-dhcp-server)==>INTERFACES="eth0"
c. 配置/etc/dhcp/dhcpd.conf==>
authoritative;
max-lease-time 604800;
default-lease-time 3100;
ddns-update-style none;
ddns-ttl 7200;
allow booting;
allow bootp;
one-lease-per-client true;
subnet 192.168.23.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.23.1 192.168.23.200;
option routers 192.168.23.1; //與本機(jī)靜態(tài)IP一致
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.23.255;
ignore client-updates;
}
host ub04{
hardware ethernet xx:xx:xx:xx:xx:xx; //為該MAC固定分配IP ...23.2
next-server 192.168.23.1; //與本機(jī)靜態(tài)IP一致,本機(jī)的靜態(tài)IP在/etc/network/interfaces里面配置參考后面
fixed-address 192.168.23.23;
filename "pxelinux.0"; //tftp時傳輸?shù)奈募颂帪榭蛻魴C(jī)開機(jī)獲取的引導(dǎo)文件
}
d.配置服務(wù)器靜態(tài)IP及相關(guān)網(wǎng)絡(luò)參數(shù)/etcc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network
192.168.1.0
broadcast
192.168.1.255
e. 重啟相關(guān)服務(wù)
/etc/init.d/networking restart
/etc/init.d/isc-dhcp-server restart
2. 安裝tftp
a. sudo apt-get installtftp,tftpd,tftp-hpa,tftpd-hpa,xinetd,openbsd-inetd
b.配置tftpd-hpa(/etc/default/tftp)
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"
c.配置/etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server =
/usr/sbin/in.tftpd
server_args =
-s /tftpboot
disable = no
per_source =
11
cps = 100 2
flags = IPv4
}
d. sudo vi /etc/inetd.conf
#:BOOT: TFTP service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers."
#tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp (/srv/tftp 為默認(rèn)tftp目錄)
#修改如下文件
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftproot
e.sudo mkdir /tftproot
f.sudo chmod 777 /tftproot
g.sudo /etc/init.d/openbsd-inetd restart
3.安裝nfs
a.安裝nfs ==>apt-get install nfs-kernel-server
b.配置exports
#下面的路徑就是客戶機(jī)文件系統(tǒng)的路徑
/home/client/ub04192.168.23.23(rw,no_root_squash,sync)
4.安裝samba
a.sudo apt-get install samba
b.配置smb.conf
[share]
comment=SharedFolder
path=/opt/samba
public=yes
writable=yes
available=yes
browseable=yes
c. smbpasswd –a shizhai添加用戶及密碼
d. 重啟samba
5.安裝syslinux
在上面DHCP配置文件中涉及到的的pxelinux.0便是這個來自于這個軟件包。
sudoapt-get install syslinux
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/ #把這個文件拷貝到我們的tftp目錄下,客戶機(jī)開機(jī)使用tftp從tftpboot目錄獲取
接下來在主機(jī)tftpboot目錄下為客戶機(jī)建立啟動引導(dǎo)配置目錄(自己猜測)
mkdir /tftpboot/pxelinux.cfg
在該目錄建立一個默認(rèn)的客戶機(jī)引導(dǎo)default ==>vi /tftpboot/pxelinux.cfg/default
DEFAULTubuntu #默認(rèn)引導(dǎo)項
LABELubuntu #
KERNELlinux
#注意boot=nfs root=/dev/nfs必須加其中的192.68.23.1為服務(wù)器的靜態(tài)IP,/home/client/ub04為其中一個客戶機(jī)的文件系統(tǒng)路徑,后面詳細(xì)介紹
appendinitrd=initrd.nfsboot=nfsroot=/dev/nfsnfsroot=192.168.23.1:/home/client/ub04ip=dhcprw
PROMPT1 #自動選擇,不等待客戶機(jī)干預(yù)
TIMEOUT10 #超時時間
若是有多臺客戶機(jī)需要建立多個引導(dǎo)配置文件,文件名稱為客戶分配到的IP的16進(jìn)制比如:客戶的IP為192.168.23.23那個需要建立一個文件名為:C0A81717內(nèi)容 如上。
6.創(chuàng)建nfs引導(dǎo)
sudomkinitramfs -o /home/cache/netboot/tftpboot/initrd.nfs
cd /tftpboot/
sudo chmod 777 initrd.nfs
7. 為客戶機(jī)生成linux內(nèi)核與文件系統(tǒng)
1.客戶機(jī)的文件系統(tǒng)生成有多種方式,現(xiàn)在介紹其中兩種:
a. 使用debootstrap工具在/home/client/ub04(ub04下面命題客戶機(jī)的文件系統(tǒng))下生成一個最簡的文件系統(tǒng),再把生成的文件系統(tǒng)的boot/vmlinux...拷貝 到/tftpboot/下改名為linux作為客戶機(jī)的公共內(nèi)核,然后再sudo chmod 777 linux
b. 使用已安裝linux系統(tǒng)(暫稱主機(jī)1)的文件系統(tǒng)(服務(wù)器與該主機(jī)1處于同一網(wǎng)段),使用rsync -avzupoglH 主機(jī)1user@主機(jī)1IP:/* /home/client/ub04/ 在/home/client/ub04下生成了一個文件系統(tǒng)(查詢rsync命令)
2. 配置生成的客戶機(jī)文件系統(tǒng)
修改的文件主要有:fstab、mtab、hosts、hostname、interfaces、udev內(nèi)容及目錄如下:
a. /home/client/ub04/etc/fstab
b. /home/client/ub04/etc/mtab
c. /home/client/ub04/etc/hots及hostname
d. /home/client/ub04/etc/network/interfaces
e. udev下面文件rules.d/70-persistent-net.rules需要清空。
3. 到ub04下進(jìn)行相關(guān)系統(tǒng)配置
cd /home/client/ub04/
sudo chroot .
useradd ub04
password ub04
8. 讓客戶機(jī)從網(wǎng)絡(luò)啟動
總結(jié)
以上是生活随笔為你收集整理的ubuntu 12.04无盘工作站的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 微信怎么设置自动回复功能
- 下一篇: Photoshop软件破解补丁安装方法