Linux無盤工作站架設執行個體_unix linux

來源:互聯網
上載者:User

摘要 
架設Linux無盤工作站執行個體,伺服器和用戶端都使用Linux。主要涉及:DHCP TFTP SYSLINUX NFS(2003-03-12 08:52:24) 

-------------------------------------------------------------------------------------- 


用戶端是支援PXE方式啟動的刀片,用Linux作為伺服器,伺服器配置如下: 


1) 安裝DHCP伺服器dhcpd 


2) 配置/etc/dhcpd.conf檔案,下面是我機器上的檔案 


max-lease-time -1; 
default-lease-time -1; #注:IP地址永不到期 
option subnet-mask 255.0.0.0; 
option routers 10.0.0.1; 
option domain-name-servers 10.10.10.10; 
# option netbios-name-servers 10.10.10.10; 
option broadcast-address 10.255.255.255; 
# option dhcp-class-identifier "PXEClient"; 
# option vendor-encapsulated-options 01:04:00:00:00:00:ff; 
# option option-135 "start"; 

subnet 10.0.0.0 netmask 255.0.0.0 { 
range 10.10.12.131 10.10.12.150; 

host blade01 { 
hardware ethernet 00:e0:43:00:02:00; 
fixed-address 10.10.12.131; 
filename "/tftpboot/pxelinux.0"; #注:啟動映象檔案 
} 

host blade02 { 
hardware ethernet 00:e0:43:00:02:02; 
fixed-address 10.10.12.132; 
filename "/tftpboot/pxelinux.0"; 
} 

host blade03 { 
hardware ethernet 00:e0:43:00:02:04; 
fixed-address 10.10.12.133; 
filename "/tftpboot/pxelinux.0"; 
} 

host blade04 { 
hardware ethernet 00:e0:43:00:02:06; 
fixed-address 10.10.12.134; 
filename "/tftpboot/pxelinux.0"; 
} 

host blade05 { 
hardware ethernet 00:e0:43:00:02:08; 
fixed-address 10.10.12.135; 
filename "/tftpboot/pxelinux.0"; 
} 
} 


說明:dhcp客戶得到IP地址後用TFTP協議從伺服器上下載啟動映象檔案。我用syslinux 

工具包裡邊的pxelinux來作為遠程啟動的loder. 

3) 配置tftp server 

使用pxelinux作引導工具需要支援TSIZE參數的tftp server。可從http://www.kernel.org/pub/software/network/tftp/下載。 

通過xinetd來使用tftp服務,我的/etc/xinetd.conf檔案如下 


...... 
service tftp 
{ 
socket_type = dgram 
protocol = udp 
wait = yes 
user = root 
server = /usr/sbin/in.tftpd 
} 


4) 配置PXELINUX 

先安裝syslinux軟體包。可從http://www.kernel.org/pub/linux/utils/boot/syslinux/下載。 

將pxelinux.0拷貝到/tftpboot/目錄下,然後建立/tftpboot/syslinux.cfg/目錄。該目錄下存放設定檔。 

pxelinux使用ip地址的十六進位表示來作為該ip地址的設定檔的檔案名稱。如blade01的 

ip地址為10.10.12.131,設定檔名為0A0A0C83,內容為: 


default linux 

label linux 
kernel vmlinuz 
append ip=dhcp root=/dev/nfsroot nfsroot=10.10.11.120:/remote/blade01 vga=normal 


5) 配置nfs 

為每個刀片建立一個根目錄,在該刀片的pxelinux設定檔裡指定了從這個nfs export的目錄啟動。 

該根目錄裡應把標準的目錄都建好,另外需要重新mount的usr, home, public等目錄也要export。 

我的 /etc/exports檔案: 


# /etc/exports: the access control list for filesystems which may be exported 
# to NFS clients. See exports(5). 

/remote/blade01 blade01(rw,async,no_root_squash) 
/remote/blade02 blade02(rw,async,no_root_squash) 
/remote/blade03 blade03(rw,async,no_root_squash) 
/remote/blade04 blade04(rw,async,no_root_squash) 
/remote/blade05 blade05(rw,async,no_root_squash) 
/remote/root *(rw,async,no_root_squash) 
/remote/home *(rw,async,no_root_squash) 
/usr *(ro,async,no_root_squash) 
/sbin *(ro,async,no_root_squash) 
/bin *(ro,async,no_root_squash) 
/lib *(ro,async,no_root_squash) 
/home *(ro,async,no_root_squash) 


6)為每個刀片修改它的/etc/fstab檔案,以blade01為例,它的nfs root是/remote/blade01 
/remote/blade01/etc/fstab檔案如下: 
# /etc/fstab: static file system information. 
# 
# 
10.10.11.120:/remote/blade01 / nfs defaults,intr 0 1 
10.10.11.120:/remote/root /root nfs defaults,intr 0 1 
10.10.11.120:/remote/home /home nfs defaults,intr 0 1 
10.10.11.120:/bin /bin nfs defaults,intr 0 1 
10.10.11.120:/usr /usr nfs defaults,intr 0 1 
10.10.11.120:/sbin /sbin nfs defaults,intr 0 1 
10.10.11.120:/lib /lib nfs defaults,intr 0 1 
none /proc proc defaults,intr 0 1 


同時還要為每個刀片修改它的網路設定檔,配置ip地址,啟動兩塊網卡等等。。 

7) 編譯核心 

刀片用的核心,應該支援Kernel Level Auto Configuration的DHCP協議,支援NFS,支援NFS ROOT, 

假設編譯好的核心為vmlinuz,將它拷貝到/tftpboot/目錄下。 

參考文檔: 

http://syslinux.zytor.com/pxe.php 
http://syslinux.zytor.com/faq.php 
http://www.cn-cio.org/xx/show.php?article_id=1680 
http://www-900.ibm.com/developerWorks/cn/linux/l-tip-prompt/l-pex/index.shtml 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.