Monday, May 29, 2023

[openstack][microstack] installation

Before running the VM, set its network properties

Set Adapter 2 for installation (using Internet connection)
Set Adapter 1 for operation (using Host connection)

Connect to the target system via SSH

SSH -p 2222 xubuntu@localhost

.

Update the target system

sudo apt-get update && sudo apt-get upgrade -y

.

Install snap tool

sudo apt install snapd

.

Install web browser (optional)

sudo apt install midori

.

Create a new user named stack

...so that OpenStack can be installed on a non-root user with sudo enabled

sudo useradd -s /bin/bash -d /opt/stack -m stack

.

Enable stack user to have root privileges and run without a password:

echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack

(The system will respond back with the message "stack ALL=(ALL) NOPASSWD: ALL")

.

Switch user to stack:

sudo su - stack

.

Disable open-vm-tools.service (if any)

# Check open-vm-tools status 
sudo systemctl status open-vm-tools.service
# Disable open-vm-tools
sudo systemctl disable open-vm-tools.service

.

Reboot

# Reboot system
sudo reboot now

.

Recconect via SSH and switch user to stack

SSH -p 2222 xubuntu@localhost
sudo su - stack

.

Install microstack:

# Install microstack
sudo snap install microstack --beta

Outcome:

2023-06-11T09:15:37+02:00 INFO Waiting for automatic snapd restart...
microstack (beta) ussuri from Canonical✓ installed

.

Check post-installation

snap list microstack

Outcome:

Name        Version  Rev  Tracking     Publisher   Notes
microstack  ussuri   245  latest/beta  canonical✓  -

(Microstack has been successfully installed)

.

Initialize Microstack

The initialisation step automatically deploys, configures, and starts OpenStack services. In particular, it will create the database, networks, an image, several flavors, and ICMP/SSH security groups. This can all be done within 10 to 20 minutes depending on your machine.

sudo microstack init --auto --control

Outcome:

stack@xubuntu:~$ sudo microstack init --auto --control
2023-06-11 09:27:02,858 - microstack_init - INFO - Configuring clustering ...
2023-06-11 09:27:03,232 - microstack_init - INFO - Setting up as a control node.
2023-06-11 09:27:08,690 - microstack_init - INFO - Generating TLS Certificate and Key
2023-06-11 09:27:10,143 - microstack_init - INFO - Configuring networking ...
2023-06-11 09:27:20,398 - microstack_init - INFO - Opening horizon dashboard up to *
2023-06-11 09:27:22,145 - microstack_init - INFO - Waiting for RabbitMQ to start ...
Waiting for 10.0.2.15:5672
2023-06-11 09:27:33,715 - microstack_init - INFO - RabbitMQ started!
2023-06-11 09:27:33,716 - microstack_init - INFO - Configuring RabbitMQ ...
2023-06-11 09:27:36,151 - microstack_init - INFO - RabbitMQ Configured!
2023-06-11 09:27:36,208 - microstack_init - INFO - Waiting for MySQL server to start ...
Waiting for 10.0.2.15:3306
2023-06-11 09:27:59,904 - microstack_init - INFO - Mysql server started! Creating databases ...
2023-06-11 09:28:03,402 - microstack_init - INFO - Configuring Keystone Fernet Keys ...
2023-06-11 09:28:43,852 - microstack_init - INFO - Bootstrapping Keystone ...
2023-06-11 09:29:02,849 - microstack_init - INFO - Creating service project ...
2023-06-11 09:29:11,089 - microstack_init - INFO - Keystone configured!
2023-06-11 09:29:11,180 - microstack_init - INFO - Configuring the Placement service...
2023-06-11 09:29:39,008 - microstack_init - INFO - Running Placement DB migrations...
2023-06-11 09:29:45,510 - microstack_init - INFO - Configuring nova control plane services ...
2023-06-11 09:30:09,190 - microstack_init - INFO - Running Nova API DB migrations (this may take a lot of time)...
2023-06-11 09:30:55,214 - microstack_init - INFO - Running Nova DB migrations (this may take a lot of time)...
Waiting for 10.0.2.15:8774
2023-06-11 09:33:16,803 - microstack_init - INFO - Creating default flavors...
2023-06-11 09:33:52,951 - microstack_init - INFO - Configuring nova compute hypervisor ...
2023-06-11 09:33:52,952 - microstack_init - INFO - Checking virtualization extensions presence on the host
2023-06-11 09:33:52,976 - microstack_init - WARNING - Unable to determine hardware virtualization support by CPU vendor id "AuthenticAMD": assuming it is not supported.
2023-06-11 09:33:52,976 - microstack_init - WARNING - Hardware virtualization is not supported - software emulation will be used for Nova instances
2023-06-11 09:33:56,309 - microstack_init - INFO - Configuring the Spice HTML5 console service...
2023-06-11 09:33:56,942 - microstack_init - INFO - Configuring Neutron
Waiting for 10.0.2.15:9696
2023-06-11 09:36:40,924 - microstack_init - INFO - Configuring Glance ...
Waiting for 10.0.2.15:9292
2023-06-11 09:37:37,764 - microstack_init - INFO - Adding cirros image ...
2023-06-11 09:37:42,719 - microstack_init - INFO - Creating security group rules ...
2023-06-11 09:37:57,554 - microstack_init - INFO - Configuring the Cinder services...
2023-06-11 09:39:28,146 - microstack_init - INFO - Running Cinder DB migrations...
2023-06-11 09:39:50,566 - microstack_init - INFO - restarting libvirt and virtlogd ...
2023-06-11 09:40:02,399 - microstack_init - INFO - Complete. Marked microstack as initialized!

