openstack制作centos6.5镜像
1、创建一个空的镜像文件
[root@KVM-node4 images]# qemu-img create -f qcow2 centos-6.5.qcow2 5G
Formatting 'centos-6.5.qcow2', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off
[root@KVM-node4 images]# ll
总用量 4349172
-rw-r--r-- 1 root root 197120 11月 20 23:56 centos-6.5.qcow2
-rw-r--r-- 1 root root 1044356608 11月 20 11:48 centos-6.7-cloud.qcow2
-rw-r--r-- 1 qemu qemu 3409117184 11月 20 11:43 centos-6.7.qcow2
2、创建虚拟机
[root@KVM-node4 images]# virt-install --name centos-6.5 --ram 1024 --cdrom=/var/www/webvirtmgr/images/CentOS-6.5-x86_64-bin-DVD1.iso --disk path=/var/lib/libvirt/images/centos-6.5.qcow2 --graphics vnc,listen=0.0.0.0 --noautoconsole --os-type=linux --os-variant=rhel6
开始安装......
创建域...... | 0 B 00:00:00
域安装仍在进行。您可以重新连接
到控制台以便完成安装进程。
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
3、系统安装过程
分区只分一个,挂载到“/”,格式为ext4;
不要swap,分区
[root@KVM-node4 images]# virsh list --all
Id 名称 状态
----------------------------------------------------
- centos-6.5 关闭
- centos6.7 关闭
- centos7.2-x86 关闭
[root@KVM-node4 images]# virsh start centos-6.5
域 centos-6.5 已开始
4、配置yum源
centos6.x
cd /etc/yum.repos.d/
\cp CentOS-Base.repo CentOS-Base.repo.$(date +%F)
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
5、防火墙及SELINUX关闭
/etc/init.d/iptables stop
chkconfig iptables off
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
虚拟机上删除网卡配置:
rm -rf /etc/udev/rules.d/70-persistent-net.rules
6、要使nova console-log 能将实例启动过程输出到实例启动日志中,要在文件/boot/grub/menu.lst 中kernel参数中增加下面的内容:
kernel ...(省略n个参数)... console=tty0 console=ttyS0,115200n8
[root@localhost yum.repos.d]# cat /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are
1、创建一个空的镜像文件
[root@KVM-node4 images]# qemu-img create -f qcow2 centos-6.5.qcow2 5G
Formatting 'centos-6.5.qcow2', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off
[root@KVM-node4 images]# ll
总用量 4349172
-rw-r--r-- 1 root root 197120 11月 20 23:56 centos-6.5.qcow2
-rw-r--r-- 1 root root 1044356608 11月 20 11:48 centos-6.7-cloud.qcow2
-rw-r--r-- 1 qemu qemu 3409117184 11月 20 11:43 centos-6.7.qcow2
2、创建虚拟机
[root@KVM-node4 images]# virt-install --name centos-6.5 --ram 1024 --cdrom=/var/www/webvirtmgr/images/CentOS-6.5-x86_64-bin-DVD1.iso --disk path=/var/lib/libvirt/images/centos-6.5.qcow2 --graphics vnc,listen=0.0.0.0 --noautoconsole --os-type=linux --os-variant=rhel6
开始安装......
创建域...... | 0 B 00:00:00
域安装仍在进行。您可以重新连接
到控制台以便完成安装进程。
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
3、系统安装过程
分区只分一个,挂载到“/”,格式为ext4;
不要swap,分区
[root@KVM-node4 images]# virsh list --all
Id 名称 状态
----------------------------------------------------
- centos-6.5 关闭
- centos6.7 关闭
- centos7.2-x86 关闭
[root@KVM-node4 images]# virsh start centos-6.5
域 centos-6.5 已开始
4、配置yum源
centos6.x
cd /etc/yum.repos.d/
\cp CentOS-Base.repo CentOS-Base.repo.$(date +%F)
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
5、防火墙及SELINUX关闭
/etc/init.d/iptables stop
chkconfig iptables off
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
虚拟机上删除网卡配置:
rm -rf /etc/udev/rules.d/70-persistent-net.rules
6、要使nova console-log 能将实例启动过程输出到实例启动日志中,要在文件/boot/grub/menu.lst 中kernel参数中增加下面的内容:
kernel ...(省略n个参数)... console=tty0 console=ttyS0,115200n8
[root@localhost yum.repos.d]# cat /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are