pxe网络安装centos系统

管理员 Linuxpxe网络安装centos系统已关闭评论12,3611字数 2109阅读7分1秒阅读模式

安装系统的方法很多方法,有从硬盘、usb、光盘、网络,方法很多种,今天提到的是网络安装,网络安装的方法很多,有KickStart、pxe等等,如下便是使用pxe安装系统,文章从运维生存时间群友的博客转过来的。

分为如下几个步骤,比较简单,但是安装比较繁琐。文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

1. 安装配置dhcp文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

1.1 安装dhcp文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

# yum install dhcp

1.2 配置dhcp文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

#  vi /etc/dhcp/dhcpd.conf
# default-lease-time 600;
#  max-lease-time 7200;
ddns-update-style none;
log-facility local7;
next-server 192.168.1.1; //指定tftp服务器ip,该ip地址这里指定本机地址
filename "pxelinux.0"; //指定引导文件
subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.10 192.168.1.100; //设置dhcp作用域范围
# option domain-name-servers 8.8.8.8;
# option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;
}

 文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

2. 安装配置tftp文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

2.1 安装tfpt文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

# yum install tftp-server

2.2 配置tftp文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

# vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot //设置tftp的根目录
disable = no //这里原来是yes要改成no
per_source = 11
cps = 100 2
flags = IPv4
}

 文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

cd /var/lib/tftp
mkdir pxelinux.cfg

挂载系统关盘到/mnt/cdrom目录下文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

# mount /dev/cdrom /mnt/cdrom
# cp /mnt/cdrom/images/*.img /var/lib/tftpboot
# cp /mnt/cdrom/isolinux/boot.msg /var/lib/tftpboot
# cp /mnt/cdrom/isolinux/initrd.img /var/lib/tftpboot
# cp /mnt/cdrom/isolinux/vesamenu.c32 /var/lib/tftpboot
# cp /mnt/cdrom/isolinux/vmlinuz /var/lib/tftpboot
# cp /mnt/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
# chmod -R 755 /var/lib/tftpboot //让tftp目录下的所有文件有执行权限
#chmod 777 /var/lib/tftpboot/pxelinux.cfg/default

获取pxelinux.0 引导文件文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

# yum install syslinux
# rpm -qa | grep syslinux
# rpm -ql syslinux-4.02-7.el6.x86_64 | grep pxelinux.0 //查找 pxelinux.0所在位置
# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

3. 配置apache
在任意的虚拟主机或者默认主机中添加一个虚拟目录指向关盘挂载目录, 或者大家配置nfs、ftp也可以,这边还是用HTTP来做演示文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
Alias /iso "/mnt/cdrom/"
<Directory "/mnt/cdrom">
AllowOverride None
Options Indexes FollowSymLinks
Require all granted
Order Deny,Allow
Deny From all
Allow From 192.168.1.0/24
</Directory>

 文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

4. 启动关闭服务文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

4.1 启动dhcp和tftp文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

# service dhcpd start
# service xinetd start

4.2 关闭selinux和iptables文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

# set enforce0
# service iptables stop

5. 安装操作系统
从网络安装即可,各自服务器网络启动方式不同,这边不再敖述,在选择安装源的步骤填http://192.168.1.1/iso文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

转自:http://www.zhengdazhi.com/index.php/centos6-3-pxe%E5%AE%89%E8%A3%85%E7%B3%BB%E7%BB%9F/文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

整理:运维生存时间文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/ 文章源自运维生存时间-https://www.ttlsa.com/linux/install-centos-by-pxe/

weinxin
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
管理员
  • 本文由 发表于 10/01/2014 01:00:34
  • 转载请务必保留本文链接:https://www.ttlsa.com/linux/install-centos-by-pxe/