(Microstack has been successfully initialized)

.

Verification

The purpose of the verification step is to confirm that the cloud is in working order and to discover some of the defaults used by MicroStack. Verification will consist of the following actions:

  • perform various OpenStack queries
  • create an instance
  • connect to the instance over SSH
  • access the cloud dashboard
  • Query OpenStack

    To list the default image
    sudo microstack.openstack image list
    

    Outcome:

    +--------------------------------------+--------+--------+
    | ID                                   | Name   | Status |
    +--------------------------------------+--------+--------+
    | e6aebf13-e081-4cab-8323-61123a4f6033 | cirros | active |
    +--------------------------------------+--------+--------+
    

    .

    To get the default list of flavors
    sudo microstack.openstack flavor list
    

    Outcome:

    +----+-----------+-------+------+-----------+-------+-----------+
    | ID | Name      |   RAM | Disk | Ephemeral | VCPUs | Is Public |
    +----+-----------+-------+------+-----------+-------+-----------+
    | 1  | m1.tiny   |   512 |    1 |         0 |     1 | True      |
    | 2  | m1.small  |  2048 |   20 |         0 |     1 | True      |
    | 3  | m1.medium |  4096 |   20 |         0 |     2 | True      |
    | 4  | m1.large  |  8192 |   20 |         0 |     4 | True      |
    | 5  | m1.xlarge | 16384 |   20 |         0 |     8 | True      |
    +----+-----------+-------+------+-----------+-------+-----------+
    

    .

    Create an instance

    MicroStack comes with a convenient instance creation command called microstack launch. It uses the following defaults for its instances:

  • keypair ‘microstack’
  • flavor ‘m1.tiny’
  • floating IP address on subnet ‘10.20.20.0/24’
  • To create an instance named ‘test’ based on the ‘cirros’ image
    sudo mkdir -p /home/root/snap/microstack/common
    sudo microstack launch cirros -n test

    Outcome:

    Creating local "microstack" ssh key at /home/root/snap/microstack/common/.ssh/id_microstack
    Launching server ...
    Allocating floating ip ...
    Server test launched! (status is BUILD)
    
    Access it with `ssh -i /home/root/snap/microstack/common/.ssh/id_microstack cirros@10.20.20.26`
    You can also visit the OpenStack dashboard at https://10.20.20.1:443
    

    Download/clone devstack from its repository:

    .

    git clone https://opendev.org/openstack/devstack

    (Devstack repo contains a script stack.sh , which will be used in OpenStack installation.)

    .

    Prepare a configuration file:

    cd devstack
    vim local.conf

    Paste the following content:

    [[local|localr]]
    ADMIN_PASSWORD=StrongAdminSecret
    DATABASE_PASSWORD=$ADMIN_PASSWOCinder
    RABBIT_PASSWORD=$ADMIN_PASSWORD
    SERVICE_PASSWORD=$ADMIN_PASSWORD
    


    To add to the group nopasswdlogin: sudo usermod -a -G nopasswdlogin To remove from nopasswdlogin group: sudo gpasswd -d nopasswdlogin
    Read More

    [openstack] installation

    .


    .

    OpenStack is a cloud computing infrastructure (IaaS) that helps in controlling large pools of computation power, storage, and networking resources throughout a datacenter. It does so with help of APIs.

    Devstack is a series of extensible scripts, which is used to set up an OpenStack environment with ease.

    50

    Top 20 Celeb Nepotism Babies Who Deserve the Fame

    Pre-requisites for using OpenStack

    There are a few basic pre-requisites you need to fulfill, before setting up OpenStack on your system.

    • Ubuntu OS

    • A minimum of 4 GB RAM

    • Multi-core enabled processor

    • At least 10GB of free hard disk space

    • A good internet connection

    There are some additional software requirements also, which you need to fulfill.

    • Git

    • A web browser

    Steps to Install Openstack on Ubuntu with Devstack

    Installing OpenStack on Ubuntu is a rather complex process. But it is made easy by Devstack. The steps to install it, are quite easy even if you’re not much proficient with the command line, simply follow the steps and get it up and running.

    Step 1: Preparing the system

    Update the system:


    sudo apt-get update && sudo apt-get upgrade -y

    The command will ask for root privileges. Enter your user password and wait for your system to upgrade. After the upgrade is done, reboot.

    Step 2: Creating stack user with Sudo privileges

    Create a new user named stack for our system to setup OpenStack, as it should be installed on a non-root user with sudo enabled.

    Open a fresh terminal, and run the useradd command:


    sudo useradd -s /bin/bash -d /opt/stack -m stack

    Enable stack user to have root privileges and run without a password:


    echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack

    The Output will look like this:

    Adding User – “stack”


    Once you have created the stack user, log in to it using the following command:


    sudo su - stack

    It will log in you to bash, as stack user.

    Logging-in as User “stack”

    Step 3: Downloading Devstack

    Assuming git is installed on your system. Enter the following command to download/clone devstack from its repository to your system:


    git clone https://opendev.org/openstack/devstack

    Devstack repo contains a script stack.sh , which will be used to setup OpenStack. It also contains templates for configuration files.

    Step 4: Creating configuration (.conf) file for Devstack

    Setup the configuration files for it.

    Navigate to the devstack folder, by running:


    cd devstack

    Afterwards, create a local.conf file, by running:


    vim local.conf

    and paste the following content –







    [[local|localr]]

     

    ADMIN_PASSWORD=StrongAdminSecret

    DATABASE_PASSWORD=$ADMIN_PASSWOCinder

    RABBIT_PASSWORD=$ADMIN_PASSWORD

    SERVICE_PASSWORD=$ADMIN_PASSWORD

    Paste using the mouse by right-clicking and clicking Paste and enter :x to save & exit.


    Note:
    1. StrongAdminSecret is the password we used here, you can change it with your choice.
    2. A sample configuration file for local.conf can be found in the Samples directory under the Devstack repository.

    Step 5: Installing Openstack with Devstack

    Run OpenStack installation using the following command:


    ./stack.sh

    The script will install the following features –

    • Horizon – OpenStack Dashboard

    • Keystone – Identity Service

    • Nova – Compute Service

    • Glance – Image Service

    • Neutron – Network Service

    • Placement – Placement API

    • Cinder – Block Storage Service

    The setup will take around 10 to 20 minutes, based on your system performance and internet speed, as many git trees and packages are installed during the process.

    Upon completion, your terminal will look like the image below.

    Devstack Installed

    Now, we can see that it is saying that Horizon (Openstack Dashboard) is available at the given URL, it will vary from system to system.

    Step 6: Accessing OpenStack using a web browser

    Browse this URL –

    1

    https://server-ip/dashboard

    Or try

    1

    https://localhost/dashboard

    It will open up the OpenStack login page, as shown below.

    Openstack Login

    Now, enter the credentials ie Admin/StrongAdminSecret

    After logging in, your dashboard will look similar to this.

    OpenStack DashboardOpenStack Dashboard

    Further Reading:




    .

    .

    Read More

    [openstack] OpenStack API Access page

     .


    http://localhost:8888/dashboard/project/api_access/

    .


    .




    .


    Read More

    [openstack] Preinstalled-Openstack-VirtualBox-x64

     .

    Preinstalled-Openstack-VirtualBox-x64

    A Pre-installed Openstack CentOS 7 x64 image that can be directly imported onto VirtualBox. You can literally setup and test Openstack in under 10 minutes. There's no need to install Openstack using this VirtualBox (.vbox/.vdi) image.

    Preface:

    I have spent hours setting up every solution out there to test Openstack. None of them are actually easy considering the heavy PC requirements and the time taken to build the Openstack modules from scratch. This solution would absolutely remove the hassle of installing Openstack, before being able to test it out. This solution does not require you to install any other application other than VirtualBox on your PC/Laptop. Openstack uses a lot of CPU and Memory resources. Please ensure that all your other applications have been saved/closed before running this VM.

    This method uses a pre-installed packstack Openstack binary. These binaries are installed on an IP address: 10.0.2.15, which is the default NAT IP that VirtualBox assigns a new machine using a NAT Adapter.

    Minimum Requirements:

    • x64 compatible PC/Laptop that supports x64 compatible Virtual hosts
    • Latest VirtualBox application installed on your PC/Laptop
    • Atleast 4 GB Hard Drive space
    • 6 GB RAM
    • 4 CPU cores (Quad Core)

    Note: You can always increase the RAM, Hard Disk space and the CPU Cores based on your Openstack requirements. Higher configuration is required for running Virtual instances within Openstack smoothly.


    Download the Centos-openstack compressed VirtualBox Image from: https://drive.google.com/open?id=0Bw59oF2-DxdEU2hrb3AwN2RicFk

    Installation Instructions:

    1. Download and Extract the zip file onto "VirtualBox VMs" folder located under your Users/ folder in your PC.

    2. Open VirtualBox application and import the contents of the zip file (Using Machine -> Add option). You should see the entry Centos-openstack in your VM after the import.

    3. Quit all other applications running in your laptop/PC. Only then run this VM. The preset settings require you have a quad core x64 PC along with 6GB ram at least. Trust me, this isn't enough for Openstack still.

    4. Ensure that the Centos-openstack -> Settings page does not have any invalid settings. Also ensure that the following configurations are properly in-place:

    VM Settings:

    a. Under Settings -> USB (turn off USB controller) if it shows up as invalid settings. Adjust your RAM to be at or below 80 % of your actual PC's Memory capacity.

    b. Under Centos-openstack -> Settings -> Network, Check if the NAT Adapter is enabled. Ensure that your PC/Laptop running the VirtualBox application has internet connectivity.

    alt tag

    c.Under Centos-openstack -> Settings -> Network -> Adapter 1 (NAT), Click the "Port Forwarding" button and check if the following Port Forwarding options are in-place, else configure them.

    alt tag

    d. Check the Settings page of your Centos-openstack VM. It should more-or-less be having the following settings:

    alt tag

    Now start the VM. Let it load. Use the following PC credentials:

    username: openstack

    password: openstack

    In the console, run the following command: sudo dhclient enp0s3

    [openstack@openstack ~]$ sudo dhclient enp0s3

    Provide the "openstack" password.

    Now, check if you have obtained the 10.0.2.15 IP for enp0s3 interface using the command: ifconfig

    [openstack@openstack ~]$ ifconfig

    alt tag

    This may not work properly if you get any other IP than 10.0.2.15. From your PC/Laptop's browser you should access the following website: http://localhost:8888

    Note: Openstack components may take 5 - 10 minutes to load once the VM has booted up and IP has been configured. Please wait a few minutes or refresh the browser's page if you do not see the Openstack horizon web interface as soon as you put them in your browser for the first time.

    Openstack's horizon web dashboard should appear with login credentials screen appearing first.

    The credentials are:

    username: admin

    password: openstack

    This should take to your Openstack console, where you can experiment with Openstack.

    Debug:

    If your Openstack web dashboard does not come up properly, check if your local port 8888 is not being blocked by your local firewall.

    If the NAT IP obtained from dhclient was something other than 10.0.2.15, you can try this command and check if your Horizon web dashboard opens up from your PC after issuing this command:

    [openstack@openstack ~]$ sudo ifconfig enp0s3 10.0.2.15 netmask 255.255.255.0

    [openstack@openstack ~]$ sudo route add default gw 10.0.2.2 dev enp0s3

    [openstack@openstack ~]$ sudo su

    <Enter "openstack" password>

    [openstack@openstack ~]# nameserver 8.8.8.8 >> /etc/resolv.conf

    Try to open an ssh terminal from the host PC/Laptop's Putty or ssh client.

    Use the command: ssh openstack@localhost -p 2222

    If you cannot access the VM's ssh console, then the NAT Port Forwarding is not working properly.


    Cheers trying out Openstack, the hassle-free way!

    Let me know if you have improvements.

    .

    Read More