This article describes how to create OpenStack images, including preparing the basic environment and creating images for common types of operating systems. Allows you to install an operating system from scratch and customize OpenStack images.

Nugget Community: Customizing OpenStack Images | tutorial series

Customizing OpenStack images | Environment preparation Customizing OpenStack images | Windows7 Customizing OpenStack images | Windows10 Customizing OpenStack images | Linux Customize an OpenStack image | Windows Server2019


CSDN: OpenStack Image Creation Tutorial guide (full)


I. System environment preparation

1. Host description

  • Host: Windows10
  • Vm: CentOS7 in VMwareWorkstation Pro, Ubuntu16.04 in VMwareWorkstation Pro
  • Image download

Download centos-7-x86_64-DVD-1908. iso download Ubuntu 16.04

  • Download the VirtIO driver

archive-virtio

virtio-win

virtio-win README

This location, and the isos that were hosted here, are now deprecated.

virtio-win builds are now distributed in a new location with a new iso file layout. A yum repo is also provided. More info here:

Fedoraproject.org/wiki/Window…

Links to the new equivalent of the old stable/ and latest/ directories are listed here:

Fedoraproject.org/wiki/Window…

If you need access to the old isos that were hosted here, there’s a mirror at:

Fedorapeople.org/groups/virt…

Only use them if you need to maintain backwards compatability. No new isos will be added here.

2. Simple configuration

Common configuration requirements after the system installation, such as vim, SSH, sudo, and source

(1) CentOS example

vim /etc/sudoers

chmod +w /etc/sudoers

vim /etc/sudoers

chmod -w /etc/sudoers

vim /etc/vimrc 

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum makecache  history
Copy the code

(2) The Ubuntu example is not described here, note the update software source.

3. Check whether virtualization is supported. Turn on virtualization

For dedicated servers, enter the BIOS to ensure that CPU virtualization is enabled. After entering the system, run egrep to check whether virtualization is supported:

grep "flags" /proc/cpuinfo
Copy the code

or

egrep -s "(vmx|svm)" /proc/cpuinfo
Copy the code

Note:

If yes, virtualization is supported. If VMX is displayed in the output, full virtualization is supported. If SVM is displayed, it indicates that THE AMD processor supports virtualization. CPU virtualization must be enabled when vmware Workstation installs the KVM. Set parameters on the BIOS interface.

If the VMware VIRTUAL mechanism is used as a KVM VM, ensure that CPU virtualization is enabled on the VMware physical machine first, and then set the VMware VM virtualization engine in the VMware.

 

2. Install the ubuntu host software environment

1. Install KVM VM tools:

sudo apt-get update

sudo apt-get install --no-install-recommends qemu-kvm qemu-utils libvirt-bin virtinst cpu-checker virt-manager virt-viewer -y
Copy the code

2. You need to download the VirtIO driver for openstack.

Download link: archive-virtio

Note: this link is the official download address of all existing virtio drivers. Foreign sites are slow to download. You are advised to download multiple driver versions in case that some driver versions are incompatible with the VM system.

3. Modify the configuration

(1) Modify the CONFIGURATION file of the VNC server

vim /etc/libvirt/qemu.conf  
Copy the code

In line 12, remove the # before vnc_LISTEN.

# vnc_listen = "0.0.0.0"
Copy the code

Wq Saves the configuration and exits.

3. Install the CentOS host software environment

1. Install the KVM

(1) Install the KVM on the new machine

Select a virtual package and select the KVM package when installing the OPERATING system

(2) Install the KVM on an existing machine

① Install KVM and other virtualization management software packages

yum install -y kvm virt-* libvirt bridge-utils qemu-img \
libguestfs-tools 

yum install virt-manager virt-viewer virt-install.noarch
Copy the code

Software Package Name:

Kvm: The software package contains the Kvm kernel module, which provides the Kvm hypervisor in the default Linux kernel

Libvirts: installs the VM management tool and uses commands such as virsh to manage and control VMS.

Bridge-utils: sets the network adapter Bridge.

Virt-*: commands for creating and cloning virtual machines, and the graphical management tool virt-manager

Qemu-img: installs the Qemu component and uses the Qemu command to create disks.

② Load the KVM module and check whether the KVM module is loaded

[root@centos centos]# modprobe kvm-intel

[root@centos centos]# lsmod | grep kvm kvm_intel             

188644  0  kvm        621480  1 kvm_intel irqbypass              13503  1 kvm

[root@centos centos]#
Copy the code

③ Restart To check whether the KVM is loaded

[root@centos centos]# reboot

[root@centos centos]# lsmod | grep kvm kvm_intel            

188644  0  kvm                   621480  1 kvm_intel irqbypass              13503  1 kvm

[root@centos centos]#
Copy the code

2. You need to download the VirtIO driver for openstack.

Download link: VirtIO driver

Note: this link is the official download address of all existing virtio drivers. Foreign sites are slow to download. You are advised to download multiple driver versions in case that some driver versions are incompatible with the VM system.

3. Configure the KVM

(1) Disable iptables firewall and selinux

Close the iptables

[root@centos init.d]# systemctl stop firewalld.service [root@centos init.d]# systemctl disable firewalld.service Removed  symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. [root@centos init.d]# systemctl disable iptables.service [root@centos init.d]# service iptables stop Redirecting to /bin/systemctl stop iptables.service [root@centos init.d]#Copy the code

Close the selinux

[root@centos init.d]# vim /etc/sysconfig/selinux

[root@centos init.d]# setenforce 0
Copy the code

4. Modify the CONFIGURATION file of the VNC server

In line 12, remove the # before vnc_LISTEN.

[root@LINUX ~]# vim /etc/libvirt/qemu.conf

------
vnc_listen = "0.0.0.0"  
------

Copy the code

At this point, the environment for both Linux platforms is ready. Subsequent articles in this series will operate on the Ubuntu platform.