OpenStack one-click deployment and installation
Openstack
Environmental preparation
Basic conditions: CentOS or Redhat bare metal, more than 16G memory, and self-installation of basic toolkits (net-tools, vim, etc.)
Configure physical machine YUM source (please use the most complete warehouse provided by the government)
TIPS: all the previous steps are prepared for the environment. For specific installation steps, please see the last section of this blog.
Build KVM platform
Yum-y install qemu-kvm\ > libvirt-client\ > livbirt-daemon\ > libvirt-daemon-driver-qemusystemctl restart libvirtd
Physical machine: adding a virtual network card
Vim / etc/libvirt/qemu/network/vbr.xml vbr virsh net-define vbr.xml # # create virtual network virsh net-start vbr # # launch virtual network virsh net-autostart vbr # # set vbr virtual network boot self-boot virsh net-list # # View virtual network
Physical machine: build FTP service (guarantee file transfer with virtual machine)
Yum-y install vsftpdvim / etc/vsftpd/vsftpd.conf listen=YES listen_ipv6=NOsystemctl start vsftpdsystemctl enable vsftpd
Physical machines: building DNS and NTP services
Yum-y install bind-chrootvim / etc/named.conf listen-on port 53 {192.168.1.254; allow-query {any;}; forwarders {202.106.196.115;}; dnssec-enable no; dnssec-validation no;systemctl restart namedyum-y install chronyvim / etc/chrony.conf server ntp1.aliyun.com iburst bindacqaddress 0.0.0.0 allow 0/0systemctl restart chronydchronyc sources-v
Virtual machine openstack,nova:
Yum-y install chronyvim / etc/chrony.conf server 192.168.1.254 iburstsystemctl restart chronydchronyc sources-v
Create a backend template virtual machine
Qemu-img create-f qcow2 node.qcow2 8G # # create a back-end disk and create a virtual machine using the back-end disk in virt-manager The details are as follows: select network installation-- > URL: ftp://176.204.xx.xx/centos-->RAM: 2048MiB CPU: 2mura-> Select or create custom storage / var/lib/libvirt/images/node.qcow2-- > select network virtual network 'vbr':NAT-- > minimize partition Minimal Install-- > close KUDMP-- > select manual partition I will configure partitioning-- > New mount points will use the following Partitioning scheme: Standard Partition Select / set root password And wait for the installation to complete.
Enter the backend template virtual machine:
Vim / etc/selinux/config # # disable selinuxcd / etc/yum.repos.d/rm-f * vi centos.repo [local_source] name=centos baseurl= ftp://192.168.1.254/centos enabled=1 gpgcheck=0yum repolistyum-y install vim net-tools
Uninstall Firewall and NetworkManager
Yum-y remove firewalld-*yum-y remove python-firewallvim / etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 ONBOOT=yes IPV6INIT=no TYPE=Ethernet BOOTPROTO=dhcpyum-y remove NetworkManager-*systemctl stop NetworkManagersystemctl restart networkip route show # # will see an empty route, which will have some impact on vim / etc/sysconfig/network NOZEROCONF=yes # # add this line, disable empty route systemctl restart networkip route show
Import gpg key
Yum-y install lftpvim / etc/yum.repos.d/centos.repo gpgcheck=1 # # modify only the line lftp 192.168.1.254/centos > get RPM-GPG-KEY-CentOS7 > byerpm-- import RPM-GPG-KEY-CentOS7yum-y install psmisc # # verify whether the software can be installed after importing KEY
Open the serial terminal to make it easy to connect with virsh console
Vim / etc/sysconfig/grub GRUB_CMDLINE_LINUX= "biosdevname=0 net.ifnames=0 console=ttyS0,115200n8" GRUB_DISABLE_LINUX_UUID= "true" GRUB_ENABLE_LINUX_LABEL= "true" grub2-mkconfig-o / boot/grub2/grub.cfg # # regenerate grub.cfgvim / etc/fstab # # modify UUID to / dev/vda1
Install partition extension software (execute when there is a need for capacity expansion)
Yum-y install cloud-utils-growpartshutdown physical machine: virt-sysprep-d node # # performs information cleaning
Quickly create a virtual machine
Cancel the definition of virsh undefine node # # to ensure that the backend template is read-only cd / var/lib/libvirt/images/qemu-img create-f qcow2-b node.qcow2 node1.img 30Gsed's node.qcow2 node1.img 30Gsed's NodeReclamation NodeJournal'/ root/node.xml > / etc/libvirtd/qemu/node1.xmlvirsh define / etc/libvirtd/qemu/node1.xmlvirsh start node1
Add a new network card and device
Virsh console node1ip link showCtrl +] # # exit the virtual machine Enter the physical machine virsh edit node1 # # add 4 lines of poweroff-p virsh start-- console node1ip link showifconfig-acd / etc/sysconfig/network-scripts/cp ifcfg-eth0 ifcfg-eth2vim ifcfg-eth2 DEVICE=eth2 ONBOOT=yes IPV6INIT=yes TYPE=Ethernet BOOTPROTO=static IPADDR=192.168.4.100 PREFIX=24systemctl restart network after the first one
Physical machine: add a hard disk to the virtual machine node1
Qemu-img create-f qcow2 disk.img 20Gvirsh edit node1 halt-pvirsh start node1lsblk
The way the back-end disk is modified offline (do not need operation, need to be careful)
# # Note: after modifying the back-end disk, all front-end disks will fail guestmount-a / var/lib/libvirt/images/node.qcow2-I / mnt/ # #-a specify the location of the image-I specify an empty directory chroot / mnt/cd / mnt/umount / mnt
Remember: there can only be one gateway per machine!
Configure the gateway to 192.168.1.254 at / etc/sysconfig/network-scripts/ifcfg-eth0
Enable private1 to access the Internet
Physical machine:
Virsh net-edit private1
Virtual machine openstack:
Create openstack storage volum
Yum-y install lvm2vgcreate cinder-volumes / dev/vdb
Modify the gpgcheck=1 of the centos1708YUM source and import the public key
Rpm-- import RPM-GPG-KEY-CentOS-7yum-y install qemu-kvm\ > libvirt-client\ > livbirt-daemon\ > libvirt-daemon-driver-qemu\ > python-setuptools
Final environmental testing
Sestatus # # check SELinux status and disable rpm-qa | grep firewall # # check whether firewall rpm-qa has been uninstalled | grep NetworkManager # # check whether NetworkManagerping 192.168.4.xx has been uninstalled # # check whether ip is correct yum repolist # # check YUM source vgs # # check whether there is a cinder-volumes volume group gpgcheck=1 # # check whether the gpgcheck=1virsh of the first system source has been modified # # check whether the KVM platform has been built successfully # # Note Meaning: all ip needs to be changed to static IP. Cancel DHCP service # # both virtual machines must meet the above configuration: the first modified hostname is openstack with 8GB of memory The second modified host name is nova, and 6 GB of memory starts to install openstack.
Virtual machine openstack:
Yum-y install openstack-packstackpackstack-- gen-answer-file answer.ini # # ini file has its own color Easy to find errors vim answer.ini # # modify the answer file CONFIG_DEFAULT_PASSWORD=Taren1 # # Line 11 CONFIG_CINDER_INSTALL=n # # Line 25 uses local hard disk storage Shared storage CONFIG_SWIFT_INSTALL=n # # line 42 CONFIG_NTP_SERVERS=192.168.1.254 # # line 75 CONFIG_CINDER_VOLUMES_CREATE=n # # line 554 CONFIG_NEUTRON_ML2_TYPE_DRIVERS=flat is not applicable Vxlan # # 840 line CONFIG_NEUTRON_ML2_VXLAN_GROUP=239.1.1.5 # # 876 line CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-ex # # 910 line CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth0 # # 921 line CONFIG_NEUTRON_OVS_TUNNEL_IF=eth2 # # Line 936 CONFIG_PROVISION_DEMO=n # # Line 1179 packstack-answer-file answer.ini
After the openstack installation is complete
Vim / etc/httpd/conf.d/15-horizon_vhost.conf WSGIApplicationGroup% {GLOBAL} # # add this line apachectl graceful in the virtual machine home directory: cat ~ / keystonerc_admin # # View password physical machine: firefox 192.168.1.100 # # visit dashboard through the browser, you can see the login page