RHEL5無人值守安裝

一、搭建好Yum源:

RHEL5 配置YUM源


cd /etc/yum.repos.d/
cp rhel-debuginfo.repo rhel-debuginfo.repo.bak
先刪除rhel-debuginfo.repo文件中所有內容,然後添加以下內容:

[base]
name=centos-5 - Base
baseurl=http://centos.ustc.edu.cn/centos/5/os/i386/
# the other site: http://centos.candishosting.com.cn/centos/5/os/i386/
# you can find more site in: http://www.centos.org/modules/tinycontent/index.php?id=13
enabled=1
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

#released updates
[update]
name=CentOS-5 - Updates
baseurl=http://mirror.centos.org/centos/5/updates/i386/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
baseurl=http://mirror.centos.org/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
baseurl=http://mirror.centos.org/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
baseurl=http://mirror.centos.org/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
baseurl=http://mirror.centos.org/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

#packages in testing
[testing]
name=CentOS-5 - Testing
baseurl=http://mirror.centos.org/centos/5/testing/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5


記裏記住把gpgcheck=1置換成gpgcheck=0.不然用一陣子後出現gpgkey錯誤的提示。
然後導入key

rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

這個源地址應該是國內比較快的一個yum庫了。

二、安裝Vsftp服務:

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

[root@rhce ~]# yum install vsftpd* -y

[root@rhce ~]# chkconfig vsftpd on

[root@rhce ~]# service vsftpd restart

關閉 vsftpd:            [失敗]

爲 vsftpd 啓動 vsftpd:  [確定]

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

三、複製PXE啓動時需要的文件資料:

1、複製必要的文件:

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

[root@rhce ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/

[root@rhce ~]# mkdir /tftpboot/pxelinux.cfg

[root@rhce ~]# cp /cdrom/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

[root@rhce ~]# cp /cdrom/images/pxeboot/initrd.img /tftpboot/

[root@rhce ~]# cp /cdrom/images/pxeboot/vmlinuz /tftpboot/

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

2、修改/tftpboot/pxelinux.cfg/default文件

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

[root@rhce ~]# chmod u+w /tftpboot/pxelinux.cfg/default //文件默認只讀

[root@rhce ~]# vim /tftpboot/pxelinux.cfg/default

default linux

prompt 1

timeout 6 //超時時間,默認600,可以不改。

display boot.msg

F1 boot.msg

F2 options.msg

F3 general.msg

F4 param.msg

F5 rescue.msg

label linux

kernel vmlinuz

append initrd=initrd.img ks=ftp://192.168.1.8/ks.cfg //ks.cfg是kickstart安裝配置文件,系統就是按照ks.cfg來安裝的。我們將在後面配置他

......下面省略

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

四、安裝配置DHCP服務:

1、安裝DHCP服務:

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

[root@rhce ~]# yum list dhcp*

Loaded plugins: rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

Installed Packages

dhcpv6-client.i386 1.0.10-16.el5  installed

Available Packages

dhcp.i386 12:3.0.5-18.el5         cdrom

dhcp-devel.i386 12:3.0.5-18.el5   cdrom

dhcpv6.i386 1.0.10-16.el5         cdrom

[root@rhce ~]# yum install dhcp.i386 dhcp-devel.i386 -y

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

2、生成主配置文件dhcpd.conf:

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

[root@rhce ~]# rpm -ql dhcp | more

......前面省略

/usr/share/doc/dhcp-3.0.5/api+protocol

/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample

......後面省略

[root@rhce ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

cp:是否覆蓋“/etc/dhcpd.conf”? y

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

3、修改主配置文件dhcpd.conf

---------------------------------------------------update-style interim;

ignore client-updates;
allow booting; #定義能夠PXE啓動
allow bootp;  #定義支持bootp
subnet 192.168.1.0 netmask 255.255.255.0 {
        range  192.168.1.10 192.168.1.80;
        option routers                  192.168.1.1;
        option subnet-mask              255.255.255.0;
        default-lease-time 21600;
        max-lease-time 43200;
        next-server 192.168.1.1; #TFTP Server的IP地址
ffilename "pxelinux.0";   #pxelinux啓動文件位置
}

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

4、啓動DHCP服務:如果啓動錯誤檢查/var/log/message

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

[root@rhce ~]# service dhcpd restart

啓動 dhcpd: [確定]

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

五、kickstart配置文件的生成:

1、安裝kickstart包:

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

[root@rhce ~]# yum list *kic*

Loaded plugins: rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

Available Packages

pykickstart.noarch 0.43.3-1.el5 cdrom

system-config-kickstart.noarch 2.6.19.8-2.el5 cdrom

[root@rhce ~]# yum install system-config-kickstart.noarch

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

2、生成ks.cfg安裝配置文件:

1)圖形化界面配置:(終端中運行system-config-kickstart命令

圖一:基本配置裏要修改的項目

圖二:安裝方法裏要修改的項目

圖三:分區信息,創建目標工作站的分區表

圖四:網絡配置,點“添加網絡設備”——“確定”

圖五:單擊“文件——保存文件”單擊“保存”

2)修改新生成的ks.cfg文件:我們沒有配置安裝的軟件包,因爲系統沒有這部分服務。

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

[root@rhce ~]# cat /root/anaconda-ks.cfg //安裝系統時自動記錄的安裝信息

......前面省略

%packages

@office

@editors

@text-internet

@gnome-desktop

@dialup

......後面省略 //%pachages 後的部分記錄系統安裝時的軟件包的安裝情況,複製下來全部複製到ks.cfg文件後面。

[root@rhce ~]# vim ks.cfg

......前面省略

# Partition clearing information

clearpart --none

key --skip //跳過輸入序列號環節

...... 中間省略

%packages //這裏及以後的內容是從/root/anaconda-ks.cfg 複製來的

@office

@editors

@text-internet

@gnome-desktop

@dialup

......下面省略

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

3、將配置文件複製到制定位置:

我們在/tftpboot/pxelinux.cfg/default文件中曾設置ks=ftp://192.168.1.8/ks.cfg

將文件複製到該位置:

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

[root@rhce ~]# cp ks.cfg /var/ftp/ // /var/ftp 目錄是VSFTP服務的根目錄

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

六、複製Linux系統安裝文件:

在配置ks.cfg文件時,我們設置的路徑爲/pub,如圖:

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

[root@rhce ~]# umount /dev/hdc

[root@rhce ~]# mount /dev/hdc /var/ftp/pub/

mount: block device /dev/hdc is write-protected, mounting read-only

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

七、確定相關服務的狀態:

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

[root@rhce ~]# service iptables stop

清除防火牆規則: [確定]

把 chains 設置爲 ACCEPT 策略:filter [確定]

正在卸載 Iiptables 模塊: [確定]

[root@rhce ~]# setenforce 0 //關閉selinux

[root@rhce ~]# chkconfig tftp on //TFTP 服務開啓命令

[root@rhce ~]# chkconfig dhcpd on

[root@rhce ~]# chkconfig vsftpd on

[root@rhce ~]# service xinetd restart //TFTP服務屬於他的子服務

停止 xinetd: [確定]

啓動 xinetd: [確定]

[root@rhce ~]# service dhcpd restart

關閉 dhcpd: [確定]

啓動 dhcpd: [確定]

[root@rhce ~]# service vsftpd restart

關閉 vsftpd: [確定]

爲 vsftpd 啓動 vsftpd: [確定]

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

八、測試工作站:

跳過DHCP,通過TFTP 開始啓動計算機

下面就讓他自己啓動就好了!出去轉一圈回來就 OK了!



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章