Install and configure OpenStackNova on Ubuntu

Source: Internet
Author: User
Tags node server ssh access
Two main modules: Nova and Swift. The former is the virtual server deployment and business computing module developed by NASA, and the latter is the distributed cloud storage module developed by Rackspack, which can be used together, it can also be used separately. OpenStack is an open-source project. In addition to the strong support of Rackspace and NASA, there are also contributions and support from heavyweight companies such as Dell, Citrix, Cisco, and Canonical, which are growing very fast, replace another

Two main modules: Nova and Swift. The former is the virtual server deployment and business computing module developed by NASA, and the latter is the distributed cloud storage module developed by Rackspack, which can be used together, it can also be used separately. OpenStack is an open-source project. In addition to the strong support of Rackspace and NASA, there are also contributions and support from heavyweight companies such as Dell, Citrix, Cisco, and Canonical, which are growing very fast, it has replaced another industry-leading open-source cloud platform, Eucalyptus.

OpenStack is written in Python 2.6. On CentOS 5.6, the default environment is Python 2.4, and many dependencies are not easy to upgrade to 2.6. Therefore, it is easier to install on Ubuntu, ubuntu is the official preferred system for OpenStack. All the documents are written in Ubuntu. Therefore, VPSee uses the latest Ubuntu 11.04 Server 64bit version to install and configure OpenStack Nova. use CentOS friends can look at: In CentOS install and configure OpenStack Nova see CentOS install and configure OpenNebula see http://www.linuxidc.com/Linux/2012-09/70036.htm.

Configure the network
After installing the basic Ubuntu 11.04 Server system, upgrade and update the entire system. After installing the bridge-utils package, restart the system:

$ Sudo apt-get update
$ Sudo apt-get upgrade

$ Sudo apt-get install bridge-utils

$ Sudo reboot
Configure the bridge:

$ Sudo vi/etc/network/interfaces

Auto lo
Iface lo inet loopback

Auto eth0
Iface eth0 inet static
Address 172.16.39.111
Netmask 255.255.254.0
Gateway 172.16.38.1

Auto br100
Iface br100 inet static
Bridge_ports eth1
Bridge_stp off
Bridge_maxwait 0
Bridge_fd 0
Address 192.168.0.1
Netmask 255.255.0.0
Broadcast 192.168.255.255
For more information about FlatManager network configuration, see FlatManager network configuration after OpenStack Nova is installed.

Install the NTP service
OpenStack Nova requires an NTP server to synchronize time between all node servers (Cloud Compute). Therefore, an NTP server must be installed on the front-end control server (Cloud Controller, then install the NTP client on the node server to maintain the synchronization with the front-end:

$ Sudo apt-get install ntp

$ Sudo vi/etc/ntp. conf
Server 127.127.1.0
Fudge 127.127.1.0 stratum 10

$ Sudo/etc/init. d/ntp restart
Install and configure the MySQL database
OpenStack Nova requires database support. MySQL is used here (other databases, such as PostgreSQL, can also be used ):

$ Sudo apt-get install mysql-server
Modify the MySQL binding address so that other node servers can access this database:

$ Sudo vi/etc/mysql/my. cnf
...
# Bind-address = 127.0.0.1
Bind-address = 0.0.0.0
...

$ Sudo/etc/init. d/mysql restart
Create a database named nova and set the root user's access permission and password from any IP Address:

$ Sudo mysql-uroot-ppassword-e 'create DATABASE nova ;'
$ Sudo mysql-uroot-ppassword-e "grant all privileges on *. * \
'Root' @ '%' with grant option ;"
$ Sudo mysql-uroot-ppassword-e "set password \
'Root' @ '%' = PASSWORD ('Password ');"
Install the Glance Image Service
Glance is an image server used to provide the image service for OpenStack Nova and an optional operating system template (image ).

$ Sudo apt-get install glance
Install OpenStack Nova
OpenStack Nova has already entered the Ubuntu 11.04 source, so you can directly install it without installing the source code:

$ Sudo apt-get install rabbitmq-server nova-common nova-doc python-nova
Nova-api nova-network nova-volume nova-objectstore nova-scheduler nova-compute

$ Sudo apt-get install-y euca2ools

$ Sudo apt-get install-y unzip
Configure Nova:

$ Sudo vi/etc/nova. conf
-- Dhcpbridge_flagfile =/etc/nova. conf
-- Dhcpbridge =/usr/bin/nova-dhcpbridge
-- Logdir =/var/log/nova
-- State_path =/var/lib/nova
-- Lock_path =/var/lock/nova
-- Verbose
-- S3_host = 172.16.39.111
-- Rabbit_host = 192.168.0.1
-- Cc_host = 192.168.0.1
-- Ec2_url = http: // 172.16.39.111: 8773/services/Cloud
-- Fixed_range = 192.168.0.0/16
-- Network_size = 8
-- FAKE_subdomain = ec2
-- Routing_source_ip = 192.168.0.1
-- SQL _connection = mysql: // root: password@172.16.39.111/nova
-- Glance_host = 192.168.0.1
-- Image_service = nova. image. glance. GlanceImageService
Restart the relevant services of nova to make the settings take effect:

$ Sudo restart libvirt-bin; sudo restart nova-network;
Sudo restart nova-compute; sudo restart nova-api;
Sudo restart nova-objectstore; sudo restart nova-scheduler;
Sudo restart nova-volume; sudo restart glance-api; sudo restart glance-registry
Use Nova
Before using Nova, you need to create a nova database table, create a network, create an administrator account, and create a cloud connection to the administrator you just created:

$ Sudo nova-manage db sync
$ Sudo nova-manage network create 192.168.0.0/24 1 255
$ Sudo nova-manage floating create 10.10.10.2 10.10.20./ 27
$ Sudo nova-manage user admin vpsee
$ Sudo nova-manage project create mycloud vpsee
Because multiple administrators can create multiple different clouds, a cloud administrator needs specific permissions to access and manage his/her own Nova cloud and create permission information, decompress the package to your directory. Note that you need to read the configuration information in novarc every time you use nova to manage the cloud:

$ Mkdir/home/vpsee/creds
$ Sudo nova-manage project zipfile mycloud vpsee/home/vpsee/creds/novacreds.zip

$ Cd/home/vpsee/creds
$ Unzip novacreds.zip
$ Sudo chown-R vpsee: vpsee/home/vpsee/creds/

$ Source/home/vpsee/creds/novarc
Environment variables in novarc are used every time you use nova. Every time source novarc is very troublesome, you 'd better add it to. bashrc:

$ Cat/home/vpsee/creds/novarc>/home/vpsee/. bashrc
$ Source/home/vpsee/. bashrc
Restart all services related to nova again:

$ Sudo restart libvirt-bin; sudo restart nova-network;
Sudo restart nova-compute; sudo restart nova-api;
Sudo restart nova-objectstore; sudo restart nova-scheduler;
Sudo restart nova-volume; sudo restart glance-api; sudo restart glance-registry
If everything is normal, you can print the following similar information:

$ Euca-describe-availability-zones verbose
AVAILABILITYZONE nova available
AVAILABILITYZONE |-node00
AVAILABILITYZONE |-nova-scheduler enabled :-) 2011-05-22 10:32:31
AVAILABILITYZONE |-nova-network enabled :-) 10:32:32
AVAILABILITYZONE |-nova-compute enabled :-) 10:32:24
If this problem occurs, check the novarc file to see if the three lines EC2_URL, S3_URL, and NOVA_URL have two consecutive http ://?

