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了!



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