Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Ubuntu Mirror in openstack

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use Ubuntu image in openstack. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

one。 Environmental preparation

Vmware12.0

OS:Ubuntu-16.04 Desktop Edition

Make an image version: ubuntu-16.04.1-server-amd64.iso (server version)

Check whether virtualization is supported (output represents support, otherwise set it in the BIOS page and set vmware in case of virtual machine):

Egrep-o'(vmx | svm)'/ proc/cpuinfo

two。 Install kvm

Sudo apt-get install qemu-kvm libvirt-bin kvm qemu virt-manager bridge-utils

Where: virt-manager is the GUI management window, bridge-utils: used for network bridging.

three。 Test whether the environment is installed successfully

Whether KVM was successfully installed

Kvm-ok

Verify that the KVM kernel is loaded successfully

Lsmod | grep kvm

See the specific steps above: http://www.aboutyun.com/thread-9356-1-1.html

four. Make a mirror image

The first step is to create an empty image on pc, which is used as the hard disk of the virtual machine, so make sure to set aside the amount of space you need:

Qemu-img create-f qcow2 server.img 20g

Download the original Ubuntu image file and go to the official website.

Download address: http://pan.baidu.com/s/1dF8ufbN

Place the downloaded iso file in a folder and start a virtual machine instance of KVM. You will see the beginning of the installation process. Type the following command, which will open the VNC service on port 0 (192.168.155.4 is my native IP):

Sudo kvm-m 1024-cdrom Ubuntu-14.04.4-server-amd64.iso-drive file=server.img,if=virtio,index=0-boot d-net nic-net user-nographic-vnc 192.168.155.4

Install (direct use of vncviewer will prompt you that the command cannot be found, install gvncviewer)

Apt-get install gvncviewer

Use 0 as the display port to connect to the VNC of the virtual machine and complete the installation.

Gvncviewer 192.168.155.4:0

After the installation is complete, view the virtual machine (the created image) with the following command:

Sudo kvm-m 1024-drive file=server.img,if=virtio,index=0-boot c-net nic-net user-nographic-vnc 192.168.155.4 purl 0

If openssh-server is not installed above, you can do the following:

Sudo apt-get updatesudo apt-get upgradesudo apt-get install openssh-server cloud-init

So far, the image used by OpenStack has been created and can be used directly in openstack. The image address is as follows: http://pan.baidu.com/s/1boMvdgj

Method 2:

Reference:

1. Http://www.cnblogs.com/CloudMan6/p/6397360.html

2. Http://www.jianshu.com/p/9ade0ba91a21

This is the first article in the OpenStack implementation experience sharing series.

OpenStack's instance is deployed through the Glance image, so preparing the image is a must. This section describes how to make Linux images, and Windows images are also discussed later.

Download clould image

The easiest way is to use a standard image. Mainstream Linux distributions provide cloud images that can be used directly in OpenStack at the download address:

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/

Let's take Ubuntu16.04 as an example to demonstrate how to import a standard image into Glance.

Create a Glance image

Log in to OpenStack and open the Project-> Compute- > Mirror menu.

Enter image-related information on the creation page, including:

The image name is "Ubuntu 16.04"

"Mirror Source" Select "Image File"

Click "Select File" to locate the Cloud image file xenial-server-cloudimg-amd64-disk1.img of Ubuntu 16.04

"Image format" Select "QCOW2"

Fill in "20" for the minimum disk, 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 image

Custom image

The cloud image is a standard mirror, has no image interface, is in the US time zone, and can only be logged in with a key. You can customize the image as needed by:

Deploy an instance through the cloud image.

Customize the instance.

Create a snapshot of the instance, which will be saved in Glance.

Deploy the new instance later through this snapshot.

Let's take the CentOS standard image as an example to demonstrate each step of customizing the image, including adding a graphical interface, setting China time zone, setting ssh password login, and so on.

1. Deploy an instance through a cloud image

Go to the "Project-> Compute- > Image" menu, and click the "start the CVM" button after the image "CentOS6".

Because the cloud image is accessed by default through the key pair, click the "access & Security" tab and select the pre-created key pair "template".

Manage key pairs in the Project-> Compute- > access & Security menu. This is where "template" was created. Existing key pairs are also supported.

two。 Customize the instance

Set China time zone

Cp / usr/share/zoneinfo/Asia/Shanghai / etc/localtime

If it is CentOS7, the content is as follows:

CentOS7, execute systemctl set-default graphical.target

Allow root to log in via password ssh

Edit / etc/ssh/sshd_config and make the following changes.

Restart the ssh service

Service sshd restart

At this point, centos6-vm is ready to launch the graphical interface and log in via ssh with a password.

Install cloud-utils-growpart (CentOS 6 only)

Cloudint will use this software to manage disk partitions, because it is not installed in CentOS6 cloud image, so it needs to be installed manually. Download address: https://pkgs.org/centos-6/epel-x86_64/cloud-utils-growpart-0.27-10.el6.x86_64.rpm/download/

Rpm-Uvh cloud-utils-growpart-0.27-10.el6.x86_64.rpm

Name the snapshot.

4. Deploy a new instance

Click "start CVM" to deploy the new instance through the snapshot.

As you can see, the instance has a graphical interface started, and root can be logged in with a ssh password.

Convert snapshot to image (optional)

There are two types of Glance images: image and snapshot. The type of image created by snapping instance is snapshot, which may be inconvenient sometimes, so you can convert snapshot to image.

two。 The image is stored in the control node / var/lib/glance/images/228f7bdc-fcf1-4f6a-8a7a-298b86f9e94b by default.

3. Execute glance image-create to create a new mirror.

Glance image-create-- name "CentOS 6.7" >

4. The newly created mirror type is image.

Author 2010jing

2017.05.06 19ore21 * words 617 read 531 comments 4 like 4

Create a virtual machine in a built OpenStack environment.

Log in to OpenStack

Login-openstack.png

Log in according to your account information.

After logging in, check out the network like this.

Main-network.png

Due to the limited IP, users cannot mount multiple VM directly on the network. Users have to create subnets, create routes, and then access the VM created in the private network by applying for Floating IP.

Create a subnet

Network-- > Network Topology-- > Create Network

Create-subnet.png

Create-subnet-info-0.png

Create-subnet-info.png

Enter some information about the subnet

Network Name: demo

Subnet Name: demo_subnet

Network Address: 10.0.1.0/24

If you look at the network again, you can see the created subnet demo (orange)

Created-subnetwork.png

Create a rout

Network-- > Routers-- > Create Router

Create-router.png

Create-router-info-0.png

Routing information

Router Name: demo-router

External Network: ext_net

The effect at this time is like this.

Created-router.png

Add an interface to a route

Network-Router-Interfaces-Add Interface

Add-router-interface.png

Select Subnet: demo_subnet

Add-router-interface-info-1.png

The effect is as follows

Add-router-interface-info-2.png

Create a VM instance

Compute-Instances-Launch Instance

Create-instance.png

Name: demo (casual)

Count:1

Create-instance-1.png

Source: Ubuntu

Create-instance-2.png

Flavor: typical

Create-instance-3.png

Network

Network: demo

Create-instance-4.png

Configuration

#! / bin/shpasswd ubuntu

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report