PXE+KICKSTART 安裝UBUNTU 10.04

PXE+KICKSTART 安裝UBUNTU 10.04

名詞解釋
PXE
PXE(preboot execute environment)是由Intel公司開發的最新技術,工作於Client/Server的網絡模式,支持工作站通過網絡從遠端服務器下載映像,並由此支持來自網絡的操作系統的啓動過程,其啓動過程中,終端要求服務器分配IP地址,再用TFTP(trivial file transfer protocol)或MTFTP(multicast trivial file transfer protocol)協議下載一個啓動軟件包到本機內存中並執行,由這個啓動軟件包完成終端基本軟件設置,從而引導預先安裝在服務器中的終端操作系統。PXE可以引導多種操作系統,如:Windows 95/98/2000/xp/2003/vista/2008,linux等。
KICKSTART
KickStart是一種無人職守安裝方式。KickStart的工作原理是通過記錄典型的安裝過程中所需人工干預填寫的各種參數,並生成一個名爲ks.cfg的文件;在其後的安裝過程中(不只侷限於生成KickStart安裝文件的機器)當出現要求填寫參數的情況時,安裝程序會首先去查找KickStart生成的文件,當找到合適的參數時,就採用找到的參數,當沒有找到合適的參數時,才需要安裝者手工干預。
 
準備工作
1.安裝KICKSTART

 
star@ubuntu:~$ sudo apt-get install system-config-kickstart
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
 hwdata isoquery libxml++2.6-2 localechooser-data
The following NEW packages will be installed:
 hwdata isoquery libxml++2.6-2 localechooser-data system-config-kickstart
0 upgraded, 5 newly installed, 0 to remove and 277 not upgraded.
Need to get 1,139kB of archives.
After this operation, 5,063kB of additional disk space will be used.
Do you want to continue [Y/n]?
 
 
1.1在 應用程序\系統工具”中打開kickstart
 

 
 
 
設置好以後,保存配置文件爲ks.cfg
 
注意: package selection 選項不能選擇,具體原因不詳(網上查詢有人說是BUG問題),這時可以直接修改ks.cfg文件添加要安裝的軟件包,在最後行添加%packages
如筆者的配置文件如下
 
Generated by Kickstart Configurator
#platform=x86
 
#System language
lang en_US
#Language modules to install
langsupport en_US
#System keyboard
keyboard us
#System mouse
mouse
#System timezone
timezone Asia/Chongqing
#Root password
rootpw --disabled
#Initial user
user star --fullname "star" --iscrypted --password $1$TELmpWrC$yPElivw5xnKjAGqxBi50T/
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use Web installation
url --url http://192.168.10.21/ubuntu
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype ext4 --size 256
part swap --size 1024
part / --fstype ext4 --size 1 --grow
#System authorization infomation
auth --useshadow --enablemd5
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled --ssh
#X Window System configuration information
xconfig --depth=24 --resolution=1024x768 --defaultdesktop=GNOME
%packages
@ubuntu-desktop
 
紅色字體部隊爲手動添加的
 
注意: 不添加@ubuntu-desktop這行,安裝成功能沒有圖形界面的
 
1.2複製ks.cfg文件/var/www/Ubuntu/目錄中,並保證其它機器能通過http://192.168.10.21/ubuntu/ks.cfg能看到ks.cfg中的內容
 
 
2.安裝DHCP服務器
 
star@ubuntu:~$ sudo apt-get install dhcp3-server
Reading package lists... Done
Building dependency tree      
Reading state information... Done
dhcp3-server is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 277 not upgraded.
star@ubuntu:~$ sudo apt-get remove dhcp3-server
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages will be REMOVED:
 dhcp3-server
0 upgraded, 0 newly installed, 1 to remove and 277 not upgraded.
After this operation, 872kB disk space will be freed.
Do you want to continue [Y/n]?
 
2.1配置DHCP,配置文件如下
 
subnet 192.168.10.0 netmask 255.255.255.0 {
 range 192.168.10.30 192.168.10.254;
 option domain-name "192.168.10.251";
 option routers 192.168.10.1;
 default-lease-time 600;
 max-lease-time 7200;
 next-server 192.168.10.21;
 filename "pxelinux.0";
 
增加紅色字體部分
 
 
3.安裝TFTP服務器
 
注意:必須使用TFTP-HPA這個軟件包,使用TFTPD會出現問題導致不能導引導系統
 
star@ubuntu:/$ sudo apt-get install tftpd-hpa tftp-hpa
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages will be REMOVED:
 atftpd tftp
The following NEW packages will be installed:
 tftp-hpa tftpd-hpa
0 upgraded, 2 newly installed, 2 to remove and 277 not upgraded.
Need to get 63.8kB of archives.
After this operation, 57.3kB disk space will be freed.
Do you want to continue [Y/n]?
 
 
 
3.1修改TFTP配置文件,把RUN_DAEMON=”no”改爲”yes”
 
star@ubuntu:/tftpboot$ sudo vim /etc/default/tftpd-hpa
 
 
#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"
 
TFTP安裝完成後會建立/var/lib/tftpboot目錄
 
star@ubuntu:~$ cd /var/lib/tftpboot/
star@ubuntu:/var/lib/tftpboot$
 
3.2下載ubuntu netboot文件(和redhat 有區別需要下載引導文件或在ubuntu DVD光盤中提取)
使用wget –r 命令下載
注意安裝不同的版本其netboot文件也不同,請選擇正確的下載
此處下載的是10.04的netboot文件
 
 
3.3進入/var/lib/tftp/Ubuntu-installer/i386/boot-screens目錄中,編輯text.cfg文件
 
default install
label install
        menu label ^Install
        menu default
        kernel ubuntu-installer/i386/linux
        append ks=http://192.168.10.21/Ubuntu/ks.cfg \
vga=normal initrd=ubuntu-installer/i386/initrd.gz -- quiet
label cli
        menu label ^Command-line install
        kernel ubuntu-installer/i386/linux
        append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=normal initrd=ubuntu-installer/i386/initrd.gz -- quiet
~
 
 
4.安裝Apache2服務器
 
star@ubuntu::~$ sudo apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
 apache2
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 0B/46.8kB of archives.
After this operation, 102kB of additional disk space will be used.
Selecting previously deselected package apache2.
(Reading database ... 135440 files and directories currently installed.)
Unpacking apache2 (from .../apache2_2.2.11-2ubuntu2.6_all.deb) ...
Setting up apache2 (2.2.11-2ubuntu2.6) ...
 
安裝完成後會建立/var/www/目錄
在些目錄中新建ubuntu 目錄
 
4.1掛載光盤鏡像,複製光盤中的所以內容到/var/www/Ubuntu/目錄下
 
注意:ubuntu 光盤必須使用Alternative,desktop版本不支持,說起這個問題了,當初因爲這個問題我耽誤了不少時間,如果使用desktop 版本會在選擇鏡像地址時出現找不到鏡像的提示
 
 
安裝系統
 
在客戶裸機上設爲網卡啓動系統,啓動系統後就會出現如下圖所示的界面
 

 
 
 
當出現如下界面時選擇第一項就開始自動安裝UBUNTU了
 

 
 
安裝完成後重啓系統進入UBUNTU,如下圖
 

 
至此,UBUNTU 10.04算是順利安裝完成了.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章