Linux的系統安裝:
linux系統的安裝主要分爲兩類,一類是網絡安裝,另外一類是本地安裝。
網絡安裝:主要有NFS服務器、Ftp服務器和Http服務器來提供安裝文件的yum源。
本地安裝:主要是光盤安裝和本次磁盤安裝。
安裝流程主要分爲兩大步驟:
配置階段:配置階段主要是對系統自帶安裝程序annconda的配置,不管是圖形化界面是文字界面annconda都會引導用戶一步步的對要安裝的系統進行預設。
安裝階段:配置階段結束後anaconda會按照用戶的配置對系統的主體文件和各類服務文件進行安裝。
安裝過程不管是在圖形化界面仍是文字界面,都有anaconda都提供了較詳細的說明和指導我這裏就再也不進行冗述,主要就分區的心得簡單談一談:
/boot 掛載點單獨分區,且應爲基本磁盤分區(因爲啓動時邏輯卷和磁盤陣列沒法被直接識別),大小100M足矣(主要用於存放grub、內核和initrd)
/ 根目錄掛載單獨分區,大小10G上下,最好使用邏輯卷(容量可浮動調整,且可快照備份)
/usr、/usr/local 此目錄主要用於安裝軟件,大小20G上下,使用邏輯卷。
/var var目錄主要存放日誌文件、郵件、打印隊列等,在系統的使用過程當中會不斷的變大,初始大小10G左右,使用邏輯卷。
下面介紹一種支持徹底託管的安裝方式:
原理是將設置好的anaconda配置文件,在安裝前導入,使其徹底遵循配置文件完成安裝個步驟,且在安裝過程當中不在於用戶進行交互。
anaconda配置文件的生成:
在圖形化界面中運行system-config-kickstart命令(須要先安裝對應的rpm包),在圖形化對話框中進行安裝配置,配置完成後生成ks配置文件。
安裝時,在boot:後輸入「linux ks=」ks文件源,文件源支持從cdrom、hd磁盤設備、file本地文件、ftp、http以及nfs,格式以下
ks=設備名、服務名:/
做者使用的是基於ftp服務的安裝,安裝時將含有boot.iso放入事先編輯好的ks文件,使用boot.iso進行引導。
下面是配置文件ks.cfg:
![](http://static.javashuo.com/static/loading.gif)
text
![](http://static.javashuo.com/static/loading.gif)
key --skip
![](http://static.javashuo.com/static/loading.gif)
keyboard us
![](http://static.javashuo.com/static/loading.gif)
lang en_US
![](http://static.javashuo.com/static/loading.gif)
langsupport --
default en_US en_US
![](http://static.javashuo.com/static/loading.gif)
#network --bootproto dhcp
![](http://static.javashuo.com/static/loading.gif)
network --bootproto=
static --ip=172.16.24.1 --netmask=255.255.0.0 --gateway=172.16.0.1 --nameserver=172.16.0.1
![](http://static.javashuo.com/static/loading.gif)
url --url ftp:
//172.16.0.1/pub
![](http://static.javashuo.com/static/loading.gif)
logging --host=172.16.0.1
#因爲使用ks文件安裝,因此直接進入文本模式。因爲使用ftp安裝系統,要與ftp服務器通訊須要開啓dhcp或配置靜態ip地址(此處配置靜態ip安裝,目的使新系統安裝好後不用在對ip進行配置)
![](http://static.javashuo.com/static/loading.gif)
zerombr yes
![](http://static.javashuo.com/static/loading.gif)
clearpart --all
![](http://static.javashuo.com/static/loading.gif)
part swap --size 1024
![](http://static.javashuo.com/static/loading.gif)
part /boot --size 100
![](http://static.javashuo.com/static/loading.gif)
part pv.01 --size 51200
![](http://static.javashuo.com/static/loading.gif)
volgroup vol0 pv.01
![](http://static.javashuo.com/static/loading.gif)
logvol / --vgname=vol0 --size=10000 --name=root
![](http://static.javashuo.com/static/loading.gif)
logvol /home --vgname=vol0 --size=500 --name=home
![](http://static.javashuo.com/static/loading.gif)
logvol /var --vgname=vol0 --size=10000 --name=var
![](http://static.javashuo.com/static/loading.gif)
logvol /usr --vgname=vol0 --size=10000 --name=usr
![](http://static.javashuo.com/static/loading.gif)
logvol /usr/local --vgname=vol0 --size=10000 --name=usrlocal
![](http://static.javashuo.com/static/loading.gif)
timezone Asia/Shanghai --utc
#清空磁盤MBR和全部安裝區域,設置磁盤交換區大小、/boot所在磁盤類型和大小以及配置lvm和時區
![](http://static.javashuo.com/static/loading.gif)
xconfig --resolution=1024x768 --depth=16 –startxonboot
![](http://static.javashuo.com/static/loading.gif)
rootpw redhat
![](http://static.javashuo.com/static/loading.gif)
authconfig --useshadow --enablemd5
![](http://static.javashuo.com/static/loading.gif)
firewall --disabled
![](http://static.javashuo.com/static/loading.gif)
bootloader
![](http://static.javashuo.com/static/loading.gif)
reboot
#設置root初始密碼爲redhat
![](http://static.javashuo.com/static/loading.gif)
%packages
![](http://static.javashuo.com/static/loading.gif)
@ GNOME Desktop Environment
![](http://static.javashuo.com/static/loading.gif)
@ X Window System
![](http://static.javashuo.com/static/loading.gif)
@ Printing Support
![](http://static.javashuo.com/static/loading.gif)
# KDE
is huge...install it
if you wish
![](http://static.javashuo.com/static/loading.gif)
#@ KDE
![](http://static.javashuo.com/static/loading.gif)
@ Development Tools
![](http://static.javashuo.com/static/loading.gif)
#@ Windows File Server
![](http://static.javashuo.com/static/loading.gif)
#@ Web Server
![](http://static.javashuo.com/static/loading.gif)
elinks
![](http://static.javashuo.com/static/loading.gif)
openssh
![](http://static.javashuo.com/static/loading.gif)
openssh-server
![](http://static.javashuo.com/static/loading.gif)
openssh-clients
![](http://static.javashuo.com/static/loading.gif)
vim-enhanced
![](http://static.javashuo.com/static/loading.gif)
samba-common
![](http://static.javashuo.com/static/loading.gif)
samba-client
![](http://static.javashuo.com/static/loading.gif)
gimp
![](http://static.javashuo.com/static/loading.gif)
gimp-data-extras
![](http://static.javashuo.com/static/loading.gif)
enscript
![](http://static.javashuo.com/static/loading.gif)
libcap
![](http://static.javashuo.com/static/loading.gif)
ntp
![](http://static.javashuo.com/static/loading.gif)
coreutils
![](http://static.javashuo.com/static/loading.gif)
elfutils
![](http://static.javashuo.com/static/loading.gif)
elfutils-libelf
![](http://static.javashuo.com/static/loading.gif)
gimp-print-plugin
![](http://static.javashuo.com/static/loading.gif)
gnome-icon-theme
![](http://static.javashuo.com/static/loading.gif)
gstreamer
![](http://static.javashuo.com/static/loading.gif)
gstreamer-tools
![](http://static.javashuo.com/static/loading.gif)
libgnomeprint22
![](http://static.javashuo.com/static/loading.gif)
libgnomeprintui22
![](http://static.javashuo.com/static/loading.gif)
libgsf
![](http://static.javashuo.com/static/loading.gif)
libIDL
![](http://static.javashuo.com/static/loading.gif)
libraw1394
![](http://static.javashuo.com/static/loading.gif)
nautilus-cd-burner
![](http://static.javashuo.com/static/loading.gif)
openmotif
![](http://static.javashuo.com/static/loading.gif)
pyorbit
![](http://static.javashuo.com/static/loading.gif)
startup-notification
![](http://static.javashuo.com/static/loading.gif)
ttmkfdir
![](http://static.javashuo.com/static/loading.gif)
firefox
![](http://static.javashuo.com/static/loading.gif)
mutt
![](http://static.javashuo.com/static/loading.gif)
screen
![](http://static.javashuo.com/static/loading.gif)
#定製隨系統安裝的軟件包
![](http://static.javashuo.com/static/loading.gif)
%post
![](http://static.javashuo.com/static/loading.gif)
ntpdate -b 172.16.0.1
![](http://static.javashuo.com/static/loading.gif)
hwclock --systohc –utc
![](http://static.javashuo.com/static/loading.gif)
cat > /etc/ntp.conf <<END
![](http://static.javashuo.com/static/loading.gif)
restrict
default ignore
![](http://static.javashuo.com/static/loading.gif)
restrict 127.0.0.1
![](http://static.javashuo.com/static/loading.gif)
restrict 172.16.0.1
![](http://static.javashuo.com/static/loading.gif)
server 172.16.0.1
![](http://static.javashuo.com/static/loading.gif)
driftfile /var/lib/ntp/drift
![](http://static.javashuo.com/static/loading.gif)
broadcastdelay 0.008
![](http://static.javashuo.com/static/loading.gif)
END
![](http://static.javashuo.com/static/loading.gif)
echo
"172.16.0.1" >> /etc/ntp/step-tickers
![](http://static.javashuo.com/static/loading.gif)
chkconfig ntpd on
![](http://static.javashuo.com/static/loading.gif)
useradd student
![](http://static.javashuo.com/static/loading.gif)
echo
"student" | passwd --stdin student
![](http://static.javashuo.com/static/loading.gif)
useradd visitor
![](http://static.javashuo.com/static/loading.gif)
echo
"password" | passwd --stdin visitor
![](http://static.javashuo.com/static/loading.gif)
mkdir /home/student/Desktop
![](http://static.javashuo.com/static/loading.gif)
${httpget} -source http:
//172.16.0.1/pub/gls/ClassInteractives.desktop > /home/student/Desktop/Class\ Interactives.desktop
![](http://static.javashuo.com/static/loading.gif)
chown -R student:student /home/student/Desktop
![](http://static.javashuo.com/static/loading.gif)
perl -pi -e 's,DAILY_UPDATE=no,DAILY_UPDATE=yes,g' /etc/updatedb.conf
#post後跟在系統安裝結束須要運行的腳本
將ks.cfg文件 isolinux文件夾和TRANS.TBL放入./iso文件中
而後使用命令:
![](http://static.javashuo.com/static/loading.gif)
# mkisofs -o boot.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T iso/
將ios目錄封裝成名爲boot.iso的iso景象文件,刻錄成啓動盤。