实验一:搭建PXE Server
服务器IP为192.168.10.253,可以给192.168.10.0/24安装 RHEL5.9
分别给每台客户端分配主机名,格式如下
stationx.tarena.com192.168.10.x
安装所需要的软件包存放在/data/iso/rhel5.9
1、配置DHCP(给需要安装系统的主机分配ip)
[root@localhost ~]# ifconfig eth0 | grep "inet addr" //修改固定IP
inet addr:192.168.10.253 Bcast:192.168.10.255 Mask:255.255.255.0
[root@localhost ~]# rpm -q dhcp
package dhcp is not installed
[root@localhost ~]# cd /etc/yum.repos.d/ //配置yum
[root@localhost yum.repos.d]# cp rhel-debuginfo.repo rhel5.9.repo //复制模板
[root@localhost yum.repos.d]# cat rhel5.9.repo
[rhel-server]
name=Red Hat Enterprise Linux Server
baseurl=file:///misc/cd/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@localhost ~]# yum -y install dhcp //安装dhcp
[root@localhost ~]# cat /etc/dhcpd.conf //修改配置文件
ddns-update-style interim;
next-server 192.168.10.253; //TFTP服务器的IP
filename "pxelinux.0"; //网卡引导文件名
subnet 192.168.10.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option domain-name "tarena.com";
option domain-name-servers 192.168.10.253; //DNS
range dynamic-bootp 192.168.10.10 192.168.10.20; //分配ip段
default-lease-time 21600;
max-lease-time 43200;
}
[root@localhost ~]# service dhcpd restart //启动服务
[root@localhost ~]# chkconfig dhcpd on
[root@localhost ~]# netstat -tulnp | grep :67
udp 0 0 0.0.0.0:67 0.0.0.0:* 5219/dhcpd
2、配置TFTP
[root@localhost ~]# rpm -q tftp-server //默认已安装tftp
tftp-server-0.49-2
[root@localhost ~]# vim /etc/xinetd.d/tftp //配置tftp
...
13 server_args = -s /tftpboot //服务根目录
14 disable = no //改为no以启用
...
[root@localhost ~]# service xinetd restart //启动服务
[root@localhost ~]# chkconfig xinetd on
[root@localhost ~]# netstat -tulnp | grep :69 //端口已启动
udp 0 0 0.0.0.0:69 0.0.0.0:* 5366/xinetd [root@localhost ~]# cd /misc/cd/images/pxeboot/
[root@localhost pxeboot]# cp initrd.img vmlinuz /tftpboot/ //复制镜像、内核、
[root@localhost pxeboot]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/ //复制网卡引导文件
[root@localhost pxeboot]# mkdir /tftpboot/pxelinux.c f g
[root@localhost pxeboot]# cp /misc/cd/isolinux/isolinux.c f g /tftpboot/pxelinux.c f g/default //创建pxe启动配置
[root@localhost pxeboot]# mkdir -p /data/iso/rhel5.9 //新建文件夹
[root@localhost pxeboot]# cp -rf /misc/cd/* /data/iso/rhel5.9/ //将光盘文件拷贝
[root@localhost ~]# rpm -q nfs-utils portmap 查看是否安装nfs
nfs-utils-1.0.9-66.el5
portmap-4.0-65.2.2.1
[root@localhost pxeboot]# cat /etc/exports //配置nfs共享
/data/iso/rhel5.9 *(ro)
[root@localhost pxeboot]# service nfs restart
DNS装
1、安装软件包
[root@localhost ~]# rpm -q bind bind-chroot caching-nameserver
package bind is not installed
package bind-chroot is not installed
package caching-nameserver is not installed
[root@localhost ~]# yum -y install bind bind-chroot caching-nameserver
2、修改主配置文件
[root@localhost ~]# cd /var/named/chroot/etc/
[root@localhost etc]# cp -p named.caching-nameserver.conf named.conf
[root@localhost etc]# vim named.conf //全局配置
...
15 listen-on port 53 { 192.168.10.10; }; //监听端口和地址
...
27 allow-query { any; }; //允许所有客户机查询
28 allow-query-cache { any; };
...
37 match-clients { any; };
38 match-destinations { any; };
[root@localhost etc]# vim named.rfc1912.zones //区域配置文件
...
51 zone "tarena.com" IN { //定义正向区域
52 type master; //type关键字定义了区域类型
53 file "tarena.com.zone"; //区域数据文件
54 };
55
56 zone "10.168.192.in-addr.arpa" IN { //定义反向区域
57 type master;
58 file "tarena.com.arpa";
59 };
[root@ser1 etc]# named-checkconf named.conf //检查配置文件
3、修改数据库文件
[root@localhost etc]# cd /var/named/chroot/var/named/
[root@localhost named]# cp -p named.local tarena.com.zone //新建区域文件
[root@localhost named]# cp -p named.local tarena.com.arpa
[root@localhost named]# cat tarena.com.zone //区域数据文件
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns1.tarena.com.
$GENERATE 10-20 pc$ IN A 192.168.10.$
[root@localhost named]# cat tarena.com.arpa
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
$GENERATE 10-10 $ IN PTR pc$.tarena.com
[root@localhost named]# named-checkzone tarena.com tarena.com.zone //检查区域地址
zone tarena.com/IN: loaded serial 1997022700
OK
[root@localhost named]# named-checkzone tarena.com tarena.com.arpa
zone tarena.com/IN: loaded serial 1997022700
OK
4、启动服务
[root@localhost named]# service named restart
[root@localhost named]# chkconfig named on
[root@localhost named]# host pc12.tarena.com
pc12.tarena.com has address 192.168.10.12
实验二:通过Kickstart实现无人值守安装(接着实验一)
[root@localhost ~]# yum -y install system-config-kickstart
操作过程见图片
[root@localhost ~]# yum -y install httpd
[root@localhost ~]# cp /root/ks.c f g /var/www/html/
[root@localhost ~]# service httpd restart
[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# vim /var/www/html/ks.c f g
在文件中添加key --skip