Monday, October 29, 2012

Howto setup Eclipse Juno on Ubuntu 12.04.1

The Eclipse PPA is dated and to install Juno for Ubuntu 12.04.1 manually kindly follow these steps 

1. Select and download Eclipse Juno .tgz for your architecture from http://www.eclipse.org/downloads/

2. Open terminal windows (Ctrl + Alt + T) and type following command

$ cd ~/Downloads
$ tar zxvf eclipse-SDK-4.2.1-linux-gtk-x86_64.tar.gz
(Do not run this command as sudo or root)

$ sudo su

# mv eclipse /usr/lib/eclipse

# chown root:root /usr/lib/eclipse

# ln -s /usr/lib/eclipse/eclipse /usr/bin/eclipse

# exit

$ eclipse

this will start eclipse.

4. To add Juno update site, in Eclipse menu select 'Help' > 'Install New Software...'. Click on Add button and enter name as 'Juno' and location enter 'http://download.eclipse.org/releases/juno' and click on 'Ok' to save.
 
5. To add eclipse to Unity Launcher, open file editor and create eclipse.desktop file

$ sudo vi /usr/share/applications/eclipse.desktop

[Desktop Entry]
Type=Application
Name=Eclipse
Version=4.2.1
Comment=Eclipse Integrated Development Environment
Icon=/usr/lib/eclipse/icon.xpm
Exec=/usr/lib/eclipse/eclipse
Terminal=false
Categories=Development;IDE;


save the file and now go ahead and type eclipse in HUD and start eclipse.

Sunday, September 30, 2012

FreeNAS® - Deployment Guide

Few days back I was searching for alternative open source solutions for enterprise and I found quite a few options and of them FreeNAS seemed quite interesting. I immediately downloaded an .iso and within 10 minutes FreeNAS was installed and running.

FreeNAS® 8.2.0 is an Open Source Storage Platform  which supports sharing across Windows, Apple, and UNIX-like systems. It includes ZFS (Zettabyte File System), which supports high storage capacities (256 quadrillion zettabytes) and integrates file systems and volume management.

To deploy we need a server with atleast 4 GB RAM & 2 HDDs, smaller HDD as a dedicated boot drive for installing OS & larger capacity HDD for storing Data. FreeNAS OS can also be installed on USB flash drive or SATA DOM with 2 GB or more space.

Follow below mentioned steps to proceed with basic server deployment.

1) Boot the system using FreeNAS CD

2) In 'Console Setup' screen select option 'Install/Upgrade'

3) In 'Choose destination media' screen select smaller HDD to install OS

4) In 'Upgrade this FreeNAS installation' screen select 'No' to do fresh installation

5) In "FreeNAS installation" screen select 'Yes' to proceed with installation

6) Once installation is done, system will ask to remove CD & proceed to reboot the system, click on 'Ok'.

7) This will go back to 'Console Setup' screen, now select 'Reboot System' option and remove CD while system boots.

8) While booting, server picks up IP address from DHCP and once server is ready, the consoles displays system menu & URL to access FreeNAS Admin Interface over the network. Now we are ready to proceed with server configuration.

9) Open a browser on any desktop from the same network and open FreeNAS URL to access Admin Console. The very first thing you do is the set Admin / root password.

     - Click on [+] Account -> Admin Account -> Change Password & now provide password for Admin Interface. Ensure 'Change root password as well' is checked. Click on 'Change Admin Password' to save new password. With saving of password, the red 'Alert' button on right hand side of screen will stop blinking and turn to green.

10) Change basic server details & set fixed IP address for the server

     - Click on [+] 'Network' -> 'Global Configuration'
     Provide details as required for these fields
          - Enter Hostname
          - Enter Domain name
          - Enter gateway address for IPv4 Default Gateway
          - Enter DNS server IPs for Nameserver
          - Click on 'Save' at the bottom of the screen

     - Click on [+] 'Network' -> 'Interfaces', in this screen click on 'Add Interface' button and fill in details as mentioned below
     - Select NIC from dropdown box
     - Enter 'nic1' Interface Name
     - Do not check DHCP as we are configuring fixed IP address
     - Enter server ip address for 'IPv4 Address'
     - Select valid subnet mask for 'IPv4 Netmask'
     Rest of the information can be left blank and at the bottom of the page click on 'Ok' button to save changes. Now restart the server.
     
11)  In the browser, enter new FreeNAS URL and login to access Admin Console

12) Before we proceed lets increase the default space allocated for /etc partition, as we would need additional space for our deployment

     - Click on 'Shell' and run following command

     [root@freenas ~]# mount -uw /
     [root@freenas ~]# vi /conf/base/etc/md_size

     and update 10204 to 20480 or more depending upon the requirement and save the file

     [root@freenas ~]# mount -ur /

     and restart the server.

