Thursday, May 12, 2016

Installing VNC on CentOS

Installing VNC server

#yum install tigervnc*

Set preferred Desktop (KDE/GNOME etc)

Desktop can be changed by editing the xtartup file or any other file invoked by xtartup.

[root@localhost ~]# cat .vnc/xstartup
#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc


[root@localhost ~]# vi /etc/X11/xinit/xinitrc

. /etc/X11/xinit/xinitrc-common

# The user may have their own clients they want to run.  If they don't,
# fall back to system defaults.
if [ -f $HOME/.Xclients ]; then
    exec $CK_XINIT_SESSION $SSH_AGENT $HOME/.Xclients || \
    exec $CK_XINIT_SESSION $SSH_AGENT $HOME/.Xclients
elif [ -f /etc/X11/xinit/Xclients ]; then
    exec $CK_XINIT_SESSION $SSH_AGENT /etc/X11/xinit/Xclients || \
    exec $CK_XINIT_SESSION $SSH_AGENT /etc/X11/xinit/Xclients
else
    # Failsafe settings.  Although we should never get here
    # (we provide fallbacks in Xclients as well) it can't hurt.
    [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
    [ -x /usr/bin/xclock ] && /usr/bin/xclock -geometry 100x100-5+5 &
    [ -x /usr/bin/xterm ] && xterm -geometry 80x50-50+150 &
    [ -x /usr/bin/twm ] && /usr/bin/twm
fi

To start GNOME, add /usr/bin/gnome-session &


else
    # Failsafe settings.  Although we should never get here
    # (we provide fallbacks in Xclients as well) it can't hurt.
    /usr/bin/gnome-session &
fi

To start KDE, , add /usr/bin/startkde  &


else
    # Failsafe settings.  Although we should never get here
    # (we provide fallbacks in Xclients as well) it can't hurt.
    /usr/bin/startkde  &
fi


Next step is, set a password for your VNC session

#vncpasswd

Then start a new session. 
#vncserver 

You can specify an unique display number

#vncserver :100

To kill a VNC session

#vncserver --kill :100 




Friday, July 3, 2015

Crontab: Permission denied


If you get "Permission denied" error message while adding any cron entry, follow these steps to fix the error.


[user@RHEL5 ~]$ crontab -e
-bash: /usr/bin/crontab: Permission denied




1. Check whether the user name is present in /etc/cron.deny file. If yes remove it.

2. Check whether /etc/cron.allow file is present. If yes, add user name to the file.

3. Check for cron related entry in PAM configuration  file.

    [user@RHEL5 ~]$grep "^+.*cron" /etc/security/access.conf

4. Change the file permission of crontab file

    #chmod 4775 /usr/bin/crontab

Wednesday, July 1, 2015

Reconnecting to DevStack screen and restarting the services


When the ./stack.sh is run, it uses screen application to create multiple sessions. Once the DevStack is up and running, you can reconnect to screen and gain control by running

stack@ubuntuvm:~/devstack$ ./rejoin-stack.sh




To view the list of tabs, CTRL+a and then press ". 


Select any tab by pressing the arrow key and hit Enter. To stop the process by pressing CTRL+c and press UP arrow key to view the command. Press enter to start the process again.



To close the screen, press CTRL+A+D.

You can also use screen command instead of rejoin-stack.sh



Screen commands

Next Tab          CTRL+a+n
Previous Tab    CTRL+a+b
Close screen     CTRL+a+d
List tabs           CTRL+a+"













Monday, June 22, 2015

Monitoring OpenStack Queue(AMQP)

RabbitMQ provides command line tool for checking the queue status. 

stack@ubuntuvm:~$ rabbitmqctl list_queues name

stack@ubuntuvm:~$ rabbitmqctl list_exchanges name

RabbitMQ provides web based GUI for monitoring and administration. To enable the management plugin, run

stack@ubuntuvm:~$ sudo rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management
Plugin configuration has changed. Restart RabbitMQ for changes to take effect.


stack@ubuntuvm:~$  sudo service rabbitmq-server restart
 * Restarting message broker rabbitmq-server    


Web GUI can be accessed from http://server-name:15672/ URL.



Tuesday, May 19, 2015

Testing OpenStack REST API using JMeter

OpenStack provides numerous REST APIs for managing various tasks and fetching information. Project website provides a well written API document which can be found here.
APIs are classified based on components and version numbers.


While creating API end points, we need to give  three different URLs namely public, internal and admin and level of access for these endpoints are defined in keystone-paste.ini file.

1. Download JMeter from http://jmeter.apache.org/ and extract the archive.

2. Download JMeter plugins from http://jmeter-plugins.org/ and extract the content into JMeter directory.

3. Create a new JMeter test plan and add "Thread Group" controller with single thread.



4. Add "HTTP Header Manager" Config Element.



5.  In HTTP Request sampler, configure server ip, port  and REST request(In Body Data field).




6.  Configure JSON Path to extract the toke id.



7. Now configure another HTTP Request control to send the API request to the Nova node. Here HTTP request type is GET.



Save the configuration and click on run button. First JMeter will fire a request to Keystone endpoint and token id is obtained. Later token id is extracted using JSon Path and passed to the second API. You can view the results in Result tree.

Monday, May 11, 2015

Run OpenStack on your laptop using DevStack

DevStack requires Ubuntu 14.04 (Trusty Tahr) to run. First create a sudo user in you Linux box.

If you are using any higher version of Ubuntu then you can forcefully run DevStack by setting FORCE environment variable to yes. However you may face issue due to python library mismatch.

export FORCE=yes

Add a new user to run DevStack. This step is optional and DevStack can be run from any sudo user.
Sudo is required since DevStack downloads various  packages and also mounts disk partitions.

groupadd stack
useradd -g stack -s /bin/bash -d /opt/stack -m stack

user@ubuntuvm:~$ id
uid=1001(stack) gid=1001(stack) groups=1001(stack),27(sudo),130(libvirtd)


apt-get install sudo -y
echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers


DevStack project is hosted on GIT and therefore install git client if not installed.

sudo apt-get install git -y

git clone https://git.openstack.org/openstack-dev/devstack

To download a specific branch

git clone https://github.com/openstack-dev/devstack.git -b stable/juno devstack/

cd devstack

./stack.sh
First this script will checkout DevStack source code from DevStack repository and it will download and install dependency packages from Ubuntu package repository.

stack.sh uses screen command. Once it is started you can close the terminal. To reconnect to the screen just ./rejoin.sh

To stop DevStack, run

./unstack.sh

This will stop all the processes and close screens.

Configuration file

In DevStack features can be enabled or disabled through local.conf file. I have created a sample local.conf file in which almost all OpenStack components
are enabled.


git clone https://github.com/uttamhoode/devstack

cp local.conf /opt/devstack


Stop DevStack instance and restart it.




Monday, December 15, 2014

Building Seagull from source


First download the source code from Seagull Sourceforge project page.

[uttam@CentOS ~]$ wget http://kaz.dl.sourceforge.net/project/gull/seagull/1.8.2/seagull.svn.tar.gz
--2014-07-04 14:45:09-- http://kaz.dl.sourceforge.net/project/gull/seagull/1.8.2/seagull.svn.tar.gz
Resolving kaz.dl.sourceforge.net... 88.204.157.163
Connecting to kaz.dl.sourceforge.net|88.204.157.163|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14811741 (14M) [application/x-gzip]
Saving to: `seagull.svn.tar.gz'


100%[==============================================================================================================================>] 14,811,741 294K/s in 38s


2014-07-04 14:45:48 (383 KB/s) - `seagull.svn.tar.gz' saved [14811741/14811741]



Extract the archive

$tar -zxvf seagull.svn.tar.gz

$cd cd seagull.svn.LINUX/
If you are not using TCAP and SCTP, then you can comment the below lines in build.conf
else you need to install the relevent libraries.

# HP OC TCAP transport library
BUILD_8_NAME="libtrans_octcap.so"
BUILD_8_TYPE=tcap_lib
BUILD_8_MODULES="common transport-frame protocol-frame library-trans-octcap32"
# sctp transport library
BUILD_9_NAME="libtrans_extsctp.so"
BUILD_9_TYPE=libextsctp
BUILD_9_MODULES="common transport-frame protocol-frame library-trans-ip library-trans-extsctp"

Install external libraries

#yum install lksctp*
#yum install lksctp-tools-devel-*

or
[uttam@CentOS seagull.svn.LINUX]$ ./build-ext-lib.ksh
[uttam@CentOS seagull.svn.LINUX]$ patch < add-fPIC.patch
patching file build.conf
[uttam@CentOS seagull.svn.LINUX]$ ./build.ksh -help
Command line syntax of ./build.ksh - options
-exec <RELEASE|DEBUG> : mode used for compilation (default RELEASE)
-target <all|clean|force|dist> : target used for compilation (default all)
-help : display the command line syntax