In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you Centos how to make Openstack virtual machine image, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!
First, create an image of Centos-7.2 1, create an img file # virsh vol-create-as lv3 Centos7.img 50g-- format qcow2
Vol Centos7.img created
If you choose qcow2 format here, the created img will be smaller, and it will be about 1.2g after successful configuration; if it is in raw format, the img created will be about 51g.
2. Create a virtual machine # virt-install-connect qemu:///system-n Centos7-r 4096-f / vg0_lv3/Centos7.img-- vnc-- vcpus=2-- network bridge=br0-c / vg0_lv1/openstack-image/CentOS-7-x86_64-Everything-1511.iso
Starting install...
Creating domain... | | 0B 00:00 |
Cannot open display:
Run 'virt-viewer-- help' to see a full list of available command line options
Domain installation still in progress. You can reconnect to
The console to complete the installation process.
Connect to vnc, graphical interface to install the centos7.2 system, select minimize installation, the system installation before continuing with the following steps.
3. Temporarily assign the Ip address to the virtual machine and connect to the public network 4, start the acpid service # yum install acpid# systemctl enable acpid5, and configure cloud-init# yum install http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-7.noarch.rpm# yum install cloud-init
Modify configuration
# vi / etc/cloud/cloud.cfg
Users: root
6. Disable zeroconf routing # echo "NOZEROCONF=yes" > / etc/sysconfig/network7, configure console
Delete rhgb quiet and add console=tty0console=ttyS0,115200n8
# vi / etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR= "$(sed's, release. * $, g' / etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT= "console"
GRUB_CMDLINE_LINUX= "crashkernel=auto rd.lvm.lv=centos/root console=tty0 console=ttyS0,115200n8"
GRUB_DISABLE_RECOVERY= "true"
Let the configuration take effect
# grub2-mkconfig-o / boot/grub2/grub.cfg
Generating grub configuration file...
Found linux image: / boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: / boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: / boot/vmlinuz-0-rescue-8ad37cd5879289675a6517371665929a
Found initrd image: / boot/initramfs-0-rescue-8ad37cd5879289675a6517371665929a.img
Done
8. Delete Nic configuration information
Delete mac information and UUID
# cd / etc/sysconfig/network-scripts/# vi ifcfg-ens3
BOOTPROTO=dhcp
ONBOOT=yes
9. Shut down virtual machine # shutdown-h now10, upload image # source ~ / admin-openrc.sh # openstack image create "Centos-7.2-init"\-- file / data/Centos-7.2-init.img\-- disk-format qcow2-- container-format bare\-- public
11. Create a CVM and view the log
2. Create a Centos-6.6 image
Note:
After the virtual machine is created, it is best to take a snapshot of the virtual machine before modifying the configuration
When creating a centos6.6 image, installing cloud-init to obtain the public key may result in a failure to connect to the virtual machine, so it is best to omit step 5.
1. Create the img file # virsh vol-create-as lv3 Centos6.6.img 50g-- format qcow2
2. Create a virtual machine
# virt-install-- connect qemu:///system-n Centos6.6-r 4096-f Centos6.6.img-- vnc-- vcpus=2-- network bridge=br0-c / vg0_lv1/CentOS-6.6-x86_64-bin-DVD1.iso
Starting install...
Creating domain... | | 0B 00:00 |
Cannot open display:
Run 'virt-viewer-- help' to see a full list of available command line options
Domain installation still in progress. You can reconnect to
The console to complete the installation process.
Connect vnc, graphical interface to install the centos6.6 system, the system installation before continuing with the following steps.
3. Temporarily assign an Ip address to the virtual machine and connect to the external network
4. Install the ACPI service
In order for the virtualization layer to restart and shut down the virtual machine, the acpid service must be installed and running within the virtual machine.
Run the following command within the CentOS virtual machine to install the ACPI service and configure it to start automatically when the system starts.
# yum install acpid # chkconfig acpid on5, use cloud-init to obtain the public key
Installing cloud-init may result in a failure to connect to the virtual machine, so it is best not to do this step, waiting for further study.
The cloud-init package automatically obtains the public key from the metadata service and saves it to the account. You can add the EPEL installation source to the CentOS virtual machine to install the cloud-init package. I found that other built-in yum sources can be installed, not necessarily the epel source.
# yum install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm# yum install cloud-init modify configuration, add root user # vi / etc/cloud/cloud.cfgusers: root6, disable zeroconf routing
For virtual machines to access metadata services, zeroconf routing must be disabled:
# echo "NOZEROCONF=yes" > > / etc/sysconfig/network7, configure console
For the nova console-log command to take effect on CentOS 6.x, you need to add the following text to the / boot/grub/menu.lst file:
Add console=tty0 console=ttyS0,115200n8# vi / boot/grub/menu.lst at the end of kernel
8. Clean up the mac address information. The final Nic configuration information is as follows.
# cat / etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0TYPE=EthernetONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=dhcp
Delete the file that records the MAC address of the network card
# cd / etc/udev/rules.d/# rm-f 70-persistent-net.rules
9. Shut down the virtual machine
# shutdown-h now
10. Upload image
# source ~ / admin-openrc.sh # openstack image create "Centos-6.6-init-cloud"\-file / data/Centos-6.6-init-cloud.img\-- disk-format qcow2-- container-format bare\-- public
11. Create a CVM and check the log
These are all the contents of the article "how to make an Openstack virtual machine image by Centos". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.