系统环境:centos5.5
一、设置tftp服务器
1、安装tftp服务器
[root@EmployServer ~]# yum install tftp-server -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tftp-server.i386 0:0.49-2.el5.centos set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
tftp-server i386 0.49-2.el5.centos updates 31 k
Transaction Summary
================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 31 k
Downloading Packages:
tftp-server-0.49-2.el5.centos.i386.rpm | 31 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : tftp-server 1/1
Installed:
tftp-server.i386 0:0.49-2.el5.centos
Complete!
2、检查tftp配置文件
[root@EmployServer /]# vi /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = yes
per_source = 11
cps = 100 2
flags = IPv4
}
~
~
~
~
~
Type :quit<Enter> to exit Vim
3、设置tftp服务为开机启动
[root@EmployServer ~]# chkconfig --level 345 xinetd on
[root@EmployServer ~]# chkconfig tftp on
检查tftp服务状态
[root@EmployServer ~]# chkconfig --list|egrep "xinetd|tftp"
xinetd 0:关闭 1:关闭 2:关闭 3:启用 4:启用 5:启用 6:关闭
基于 xinetd 的服务:
tftp: 启用
查看udp69端口
[root@EmployServer ~]# netstat -a |grep tftp;netstat -an |grep "udp.*69"
udp 0 0 *:tftp *:*
udp 0 0 0.0.0.0:69 0.0.0.0:*
二、搭建NFS服务
1、验证nfs-utils包是否已经安装
[root@EmployServer ~]# yum list installed | grep nfs-utils
nfs-utils.i386 1:1.0.9-44.el5 installed
nfs-utils-lib.i386 1.0.8-7.6.el5 installed
Centos5.5默认已经安装好nfs服务
2、修改/etc/exports 文件,配置输出目录
/etc/exports 文件默认是空,需要自己配置
[root@EmployServer ~]# vi /etc/exports
/media/centos5.5 *(ro)
/anaconda/ks *(ro)
~
~
~
~
~
"/etc/exports" 2L, 52C written
# *号代表所有网段的主机都可以访问此共享目录,ro 表明只读权限。
当然,系统中实际上还没有这两个目录,需要我们手动建立
[root@EmployServer ~]# mkdir /anaconda
[root@EmployServer ~]# mkdir /anaconda/ks
[root@EmployServer ~]# mkdir /media/centos5.5
3、开启nfs服务并设置随机启动
[root@EmployServer ks]# service nfs start
启动 NFS 服务: [确定]
关掉 NFS 配额: [确定]
启动 NFS 守护进程: [确定]
启动 NFS mountd: [确定]
[root@EmployServer ks]# chkconfig --level 345 nfs on
[root@EmployServer ks]# chkconfig --list|grep nfs
nfs 0:关闭 1:关闭 2:关闭 3:启用 4:启用 5:启用 6:关闭
nfslock 0:关闭 1:关闭 2:关闭 3:启用 4:启用 5:启用 6:关闭
三、 搭建dhcp服务
1、查看是否已经安装dhcp包
[root@EmployServer pxeboot]# rpm -qa |grep dhcp
dhcpv6-client-1.0.10-18.el5
默认没有安装dhcp包
2、安装dhcp包
[root@EmployServer pxeboot]# yum install dhcp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package dhcp.i386 12:3.0.5-29.el5_7.1 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================
Package Arch Version Repository Size
======================================================================================================
Installing:
dhcp i386 12:3.0.5-29.el5_7.1 updates 873 k
Transaction Summary
======================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 873 k
Is this ok [y/N]: y
Downloading Packages:
dhcp-3.0.5-29.el5_7.1.i386.rpm | 873 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : dhcp 1/1
Installed:
dhcp.i386 12:3.0.5-29.el5_7.1
Complete!
安装完毕,查看:
[root@EmployServer pxeboot]# yum list installed | grep dhcp
dhcp.i386 12:3.0.5-29.el5_7.1 installed
dhcpv6-client.i386 1.0.10-18.el5 installed
[root@EmployServer pxeboot]# rpm -qa|grep dhcp
dhcpv6-client-1.0.10-18.el5
dhcp-3.0.5-29.el5_7.1
3、配置dhcp服务
dhcp的配置文件是 /etc/dhcpd.conf 此文件默认内容如下:
[root@EmployServer pxeboot]# cd
[root@EmployServer ~]# vi /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
~
~
~
"/etc/dhcpd.conf" [noeol] 4L, 86C
------------------------------------------------------------------
“# see /usr/share/doc/dhcp*/dhcpd.conf.sample”所以我们可以按照sample文件的格式设置dhcpd.conf,格式一定要正确,否则dhcp服务没办法启动。
[root@EmployServer ~]# cd /usr/share/doc/dhcp
dhcp-3.0.5/ dhcpv6-client-1.0.10/
[root@EmployServer ~]# cd /usr/share/doc/dhcp-3.0.5/
[root@EmployServer dhcp-3.0.5]# ls
api+protocol draft-ietf-dhc-dhcp-dns-12.txt README rfc2132.txt
dhcpd.conf.sample draft-ietf-dhc-failover-07.txt RELNOTES rfc2485.txt
IANA-arp-parameters rfc1542.txt rfc2489.txt
draft-ietf-dhc-authentication-14.txt ja_JP.eucJP rfc2131.txt rfc951.txt
[root@EmployServer dhcp-3.0.5]# cp dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆盖“/etc/dhcpd.conf”? y
[root@EmployServer dhcp-3.0.5]# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1;
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;
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.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
"/etc/dhcpd.conf" 31L, 852C
---------------------------------------------------------
下面要修改一下配置文件,尽量按照原来格式修改,千万要小心。
修改后的内容如下:
-------------------------------------------
[root@EmployServer dhcp-3.0.5]# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.120.0 netmask 255.255.255.0 {------子网及掩码
# --- default gateway
option routers 192.168.120.1;--- 网关(路由器)
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;
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.120.128 192.168.120.254;-------动态分配的IP区域
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.120.36;-----很重,指出引导文件所在的服务器IP。
filename "/pxelinux.0";-----指出引导文件名称。
# we want the nameserver to appear at a fixed address
"/etc/dhcpd.conf" 33L, 913C written
----------------------------------------------------------------------------------
4、启动dhcp服务,并设置其开机启动,启动服务之前最好确保机器在单独网络中,以免造成dhcp冲突。
[root@EmployServer dhcp-3.0.5]# service dhcpd start
启动 dhcpd: [确定]
[root@EmployServer dhcp-3.0.5]# chkconfig --list dhcpd |grep dhcpd
dhcpd 0:关闭 1:关闭 2:关闭 3:启用 4:启用 5:启用 6:关闭
四、组建pxe环境
1、验证syslinux是否已经安装
[root@EmployServer ks]# yum list installed | grep syslinux
syslinux.i386 3.11-4 installed
centos5.5默认已经安装了syslinux包
2、复制相关文件到tftp-server的输出根目录 /tftpboot
[root@EmployServer ks]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot
[root@EmployServer ks]# cp /usr/lib/syslinux/menu.c32 /tftpboot
[root@EmployServer ks]# cp /usr/lib/syslinux/memdisk /tftpboot
[root@EmployServer ks]# cp /usr/lib/syslinux/mboot.c32 /tftpboot
[root@EmployServer ks]# cp /usr/lib/syslinux/chain.c32 /tftpboot
[root@EmployServer ks]#
[root@EmployServer ks]# ls /tftpboot/
chain.c32 mboot.c32 memdisk menu.c32 pxelinux.0
3、复制系统盘的所有内容到共享目录 /media/centos5.5
[root@EmployServer dev]# mount /dev/cdrom /mnt/cdrom
[root@EmployServer dev]# cp -rv /mnt/cdrom/* /media/centos5.5/
4、复制系统内核和rmdisk驱动以及启动菜单所需要的文件到/tftpboot
[root@EmployServer pxeboot]# cd /media/centos5.5/isolinux
[root@EmployServer pxeboot]# cp * /tftpboot/
5、创建pxelinux.0的默认配置文件
[root@EmployServer dhcp-3.0.5]# cd /tftpboot/
[root@EmployServer tftpboot]# mkdir pxelinux.cfg
[root@EmployServer tftpboot]# cp isolinux.cfg pxelinux.cfg/default
6、关闭防火墙
[root@EmployServer tftpboot]# service iptables stop
至此所有设置完毕,可以网络安装了
远程系统部署服务器设置
原创
©著作权归作者所有:来自51CTO博客作者Jan_Wu的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:PXE启动芯片出错代码表
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Jenkins部署到远程服务器
基于前述实现功能,即向GitLab提交代码,自动触发Jenkins构建,进一步实现把构
maven 服务器 自动化构建 -
pycharm设置远程服务器调试
Pycharm同步远程服务器调试1、需要准备工具xftp:上传项目文件xshell:连接Linux系统调试
远程服务器 虚拟环境 python