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)
Please refer to previous articles to omit some of the preceding steps.
One, Ubuntu image production
Ubuntu image is made by VMDK file conversion.
For Centos and Ubuntu images on the OpenStack platform, you can use VMware to create VMS, configure network configuration files and APT sources on the VMS, and then convert them.
1. Create precautions
(1) When creating a VM, note the following: If you do not set the size of the hard disk, the single file of the hard disk, and the configuration file of the NETWORK interface card (NIC), the VM may fail to start in openstack.
(2) Format conversion
Convert the VMDK format of the VMware VM to the Qcow2 format
Reference links:
Convert a vmware VMDK VM to the Qcow2 format. Convert a vmware VM to the qcow2 and RAW formats
2. Installation in the environment
apt-get install dnsmasq libvirt-daemon-system qemu-kvm qemu-utils virt-manager -y
Copy the code
3. Format conversion
qemu-img convert -f vmdk -O qcow2 ubuntu1604.vmdk ubuntu1604.qcow2
Copy the code
4. Upload glance
source /openstack/admin-openrc.sh
glance image-create --name "ubuntu1604" --file ./ubuntu1604.qcow2 --disk-format qcow2 --container-format bare --visibility public --progress
Copy the code
2. Centos image production
The steps are similar to the first one, Ubuntu image production, omit, the command used is recorded as follows:
qemu-img create -f qcow2 -o preallocation=metadata Centos7.qcow2 16G virt-install --connect qemu:///system -n centos --vcpus=1 -r 1024 \ --disk path=/home/ubuntu/image_create/Centos7.qcow2,format=qcow2,device=disk,size=16,bus=virtio,cache=none \ --disk Path =/home/ubuntu/image_create/iso/ centos-7-x86_64-minimal-2003. iso,device=cdrom,perms=rw \ -- VNC --vnclisten=0.0.0.0 \ -- OS-variant = CENtos7.0 \ --accelerate --network=default,model=virtio \ --disk Path = / home/ubuntu/image_create/virtio/virtio - win - 0.1.173. Iso, device = cdrom, perms = rw \ --disk=/home/ubuntu/image_create/virtio/virtio-win-0.1.173_amd64. VFD,device=floppy qemu-img convert -o qcow2 Centos7.qcow2 CentOS-7-x86_64-Minimal2003_16G.qcow2Copy the code
Additional view os-Variant type
Third, KaliLinux image production
1. Create a hard disk
qemu-img create -f qcow2 kali.qcow2 64G
qemu-img info kali.qcow2
Copy the code
2. Start making
Virt - install - virt -type KVM - name kali - ram 1024 \ - cdrom = / home/ubuntu Desktop/ops/kali - Linux - 2019.3 - amd64. Iso \ - disk/home/ubuntu Desktop/ops/kali qcow2 - network network = default \ - graphics VNC, listen = 0.0.0.0 \ - noautoconsole \ --os-type=linux \ --os-variant=debianwheezyCopy the code
Note: System type Linux, derivative should be debianwheezy, version may be updated. Linux Basic tool (virt-install — OS-variant)
3. Check the status
virsh list
Copy the code
ifconfig br0
Copy the code
virsh vncdisplay 1
Copy the code
4. Log in to the VM using VNC Viewer
Open the VNC Viewer software
Input: 192.168.177.130:0
Press the button to select Graphical Installation to start the installation process. If the keyboard input is invalid when you use the VNC software, switch the Sogou input method back to the default input method.
After the installation is complete, the system automatically restarts. Enter administration.
virsh list --all
history | grep start
virsh start kali
ll -lh
virsh list --all
virsh vncdisplay 2
Copy the code
192.168.177.130:0
At this point, the common Linux distribution method is over.