Linux pxe 安装

centos6.5为例

关闭系统防火墙:

# service iptables stop

# vi /etc/selinux/config  修改

SELINUX=disabled

  1. 安装DHCP服务

# yum -y install dhcp

修改vi /etc/dhcp/dhcpd.conf 配置文件,内容如下:

ddns-update-style interim;

ignore client-updates;

allow booting;

allow bootp;

filename "pxelinux.0";#pxe boot需要的启动文件名, 相当于bootloader

next-server 192.168.100.149; #tftp server的ip

subnet 192.168.100.0 netmask 255.255.255.0{

        default-lease-time 216000;

        max-lease-time 432000;

        option time-offset -18000;

        range 192.168.100.150 192.168.100.160;#地址池范围

        option subnet-mask 255.255.255.0;

        option routers 192.168.100.149;

}

 

启动DHCP服务

# /etc/init.d/dhcpd start

 

 

2.1 安装tftp-server

# yum install tftp-server xinetd –y

2.2 启用tftp 服务

# vi /etc/xinetd.d/tftp

将disable 设置为no

# /etc/init.d/xinetd restart

# /etc/init.d/tftpd restart

 

3.1 安装并配置HTTP

# yum install httpd –y

 

开启服务

# /etc/init.d/httpd start

将iso文件挂载至/var/www/html/centos

# mount /dev/cdrom/ /var/www/html/centos

 

4. 配置支持PXE的启动程序

安装syslinux

yum install –y syslinux

4.1 复制pxelinux.0 文件至/var/lib/tftpboot/ 文件夹中

# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

4.2 复制iso 镜像中的/image/pxeboot/initrd.img 和vmlinux 至/var/lib/tftpboot/ 文件夹中

# cp /var/www/html/centos/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/

4.3复制iso 镜像中的/isolinux/boot.msg,vesamenu.c32 splash.png 至/var/lib/tftpboot/ 文件夹中

cp /var/www/html/centos/isolinux/{boot.msg,vesamenu.c32,splash.jpg} /var/lib/tftpboot/

4.4 在/var/lib/tftpboot/ 中新建一个pxelinux.cfg目录

# mkdir /var/lib/tftpboot/pxelinux.cfg

4.5 将iso 镜像中的/isolinux 目录中的isolinux.cfg复制到pxelinux.cfg目录中,同时更改文件名称为default

# cp /var/www/html/centos/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

4.6 修改default文件

# vi /var/lib/tftpboot/pxelinux.cfg/default

 

label linux

  menu label ^Install by pxe

  menu default

  kernel vmlinuz

  append initrd=initrd.img ks=http://192.168.100.149/ks.cfg

 

5.1 生成并修改ks.cfg 文件

#vi /var/www/html/ks.cfg

 

#version=DEVEL

# Firewall configuration

firewall --disabled

# Install OS instead of upgrade

install

# Use network installation

url --url="http://192.168.100.149/centos"

# Root password  huawei123

rootpw  --iscrypted $6$.2zqp7Meu4kPupW2$xsC6bRSp6AIeIjbem5MXaI4pN4Z27AgAVPrWxTaL

drEJ8n.lXVsSRlMsmeqyiKXgrm.whw28gFwDMkMpU4q1W.

# System authorization information

auth  --useshadow  --passalgo=sha512

# Use text mode install

text

firstboot --disable

# System keyboard

keyboard us

# System language

lang zh_CN.UTF-8

# SELinux configuration

selinux --disabled

# Installation logging level

logging --level=info

 

# System timezone

timezone --utc Asia/Shanghai

# Network information

network  --bootproto=dhcp --device=eth0 --onboot=yes

# Clear the Master Boot Record

zerombr

# System bootloader configuration

bootloader --append=" crashkernel=auto"--location=mbr --driveorder=sda

# Disk partitioning information

autopart

# Partition clearing information

clearpart --all --initlabel

# Reboot after installation

reboot

 

repo --name="CentOS"  --baseurl=http://192.168.100.149/centos --cost=100

 

%packages --nobase

@core

%end

 

6. 确认三个服务是否正常运行:

service httpd status

service dhcpd status

service xinetd statu

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

猫咪没有Fish

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值