一.使用yum安装dhcp tftp vsftpd system-config-kickstart软件包
1. 安装相关软件包
#yum -y install tftp dhcp vsftpd system-config-kickstart
二.配置dhcpd服务
cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
#vim /etc/dhcpd.conf 内容如下,当然也可以根据自己的需要灵活修改
- ddns-update-style interim;
- ignore client-updates;
- subnet 192.168.126.0 netmask 255.255.255.0 {
- # --- default gateway
- option routers 192.168.126.254;//路由器IP,可以写网关IP
- option subnet-mask 255.255.255.0;
- # option nis-domain "domain.org";
- # option domain-name "domain.org";
- # option domain-name-servers 192.168.1.1;//DNS服务器IP
- next-server 192.168.126.50;//服务器IP地址。
- filename "pxelinux.0";//PXE得到IP以后的引导文件
- option time-offset -18000; # Eastern Standard Time
- # option ntp-servers 192.168.1.1;
- # option netbios-name-servers 192.168.1.1;
- # --- Selects point-to-point node (default is hybrid). Don't change this unless
- # -- you understand Netbios very well
- # option netbios-node-type 2;
- range dynamic-bootp 192.168.126.128 192.168.126.254;//IP地址池范围。
- default-lease-time 21600;
- max-lease-time 43200;
- # next-server marvin.redhat.com;
- # we want the nameserver to appear at a fixed address
- host ns {
- next-server marvin.redhat.com;
- hardware ethernet 12:34:56:78:AB:CD;
- fixed-address 207.175.42.254;
- }
- }
三.配置tftp服务
1.编辑/etc/xinetd.d/tftp文件
- #vim /etc/xinetd.d/tftp 内容如下service tftp
- {
- socket_type = dgram
- protocol = udp
- wait = yes
- user = root
- server = /usr/sbin/in.tftpd
- server_args = -s /tftpboot
- disable = no
- per_source = 11
- cps = 100 2
- flags = IPv4
- }
四.复制及编辑PXE启动时用到的文件
1. 复制PXE引导时需要的文件到/tftpboot目录下
#mkdir /tftpboot/pxelinux.cfg
#cp /media/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
#cp /media/p_w_picpaths/pxeboot/initrd.img /tftpboot/
cp /media/p_w_picpaths/pxeboot/vmlinuz /tftpboot/
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
2. 编辑/tftpboot/pxelinux.cfg/default文件 内容如下
default linux prompt 1 timeout 6 label linux kernel vmlinuz append initrd=initrd.img ks=ftp://192.168.126.50/ks.cfg ##ks=是指定kickstart安装时用到的配置文件将配置这个文件
五.编写ks.cfg配置文件,当然也可以使用工具配置
1.使用system-config-kickstart工具配置ks.cfg配置文件
cp /root/ks.cfg /var/ftp
把下列信息加入到ks.cfg
- %packages
- @dialup
- @base
- @admin-tools
- @base-x
- @openfabrics-enterprise-distribution
- @system-tools
- @gnome-desktop
- @sound-and-video
- @legacy-software-development
- @graphical-internet
- @text-internet
- @editors
- @ruby
- @java
- @office
六.在ftp根目录下创建一个用于挂载或放系统安装光盘的目录并挂载
1 .创建目录及挂载
#mkdir /var/ftp/cdrom
#mount /dev/cdrom /var/ftp/cdrom
七.启动服务
#service dhcpd restart
#service xinetd restart
#service vsftpd restart
chkconfig dhcpd on
#chkconfig vsftpd on
八,制作linux引导盘
在启动时boot:linux
问题
使用system-config-kickstart来配置ks.cfg文件,但是在软件包选择这里,却显示"由于下载软件包信息失败,软件包选择被禁止"
解决方法:
需要自建一个yum源,yum源名字一定要是base
[base]
name=base
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
name=base
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
转载于:https://blog.51cto.com/tntdba/989711