$ Euca-describe-availability-zones verbose
Invalid literal for int () with base 10 :''

$ Vi/home/vpsee/creds/novarc
...
Export EC2_URL = "http: // 172.16.39.100: 8773/services/Cloud"
Export S3_URL = "http: // 172.16.39.100: 3333"
...
Export NOVA_URL = "http: // 172.16.39.100: 8774/v1.1 /"
...
You can delete an http:

$ Vi/home/vpsee/creds/novarc
...
Export EC2_URL = "http: // 172.16.39.100: 8773/services/Cloud"
Export S3_URL = "http: // 172.16.39.100: 3333"
...
Export NOVA_URL = "http: // 172.16.39.100: 8774/v1.1 /"
...
Start the First Instance
Before starting an instance, You need to upload a system template, which is called image. It is a little troublesome to create an operating system image by yourself (see: Create Ubuntu image http://www.linuxidc.com/Linux/2012-09/70031.htm for OpenStack Nova, centOS image http://www.linuxidc.com/Linux/2012-09/70032.htm for OpenStack Nova and Windows Image for OpenStack Nova http://www.linuxidc.com/linux/2012-09/70033.htm .), Here, we use a ready Ubuntu 10.10 image to download the ready image file and upload it to the image server (the image server and the front-end server are on the same physical server ):

$ Wget http://c0179148.cdn1.cloudfiles.rackspacecloud.com/ubuntu1010-UEC-localuser-image.tar.gz

$ Uec-publish-tarball ubuntu1010-UEC-localuser-image.tar.gz ubuntu1010-bucket x86_64
List existing images in the cloud that can be loaded, and start an instance (operating system) with an image (for example, number as a ami-00000003) as a template ):

$ Euca-describe-images
IMAGE aki-00000001 ubuntu1010-bucket/vmlinuz-2.6.32-28-server.manifest.xml available public x86_64 kernel
IMAGE ari-00000002 ubuntu1010-bucket/initrd. img-2.6.32-28-server.manifest.xmavailable public x86_64 ramdisk
IMAGE ami-00000003 ubuntu1010-bucket/maverick-server-uec-amd64.img.manifest.xml available public x86_64 machine aki-00000001 ari-00000002

$ Euca-add-keypair mykey> mykey. priv

$ Euca-run-instances-k mykey-t m1.tiny ami-00000003
Check whether the instance is successfully started and running:

$ Virsh list
Id Name State
----------------------------------
1 instance-00000001 running
Accessing an instance
How can I access the instance after it is started? Like accessing VPS, you need an IP address for ssh access. Do you still remember the network configuration above? The newly created system will assign an IP address in the form of 192.168.0.x, so 192.168.0.3 is the IP address of the instance just created by euca-run-instances:

$ Ssh ubuntu@192.168.0.3.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.