13) Configure NTP server for FreeNAS server to sync & also enable it to be a NTP server for our network
     - Click on [+] 'Systems' -> 'NTP Servers' -> 'Add NTP Server'
     - Enter '1.in.pool.ntp.org' for Address and keeping rest as default click on 'Ok' button to save
     - Again click on 'Add NTP Server' & enter '2.asia.pool.ntp.org' for Address & click on 'Ok' button to save
    We can safely remove few other NTP servers
     - Click on [+] 'Systems' -> 'NTP Servers' -> 'View NTP Server' and delete '1.freebsd.pool.ntp.org' & '2.freebsd.pool.ntp.org' by clicking on 'Delete' button next to it.

14) Configure correct timezone
     - Click on [+] 'Systems' -> 'Settings' -> 'General'
     - Select 'Asia/Kolkata' for TimeZone and click on 'Save' button

15)
Configure 'System Log Status Window'
     - Click on [+] 'Systems' -> 'Settings' -> 'Advance'
     - Select checkbox next to 'Show console messages in the footer'
      And click on 'Save' to save.


16) Now lets proceed to configure ZFS Volume for storage
     - Click on [+] 'Storage' -> 'Volumes' -> 'Volume Manager'
     - In 'Volume Manager' screen, enter 'Volume name' for e.g. 'DATA'
     - In Member Disk, select displayed HDD(s) for eg ada1
     - For 'Filesystem type ' select 'ZFS' radio button
     - Click on 'Add Volume' to create ZFS volume

17) Prepare data storage directory
     - Click on 'Shell' and run following command
     [root@freenas ~]# zfs list
     NAME   USED  AVAIL  REFER  MOUNTPOINT
     DATA   364K   913G   112K  /mnt/DATA

     Lets make a directory to store all users data for e.g 'individual' 
     [root@freenas ~]# mkdir /mnt/DATA/individual
     [root@freenas ~]# ls -l  /mnt/DATA
     total 17                                                                       
     drwxrwxr-x  2 root  wheel  2 Aug 22 18:45 individual

     And the output should be similar as above
   
18) Proceed to create common user group for e.g 'usergrp'
     - Click on [+] 'Account' -> 'Groups' -> 'Add Group'
     - In 'Add Group' screen, provide 'usergrp' for 'Group Name' & click on 'Ok' to create

19) Proceed to create users
     - Click on 'Shell' and run following command, for eg to create user joel

     [root@freenas ~]# mkdir /mnt/DATA/individual/joel

     - close 'Shell' window
     - Click on [+] 'Account' -> 'User' -> 'Add User'
     - Enter username for eg 'joel'
     - Uncheck checkbox for 'Create a new primary group for the user'
     - From 'Primary Group' dropdown list box select 'usergrp'
     - For 'Home Directory', browse and select /etc/DATA/individual/joel
     - For 'Home Directory Mode', select all checkboxes under 'Owner' and uncheck all checkboxes under 'Group' & 'Other'
     - For 'Shell' select 'nologin'
    - Provide Full Name, Email & Password and then click 'Ok' button at the end of the page
     There is a bug in GUI as it is not able to set user permission correctly while user creation so Click on [+] 'Account' -> 'Users' -> 'View Users' and on right hand side section click on 'Modify User' for the newly created user
     - In the 'Modify User' screen goto 'Home Directory Mode' and select all checkboxes under 'Owner' and uncheck all checkboxes under 'Group' & 'Other'. This should correct all user permissions.

20) Now configure CIFS services
     - Click on [+] 'Services' -> 'CIFS'
     - For 'Authentication Model' select 'Local User'
     - For 'NetBIOS name' should be same as hostname
     - For 'Workgroup' provide workgroup name
     - For 'Description' provide description
     - Keep 'DOS charset', 'Unix charset' & 'Log level' as default
     - Uncheck for 'Local Master'
     - Check for 'Time Server for Domain'
     - Uncheck for 'Large RW support'
     - Check for 'Send files with sendfile(2)'
     - Uncheck for 'EA Support'
     - Check for 'Support DOS File Attributes'
     - Uncheck for 'Allow Empty Password'
     - For 'Auxiliary parameters' leave blank
     - Uncheck for 'Enable home directories' & 'Enable home directories browsing'
     - Leave blank for 'Home directories' & 'Homes auxiliary parameters'
     - Check 'Unix Extensions'
     - Check 'Enable AIO' and leave default values for 'Minimum AIO read size' & 'Minimum AIO write size'
     - Uncheck for 'Zeroconf share discovery'
     And click on 'Ok' to save.

     Now click on [+] 'Sharing' -> 'Windows (CIFS) Shares' -> 'Add Windows (CIFS) Share'
     - For 'Name' provide share name example 'data'
     - For 'Comment' leave blank
     - For 'Path' provide data directory path for eg '/mnt/DATA/individual'
     - Check for 'Browsable to Network Clients'
     Rest leave as unchecked and click on 'Ok', once clicked it will ask to enable service, click on 'Yes' to start CIFS services

