Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Thursday, 17 December 2015

Create guest VM fullscreen inside VirtualBox

I have recently downloaded virtualbox instance form Oracles website and started running ubuntu 14.04 as guest machine om the same. However guest machine do not resizes when we resize the VMWare window. Some googling and it seems I need to install guest extension packges. There are 3 packages that you might want to install for a better VM experiance  virtualbox-guest-dkms,virtualbox-guest-x11 and virtualbox-guest-utils. To install them follow below command inside a VM

sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11

Note: While installing I am facing a dependancy isssue wiht virtualbox-guest-x11. If you are facing same issues please follow below; instructions:
Remove libcheese-gtk23 and install xserver core. Removing libcheese-gtk23 will take 5-10 mins. So be patient.

sudo apt-get remove libcheese-gtk23
sudo apt-get install xserver-xorg-core


and finally intall x11 guest extension;

sudo apt-get install -f virtualbox-guest-x11

Tuesday, 22 October 2013

Creating a simple application in Open Daylight Controller

In this post I am going to make a simple application in ODL. Main aim of this application will be just to say "I have started" at the time of loading and "Over and out", when it stops.
To program for ODL you need to know java language and Maven, OSGi. Dont panic if you don't know about the last two its fairly easy and I will go step-by-step on that.
When you start developing your folder structure should be as below;

ubuntu@ubuntu:userinfo$ ls
META-INF pom.xml src target 


Here src is where you will have code; target is where you will have binaries META-INF has information related to OSGi (Explained later). You need not to worry about it right now Maven will take care of it.

To understand about OSGi and create a simple java code click here
To understand and create a simple pom file in ODL click here

Once you have build successfully go to your target directory. you will find samples.userinfo-0.4.0-SNAPSHOT.jar over there. Thats your bundle !

Now follow the steps at running a custom bundle and see your sample app running in controller.
If you have any queries feel free to post it :)


Basic pom.xml file for building a bundle in Open DayLight

Maven is something like makefile in linux. Maven helps in compilation. when you say 'mvn install' it reads the pom.xml file. pom.xml have various tags essential tags for creating basic pom.xml are as below. Please note i have put comments between <!-- --> which is standard xml comment tag.
pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

<!-- Do not change above lines. They provide xml version and maven version info -->
    <parent>
<!-- Everything inside this tab is your parents, i.e on top of which you will make your application   --> 
    <groupId>org.opendaylight.controller</groupId>
    <!-- its the project where your parent is located-->
    <artifactId>commons.opendaylight</artifactId>
    <!-- Parent application name-->
    <version>1.4.0-SNAPSHOT</version>
    <!-- Parents version-->
    <relativePath>../../commons/opendaylight</relativePath>
    <!-- Path where parent pom file is located-->
  </parent>
  <scm>
    <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main</url>
  </scm>
    <!-- Everything inside scm tag is for version controlling you can delete this tag if you want-->

  <artifactId>samples.userinfo</artifactId>
  <!-- this is your application name.  -->
  <version>0.0.1-SNAPSHOT</version>
  <!-- Your application version.  -->

  <packaging>bundle</packaging>
  <!-- Tells maven you want to create OSGi bundle.   -->


  <build>
  <!-- Information on how to build the code-->
    <plugins>
      <plugin>
      <!-- Info on which plugin to use from maven   -->
        <groupId>org.apache.felix</groupId>
        <!-- Project name for that plugin-->
        <artifactId>maven-bundle-plugin</artifactId>
        <!-- Kind of obvious we are making an OSGi bundle-->
        <version>2.3.6</version>
        <!-- Plugins option-->
        <extensions>true</extensions>
        <!-- Use extension for this project-->
        <configuration>
          <instructions>
            <Import-Package>
              org.opendaylight.controller.sal.core,
              org.slf4j,
            </Import-Package>
            <!-- Which package to import for building the code-->
            <Export-Package>
              org.opendaylight.controller.samples.userinfo
            </Export-Package>
          <!-- Name of the package, which will be exported-->
            <Bundle-Activator>
              org.opendaylight.controller.samples.userinfo.internal.Activator
            </Bundle-Activator>
           <!-- Address where OSGi activator is located -->


          </instructions>
          <manifestLocation>${project.basedir}/META-INF</manifestLocation>
           <!-- Address of OSGi META file -->
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
  <!-- Dependencies on exiting code>
    <dependency>
      <groupId>org.opendaylight.controller</groupId>
      <artifactId>sal</artifactId>
      <version>0.5.0-SNAPSHOT</version>
    </dependency>
  </dependencies>
