# 安装qemu-kvm
[root@master1 ~]# yum install qemu-kvm
# yum install libvirt libvirt-client virt-install virt-manager
安装时检测到冲突,需要根据报错卸载一些旧软件重新安装:
[root@master1 ~]# yum remove ipa-common ipa-client ipa-client-common
[root@master1 ~]# yum install ipa-common ipa-client ipa-client-common
[root@master1 ~]# rpm -ql libvirt-daemon | grep service
/usr/lib/systemd/system/libvirtd.service
[root@master1 ~]# systemctl start libvirtd.service
/etc/libvirt
[root@master1 ~]# virsh list
Id Name State
----------------------------------------------------
[root@master1 ~]# virt-manager &
[root@master1 ~]# virsh capabilities
[root@master1 ~]# virsh help
只显示一段帮助
[root@master1 ~]# virsh help interface
[root@master1 ~]# virsh iface-bridge eth0 br0 --no-stp
使用附加设备 br0 生成桥接 eth0 失败
已启动桥接接口 br0
需要重启网卡服务,eth0的IP地址才会拆除:
[root@master1 ~]# systemctl restart network
[root@master1 ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000c29a77aec no eth0
[root@master1 ~]# yum install dhcp -y
拷贝配置文件:
[root@master1 ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf -f
配置:
[root@master1 ~]# vim /etc/dhcp/dhcpd.conf
option domain-name "master1.com";
option domain-name-servers 10.201.106.131,8.8.8.8;
default-lease-time 86400;
max-lease-time 86400;
subnet 10.201.106.0 netmask 255.255.255.0 {
range 10.201.106.10 10.201.106.20;
option routers 10.201.106.131;
filename "pxelinux.0";
next-server 10.201.106.131;
}
其他暂时注释掉:
.,$s/^[^#]/#/g
启动服务:
[root@master1 dhcp]# systemctl start dhcpd.service
[root@master1 ~]# yum -y install tftp-server
配置:
安装和启动守护进程:
[root@master1 ~]# yum -y install xinetd
[root@master1 ~]# systemctl start xinetd.service
安装syslinux包
[root@master1 ~]# yum install -y syslinux
将引导文件复制到tftp默认目录
[root@master1 ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
复制光盘里面的isolinux目录下的文件
[root@master1 cdrom]# cp ./images/pxeboot/vmlinuz ./images/pxeboot/initrd.img /var/lib/tftpboot/
[root@master1 isolinux]# cp vesamenu.c32 splash.jpg boot.msg /var/lib/tftpboot/
需要在tftp再创建一个目录
[root@master1 isolinux]# mkdir /var/lib/tftpboot/pxelinux.cfg
复制一个文件并重名为default
[root@master1 cdrom]# cp isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
编辑default文件
[root@master1 ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu title ####### Linux Install Menu #######
label install CentOS6
menu label Install or upgrade CentOS6.6 x86
menu default
kernel vmlinuz
append initrd=initrd.img ks=http://10.201.106.131/ks.cfg
安装制作Kickstart文件的命令
[root@master1 ~]# yum install -y system-config-kickstart
从其它centos6.6系统拷贝已经安装完毕的ks文件二次修改
[root@node3 ~]# scp anaconda-ks.cfg root@10.201.106.131:/root/ks.cfg
编辑另存ks文件
接下来的设置按需设置:
保存:
记得改这个地址
[root@master1 ~]# vim ks.cfg
repo --name="CentOS" --baseurl=http://10.201.106.131 --cost=100
安装开启http:
[root@master1 ~]# yum install -y httpd
注释欢迎页:
[root@master1 ~]# vim /etc/httpd/conf.d/welcome.conf
#<LocationMatch "^/+$">
# Options -Indexes
# ErrorDocument 403 /.noindex.html
#</LocationMatch>
修改默认目录并开启目录浏览权限:
[root@master1 ~]# vim /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/centos6"
<Directory />
Options indexes FollowSymLinks
AllowOverride none
Require all granted
</Directory>
[root@master1 ~]# service httpd start
拷贝光盘所有文件到http目录
[root@master1 ~]# mkdir /var/www/centos6
[root@master1 ~]# mount /dev/cdrom /media/cdrom
[root@master1 ~]# cp -a /media/cdrom/* /var/www/centos6/
复制ks文件到http镜像目录
[root@master1 ~]# cp ks.cfg /var/www/centos6/
[root@master1 ~]# chmod +r /var/www/centos6/ks.cfg
[root@master1 ~]# virt-manager &
创建存储,不要立即分配:
设置桥接:
一些其它配置,按需配置:
IO调整
网卡也可调整成virtio
设置VNC显示:
定义完毕开始安装
等待全自动安装完毕:
原文地址:http://blog.51cto.com/zhongle21/2091012