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

2011-11-14

Jabber with MSN transport in Ubuntu 11.10

There are several ways to install a messenger service on your own servers to provide communication to your comrades or integrate a messenger service on the Intranet page in your workplace.

Ubuntu has packages to help you out,  I'll show you here how to install the Erlang Jabber/XMPP Daemon and the MSN Transport to help your users to communicate with their contacts on the MSN Messenger network.

I'll be using the Virtual Machine created in my first post, you might want to use your own computer with Ubuntu already installed and the only difference is that you might already have the required packages installed.

Preliminaries:
  • You need a hostname to identify your server, feel free to use the IP Address of your server as it will work. Of course a Dynamic DNS entry, a conventional Domain Name System or a DNS Appliance to get a hostname will be useful if you want to provide worldwide access.
Installation:

I'll be using the IP Address 192.168.1.82 as the hostname but you need to change it to your Internal IP Address, your Public IP Address or your hostname.

  1. You need the Erlang Jabber/XMPP Daemon and the MSN Transport, to install the packages use the following:
    sudo apt-get install ejabberd pymsnt  
    
  2. Your hostname and your administration user are missing in the configuration file, edit the file with the following command:
    sudo vi /etc/ejabberd/ejabberd.cfg  
    
    Add your admin user on line 58 (remember to change the IP Address accordingly, this user does not exists yet), change the line to something like the following:
    {acl, admin, {user, "myuser", "192.168.1.82"}}.  
    
    Add your hostname on line 61 (remember to change the IP Address accordingly), change the line to something like the following:
    {hosts, ["localhost","192.168.1.82"]}.  
    
    Uncomment the lines from 165 to 170 (MSN Transport) and change the hostname, just delete the initial "%%" and change localhost, it must look like the following:
     %% MSN Transport  
     {5557, ejabberd_service, [  
                             {ip, {127, 0, 0, 1}},  
                             {access, all},  
                             {shapper_rule, fast},  
                             {host, "msn.192.168.1.82", [{password, "secret"}]}  
                             ]},
    
  3. Restart the Erlang Jabber/XMPP Daemon with the following command:
    sudo service ejabberd restart  
    
  4. Create your admin user (remember to change the IP Address as well as myuser and mypassword accordingly) with the following command:
    sudo ejabberdctl register myuser 192.168.1.82 mypassword  
    
  5. Allow port 5222/TCP through the firewall with the following command:
    sudo ufw allow 5222/tcp  
    
    Optionally, the administrator interface is available using the address http://192.168.1.82:5280/admin, use the admin user created in step 4 without the hostname, to allow the administration interface through the firewall use the following command:
    sudo ufw allow 5280/tcp  
    
  6. The Erlang Jabber/XMPP Daemon is expecting the MSN Transport to connect using the port number 5557 (as we can see in step 2) but the MSN Transport is using 5347, edit the configuration file with the following command:
    sudo vi /etc/pymsnt.conf.xml  
    
    Change the Jabber Identification on line 6 to match your hostname (remember to change the IP Address accordingly), change the line to something like the following:
    <jid>msn.192.168.1.82</jid>  
    
    Change the port number on line 24, the line should look like following:
    <port>5347</port>  
    
  7. Restart the MSN Transport with the following command:
    sudo service pymsnt restart  
    
At this point you should be able to use a Jabber Client like Psi to get access using your admin user myuser@192.168.1.82 (remember to change the IP Address accordingly), new users can register also and use the MSN Transport to get their MSN Messenger contacts in Jabber.

The secure connection is possible using a self signed certificate you can set on line 229 in the configuration file /etc/ejabberd/ejabberd.cfg, but you might want to install your own certificate if you have the experience. Even with the self signed certificate every connection can be protected using STARTTLS if the Jabber Client support this feature, a good way to keep your conversations private.

I hope this will help someone out there, please feel free to send any comments.

2011-11-08

Oracle Instant Client 11.2.0.3.0 in Ubuntu 11.10

As an Oracle Database Administrator, I've been involved in several projects where the installation of the Instant Client is a requirement.

