Monday 23 June 2014

Steps to configure Neutron LBaaS Agent for OpenStack Icehouse




[Steps summarised from http://docs.openstack.org/admin-guide-cloud/content/install_neutron-lbaas-agent.html]



Prerequisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-install-openstack-icehouse.html to setup OpenStack.
All Configuration details can be found there.




Install the Neutron LBaaS Agent and HAProxy

# yum -y install haproxy neutron-lbaas-agent



For LBaaS to be configured properly, various configuration files must have the following changes.


# vi /usr/share/neutron/neutron-dist.conf:

service_provider = LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default



# vi /etc/neutron/neutron.conf

service_plugins = neutron.services.loadbalancer.plugin.LoadBalancerPlugin


# vi /etc/neutron/lbaas_agent.ini

device_driver = neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver

interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver

user_group = nobody


# vi /etc/openstack-dashboard/local_settings 

OPENSTACK_NEUTRON_NETWORK = {'enable_lb': True,




Comment service_provider from the file /usr/share/neutron/neutron-dist.conf to avoid the following error in server.log:
TRACE neutron.service Invalid: Driver neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver is not unique across providers



If the above configuration files were changed manually, restart the neutron-server service and neutron-lbaas-agent service.
Also, restart the httpd service.

# service httpd restart
# service neutron-server restart
# service neutron-lbaas-agent start
# chkconfig --level 345 neutron-lbaas-agent on



Thursday 19 June 2014

Steps to install Jenkins on CentOS 6




Prerequisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-oracle-java-jdk-7u60-on.html to install Java on CentOS 6.



Change the user to root

sudo -s



Install the Jenkins repository

yum -y install wget
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key



Install Jenkins

yum -y install jenkins



Configure Jenkins to start with the system   

chkconfig jenkins on



Configure Jenkins to start now

service jenkins start



Open Port 8080 in iptables

vi /etc/sysconfig/iptables
-A INPUT -p tcp -m multiport --dport 8080 -m comment --comment "Open port for Jenkins" -j ACCEPT
service iptables restart



Test the URL for Jenkins at http://<server-IP-address>:8080/



Monday 9 June 2014

Steps to setup Oracle Java JDK 7u60 on CentOS 6




Download the appropriate JDK RPM file (check for the correct architecture - 32 or 64 bit)

This is the command for downloading the rpm for a 64bit architecture:

# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-x64.rpm



Install the JDK RPM
# rpm -Uvh ~/jdk-7u60-linux-x64.rpm



Install alternatives

# alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_60/jre/bin/java 20000
# alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_60/jre/bin/javaws 20000
# alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_60/bin/javac 20000
# alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_60/bin/jar 20000



Update alternatives (Enter Selection ID of the installation you need to be selected as default)

# alternatives --config java
# alternatives --config javaws
# alternatives --config javac
# alternatives --config jar



Check the default version of java

# java -version



Steps to create a volume in Cinder and attach it to an OpenStack instance




[Steps summarised from http://docs.openstack.org/user-guide/content/cli_manage_volumes.html]



Prerequisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-openstack-command-line.html to create an instance in OpenStack.



Set environment for your specific user and tenant

# source ~/keystonerc_<user-name>



Change the iptables rule for Cinder to allow command line access from an IP other than the OpenStack Controller Node

On the Controller node, in file /etc/sysconfig/iptables, remove the line
-A INPUT -s 192.168.2.6/32 -p tcp -m multiport --dports 3260,8776 -m comment --comment "001 cinder incoming cinder_192.168.2.6" -j ACCEPT

and in its place, add the line
-A INPUT -p tcp -m multiport --dports 3260,8776 -m comment --comment "Cinder incoming ALL" -j ACCEPT

Restart iptables service to enable the change
# service iptables restart



Create a 10GB Volume

# cinder create 10 --display-name <my-new-volume>



Gather required parameters

# cinder list
Note the <volume-ID> in the ID column of the list displayed. Make sure the "Attached to" column is empty.

# nova list
Note the <instance-ID> in the ID column of the list displayed. This will be the ID of the instance.



Attach the volume to the instance

# nova volume-attach <instance-ID> <volume-ID> <volume-drive-device>



SSH into the new instance using the floating IP and the private key file for <key-name>

# ssh -i <my-key>.pem <user-name>@<floating-IP>

Use fdisk to list the devices attached to the instance

# sudo fdisk -l



Steps to launch a new instance in OpenStack and ssh into it using a floating IP




[Steps summarised from http://docs.openstack.org/user-guide/content/launch_from_image.html]



Pre-requisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-openstack-command-line.html to setup command line tools for OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-new-tenant-and-users-on.html to create a tenant and user for OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-initial-networks-for.html to create public network, private network, and a router.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-add-image-to-openstack.html to add a new qcow2 image to OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-keypair-in-openstack.html to create a new keypair in OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-and-update-security.html to create a new security group in OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-new-flavor-in-openstack.html to create a new flavor in OpenStack.



Set environment for your specific user and tenant

# source ~/keystonerc_<user-name>



Gather required parameters

# nova flavor-list
Note the <flavor-ID> from the ID column displayed.

# nova image-list
Note the <image-ID> from the ID column displayed.

# nova keypair-list
Note the <key-name> from the Name column displayed.

# nova secgroup-list
Note the <secgroup> from the Name column displayed.

# nova net-list
Note the <tenant-network-ID> from the ID column for the tenant network (not the external network).

# nova floating-ip-list
Note the <floating-IP> from the Ip column, with "-" in the Fixed IP column, to get an unassociated floating IP.



Create a new instance using parameters set above

# nova boot --flavor <flavor-ID> \
                  --image <image-ID> \
                  --key-name <key-name> \
                  --security-groups <secgroup> \
                  --nic <net-id=net-uuid> \
                  <instance-name>



Assign a floating IP to the instance created

# nova floating-ip-associate <instance-name> <floating-IP>



SSH into the new instance using the floating IP and the private key file for <key-name>

# ssh -i <my-key>.pem <user-name>@<floating-IP>

NOTE:
Full path for <my-key>.pem should be mentioned.
1. Username for the instances will depend on the type of the image.
2. Following are a few examples:
CentOS 6.5 (http://repos.fedorapeople.org/repos/openstack/guest-images/centos-6.5-20140117.0.x86_64.qcow2): cloud-user
Fedora 19 (http://cloud.fedoraproject.org/fedora-19.x86_64.qcow2): fedora
Ubuntu 12.04 (http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img): ubuntu



Sunday 8 June 2014

Steps to create a new flavor in OpenStack




[Steps summarised from http://docs.openstack.org/user-guide-admin/content/cli_manage_flavors.html]



Pre-requisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-openstack-command-line.html to setup command line tools for OpenStack.



Set environment for admin

# source ~/keystonerc_admin



Create new flavor

# nova flavor-create --is-public <true/false> <flavor-name> <flavor-ID> <RAM-in-MB> <root-disk-in-GB> <number-of-VCPUs>

Example of new flavor with 1GB RAM, 20GB Root Disk, and 3 VCPUs

# nova flavor-create --is-public true VCPU3RAM1024DISK20 auto 1024 20 3



Steps to create and update security group in OpenStack




[Steps summarised from http://docs.openstack.org/trunk/openstack-ops/content/security_groups.html]



Pre-requisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-openstack-command-line.html to setup command line tools for OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-new-tenant-and-users-on.html to create a tenant and user for OpenStack.



Set environment for your specific user and tenant

# source ~/keystonerc_<user-name>



Create a new security group

# nova secgroup-create <security-group-name> "<security-group-description>"

Example

# nova secgroup-create secgroup1 "Create new default security group"



Open port 22 for ssh access in the security group

# nova secgroup-add-rule <secgroup> <ip-proto> <from-port> <to-port> <cidr>

Example

# nova secgroup-add-rule secgroup1 tcp 22 22 0.0.0.0/0



Saturday 7 June 2014

Steps to create a keypair in OpenStack




[Steps summarised from http://docs.openstack.org/user-guide/content/cli_configure_instances.html]



Pre-requisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-openstack-command-line.html to setup command line tools for OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-new-tenant-and-users-on.html to create a tenant and user for OpenStack.



Set environment for your specific user and tenant

# source ~/keystonerc_<user-name>



Create keypair

# nova keypair-add <key-name> > <my-key>.pem



Change permissions of the private key

# chmod 400 <my-key>.pem


Steps to add an image to OpenStack




[Steps summarised from http://docs.openstack.org/trunk/openstack-ops/content/user_facing_images.html]



Pre-requisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-openstack-command-line.html to setup command line tools for OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-new-tenant-and-users-on.html to create a tenant and user for OpenStack.



Download CentOS Qcow2 Image

# wget http://repos.fedorapeople.org/repos/openstack/guest-images/centos-6.5-20140117.0.x86_64.qcow2



Set environment for your specific user and tenant

# source ~/keystonerc_<user-name>



Upload image 

# glance image-create --name='<image-name>' --is-public=<true/false> \
  --container-format=<image-container-format> --disk-format=<image-disk-format> <image-file-location-on-disk>

Example

# glance image-create --name='CentOS6.5_QCOW2' --is-public=true \
  --container-format=bare --disk-format=qcow2 < centos-6.5-20140117.0.x86_64.qcow2



Steps to create initial networks for OpenStack




[Steps summarised from http://docs.openstack.org/icehouse/install-guide/install/yum/content/neutron-initial-networks.html]



Pre-requisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-openstack-command-line.html to setup command line tools for OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-new-tenant-and-users-on.html to create a tenant and user for OpenStack.



Change the iptables rule for Neutron Server to allow command line access from an IP other than the OpenStack Controller Node

On the Controller node, in file /etc/sysconfig/iptables, remove the line
-A INPUT -s 192.168.2.6/32 -p tcp -m multiport --dports 9696 -m comment --comment "001 neutron server incoming neutron_server_192.168.2.6_192.168.2.6" -j ACCEPT

and in its place, add the line
-A INPUT -p tcp -m multiport --dports 9696 -m comment --comment "Neutron incoming ALL" -j ACCEPT

Restart iptables service to enable the change
# service iptables restart



On the node where OpenStack Command Line tools are installed, set environment for the user admin tenant admin

# source ~/keystonerc_admin



Create external networ

 # neutron net-create <external-network-name> --shared --router:external=True

Example

# neutron net-create Ext1 --shared --router:external=True



Create subnet for the external networ

 # neutron subnet-create <external-network-name> --name <external-network-subnet-name> \
  --allocation-pool start=<start-floating-IP>,end=<end-floating-IP> \
  --disable-dhcp --gateway <external-network-gateway-IP> <external-network-CIDR>

Example 

 # neutron subnet-create Ext1 --name Ext1Subnet1 \
  --allocation-pool start=192.168.3.51,end=192.168.3.230 \
  --disable-dhcp --gateway 192.168.3.1 192.168.3.0/24



Set environment for your specific user and tenant

# source ~/keystonerc_<user-name>



Create tenant network

# neutron net-create <tenant-network-name>

Example

# neutron net-create Private1



Create subnet for the tenant network

# neutron subnet-create <tenant-network-name> --name <tenant-network-subnet-name> \
  --gateway <tenant-network-gateway-IP> <tenant-network-CIDR>
 
Example

# neutron subnet-create Private1 --name Private1Subnet1 \
  --gateway 10.10.3.1 10.10.3.0/24
 


Create a router on the tenant network 

# neutron router-create <router-name>

Example

# neutron router-create Router1



Attach tenant networks to the router

# neutron router-interface-add <router-name> <tenant-network-subnet-name>

Example

# neutron router-interface-add Router1 Private1Subnet1



Attach external network to the router

# neutron router-gateway-set <router-name> <external-network-name>

Example

# neutron router-gateway-set Router1 Ext1



Verify network connectivity by pinging the tenant router gateway

# ping -c 4 <router-gateway-IP>

Example

# ping -c 4 192.168.3.51



Assign Floating IP to the tenant

# nova floating-ip-create <external-network-name>

Note the IP address as <floating-IP> to be used to assign to an instance.



Friday 6 June 2014

Steps to create new tenant and users on OpenStack




[Steps summarised from http://docs.openstack.org/grizzly/openstack-compute/admin/content/adding-users-tenants-and-roles-with-python-keystoneclient.html]



Pre-requisite

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-openstack-command-line.html to setup command line tools for OpenStack.



Set the environment for OpenStack Administrator User

# source ~/keystonerc_admin



List all existing roles

# keystone role-list



Create new tenant or project

# keystone tenant-create --name=<tenant-name>



List all tenants in OpenStack

# keystone tenant-list



Create User for OpenStack

# keystone user-create --name=<user-name> --pass=<password> --email=<user-email-address>



Assign User to a tenant as a particular role

# keystone user-role-add --user=<user-name> --tenant=<tenant-name> --role=<admin or _member_>



List all existing users

# keystone user-list



Create rc file for setting environment for new user

# vi ~/keystonerc_<user-name>
export OS_USERNAME=<user-name>
export OS_TENANT_NAME=<tenant-name>
export OS_PASSWORD=<password>
export OS_AUTH_URL=http://<openstack-controller-IP>:5000/v2.0/
export PS1='[\u@\h \W(keystone_<user-name>)]\$ '



Set the environment for OpenStack New User

# source ~/keystonerc_<user-name>



Steps to setup OpenStack Command Line Tools on CentOS 6




[Performed on a physical machine with CentOS 6.5, which is different from OpenStack Controller.
Steps summarised from http://docs.openstack.org/user-guide/content/install_clients.html]



# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# yum install python-pip



# for proj in ceilometer cinder glance heat keystone neutron nova swift trove; do
  pip install python-${proj}client
done



# sftp root@<openstack-controller-IP>
>> get keystonerc_admin
>> bye

# source ~/keystonerc_admin



# nova list



Thursday 5 June 2014

Steps to install OpenStack Icehouse using RDO Packstack on a single node




NODE DETAILS

Processor: AMD Phenom II X6 (6 Cores)
RAM: 16 GB DDR3
Hard Drives: 4 x 1TB Seagate Barracuda
Operating System: CentOS 6.5 Minimal



DISK DETAILS

/dev/sda -  root
/dev/sdb - swift
/dev/sdc - cinder
/dev/sdd - cinder



PREPARE DISK FOR SWIFT

Create /dev/sdb1 partition for the disk marked for Swift
# fdisk /dev/sdb

Format the partition as ext4
# mkfs.ext4 /dev/sdb1



NETWORK CONFIGURATION

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
HWADDR=<MAC-address>
IPADDR=<IP-address>
NETMASK=<netmask>
GATEWAY=<gateway-IP-address>
IPV6INIT=no



SET TIMEZONE AND SYNCHRONIZE TIME

# mv /etc/localtime /etc/localtime.bak
# cp /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

# yum install ntp
# chkconfig ntpd on
# service ntpd start



UPDATE CENTOS

yum -y update



DISABLE SELINUX

# vi /etc/selinux/config
SELINUX=disabled

# reboot



CREATE LOGICAL VOLUME GROUP FOR CINDER

Create partitions /dev/sdc1 and /dev/sdd1 on /dev/sdc and /dev/sdd using fdisk

# fdisk /dev/sdc
# fdisk /dev/sdd

Create logical volume group using the created partitions

# yum install lvm2
# pvcreate /dev/sdc1 /dev/sdd1
# vgcreate cinder-volumes /dev/sdc1 /dev/sdd1



RUN RDO PACKSTACK

# yum install -y http://rdo.fedorapeople.org/rdo-release.rpm
# yum install -y openstack-packstack
# packstack --gen-answer-file my_answers.txt
# vi my_answers.txt
Refer to the attached file for details about the answer file configurations.

# packstack --answer-file=my_answers.txt



UPDATE NETWORK CONFIGURATION

# vi /etc/sysconfig/network-scripts/ifcfg-br-ex
DEVICE=br-ex
IPADDR=<IP-address>
NETMASK=<netmask>
GATEWAY=<gateway-IP-address>
ONBOOT=yes
STP=off
HOTPLUG=no
NM_CONTROLLED=no

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
HWADDR=<MAC-address>

#  ovs-vsctl add-br br-ex
# ovs-vsctl add-port br-ex eth0
  


REBOOT MACHINE TO ENABLE ALL CHANGES

# reboot



ACCESS HORIZON DASHBOARD AT http://<IP-address>

Login details can be found at /root/keystonerc_admin.


Tuesday 3 June 2014

Steps to Setup SVN Server on CentOS 6




Install SVN Packages

# yum -y install subversion mod_dav_svn



Create directory for first SVN Repository

# mkdir /svnrepos
# cd /svnrepos
# chown -R apache.apache /svnrepos
# svnadmin create repo1



Enable Permissions through selinux

# chcon -R -h -t httpd_sys_content_t /svnrepos




Modify the SVN Configuration File

# vi /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location />
   DAV svn
   SVNParentPath /svnrepos
   SVNListParentPath on
   AuthType Basic
   AuthName "Subversion repositories"
   AuthUserFile /etc/svn-auth-users
   Require valid-user
</Location>




Create User for SVN Access

# htpasswd -cm /etc/svn-auth-users svnuser



Restart Apache Web Server

# service httpd restart 



Open Firewall to allow access to port 80

# iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
# service iptables save
# service iptables restart



Access the SVN Repository from the URL

http://<machine-IP>/repo1/