</project>

For more information on how to make a simple application in open daylight controller click here

Wednesday, 16 October 2013

Running a custom bundle in Open Day light controller

I have copied one of the sample application int the opendaylight controller and named it as userinfo by changing artifact id in pom file. In this post i will show you how can i add my application while controller is running.
First of all build the bundle by command "mvn install". If everything is well go to command line of controller. But before that let me shed some light on how OSGi works. Life cycle of any app is 1. install 2. resolve 3.uninstall. First and last is self explanatory. A bundle will be in resolved state when all the dependencies are resolved and that's when you can start a service. 

osgi> install file:/home/ubuntu/workspace/controller/opendaylight/samples/userinfo
Bundle id is 150
< output omitted>
Version              0.0.1.SNAPSHOT
BundleDescription    org.opendaylight.controller.samples.userinfo_0.0.1.SNAPSHOT
Framework            org.eclipse.osgi.framework.internal.core.Framework@164e955
ResolutionFailureException org.osgi.framework.BundleException: The state indicates the bundle is resolved
Revisions            [org.opendaylight.controller.samples.userinfo_0.0.1.SNAPSHOT]
BundleContext        null
BundleId             150
StartLevel           1
SymbolicName         org.opendaylight.controller.samples.userinfo
BundleData           org.opendaylight.controller.samples.userinfo_0.0.1.SNAPSHOT
KeyHashCode          150
StateChanging        null

as you can see once installed osgi gives you a bundle id. now you can start or stop this bundle with this id.
To check currently installed bundle and its id/state say 'ss'

osgi> ss
"Framework is launched."


id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.8.1.v20120830-144521
<OUTPUT ommited>
150     RESOLVED    org.opendaylight.controller.samples.userinfo_0.0.1.SNAPSHOT

As you can see state is resolved. Good now let you can start the bundle by giving command 'start 150'. But it will give you error as the controller don't have binaries. For that you need to copy your binary (i.e. jar) to
/home/ubuntu/workspace/controller/opendaylight/distribution/opendaylight/target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage/opendaylight/plugins

ok. Now say start 150 and njoy your code !

To create a simple application click here






Tuesday, 15 October 2013

Create a symbolic link in linux

Well I was working on this project and so happens my development directory and deployment directory (where i compile the code) are different. Now its not possible every time to go back and forth and copy my development one into deployment. So i will create a symbolic link between them. For those who are new to term symbolic link; its a file which has the reference( an address to reach to original file) of linked file.Yes something what windows calls a shortcut file.
To create a symbolic link, just say

ln -s [source; in my case development dir]  [target; deployment dir]

Note: Linux will not create hard link between directories. So if you have created a directory as target; simply delete it and give just the name instead.

Adding some more point.There are two types of links - Symbolic link and Hard link. Hard link actually points to the physical data i.e. location where it is stored on disk. Symbolic links refer to just path of the file. So if you delete the original file symbolic link will go, but hard links will stay as it is.

To create hard link just say 'ln' no '-s' in option.

Monday, 19 September 2011

How to install Open IMS Core in ubuntu



Open IMS Core is an open source implementation of IMS call session control function and a lightweight Home Subscriber Server. In this document I have discussed how to install it on Ubuntu.

Prerequisite:

Before installing Open IMS Core you need programs listed below installed and running.
  • an SVN client running
  • A mysql server. Install it by entering following command sudo apt-get mysql*
  • A DNS server. I have used bind9. I have installed it using synaptic Package Manger.
  • GCC3/4, make, JDK1.5, ant
  • bison and flex
  • libxml2, libmysql 

Getting the Source Code:

Create a directory /opt/OpenIMSCore and go in that directory by command

mkdir /opt/OpenIMSCore
cd /opt/OpenIMSCore

Download the latest version from the repository of Open IMS Core. But before downloading make two folders FHoSS for HSS functionalities and ser_ims for CSCF functionalities.

mkdir FHoSS
mkdir ser_ims

