云计算
系统环境 VMware workstation
系统 CentOS-7-x86_64-DVD-1810
以下需注意:本文由多篇博客组成,作者为了防止忘记而记录,途中有些有误地方,比如10.10.10.0/24网段的,应该改成10.1.1.0/24网段,为了节省时间,部分图取决于https://www.linuxprobe.com/chapter-22.html
安装前需要修改 /etc/hosts文件,添加 127.0.0.1 op.sealin.top(op.sealin.top为当前机器名)
# yum install -y http://rdo.fedorapeople.org/rdo-release.rpm
# yum install -y openstack-packstack
# packstack –allinone //在执行此处报错,一个是关于NetworkManager,关闭即可,但执行到control.pp报错,后来把demo模块关闭即可,命令如下:
# packstack –allinone –provision-demo=n
Welcome to Installer setup utility
Installing:
Clean Up [ DONE ]
Setting up ssh keys [ DONE ]
Discovering hosts\’ details [ DONE ]
Adding pre install manifest entries [ DONE ]
Preparing servers [ DONE ]
Adding AMQP manifest entries [ DONE ]
Adding mysql manifest entries [ DONE ]
Adding Keystone manifest entries [ DONE ]
Adding Glance Keystone manifest entries [ DONE ]
Adding Glance manifest entries [ DONE ]
Adding Cinder Keystone manifest entries [ DONE ]
Adding Cinder manifest entries [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Adding Nova API manifest entries [ DONE ]
Adding Nova Keystone manifest entries [ DONE ]
Adding Nova Cert manifest entries [ DONE ]
Adding Nova Conductor manifest entries [ DONE ]
Creating ssh keys for Nova migration [ DONE ]
Gathering ssh host keys for Nova migration [ DONE ]
Adding Nova Compute manifest entries [ DONE ]
Adding Nova Scheduler manifest entries [ DONE ]
Adding Nova VNC Proxy manifest entries [ DONE ]
Adding Openstack Network-related Nova manifest entries[ DONE ]
Adding Nova Common manifest entries [ DONE ]
Adding Neutron API manifest entries [ DONE ]
Adding Neutron Keystone manifest entries [ DONE ]
Adding Neutron L3 manifest entries [ DONE ]
Adding Neutron L2 Agent manifest entries [ DONE ]
Adding Neutron DHCP Agent manifest entries [ DONE ]
Adding Neutron LBaaS Agent manifest entries [ DONE ]
Adding Neutron Metering Agent manifest entries [ DONE ]
Adding Neutron Metadata Agent manifest entries [ DONE ]
Checking if NetworkManager is enabled and running [ DONE ]
Adding OpenStack Client manifest entries [ DONE ]
Adding Horizon manifest entries [ DONE ]
Adding Swift Keystone manifest entries [ DONE ]
Adding Swift builder manifest entries [ DONE ]
Adding Swift proxy manifest entries [ DONE ]
Adding Swift storage manifest entries [ DONE ]
Adding Swift common manifest entries [ DONE ]
Adding Provisioning Demo manifest entries [ DONE ]
Adding MongoDB manifest entries [ DONE ]
Adding Ceilometer manifest entries [ DONE ]
Adding Ceilometer Keystone manifest entries [ DONE ]
Adding Nagios server manifest entries [ DONE ]
Adding Nagios host manifest entries [ DONE ]
Adding post install manifest entries [ DONE ]
Installing Dependencies [ DONE ]
Copying Puppet modules and manifests [ DONE ]
Applying 192.168.1.105_prescript.pp
192.168.1.105_prescript.pp: [ DONE ]
Applying 192.168.1.105_amqp.pp
Applying 192.168.1.105_Mysql.pp
192.168.1.105_amqp.pp: [ DONE ]
192.168.1.105_MYSQL.pp: [ DONE ]
Applying 192.168.1.105_keystone.pp
Applying 192.168.1.105_glance.pp
Applying 192.168.1.105_cinder.pp
192.168.1.105_keystone.pp: [ DONE ]
192.168.1.105_glance.pp: [ DONE ]
192.168.1.105_cinder.pp: [ DONE ]
Applying 192.168.1.105_api_nova.pp
192.168.1.105_api_nova.pp: [ DONE ]
Applying 192.168.1.105_nova.pp
192.168.1.105_nova.pp: [ DONE ]
Applying 192.168.1.105_neutron.pp
192.168.1.105_neutron.pp: [ DONE ]
Applying 192.168.1.105_neutron_fwaas.pp
Applying 192.168.1.105_osclient.pp
Applying 192.168.1.105_horizon.pp
192.168.1.105_neutron_fwaas.pp: [ DONE ]
192.168.1.105_osclient.pp: [ DONE ]
192.168.1.105_horizon.pp: [ DONE ]
Applying 192.168.1.105_ring_swift.pp
192.168.1.105_ring_swift.pp: [ DONE ]
Applying 192.168.1.105_swift.pp
Applying 192.168.1.105_provision_demo.pp
192.168.1.105_swift.pp: [ DONE ]
192.168.1.105_provision_demo.pp: [ DONE ]
Applying 192.168.1.105_mongodb.pp
192.168.1.105_mongodb.pp: [ DONE ]
Applying 192.168.1.105_ceilometer.pp
Applying 192.168.1.105_nagios.pp
Applying 192.168.1.105_nagios_nrpe.pp
192.168.1.105_ceilometer.pp: [ DONE ]
192.168.1.105_nagios.pp: [ DONE ]
192.168.1.105_nagios_nrpe.pp: [ DONE ]
Applying 192.168.1.105_postscript.pp
192.168.1.105_postscript.pp: [ DONE ]
Applying Puppet manifests [ DONE ]
Finalizing [ DONE ]
**** Installation completed successfully******
Additional information:
irectory.
。。。。。
创建云平台的网卡配置文件: [root@op ~]# DEVICE=br-ex IPADDR=192.168.3.91 NETMASK=255.255.255.0 BOOTPROTO=static dns1=192.168.3.1 GATEWAY=192.168.3.1 BROADCAST=192.168.3.254 NM_CONTROLLED=no DEFROUTE=yes IPV4_FAILURE_FATAL=yes IPV6INIT=no ONBOOT=yes DEVICETYPE=ovs TYPE=OVSIntPort OVS_BRIDGE=br-ex 修改网卡参数信息为: [root@openstack ~]# DEVICE=ens33 ONBOOT=yes TYPE=OVSPort DEVICETYPE=ovs OVS_BRIDGE=br-ex NM_CONTROLLED=no IPV6INIT=no 将网卡设备添加到OVS网络中: [root@openstack ~]# [root@openstack ~]# 55501ff1-856c-46f1-8a00-5c61e48bb64d Bridge br-ex Port br-ex Interface br-ex type: internal Bridge br-int fail_mode: secure Port br-int Interface br-int type: internal Port patch-tun Interface patch-tun type: patch options: {peer=patch-int} Bridge br-tun Port patch-int Interface patch-int type: patch options: {peer=patch-tun} Port br-tun Interface br-tun type: internal ovs_version: 2.1.3 重启系统让网络设备同步: [root@op ~]# reboot
//登陆平台http://192.168.3.91/dashboard
查看密码
# cat /root/keystonerc_admin
export OS_USERNAME=admin
export OS_TENANT_NAME=admin
export OS_PASSWORD=3b63bde2721349d0
export OS_AUTH_URL=http://192.168.1.105:5000/v2.0/
Openstack创建网络:
点击创建子网:
子网详情:
创建私有网络
增加路由信息
填写路由名称:
设置路由的网关信息:
设置网关:
在网络拓扑中添加接口:
添加接口信息:
openstack安装windown系统
原理,通过kvm安装好,然后上传到openstack,网上大多数都是以这种方式安装,但是要先下载virtio的驱动,网上搜一下就有了
virt-install –connect qemu:///system –name win7 –ram 4080 –vcpus 2 –network=default,model=virtio –disk path=/tmp/win7.qcow2,format=qcow2,device=disk,bus=virtio –cdrom /tmp/win7.iso –disk path=/tmp/virtio-win-0.1.160.iso,device=cdrom –graphics spice,listen=0.0.0.0 –boot cdrom
在此遇到两个问题,一个是无法读取cdrom,原因是win7.iso和win-0.1.160.iso的设备名称颠倒,把win7.iso设为hda,win-0.1.160.iso设为hdb即可。另一个是卡在start windows ,起初据网上说把 –video 值改为cirrus,但毫无作用,后来才发现是仿真机的问题,由于我的环境是vmware所以仿真机要改
virsh destroy win7 停止win7
vi /etc/libvirt/qemu/win7.xml
dev选项互换即可,途中已经互换
virsh define /etc/libvirt/qemu/win7.xml
virsh destroy win7 && virsh start win7
进入系统正常驱动viostor对应的驱动,一开始我还以为是vioscsi,还以为驱动不行,之后就可以正常安装了,安装完还要再装其他驱动,比如网卡,显卡等
这时候就大功告成了,我们成功的制作了一个qcow2的镜像。接下来部署到glance上去
glance image-create –name windows7 –file home/house/windows7.qcow2 –disk-format qcow2 –container-format bare –visibility public –progress
错误:you must provide a username via either –os-username or env[OS_USERNAME]
由于我之前改了密码
解决办法 在root用户下执行如下命令
source keystonerc_admin
再执行上传命令
完成后就可以在openstack平台看到该镜像,然后就可以开始创建虚拟机了