Install OpenStack - DevStack into Ubuntu 16.04.05 Virtual Machine - NETSEC

Latest

Learning, Sharing, Creating

Cybersecurity Memo

Sunday, January 20, 2019

Install OpenStack - DevStack into Ubuntu 16.04.05 Virtual Machine

DevStack is an opinionated script to quickly create an OpenStack development environment. It can also be used to demonstrate starting/running OpenStack services and provide examples of using them from a command line. This post is going to present the steps how to install DevStack into a VMware workstation Ubuntu VM.

Youtube Video:


1. Prepare Ubuntu VM

This Ubuntu Virtual machine will need at least 12G memory and 100G hard drive. I have given my OpenStack VM 16G memory and 120G hard drive for testing.




2. Update System and change sources.list file
You may want to remove or comment cdrom entry from your default installed Ubuntu sources.list.

I found if I did not do this, my Ubuntu will get some error message to say:

The repository 'cdrom://Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1) xenial Release' does not have a Release file.
Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
See apt-secure(8) manpage for repository creation and user configuration details.
The repository 'ppa.launchpad.net/kirillshkrogalev/ffmpeg-next/ubuntu xenial Release' does not have a Release file.
Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
See apt-secure(8) manpage for repository creation and user configuration details.
Failed to fetch cdrom://Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)/dists/xenial/main/binary-amd64/Packages  Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
Some index files failed to download. They have been ignored, or old ones used instead.

To resolve this problem from terminal you must remove/comment this CD-ROM repository source directly from /etc/apt/sources.list
 sudo nano /etc/apt/sources.list
and comment or remove lines that include cdrom. eg:
deb cdrom:[Ubuntu-Server 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.3)]/ xenial main restricted
Now it is time to update / upgrade Ubuntu system:
sudo apt-get update
​sudo apt-get upgrade

3. Install git and clone Devstack to local

sudo apt-get install git
cd /
​sudo git clone https://git.openstack.org/openstack-dev/devstack master

4. Prepare to install Devstack

4.1 copy a sample configuration file to use for installation

cd /master
​sudo cp samples/local.conf local.conf
sudo nano local.conf
Search for the password variable section and ensure it reflects the following (YOURPASSWORD is the actual password you want to use):
ADMIN_PASSWORD=YOURPASSWORD
​MYSQL_PASSWORD=$ADMIN_PASSWORD
​RABBIT_PASSWORD=$ADMIN_PASSWORD
​SERVICE_PASSWORD=$ADMIN_PASSWORD

4.2 Create a new user 'stack' and change master folder permission to this new user

We can use a pre-installed script to create a new user for devstack. The command to run this script is:
sudo /devstack/tools/create-stack-user.sh
Once the script completes, you'll need to change the permissions of the master folder with the command:
sudo chown -R stack:stack /master
5. Start DevStack installation

This must be run as the stack user. lets change current user to our new created user - stack.
sudo su stack
Final command to start installation:
./stack.sh
Then it is a long time to wait, more than 45 minutes for me. At the end, once you see following output, your DevStack installation is successful.



=========================
DevStack Component Timing
 (times are in seconds)
=========================
run_process           34
test_with_retry        4
apt-get-update         7
pip_install          635
oc                  216
wait_for_service      30
git_timed            1248
dbsync                48
apt-get              408
-------------------------
Unaccounted time     591
=========================
Total runtime        3221


This is your host IP address: 10.94.200.78
This is your host IPv6 address: ::1
Horizon is now available at http://10.94.200.78/dashboard
Keystone is serving at http://10.94.200.78/identity/
The default users are: admin and demo
The password: password1234

WARNING:
Using lib/neutron-legacy is deprecated, and it will be removed in the future


Services are running under systemd unit files.
For more information see:
https://docs.openstack.org/devstack/latest/systemd.html

DevStack Version: stein
Change: 62c832b090021b0c85ade8eb718eabaccc345257 Merge "Update default cirros version" 2019-01-20 15:20:35 +0000
OS Version: Ubuntu 16.04 xenial



6. Launch Browser to log in DevStack



7. Uninstall DevStack.
If there is any change on local.conf file, you will have to uninstall and clean DevStack installation first.

stack@ubuntu:/master$ ./unstack.sh
stack@ubuntu:/master$ ./clean.sh



Some Command line tools:



test@ubuntu:~$ cd /master
test@ubuntu:/master$ source openrc admin admin
WARNING: setting legacy OS_TENANT_NAME to support cli tools.
test@ubuntu:/master$ nova show tt1
+--------------------------------------+-----------------------------------------------------------------+
| Property                             | Value                                                           |
+--------------------------------------+-----------------------------------------------------------------+
| OS-DCF:diskConfig                    | AUTO                                                            |
| OS-EXT-AZ:availability_zone          | nova                                                            |
| OS-EXT-SRV-ATTR:host                 | ubuntu                                                          |
| OS-EXT-SRV-ATTR:hostname             | tt1                                                             |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | ubuntu                                                          |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000004                                               |
| OS-EXT-SRV-ATTR:kernel_id            |                                                                 |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                               |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                                 |
| OS-EXT-SRV-ATTR:reservation_id       | r-gmom984x                                                      |
| OS-EXT-SRV-ATTR:root_device_name     | /dev/vda                                                        |
| OS-EXT-SRV-ATTR:user_data            | -                                                               |
| OS-EXT-STS:power_state               | 4                                                               |
| OS-EXT-STS:task_state                | -                                                               |
| OS-EXT-STS:vm_state                  | stopped                                                         |
| OS-SRV-USG:launched_at               | 2019-01-22T01:10:52.000000                                      |
| OS-SRV-USG:terminated_at             | -                                                               |
| accessIPv4                           |                                                                 |
| accessIPv6                           |                                                                 |
| config_drive                         |                                                                 |
| created                              | 2019-01-22T01:10:40Z                                            |
| description                          | tt1                                                             |
| flavor:disk                          | 0                                                               |
| flavor:ephemeral                     | 0                                                               |
| flavor:extra_specs                   | {}                                                              |
| flavor:original_name                 | cirros256                                                       |
| flavor:ram                           | 256                                                             |
| flavor:swap                          | 0                                                               |
| flavor:vcpus                         | 1                                                               |
| hostId                               | d04e0dcc9fc1398a8e5e01ed3376e8fb30f59e85459ca7bd75bb983e        |
| host_status                          | UP                                                              |
| id                                   | 58ddbe80-d943-4d5b-9b2a-e5f6518e5ea1                            |
| image                                | cirros-0.4.0-x86_64-disk (b897ce20-2ad3-4142-9e02-63ec31986bcd) |
| key_name                             | -                                                               |
| locked                               | False                                                           |
| metadata                             | {}                                                              |
| name                                 | tt1                                                             |
| os-extended-volumes:volumes_attached | []                                                              |
| public network                       | 172.24.4.31, 2001:db8::1f7                                      |
| security_groups                      | default                                                         |
| status                               | SHUTOFF                                                         |
| tags                                 | []                                                              |
| tenant_id                            | ad9bc16cfe6f4d57a3f1a722e413f9d5                                |
| trusted_image_certificates           | -                                                               |
| updated                              | 2019-01-22T01:21:45Z                                            |
| user_id                              | 659da36320994abdaac01a509911cd81                                |
+--------------------------------------+-----------------------------------------------------------------+
test@ubuntu:/master$ 
test@ubuntu:/master$ nova service-list
+--------------------------------------+------------------+--------+----------+---------+-------+----------------------------+-----------------+-------------+
| Id                                   | Binary           | Host   | Zone     | Status  | State | Updated_at                 | Disabled Reason | Forced down |
+--------------------------------------+------------------+--------+----------+---------+-------+----------------------------+-----------------+-------------+
| f26f6b58-ee11-4371-92ab-7bcdb4a0460d | nova-scheduler   | ubuntu | internal | enabled | up    | 2019-01-22T01:38:09.000000 | -               | False       |
| ef6130dd-14e0-4c7f-a6ed-52ab18dbf290 | nova-consoleauth | ubuntu | internal | enabled | up    | 2019-01-22T01:38:07.000000 | -               | False       |
| 2f7f1d9b-de00-476a-b396-0beb2f013c33 | nova-conductor   | ubuntu | internal | enabled | up    | 2019-01-22T01:38:10.000000 | -               | False       |
| 1c479ce7-ad67-4d51-bb9f-a2caa7ff473b | nova-compute     | ubuntu | nova     | enabled | up    | 2019-01-22T01:38:15.000000 | -               | False       |
| 99d78d26-aedb-455b-bf71-ca8b868464e5 | nova-conductor   | ubuntu | internal | enabled | up    | 2019-01-22T01:38:09.000000 | -               | False       |
| c8ecc3a9-0b60-41fb-b6d7-36e7210cadb3 | nova-compute     | ubuntu | nova     | enabled | up    | 2019-01-22T01:38:12.000000 | -               | False       |
+--------------------------------------+------------------+--------+----------+---------+-------+----------------------------+-----------------+-------------+
test@ubuntu:/master$ nova hypervisor-stats
+----------------------+-------+
| Property             | Value |
+----------------------+-------+
| count                | 1     |
| current_workload     | 0     |
| disk_available_least | 10    |
| free_disk_gb         | 18    |
| free_ram_mb          | 15261 |
| local_gb             | 18    |
| local_gb_used        | 0     |
| memory_mb            | 16029 |
| memory_mb_used       | 768   |
| running_vms          | 1     |
| vcpus                | 6     |
| vcpus_used           | 1     |
+----------------------+-------+
test@ubuntu:/master$ 
test@ubuntu:/master$ openstack volume show testv
+--------------------------------+--------------------------------------+
| Field                          | Value                                |
+--------------------------------+--------------------------------------+
| attachments                    | []                                   |
| availability_zone              | nova                                 |
| bootable                       | false                                |
| consistencygroup_id            | None                                 |
| created_at                     | 2019-01-22T01:43:46.000000           |
| description                    |                                      |
| encrypted                      | False                                |
| id                             | 267cffee-8da0-42d1-8eb0-a45e4192dc3a |
| migration_status               | None                                 |
| multiattach                    | False                                |
| name                           | testv                                |
| os-vol-host-attr:host          | None                                 |
| os-vol-mig-status-attr:migstat | None                                 |
| os-vol-mig-status-attr:name_id | None                                 |
| os-vol-tenant-attr:tenant_id   | ad9bc16cfe6f4d57a3f1a722e413f9d5     |
| properties                     |                                      |
| replication_status             | None                                 |
| size                           | 2                                    |
| snapshot_id                    | None                                 |
| source_volid                   | None                                 |
| status                         | error                                |
| type                           | Performance                          |
| updated_at                     | 2019-01-22T01:43:46.000000           |
| user_id                        | 659da36320994abdaac01a509911cd81     |
+--------------------------------+--------------------------------------+








