8、手动创建Openstack Centos虚拟机
1、安装环境
yum install -y qemu-kvm libvirt yum install -y virt-install systemctl enable libvirtd systemctl start libvirtd
2、创建一个虚拟机磁盘
qemu-img create -f qcow2 /tmp/centos7.2.qcow2 10G
3、安装一台虚拟机
virt-install --virt-type kvm --name centos --ram 1024 \ --disk /tmp/centos7.2.qcow2,format=qcow2 \ --network network=default \ --graphics vnc,listen=0.0.0.0 --noautoconsole \ --os-type=linux --os-variant=centos7.0 \ --location=/tmp/CentOS-7-x86_64-DVD-1511.iso
4、启动
virsh list --all virsh start centos7.2
5、安装默认需要的软件
net-tools tree scree wget git vim salt-minion zabbix-agent lrzsz
6、修改网卡
TYPE=Ethernet BOOTPROTO=dhcp IPV4_FAILURE_FATAL=no NAME=eth0 DEVICE=eth0 ONBOOT=yes
7、关闭防火墙、NetworkManager、selinux、postfix
systemctl stop firewalld systemctl disable firewalld systemctl stop NetworkManager systemctl disable NetworkManager systemctl stop postfix systemctl disable postfix vim /etc/sysconfig/ SELINUX=disable
8、上传开启配置脚本
scp init-v1.sh 192.168.122.221:/tmp
9、编辑脚本
echo "GATEWAY=192.168.90.1" >> $NET_FILE
10、拷贝rc.local文件
cp /etc/rc.d/rc.local /tmp
11、设置开机启动并赋予执行权限
vim /etc/rc.local
/bin/bash /tmp/init-v1.sh
chmod +x /tmp/init-v1.sh chomod +x /etc/rc.d/rc.local
12、关机上传镜像到glance
openstack image create "CentOS-7.4-x86_64" \ --file /tmp/centos7.4.qcow2 \ --disk-format qcow2 --container-format bare \ --public
13、在控制台选择镜像创建虚拟机
浙公网安备 33010602011771号