条件:两台虚拟机,一台作为测试环境,一台作为被安装客户端
FTP+TFTP+DHCP+KICKstart+PXE+NFS
一:配置yum源
1.挂载镜像
[root@localhost ~]# mount /dev/sr0 /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
2.编辑Yum源
vi /etc/yum.repos.d/rhel-source.repo
[root@localhost ~]# more /etc/yum.repos.d/rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
3.导入gpgkey
[root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@localhost ~]
第二:安装ftp
1,yum安装vsftpd包
yum -y install vsftpd
2.启动ftp服务服务
[root@localhost ~]# /etc/init.d/vsftpd start
为 vsftpd 启动 vsftpd:[确定]
3.设置为开机启动
[root@localhost ~]# chkconfig 查看vsftp是关闭的
[root@localhost ~]# chkconfig vsftpd on
[root@localhost ~]# chkconfig 查看vsftpd服务已经开启
三,安装TFTP
1,YUM安装TFTP包
[root@localhost ~]# yum install tftp* �Cy
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tftp.i686 0:0.49-5.1.el6 will be installed
---> Package tftp-server.i686 0:0.49-5.1.el6 will be installed
--> Processing Dependency: xinetd for package: tftp-server-0.49-5.1.el6.i686
--> Running transaction check
---> Package xinetd.i686 2:2.3.14-31.el6 will be installed
--> Finished Dependency Resolution
2.修改配置文件
vi /etc/xinetd.d/tftp
利用set nu显示行数,修改13,14行保存
3.重启xinetd服务
[root@localhost ~]# /etc/init.d/xinetd restart
停止 xinetd:[失败]
正在启动 xinetd:[确定]
4,用chkconfig查看xinetd默认是开机启动的,因此不需要设置。查看端口侦听状态
root@localhost ~]# lsof -i:69
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
xinetd 2475 root 5u IPv4 19706 0t0 UDP *:tftp
四.安装dhcp
1.yum安装dhcp包
yum install dhcp -y
2,修改配置文件
[root@localhost ~]# more /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
ddns-update-style interim;
ignore client-updates;
subnet 192.168.2.0 netmask 255.255.255.0 {
option routers 192.168.2.250;
option subnet-mask 255.255.255.0;
filename "pxelinux.0";
next-server 192.168.2.21
option domain-name-servers 192.168.2.250;
range dynamic-bootp 192.168.2.1 192.168.2..200;
default-lease-time 21600;
max-lease-time 43200;
}
subnet是分配ip地址的网段,option routers是配置的默认网关ip,subnet-umask是子网掩码,
而next-server则是本机ip
3,启动dhcp并将其设置为开机启动
/etc/init.d/dhcpd start
正在启动 dhcpd:[成功]
[root@localhost ~]# chkconfig dhcpd on
现在就可以配置kickstart