How to install Openstack Newton
For this tutorial, we will be installing Openstack Newton on Ubuntu 16.04 (Xenial). You can use the same tutorial also on Debian 8 (Jessie) but this will install Openstack Mitaka. This tutorial is to help people that wants to start to learn Openstack.
Prerequisites
To complete this tutorial, you'll need the following:
- 1 controller node
- 1 compute node
Hardware requirements
According to the Openstack Documentation, to run several CicrOS instances you will need:
- Controller Node: 1 processor, 4 GB memory, and 5 GB storage
- Compute Node: 1 processor, 2 GB memory, and 10 GB storage
This this tutorial I am using:
- Controller Node: 2 processors, 16 GB memory, 2x250GB disks in a Raid1 configuration and 2 NIC's (eno1 and eno2)
- Compute Node: 2 processors, 16 GB memory, 2x350GB disks in a Raid1 configuration and 2 NIC's (eno1 and eno2)
Your environment doesn't have to have 2 disks in Raid1 configuration, 1 disk will be okay.
Networking
I am using a Cisco switch to setup 2 VLAN's
- manegment VLAN
- Provider VLAN ( Internet)
If you don't have a Cisco switch, you can use two 4 port switches
Controller node
Update hosts file
Make sure the node has Ubuntu 16.04 installed with all updates. If you do not have a DNS server in your environment manually update the hosts file
/etc/hosts
controller mgmt_IP_address controller.your_domain_name controller compute mgmt_IP_address computer.your_domain_name compute
example
10.192.16.38 controller.dfw.ppnet controller 10.192.16.67 compute.dfw.ppnet computer
In my case I have a DNS server in my environement so my /etc/hosts file looks like this:
127.0.0.1 localhost 10.192.16.38 controller.dfw.ppnet controller # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
update Interface
In my environment I have a DHCP server and a DNS server on the lab network and all the install on the lab network are done by pxe boot and a preseed file that auto configure my first network interface. My interface file looks like the one below. If you do not have a DHCP or DNS server you can do this manually.
# The primary network interface auto eno1 iface eno1 inet static address 10.192.16.38 netmask 255.255.252.0 network 10.192.16.0 broadcast 10.192.19.255 gateway 10.192.16.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 10.192.16.2 10.192.16.4 dns-search dfw.ppnet # The secondery network interface auto eno2 iface eno2 inet static address 10.192.0.75 network 10.192.0.0 netmask 255.255.255.0
Compute node
Update hosts file
Make sure the node has Ubuntu 16.04 installed with all updates. If you do not have a DNS server in your environment manually update the hosts file
/etc/hosts
controller mgmt_IP_address controller.your_domain_name controller compute mgmt_IP_address computer.your_domain_name compute
example
10.192.16.38 controller.dfw.ppnet controller 10.192.16.67 compute.dfw.ppnet computer
In my case I have a DNS server in my environement so my /etc/hosts file looks like this:
127.0.0.1 localhost 10.192.16.67 compute.dfw.ppnet compute # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
Update interface
# The primary network interface auto eno1 iface eno1 inet static address 10.192.16.67 netmask 255.255.252.0 network 10.192.16.0 broadcast 10.192.19.255 gateway 10.192.16.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 10.192.16.2 10.192.16.4 dns-search dfw.ppnet # The secondery network interface auto eno2 iface eno2 inet static address 10.192.0.73 network 10.192.0.0 netmask 255.255.255.0
Testing Network
From you controller node ping the compute node
ping compute.dfw.ppnet PING compute.dfw.ppnet (10.192.16.67) 56(84) bytes of data. 64 bytes from compute.dfw.ppnet (10.192.16.67): icmp_seq=1 ttl=64 time=0.286 ms 64 bytes from compute.dfw.ppnet (10.192.16.67): icmp_seq=2 ttl=64 time=0.213 ms 64 bytes from compute.dfw.ppnet (10.192.16.67): icmp_seq=3 ttl=64 time=0.209 ms 64 bytes from compute.dfw.ppnet (10.192.16.67): icmp_seq=4 ttl=64 time=0.216 ms
From your compute node ping the controller node
ping controller.dfw.ppnet PING controller.dfw.ppnet (10.192.16.38) 56(84) bytes of data. 64 bytes from controller.dfw.ppnet (10.192.16.38): icmp_seq=1 ttl=64 time=0.206 ms 64 bytes from controller.dfw.ppnet (10.192.16.38): icmp_seq=2 ttl=64 time=0.186 ms 64 bytes from controller.dfw.ppnet (10.192.16.38): icmp_seq=3 ttl=64 time=0.166 ms
Now that our environment is ready lest move to the OpenStack installation.
Controller node installation
Login to your controller node as root and copy the script below into you root directory.
Create a repertory called controller and download and upload all the files into the directory.
- file to upload
Note: I am using password=password1 for all passwords in this tutorial. You can use a different password.
Location where you need to use a password:
- MYSQL passwword
- RabbitMQ password
- User keystone password
- User glance password
- User nova password
- User neutron password
vi install-controller-node.sh
#!/bin/bash #If you are not using a DNS server make sure you have #serverIP FQDN hostname in your /etc/hosts file if [ "$(id -u)" != "0" ]; then echo "This script must be run as root" 1>&2 exit 1 fi PASSWORD=password1 CONFIG_DIR=/root/controller file="99-openstack.cnf" export DEBIAN_FRONTEND=noninteractive debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password password '$PASSWORD debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password_again password '$PASSWORD echo "Enable the Openstack repository" sleep 3 apt -y install software-properties-common add-apt-repository -y cloud-archive:newton apt update && apt -y dist-upgrade echo "Install the Openstack client" sleep 3 apt -y install python-openstackclient echo "Start to Install Database" sleep 3 apt -y install mariadb-server python-pymysql echo "Create and edit the files/etc/mysql/mariadb.conf.d/99-openstack.cnf" cd /etc/mysql/mariadb.conf.d/ if [ ! -f "$file" ] ; then # if not create the file cat > $file << EOF [mysqld] bind-address = 10.192.16.38 default-storage-engine = innodb innodb_file_per_table max_connections = 4096 collation-server = utf8_general_ci character-set-server = utf8 EOF else echo "$file existe" fi echo "Restart the database service" sleep 3 service mysql restart echo "Start to Install RabbitMQ" sleep 3 apt -y install rabbitmq-server rabbitmqctl add_user openstack $PASSWORD rabbitmqctl set_permissions openstack ".*" ".*" ".*" echo "Start to install memcached" sleep 3 apt -y install memcached python-memcache echo "Edit the /etc/memcached.conf" sleep 3 cp /etc/memcached.conf /etc/memcached.conf~ sed -i 's/127.0.0.1/10.192.16.38/g' /etc/memcached.conf service memcached restart echo "start to Install Keystone" sleep 3 cat << EOF | mysql -uroot -p$PASSWORD # CREATE DATABASE keystone; GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \ IDENTIFIED BY '$PASSWORD'; GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \ IDENTIFIED BY '$PASSWORD'; # CREATE DATABASE glance; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '$PASSWORD'; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '$PASSWORD'; # CREATE DATABASE nova_api; CREATE DATABASE nova; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \ IDENTIFIED BY '$PASSWORD'; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \ IDENTIFIED BY '$PASSWORD'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \ IDENTIFIED BY '$PASSWORD'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \ IDENTIFIED BY '$PASSWORD'; # CREATE DATABASE neutron; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \ IDENTIFIED BY '$PASSWORD'; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \ IDENTIFIED BY '$PASSWORD'; EOF apt -y install keystone mv /etc/keystone/keystone.conf /etc/keystone/keystone.conf~ cp $CONFIG_DIR/keystone.conf /etc/keystone/ su -s /bin/sh -c "keystone-manage db_sync" keystone keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone keystone-manage credential_setup --keystone-user keystone --keystone-group keystone keystone-manage bootstrap --bootstrap-password $PASSWORD \ --bootstrap-admin-url http://controller:35357/v3/ \ --bootstrap-internal-url http://controller:35357/v3/ \ --bootstrap-public-url http://controller:5000/v3/ \ --bootstrap-region-id RegionOne echo "Start Apache configuration" sleep 3
You need to change what is in red in the script to match your environment.
Before running the script
There are some settings that needs to change first in some of the files we upload to the /root/controller/ repertory. Navigate to the controller repertory
cd controller
lets start with the file keystone.conf.if you changed the default password in the controller-node.sh you need to change it also on line 643.
643 connection = mysql+pymysql://keystone:password1@controller/keystone
The next file is the glance-api.conf. if the password was changed too in the controller-node.sh use the same password on line 1735 and line 3190
1735 connection = mysql+pymysql://glance:password1@controller/glance --- 3190 password = password1
Next file: glance-registry.conf on line 1025
1025 connection = mysql+pymysql://glance:password1@controller/glance
OpenStack dashboard (Horizon) login
After the script complete with no error, login to the horizon by typing your_controller_IP_Address/horizon into your browser. In my case i am using the 10.192.0.0/24 network address to access horizon since the computer I am using for this tutorial is on that network.
http://10.192.0.75/horizon/
You have 2 options here to login: login with the user admin or with the user demo with the password you set. In my case i am going to use user=admin and password=password1
Compute node installation
Login to your compute node as root and copy the script below into you root directory. For the compute node, I am using also password=password1. You can change this with your own password.
vi install-compute-node.sh
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
PASSWORD=password1
CONFIG_DIR=/root/compute
echo "Enable the Openstack repository"
sleep 3
apt -y install software-properties-common
add-apt-repository -y cloud-archive:newton
apt update && apt -y dist-upgrade
echo "Install the Openstack client"
sleep 3
apt -y install python-openstackclient
echo "Install libvirt-bin"
sleep 3
sudo apt-get -y install libvirt-bin
##Install nova compute
echo "Start to Install Nova"
sleep 3
apt-get install -y nova-compute
mv /etc/nova/nova.conf /etc/nova/nova.conf~
cp $CONFIG_DIR/nova.conf /etc/nova
chown nova:nova /etc/nova/nova.conf
service nova-compute restart
sleep 3
##neutron installation
echo "Install the network components"
sleep 3
apt install -y neutron-linuxbridge-agent
mv /etc/neutron/neutron.conf /etc/neutron/neutron.conf~
cp $CONFIG_DIR/neutron.conf /etc/neutron/neutron.conf
chown root:neutron /etc/neutron/neutron.conf
mv /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini~
cp $CONFIG_DIR/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini
service nova-compute restart
sleep 3
service neutron-linuxbridge-agent restart
sleep 3