21) Now lets ensure directories are created with proper rights
     - Click on 'Shell' and run following commands to check

     [root@freenas ~]# ls -l /mnt/DATA/individual/
     total 34
     drwx------  2 abhijit  wheel  10 Aug 23 18:30 abhijit
     drwxrwx---  2 joel     usergrp  11 Aug 23 18:26 joel
    
     if a directory is found with incorrect permission i.e 700 then run following command for those directories

     [root@freenas ~]# chmod 700 /mnt/DATA/individual/joel

     and check again
    
     [root@freenas ~]# ls -l /mnt/DATA/individual/
     total 34
     drwx------  2 abhijit  wheel  10 Aug 23 18:30 abhijit
     drwx------  2 joel     usergrp  11 Aug 23 18:26 joel

     if a directory is found with incorrect group i.e 'usergrp' then run following command for those directories
    
     [root@freenas ~]# chgrp usergrp /mnt/DATA/individual/abhijit

     and check again
    
     [root@freenas ~]# ls -l /mnt/DATA/individual/
     total 34
     drwx------  2 abhijit  usergrp  10 Aug 23 18:30 abhijit
     drwx------  2 joel     usergrp  11 Aug 23 18:26 joel

22) Lets create a common folder for users to share data amongst users
     - Click on 'Shell' and run following commands
     [root@freenas ~]# mkdir /mnt/DATA/individual/common
     [root@freenas ~]# chgrp usergrp /mnt/DATA/individual/common
     [root@freenas ~]# chmod 770 /mnt/DATA/individual/common

23) Configure Periodic Snapshot Task for data backup. For example configure snapshot once a day & set its lifetime to 1 week or more depending upon the storage space & requirement
     - Click on [+] 'Storage' -> 'Periodic Snapshot Tasks' -> 'Add Periodic Snapshot'
     - For 'Filesystem/Volume' select 'DATA' i.e ZFS Volume Name
     - Check for 'Recursive'
     - For 'Lifetime' set 1 Week
     - For 'Interval' select '1 day'
     - Check all weekdays for 'Weekdays'
     And click on 'Ok' to save.
     
24) Configure ZFS Scrub to proactively check data integrity. For example configure scrub to happen once every 7 days i.e every Saturday at 12:00 am. This activity is going to be bit heavy on server so plan when there are no or negligible data access
     - Click on [+] 'Storage' -> 'ZFS Scrub' -> 'View ZFS Scrub' and click on 'Edit' button for default rule
     - For 'Threshold days' change to '7'
     - For 'Day of week', select checkbox next to 'Saturday'
     - Uncheck checkbox next to 'Sunday'
     And click on 'Ok' to save.

And you should be ready to start using FreeNAS over the network. Mount samba share on your windows / linux client desktop and and start storing your data.

Monday, April 30, 2012

Sucess Story - Deploying Open Source in Enterprise

We were setting up 75 seater backoffice for our organisation and we decided to use Linux as desktop operating system in anticipation of reducing TCO.

Basic Requirement

First step taken was to ensure that our sysadmin team is Linux ready with training and studying online references.

Preparation

We evaluated multiple Linux distributions and Ubuntu topped our list for its ease of use and extensive online documentation. Next step was to list down open source alternative softwares for all applications / tools used by our backoffice team.

We did test run with a small user group to ascertain Ubuntu's suitability and reliability for its smooth implementation in a larger environment. Issues encountered during implementation and operations were documented along with their solutions. After the successful run for a month with this user group, it was then implemented at our new 75 seater backoffice.

Deployment

To ensure that Ubuntu installation is consistent across all desktops, the customised Ubuntu installation guide was used which was prepared during test run. The applications installed on desktops were Libre Office, VLC, Flash plugin, Java JRE, PDF reader, 7Zip, Gimp, Microsoft compatible fonts, hplip printer drivers, etc. And likewise-open was used to join Ubuntu desktops to Windows Domain.

As all 75 desktops were of similar configuration we first got one system ready and then used clonezilla to clone this system to remaining 74 systems.

Key benefits

- Reduced TCO which is crucial for growing organisation
- Easy integration of Ubuntu system in existing environment
- Secured environment
- Better system management
- Reduced downtime
- Vast online community support

