码迷,mamicode.com
首页 > Web开发 > 详细

CentOS 7 DHCP+PXE+Apache+Kickstart 自动安装

时间:2015-09-25 03:58:56      阅读:352      评论:0      收藏:0      [点我收藏+]

标签:kickstart

关闭selinux,关闭防火墙,配置网络

getenforce
setenforce 0
vi /etc/selinux/config
systemctl stop firewalld.service
systemctl disable firewalld.serivce


挂载光盘,备份文件,创建repo文件,清除和重建缓存

mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
mkdir /etc/yum.repos.d/backup/
mv /etc/yum.repos.d/*.* /etc/yum.repos.d/backup/
vi /etc/yum.repos.d/cdrom.repo
[base]
name=cdrom
baseurl=file:///mnt/cdrom
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
yum clean all
yum update


如果用阿里云repo

vi /etc/yum.repos.d/aliyun.repo
[base]
name=aliyun
baseurl=http://mirrors.aliyun.com/centos/7/os/x86_64/
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


安装GNOME桌面

yum groupinstall ‘GNOME Desktop‘

启动桌面

startx #刚装完需要exit再登录


安装httpd,新建http安装源目录,复制光盘上的文件

yum install httpd
mkdir /var/www/html/cdrom
cp -rf /mnt/cdrom/* /var/www/html/cdrom
systemctl enable httpd.service
systemctl restart httpd.service


安装dhcp,编辑dhcpd.conf文件

yum install dhcp
vi /etc/dhcp/dhcpd.conf
ddns-update-style interim; 
ignore client-updates; 
filename "pxelinux.0";
next-server 192.168.1.100;
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers 192.168.1.1; 
        option subnet-mask 255.255.255.0;
        range dynamic-bootp 192.168.1.90 192.168.111.99; 
        default-lease-time 21600; 
        max-lease-time 43200;
}
systemctl enable dhcpd.service
systemctl restart dhcpd.service


安装tftp-server,将disable=yes改为no

yum install tftp-server
vi /etc/xinetd.d/tftp
systemctl enable xinetd.service
systemctl restart xinetd.service


查看服务和端口状态

netstat -ntulp


安装syslinux,复制pxelinux.0文件,复制isolinux.cfg文件改名为default,修改default,复制

initrd.img,vmlinuz,boot.msg
yum install syslinux
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
cp /var/www/html/cdrom/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/
cp /var/www/html/cdrom/isolinux/boot.msg /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg/
cp /var/www/html/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
vi /var/lib/tftpboot/pxelinux.cfg/default
default ks
prompt 1
timeout 60
display boot.msg
label ks 
  kernel vmlinuz 
  append ks=http://192.168.1.100/ks.cfg initrd=initrd.img

安装kickstart,保存到/var/www/html/ks.cfg

yum install system-config-kickstart
system-config-kickstart

ks.cfg末尾添加

%packages
@core
%end

注意,用来测试自动安装的虚拟机CPU要至少4核,RAM要至少2G,否则会在starting package installation process步骤停止响应

CentOS 7 DHCP+PXE+Apache+Kickstart 自动安装

标签:kickstart

原文地址:http://eafan.blog.51cto.com/382462/1698020

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!