I'm aware of some tutorials where people tell you to use "alien" to convert Oracle RPMs to DEBs but I preffer to use ZIPs, so I'll post here how it works including the Basic package along with the SQL*Plus and the SDK.

I'll be using the Virtual Machine created in my first post, you might want to use your own computer with Ubuntu already installed and the only difference is that you might already have the required packages installed.

Preliminaries:
  1. Get the following files from Oracle Download site:
    instantclient-basic-linux.x64-11.2.0.3.0.zip
    instantclient-sdk-linux.x64-11.2.0.3.0.zip
    instantclient-sqlplus-linux.x64-11.2.0.3.0.zip
  2. You will need unzip for the files and SQL*Plus requires the Linux kernel AIO access library, to install the packages use the following:
    sudo apt-get install unzip libaio1
Installation:
  1. Instant Client will be installed under /usr/lib/oracle, from the directory where you have the ZIP files enter the following commands:
    sudo unzip instantclient-basic-linux.x64-11.2.0.3.0.zip -d /usr/lib/oracle
    sudo unzip instantclient-sdk-linux.x64-11.2.0.3.0.zip -d /usr/lib/oracle
    sudo unzip instantclient-sqlplus-linux.x64-11.2.0.3.0.zip -d /usr/lib/oracle

  2. You need two Symbolic Links for compilation purposes, create them with the following commands:
    sudo ln -s /usr/lib/oracle/instantclient_11_2/libclntsh.so.11.1 /usr/lib/oracle/instantclient_11_2/libclntsh.so
    sudo ln -s /usr/lib/oracle/instantclient_11_2/libocci.so.11.1 /usr/lib/oracle/instantclient_11_2/libocci.so
  3. Dynamic Linker Run-Time Bindings must be configured, create a new file with the following command:
    sudo vi /etc/ld.so.conf.d/oracle.conf
    And insert the following line:
    /usr/lib/oracle/instantclient_11_2
    Save the file and run the configuration of the Dynamic Linker Run-Time Bindings with the following command:
    sudo ldconfig
  4. Some environment variables are required and you can add the directory to the path, create a new file with the following command:
    sudo vi /etc/profile.d/oracle.sh
    And insert the following lines:
    export ORACLE_HOME=/usr/lib/oracle/instantclient_11_2
    export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
    export TNS_ADMIN=/etc/oracle
    export PATH=$PATH:$ORACLE_HOME
    Please note, the NLS_LANG environment variable must match the configuration of your Oracle Database or you will have character problems I normally use one of AMERICAN_AMERICA.AL32UTF8, MEXICAN SPANISH_MEXICO.AL32UTF8, MEXICAN SPANISH_MEXICO.WE8ISO8859P1 or MEXICAN SPANISH_MEXICO.WE8ISO8859P15 but you might need another.
  5. Log out and log in again to make the new environment variables available to your user.
  6. Finally, the tnsnames.ora file must be created in the path defined in the environment variable TNS_ADMIN, create the directory with the following command:
    sudo mkdir /etc/oracle
    Create the file with the following command:
    sudo vi /etc/oracle/tnsnames.ora
    And insert the lines you need to configure your connections, for example:
    ORCL =
    (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.87)(PORT = 1521))
     (CONNECT_DATA =
       (SERVICE_NAME = orcl)
     )
    )
You can now use SQL*Plus to test your installation:
sqlplus myuser@orcl

Feel free to use "alien" to make your own DEBs, I'm not against that in any way, I'm just posting this because some people I've worked with believe that just by installing those DEB files everything will work as espected ignoring some missing steps are needed. Hopefully, this will save you some time.

I hope this will help someone out there, please feel free to send any comments.

2011-11-07

Ruby 1.8.7/1.9.3 in Ubuntu 11.10 (using RVM Single-User installation)

As a Ruby developer, I'm often using different versions of the language to create scripts and Ruby on Rails applications. Packages for Ruby are available for Ubuntu through the official repositories but you might want to use Ruby Version Manager to keep things a bit simpler.

I'll be using the official installation instructions for Ruby Version Manager in the Virtual Machine created in my first post, you might want to use your own computer with Ubuntu already installed and the only difference is that you might already have the required packages installed.

