Original link: http://www.cnblogs.com/CloudMan6/p/6397360.html
The instance of OpenStack is deployed through glance mirroring, so preparing mirroring is a must. This section describes how to make a Linux image, followed by a discussion of Windows mirroring. Download Clould Mirrors
The easiest way to do this is to use standard mirrors. Mainstream Linux distributions provide cloud mirrors that can be used directly in OpenStack, download addresses:
centos6:http://cloud.centos.org/centos/6/images/
centos7:http://cloud.centos.org/centos/7/images/
ubuntu14.04:http://cloud-images.ubuntu.com/trusty/current/
ubuntu16.04:http://cloud-images.ubuntu.com/xenial/current/
The following example shows how to import a standard mirror into glance Ubuntu16.04. Creating glance Mirrors
Login OpenStack to open the project->compute-> mirroring menu.
Click the "Create Mirror" button.
Fill in the mirroring information on the Create page, which includes:
Mirror name is "Ubuntu 16.04"
"Mirror Source" select "Mirrored File"
Click "Select File" to locate Ubuntu 16.04 Cloud image file Xenial-server-cloudimg-amd64-disk1.img
"Mirror Format" select "QCOW2"
Minimum disk Fill "20", which is equivalent to setting the minimum capacity of the instance boot disk
Check the "common" selection box so that all project can use the mirror
Click the "Create mirror" button to begin uploading the image. When you are finished, the new mirror appears on the mirror list.
Custom Mirroring
The Cloud mirror is a standard mirror, has no image interface, is an American time zone, and can only be logged in through a key. You can customize the image as needed by:
Deploy an instance through the cloud mirror.
Customize the instance.
Creates a snapshot of the instance, which is saved in glance.
New instances are deployed later through the snapshot.
Below we use CentOS standard mirroring as an example to illustrate each step of custom mirroring, custom content includes: Add graphical interface, set China time zone, set SSH password login, etc. 1. Deploy an instance via cloud mirroring
Go to the Project->compute-> Mirror menu and click the "Start Cloud Host" button after the Mirror "CentOS6".
Named "CENTOS6-VM".
Because the cloud mirror is accessed by default via a key pair, click on the "Access & Security" tab to select a previously created key pair "template".
Click "Run" to CENTOS6-VM deployment successfully.
Manage key pairs in the project->compute-> Access & Security menu. "Template" is created here. The existing key pair is also supported.
Download and take care of the private key file Template.pem when you create the key, and then log in to CENTOS6-VM via this file.
Ssh-i <key-path>/template.pem centos@172.17.24.97
Then switch to the root user:
sudo su–
2. Customizing the Instance
Set China time zone
Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
Set Yum source
Because to install graphics and other related packages, Yum source needs to be prepared in advance (of course, can also use the source of the official website). Then edit/etc/yum.repos.d/centos-base.repo
If it is CentOS7, the contents are as follows:
Install development tools and graphical interfaces
CentOS6 Install the following package:
Yum Groupinstall "Desktop"
Yum Groupinstall "X Window System"
Yum Groupinstall "Development Tools"
CentOS7 Install the following package:
Yum Groupinstall "Server with GUI"
Yum Groupinstall "GNOME Desktop"
Yum Groupinstall "Development Tools"
Set the system default start graphical interface
CentOS6, editor/etc/inittab,