Seeing the result and the success herein Ubuntu replaced the existing operating at our regional offices thereby giving brighter results with each new implementation.

Tuesday, November 22, 2011

Revisiting Nginx (engine x) – Installation Guide on CentOS 5.5

It has been a long time since I worked with Nginx and decide to check it again. And was amazed to find that the server has improved and also its installation process is much simpler. Below are the revised installation steps.

1] Download Nginx from its official site (http://nginx.org/)

Stable version is available at

(Note : On production server use only stable version)

or

Development version is available at



2] Lets store downloaded file under a directory, for example 'download' directory

$ mkdir ~/download

$ mv nginx-1.0.10.tar.gz ~/download


3] We need to install following required Nginx dependencies - pcre pcre-devel zlib zlib-devel openssl openssl-devel

$ sudo yum install pcre pcre-devel zlib zlib-devel openssl openssl-devel


4] Create Nginx user and group id

$ sudo /usr/sbin/groupadd nginx

$ sudo /usr/sbin/useradd –g nginx –s /bin/false nginx


5] Proceed with source installation of Nginx

$ cd ~/download

$ tar -zxvf nginx-1.0.10.tar.gz

$ cd nginx-1.0.10.tar.gz


6] Configure Nginx source

$ ./configure \
--user=nginx \
--group=nginx \
--with-http_realip_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_ssl_module \
--with-http_stub_status_module


7] Make and install

$ make

$ sudo make install


8] Change ownerships before we proceed

$ sudo chown nginx:nginx –R /usr/local/nginx


9] To start Nginx

$ sudo /usr/local/nginx/sbin/nginx

If we get no error while starting Nginx then lets check running process status

[joel@localhost ~]$ ps aux | grep nginx
root 14802 0.0 0.0 4076 500 ? Ss 01:27 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 14803 0.0 0.1 4264 1092 ? S 01:27 0:00 nginx: worker process
joel 15004 0.0 0.0 4016 708 pts/1 S+ 01:39 0:00 grep nginx

10] And now we are ready to use Nginx

Open http://localhost or http://127.0.0.1 on your system browser and Nginx shows up.

Bingo!!!

11] To shutdown Nginx

$ sudo kill `cat /usr/local/nginx/logs/nginx.pid`

Monday, August 23, 2010

MyTop for MySql - Installation guide on CentOS

MyTop is the console-based tool for monitoring the overall performance of a MySQL server. The installation steps are as follows

# yum install perl-TermReadKey
# wget http://www.mysqlfanboy.com/mytop/mytop-1.9.tar.gz
# tar -zxvf mytop-1.9.tar.gz
# cd mytop-1.9
# perl Makefile.PL
# make
# make test
# make install


Now we need a config file as follows

# vi ~/.mytop

user=root
pass=YOURPASSWORD
host=localhost
db=YOURDBNAME
delay=5
port=3306
socket=/tmp/mysql.sock
batchmode=0
header=1
color=1
idle=1

Monday, April 12, 2010

Using PUTools with Python for S60 Ver 2.0.0

Python for S60 developers installing PUTools should follow the original document up to "Getting started with push (Python Utility Shell)"

And before proceeding with "On the phone" section do the following

(i) On phone edit phpush.py as follows

[Original phpush.py - Line 1 to 13]

# phpush.py
#

import appuifw
import phcomm
import os
import sys
import glob
import code
import thread
import pushlib
import graphics
import e32

[Modified phpush.py]

# phpush.py
#
# The memory card of my phone is e: and so have Python & Python/libs
# directories on e: drive. Change the path according to your phone.
import sys
sys.path.append("e://Python//libs")
import appuifw
import phcomm
import os
import glob
import code
import thread
import pushlib
import graphics
import e32

(ii) On phone modify phcomm.py stored under e:/python/libs directory

[Original phcomm.py - Line 32]

import socket

[Modified phcomm.py]

import btsocket as socket

Monday, October 26, 2009

Using Cloud Computing

I am sure we all are using so call cloud computing solutions in our day to day activities / operations either knowingly or unknowingly. And it is equally true that the improvisation of Operating System or the platform running over our enormous hardware has helped us to improvise utilisation of available resources. Take an example most of my emails and personal document management is taken care by google apps and if I have to deploy my online application and want to purely concentrate on my business rather than worry about Infrastructure, hardware scoping, infrastructure management, high availability, up-scaling, etc. and most important CAPEX, it would make more sense in using offerings made by Amazon and others, as this will help me to concentrate more on my business operations & activities and let the service provider manage the Infrastructure. And yes, SaaS (Software as a Service), PaaS (Platform as a Service) & IaaS (Infrastructure as a Service) will be the focus and not just selling boxes or softwares.