svn checkout http://svn.berlios.de/svnroot/repos/openimscore/ser_ims/trunk ser_ims
svn checkout http://svn.berlios.de/svnroot/repos/openimscore/FHoSS/trunk FHoSS

You can checkout at different path but after that you have to change configuration files.

Configuring DNS server:

As we want to make our own network we need DNS server for IP and domain name binding.
Next discussion will be based on following configuration:

Domain name: group1-imslab11.in
IP address: 192.168.1.100
Subnet : 255.255.0.0

Following steps will tell you how to configure your own DNS server. Before proceeding further you have to stop Network Manager, as it does automatic changes to files needed. To stop network manager run,

sudo service network-manager stop

Setup your ethernet; my ethernet is running on eth0 please check your ethernet ports name.

sudo ifconfig eth0 192.168.1.100/16 up

make the necessary changes in your interface file. Open interface file with command

sudo gedit /etc/networking/interfaces

copy the configuration of snapshot



resolv.conf file is used for client side configuration of DNS server.

open it with

sudo gedit /etc/resolv.conf



nameserver - IP address of DNS server
search - Search list for hostname lookup
domain - name of the local domain

Open hosts file with command

sudo gedit /etc/host



host file has the static lookup table for hostname
Ex. IP_ADDR cannonical_host_name aliases

This file joints ip addresses with there names and alias name.

Restart the network by command

/etc/init.d/networking restart

Configuring Bind:

DNS configuration files are stored in /etc/bind directory. Primary configuration file is /etc/bind/named.conf.
Here we will insert forward lookup zone and reverse lookup zone.



Here I have added a zone by giving it a name group1-imslab11.in and file for that forward zone declaring as /etc/bind/open-ims.dnszone. Similarly reverse zone and reverse zone file at location /etc/open-ims-rev.dnszone




copy open-ims.dnszone to /opt/OpenIMSCore/ser_ims/cfg/

restart bind9 server with

sudo /etc/init.d/bind9 restart

check whether DNS has configured properly or not from nslookup command.





OK all done. Now let us install Open IMS Core !!!

Make sure that mysql and bind9 are running.
  1. Go inside ser_ims/cfg directory ( cd /ser_ims/cfg/ )
  2. Run “configurator.sh” ( sh configurator.sh )
  3. Enter Domain Name: < your domain name>
  4. Enter IP Address: < Your IP Address>
    (We have given group1-imslab11.in as domain name and 192.168.1.100 as IP)
  5. Apply changes to all.
    (This step will change domain name and ip address in the following files: icscf.cfg,        icscf_pg.sql, icscf.sql, icscf.thig.cfg, icscf.xml, pcscf.cfg, pcscf.xml, persist_my.sql,        persist_pg.sql, scscf.cfg, scscf.xml)
  6. Change to the following directory:
    cd /opt/OpenIMSCore/FHoSS/scripts
  7. Change domain name and ip in userdata.sql to your domain and IP address.
  8. Change to the following directory
    cd /opt/OpenIMSCore/FHoSS/config/
  9. Change Domain name and IP in DiameterPeerHSS.xml to your domain name and IP.
  10. Move to the following directory and make by given command:
    cd /opt/OpenIMSCore/ser_ims
    make install-libs all
  11. After that write given command in prompt
    cd /opt/OpenIMSCore/FHoSS
    ant compile deploy
  12. Now make Database by command:
    cd /opt/OpenIMSCore
    mysql –u root –p < ser_ims/cfg/icscf.sql
    mysql –u root –p < FHoSS/scripts/hss_db.sql
    mysql –u root –p <FHoSS/scripts/userdata.sql
  13. To copy the following files into /opt/OpenIMSCore give commands
    cp ser_ims/cfg/*.cfg .
    cp ser_ims/cfg/*.xml .
    cp ser_ims/cfg/*.sh .
  14. Start OpenIMSCore in four parellel terminals by giving each command in different terminal:
    ./pcscf.sh
    ./scscf.sh
    ./icscf.sh
    cd FHoSS/deploy/
    ./startup.sh
  15. Open FHoSS web Console
    http://localhost:8080/hss.web.console/
    User Name: hssAdmin
    password: hss
  16. Go to user identities -> Public User Identities -> search
  17. Click on search, you will see two default users:   Alice and bob
  18. Go and do various experiments with Open IMS Core !!!!!