Preliminaries:
  1. You will need curl and git to get the source code using the official script, to install the packages use the following:
    sudo apt-get install curl git
  2. If you want to use SSL you need the OpenSSL libraries available, for Ruby on Rails this is a requirement, to install the package use the following:
    sudo apt-get install libssl-dev
  3. If you like to use the Interactive Ruby Shell (IRB), you probably want to install the GNU readline libraries using the folowing:
    sudo apt-get install libreadline-dev

Installation:

Everything will be done as user, no need for administrative rights (or sudo), use the following command to install Ruby Version Manager:
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Once the installer finishes and you are back to your command line you need to log out and log in again to have Ruby Version Manager available (this is the preferred way for initial installations).

Post-Installation:

After your log in, you will have Ruby Version Manager installed and it is time to install Ruby. To install both versions (1.8.7 and 1.9.3) use the following commands:
rvm install 1.8.7
rvm install 1.9.3


After the installation of Ruby you need to select the default version to be used (even if you only installed one), use the following command to set the version 1.9.3 as default (of course, you can change the version number if you like):
rvm use 1.9.3 --default


You can change the default Ruby version anytime you want using the previous command, or you can change it temporary in your current session or terminal using it without the default flag (everytime you log in you will have the default version available):
rvm use 1.8.7


Ruby Gems will be installed as well, no need to download and install. Please note each Ruby version will have its own Gems, you can start to install Gems right away using the gem command.

I hope this will help someone out there, please feel free to send any comments.

Ubuntu 11.10 Server in VirtualBox 4.1.10

I've been doing a lot of research over the years looking for ways to integrate new or updated Software in different environments, something I always need is a Virtual Machine in which I install all the new stuff to test it and people ask me about how I create it to start their own (and, with a bit of luck, compete with me to be the first to implement something useful to make someone's job a bit easier).

At this time, I'm using VirtualBox 4.1.10 (no Extension Pack) and Ubuntu 11.10 Server (64 bit) but you can use 32 bit as well.

Preliminaries:
  1. Create a Virtual Machine using all the default option for a "Linux" Operating System and the "Ubuntu (64 bit)" Version.
  2. After creation, you need to change from SATA to IDE in the Storage configuration or your system will never boot (please! don't ask me why).

Installation:

After language selection (when you can highlight the "Install Ubuntu Server" entry) you should press "F4" on the keyboard to list the available instalation modes and select "Install a minimal Virtual Machine", now when you "Install Ubuntu Server" the installer will use a special version of the Linux Kernel made to be used in Virtual Machines.
Once the installation starts, configure everything according to you needs. I'll just list the following:
  • At the "Partition Disks" step I select "Guided - Use entire Disk" which will create a 534.8MB partition for Swap and leave the rest for the file system root "/" using EXT4.
  • At the "Software selection" step I leave everything blank to know exactly what packages I need to install when needed.

Post-Installation:

You will notice a faster boot of your Virtual Machine as it is using just what it needs to run, but to have complete functionality you might want to do the following:
  1. ACPI Shutdown from the "Machine" menu in VirtualBox does not work, to make it work use the following command:
    sudo apt-get install acpid
  2. Build Essential is missing, to install the packages needed to compile use the following command:
    sudo apt-get install build-essential
  3. No firewall installed, it is a good idea to install one if you want to understand your network services and add a level security, to install the Uncomplicated Firewall and enable it use the following commands:
    sudo apt-get install ufw  
    sudo ufw enable  
    
  4. There is no X server installed but you might want to use VirtualBox Shared Folders, select "Install guest additions..." from the "Devices" menu in VirtualBox and use the following commands:
    sudo apt-get install dkms linux-headers-virtual
    sudo mount /dev/cdrom /media/cdrom
    cd /media/cdrom
    sudo ./VBoxLinuxAdditions.run
Remember to keep your packages up to date with the following commands:
sudo apt-get update
sudo apt-get dist-upgrade
At this point you might want to export the appliance (444MB), clone the Virtual Machine or save a Snapshot.

I hope this will help someone out there, please feel free to send any comments.