The original text was written for the pike version half a year ago. Here is an update for the Queen version.
===========================
There are many OpenStack installation methods, such as chef, ansible, puppet, fuel, etc. If it is the development and preliminary research of OpenStack, devstack should be the installation method with the lowest learning cost. Next, let's introduce how to gracefully install OpenStack with devstack.
Why an elegant installation? For indescribable reasons, we can only pretend to be elegant. If you can see the outside world or just in the outside world, you are elegant enough to skip to step 5.
0. Environmental preparation
8G memory (recommended number, the more the better), 60G hard disk.
For Ubuntu 16.04 system, you can use server image without desktop to save memory.
It's best to make a virtual machine. One is convenient for backup, and the other devstack will install a large number of packages, which may affect the normal use of your computer.
I use this (it has just been verified and can be downloaded)
imagereleases.ubuntu.com
.
As for how to deploy virtual machines, there are many tutorials on the Internet. You can use Virtual box, hyperV, VMware workstation and VMware Fusion. I'll skip this part.
1. Configure Ubuntu apt source
Execute the following command:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo vim /etc/apt/sources.list
In the editing interface, delete the original content and fill in
sources.listgithub.com
Content in. After that:
sudo apt update
2. Configure pip source
Most OpenStack projects are python projects. During the installation process, a large number of python packages need to be downloaded. In order to install more smoothly, the pip source needs to be modified.
mkdir ~/.pip vim ~/.pip/pip.conf
Fill in in the edit interface
pip.confgithub.com
Content in.
At the same time, modify the following file and fill in the content of pip.conf.
sudo mkdir /root/.pip sudo vim /root/.pip/pip.conf
3. Download devstack
Download devstack and switch to a stable version. If you are not doing upstream development, try to avoid using the latest devstack because it may be unstable.
git clone https://git.openstack.org/openstack-dev/devstack cd devstack git checkout remotes/origin/stable/queens git checkout -b queens
4. Configure devstack local.conf
First switch to the stable version of pike, and then generate local.conf through the following method. Local.conf is the installation parameter of devstack.
cp samples/local.conf ./ vim local.conf
According to the mode you want to deploy, refer to the local modification I put on github. Here, just take all in one as an example, Second hand mobile phone number auction platform The local.conf configuration file for multi node deployment is also given for reference only.
local.confgithub.com
implement
cp ~/devstack/samples/local.sh ~/devstack/
5. Elegant installation
After completing the above steps, you can start the elegant installation. In the devstack directory, execute:
./stack.sh
The installation process may require a password to be entered. The installation time depends on your network speed, hard disk speed and CPU speed. It usually takes about an hour. My personal computer is a little slower. It took more than an hour and a half to complete. If you finally see the following prompt, Congratulations, the installation is successful.
========================= DevStack Component Timing ========================= Total runtime 6345 run_process 48 test_with_retry 9 apt-get-update 12 pip_install 1335 osc 384 wait_for_service 54 git_timed 672 dbsync 544 apt-get 984 ========================= This is your host IP address: 192.168.31.179 This is your host IPv6 address: ::1 Horizon is now available at http://192.168.31.179/dashboard Keystone is serving at http://192.168.31.179/identity/ The default users are: admin and demo The password: nomoresecret
After installation, the source code is in the / opt/stack directory. Not all projects will be installed. Only the core projects of OpenStack will be installed by default. Because we set the version of devstack in step 3, the versions of all projects here are queens.
The configuration file is in the / etc / directory. For example, the configuration file of nova is in the / etc/nova directory.
6. Verification
6.1 create virtual machine
Devstack will bring a mirror image by default. This is a simplified version of the system, which is suitable for testing. Devstack will also create a virtual machine three-tier network architecture by default. It includes a router, a tenant network and a public network. First, import the user name and tenant in the devstack directory, and then execute nova boot to create the virtual machine:
source ~/devstack/openrc admin admin nova boot --image cirros-0.3.5-x86_64-disk --flavor 1 --nic net-name=private vm1
6.2 login virtual machine
Determine the virtual machine IP first.
nova list
You can see the IP address in the virtual machine list.
Log in to Linux namespace,
$ ip netns qrouter-1818f77c-e76b-43c5-b87a-9a04fbba6a9e qdhcp-51b3ecc4-50c5-408b-b554-1dd5f6e6a708 $ sudo ip netns exec qdhcp-51b3ecc4-50c5-408b-b554-1dd5f6e6a708 bash
Note that the uuid behind your Linux namespace is different. In fact, you can choose either of the two namespaces. In the namespace, log in to the virtual machine with the password cubwin:)
ssh cirros@10.0.0.9
In this way, you enter the virtual machine managed by OpenStack. You can view the current IP address, access other virtual machines (if you have created other virtual machines), and even access the external network, for example:
$ ping 8.8.8.8 -c 1
last
0-4 is some of my experience in building OpenStack in my personal environment. It may be helpful for friends living in the network environment of my motherland. 5-6 is a simple OpenStack installation and use. If you want to understand OpenStack, or want to use OpenStack, I believe this article is a good way to get started.