3 comments:

  1. Hi,

    I am trying to install Openstack on Ubuntu 20.04 LTS. I followed all the steps given above, atlast after giving ./stack.sh it runs for about 1 hour, and finally got error as below:-

    it started running for about an hour. And finally got below message:-

    wget --progress=dot:giga -c http://do wnload.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img -O /opt/stack/devstac k/files/cirros-0.5.1-x86_64-disk.img
    --2020-08-14 13:01:45-- http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86 _64-disk.img
    Resolving download.cirros-cloud.net (download.cirros-cloud.net)... 64.90.42.85, 2607:f298:6:a036::bd6:a72a
    Connecting to download.cirros-cloud.net (download.cirros-cloud.net)|64.90.42.85| :80... failed: Connection timed out.
    Connecting to download.cirros-cloud.net (download.cirros-cloud.net)|2607:f298:6: a036::bd6:a72a|:80... failed: Network is unreachable.
    +functions:upload_image:1 exit_trap
    +./stack.sh:exit_trap:489 local r=4
    ++./stack.sh:exit_trap:490 jobs -p
    +./stack.sh:exit_trap:490 jobs=
    +./stack.sh:exit_trap:493 [[ -n '' ]]
    +./stack.sh:exit_trap:499 '[' -f /tmp/tmp.i4cMoIoHkQ ']'
    +./stack.sh:exit_trap:500 rm /tmp/tmp.i4cMoIoHkQ
    +./stack.sh:exit_trap:504 kill_spinner
    +./stack.sh:kill_spinner:399 '[' '!' -z '' ']'
    +./stack.sh:exit_trap:506 [[ 4 -ne 0 ]]
    +./stack.sh:exit_trap:507 echo 'Error on exit'
    Error on exit
    +./stack.sh:exit_trap:509 type -p generate-subunit
    +./stack.sh:exit_trap:510 generate-subunit 1597386249 4186 fail
    +./stack.sh:exit_trap:512 [[ -z /opt/stack/logs ]]
    +./stack.sh:exit_trap:515 /usr/bin/python3.8 /opt/stack/devstac k/tools/worlddump.py -d /opt/stack/logs
    World dumping... see /opt/stack/logs/worlddump-2020-08-14-073355.txt for details
    ebtables v1.8.4 (nf_tables): table `broute' is incompatible, use 'nft' tool.

    +./stack.sh:exit_trap:524 exit 4


    Please help me out in this. I have given user sudo powers - Without password also, but still error in installation.

    ReplyDelete
    Replies
    1. I have not tried 20.04 version. But if you have some time, can you try 16.04 version ?

      Delete
  2. Hi,

    I came here after watching the same youtube video. I have been trying to create devstack vm and encountering different errors.
    Before I start following your tutorial, can you please provide link of your video in which ubuntu machine was previously installed (as referred at 0:30 in above video). I am not confident with ubuntu environment so I want to start by creating correct OS environment and then follow this guide.

    ReplyDelete