Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.

Monday, November 14, 2016

Play all music files from a local or remote directory via web browser

I blogged about Setting up Raspberry Pi with Apache HTTP server to display files from external hard drive over HTTPS with authentication. The external drive in question has a folder called Music and my objective here is to play all MP3 files from the folder one after another, in a random order. I can click on each file and play them one by one, but that's quite inconvenient. So I decided to use PHP to find all files in the directory and play them using HTML5 Audio tag in a random order. The steps are below (on my Raspberry Pi):

1. $ sudo apt-get update && sudo apt-get upgrade

2. Install PHP: $ sudo apt-get install libapache2-mod-php5 php5 php-pear php5-xcache php5-mysql php5-curl php5-gd

3. Go to DocumentRoot $ cd /var/www/html

4. Create a file for testing $ sudo echo "<?php phpinfo(); ?>" | sudo tee index.php

5. Restart Apache $ sudo service apache2 restart

6. Go to your browser and type x.x.x.x/index.php

If everything works Ok proceed to the next step.

I found it difficult to work with Aliases for this exercise. In my previous note I used

Alias /500all "/media/HD500G"

but now I changed it to

Alias /media/HD500G "/media/HD500G"

(so you can work without Aliases, but I wanted to keep it because I may revert it back).

The next step is to create a music.php file under DocumentRoot that will find the MP3 files from a directory and will play the files. The code is below.

Once you have created the file, change the directory name and go to x.x.x.x/music.php on your web browser.

References:
https://www.stewright.me/2015/08/tutorial-install-apache-php-and-mysql-on-a-raspberry-pi-2/
http://www.webdeveloper.com/forum/showthread.php?352807-PROBLEM-play-all-mp3-files-from-dir-PHP

Sunday, January 17, 2016

Raspberry Pi - expanding root file system

I was playing with a Raspberry Pi 2 Model B for last couple of days. My OS installation notes are here, and after the OS I installed VNC, Samba and Apache HTTP Server. Once I finished these installations and configurations, I noticed the root file system was 98% full. I was using a 64 GB Micro SD card, but the root filesystem was created on a partition of 3.8 GB only. So I needed to expand the root file system.

I found the following tutorial quite useful, it has step-by-step instructions that worked great.
https://www.raspberrypi.org/forums/viewtopic.php?f=51&t=45265

However, the "mkpart" resulted in an error:
Error: The maximum head value is 254.

In order to fix it, I had to reduce the value. Initially I was trying:

(parted) mkpart primary 6,127,57  1946,255,62

that resulted in the error. Error: The maximum head value is 254.

Then I tried reduce the head value to 254:

(parted) mkpart primary 6,127,57  1946,254,62

but still no luck.

But the following finally worked:

(parted) mkpart primary 6,127,57  1945,252,62

Rest of the tutorial worked as-is for me.

Setting up Raspberry Pi with Apache HTTP server to display files from external hard drive over HTTPS with authentication

Devices:
Raspberry Pi 2 Model B (I bought it with a case and charger - Amazon link)
with 64 GB Micro SD card -  Amazon link
AT&amp;T U-verse router 5031NV 

In my last post I detailed how to share files from an external hard drive using Samba. However I wanted to see and play the files from my external hard drive on the web browser and the easiest way to achieve that was by using Apache HTTP Server. This post contains information about setting up the server, using it to list directories and files, and configure HTTPS using OpenSSL.

While writing this post, my external drive is already mounted at /media/HD500G. You can see the details in the "Set up the external hard drive" section in my previous post.

Apache Installation and mapping URL to FileSystem using Alias

1. I installed apache2 and php5 using
$ sudo apt-get install apache2 php5 libapache2-mod-php5

After the installation completed, I created an alias at /etc/apache2/sites-enabled/000-default.conf and

2. added the following to the file:

Also I set the permission for the files in the shared directory:

3. $ sudo chmod -R o+x /media/HD500G

and restarted the service

4. $ sudo service apache2 restart

Apache runs on port 80 for HTTP and port 443 for HTTPS. It's now ready to show the contents of /media/HD500G if you browse http://111.222.333.444/500all (assuming my public IP is 111.222.333.444 and port 80 is open in my router configuration). However please do NOT open the ports in your router at this point as this is very insecure.

More details about port forwarding is described in previous posts about Samba and SSH and VNC. I created a new user defined application for Apache and associated it with ports 80 and 443.

Configure HTTP basic authentication in Apache

Now I wanted to configure Apache so that it will ask for a username and password before showing the contents of /500all. I used the following steps to configure it:

5. Create a directory: # mkdir /etc/htpasswd
6. Set Up the password for user pi: # htpasswd -c /etc/htpasswd/.htpasswd pi
7. Create a new .htaccess file:
# pwd
/media/HD500
# vi .htaccess
# cat .htaccess
AuthType Basic
AuthName "Authentication Required"
AuthUserFile "/etc/htpasswd/.htpasswd"
Require valid-user


8. Edit /etc/apache2/sites-enabled/000-default.conf
So this is what you added in Step-2. Just replace "All" with "AuthConfig" for AllowOverride. And restart apache:

9. $ sudo service apache2 restart

At this point, if you browse http://111.222.333.444/500all it will ask for a username and password. Username is pi, and the password is what you set in step-6. This is slightly more secure than before, but the credentials will be passed over HTTP, so a MITM can see it in clear text. Now we will configure HTTPS to encrypt the communication.

Configure HTTPS and redirect HTTP traffic

10. Create new keys and certificate using OpenSSL.

# pwd
/etc/apache2


11. Enable SSL module

# a2enmod ssl

12.  Add the following to /etc/apache2/sites-enabled/000-default.conf

 13. Redirect all HTTP traffic to HTTPS. Add the following to /etc/apache2/sites-enabled/000-default.conf

14. Restart Apache:
$ sudo service apache2 restart

That's it. Now browsing http://111.222.333.444/500all will redirect you to https://111.222.333.444/500all and it will ask for authentication. Ignore the complaints from the browser, they don't like self-signed certificates (of course for very valid reasons). But now the connection is encrypted and all the contents of the drive are password protected.

Setting up Raspberry Pi with Samba and external hard drive - AT&T U-verse router configuration to make it remotely accessible

Devices:
Raspberry Pi 2 Model B (I bought it with a case and charger - Amazon link)
with 64 GB Micro SD card -  Amazon link
AT&T U-verse router 5031NV


Once I finished OS installation and SSH and VNC configuration, I wanted to access the files I stored in an external Hard drive using Samba on Raspberry Pi.

Set up the external hard drive

Connect the external drive to RP, and run

1. $ sudo fdisk -l

and find the device and note the "Type". If the type is FAT32, proceed to the next step. But if it's "NTFS", install the NTFS driver using

2. $ sudo apt-get install ntfs-3g

The fdisk command will also print the device e.g. /dev/sda1 that we will use in this step. This is to make sure the device is automatically mounted on a pre-decided location e.g. /media/HD500G. In order to do that, I created a new directory

3. # mkdir /media/HD500G

and added a new line at /etc/fstab

5. /dev/sda1    /media/HD500G    ntfs-3f    defaults,noatime    0    0

If your filesystem is FAT, use "vfat" instead of "ntfs-3g".

Then unmount and mount the drive.

$ sudo umount /dev/sda1
$ sudo mount /dev/sda1

And make sure all your files and directories are there.

$ cd /media/HD500G
$ cd ls -la

It might be good idea to spindown the external drive if it's inactive for a while. Use hdparm to do so once it's inactive for 20 minutes.

$ sudo apt-get install hdparm
$ sudo hdparm -S 240 /dev/sda1

Install and configure Samba

Installing Samba is easy: $ sudo apt-get install samba samba-common-bin

In order to configure it to access /media/HD500G, I added the following to /etc/samba/smb.conf:

[media]
comment = Movies and Music
path = /media/HD500G
valid users = pi
force group = users
create mask = 0660
directory mask = 0771
read only = no

The next step will be adding a user account and setting up a password.

$ sudo smbpasswd -a pi

After that, restart the samba services:

$ sudo service smbd restart
$ sudo service nmbd restart


Open Samba ports on your router

This is required to access the Samba share outside my home-network i.e. from anywhere on the internet. The default ports are TCP 139,445 and UDP 137,138.  You can verify the ports by using

# netstat -plunt | grep smbd

Router Configuration:

Go to the configuration page using the web browser. The page URL is usually printed on the router with the default password. If it's not there, run # netstat -rn and look at the default gateway and try that address. It can be something like 192.168.1.xx. If you don't know the password, try username "admin" and password "password" (I know, very poor choice of credentials from router manufacturers).  If nothing works, contact the internet service provider and ask for the details.

Locate the Firewall settings (usually under settings) and find the page that allows you to make changes to applications, pinholes and DMZ. Select the raspberry pi device and proceed to editing the firewall settings for the device. There should be few applications already listed there, if you see Samba server there, select that and add it as hosted applications. Check what ports were opened by that service. If they are same as above (137, 138, 139, 445),then you are all set. You can now use the public IP of the router to access Samba from anywhere on the internet.

In my case, there was no such Samba server listed in the default applications. So I had to add a new user-defined application under firewall settings. I named it "Samba" and associated it with UDP ports 137, 138 and TCP ports 139 and 445. Then I added Samba to the hosted applications list. Now my RP is open to Samba ports and I can use the samba share from anywhere on the internet.

Access Samba share

The following examples assume my public IP address is 111.222.333.444.

From Unix/Mac OS X:
$ sudo mkdir -p /smb/hdd5
$ sudo mount -t smbfs //pi@111.222.333.444/media /smb/hdd5

In this example "media" is what you wrote under [] at /etc/samba/smb.conf

From Windows:

Type the following in the address bar of your web browser -
\\111.222.333.444

Ubuntu:

File Manager -> Connect to Server

Setting up Raspberry Pi with SSH and VNC - AT&T U-verse router configuration to make it remotely accessible

Device:
Raspberry Pi 2 Model B (I bought it with a case and charger - Amazon link)
with 64 GB Micro SD card -  Amazon link
AT&T U-verse router 5031NV

After my first boot, I noticed the SSH service was already installed and enabled. I was able to login from other devices connected to my router. But I also wanted to install VNC for remote access to the desktop. It was fairly straight forward to install and run VNC.

Install: $ sudo apt-get install tightvncserver
Run: $ tightvncserver
Stop: $ tightvncserver -kill :1

After I ran tightvncserver, I was able to access the Raspberry Pi from other devices using VNC Viewer.

The next step involves setting up my AT&T U-verse router 5031NVto enable remote SSH and VNC access outside my home network (i.e. from the internet). In order to do that, the first thing was finding out the ports these services are running on.

SSH was running on standard port 22.

# netstat -plunt | grep ssh
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      496/sshd

tightvnc was running on 5901 nad 6001.

# netstat -plunt | grep tightvnc
tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN      30583/Xtightvnc
tcp        0      0 0.0.0.0:6001            0.0.0.0:*               LISTEN      30583/Xtightvnc

Router Configuration:

Go to the configuration page using the web browser. The page URL is usually printed on the router with the default password. If it's not there, run # netstat -rn and look at the default gateway and try that address. It can be something like 192.168.1.xx. If you don't know the password, try username "admin" and password "password" (I know, very poor choice of credentials from router manufacturers).  If nothing works, contact the internet service provider and ask for the details.

Locate the Firewall settings (usually under settings) and find the page that allows you to make changes to applications, pinholes and DMZ. Select the raspberry pi device and proceed to editing the firewall settings for the device. There should be few applications already listed there, if you see SSH server and VNC Server select those and add them as hosted applications. Check what ports were opened by those services. If they are same as above (22 for SSH and 5901,6001 for VNC), then you are all set. You can now use the public IP of the router to access via SSH or VNC from anywhere on the internet.

In my case, the VNC ports were different. So I had to add a new user-defined application under firewall settings. I named it "TightVNC" and associated it with ports 5901 and 6001. Then I removed default VNC from the hosted applications list as I didn't want to keep any ports open unnecessarily and added TightVNC to the list instead. Now my RP is open to ports 22, 5901 and 6001. And I can use SSH client and VNC Viewer applications on my phone to access the device from anywhere on the internet.

Getting started with Raspberry Pi 2 Model B - OS installation and fixing display issue (no dosplay on HDMI TV)

Devices:

Raspberry Pi 2 Model B (I bought it with a case and charger - Amazon link)
64 GB Micro SD card that came with an adapter -  Amazon link
(I also used a different USB adapter - Amazon link) 
MacBook Pro early 2011 running OS X El Capitan 10.11.2
Samsung TV PN58C8000YF (any other TV with HDMI ports should work)
USB keyboard and mouse
Ethernet cable
HDMI cable

OS installation:

1. I downloaded the OS image from https://www.raspberrypi.org/downloads/raspbian/ - Raspbian Jessie and unzipped the image file.  Connected the Micro SD card using the USB adapter to my MBP, then ran diskutil to find the device.

2. ~ RitwikG$ diskutil list
/dev/disk0 (internal, physical):
  ...
/dev/disk1 (disk image):
  ...
/dev/disk2 (disk image):
   ...
/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *32.4 GB    disk3
   1:             Windows_FAT_32 UUI                     32.4 GB    disk3s1

So disk3 here is the Micro SD card. Then I unmounted the card and copied the data from the downloaded image file to the SD card.

3. ~ RitwikG$ diskutil unmountDisk /dev/disk3
Unmount of all volumes on disk3 was successful
4. ~ RitwikG$ sudo dd bs=1m if=2015-11-21-raspbian-jessie.img of=/dev/rdisk3

You can find more information about this at https://www.raspberrypi.org/documentation/installation/installing-images/mac.md.

Please note: The raw disk /dev/rdisk3 was used in the command above. If you use /dev/disk3 instead, it will work as well but will take a lot longer to finish the copy operation. You can find more details about it at http://superuser.com/questions/631592/why-is-dev-rdisk-about-20-times-faster-than-dev-disk-in-mac-os-x.

The next step is connecting the Raspberry Pi with the SD card, ethernet cable that's connected to the router, keyboard. mouse, HDMI cable connected to the TV and at last the power cable to turn it on. At this point I was disappointed to see  that there was NO display on my TV screen. So I powered off the RP, took out the SD card, connected it to my laptop and made the following changes.

5. Go to the SD card directory, find the /boot/config.txt file, then add/uncomment the following:

hdmi_force_hotplug=1
config_hdmi_boost=4
hdmi_group=2
hdmi_mode=47

You can find more details about these changes here:
https://www.raspberrypi.org/forums/viewtopic.php?f=26&t=5851
Also some useful commands:

Run “tvservice –m CEA” to give a list of CEA supported modes.
Run “tvservice –m DMT” to give a list of DMT supported modes.
Run “tvservice -s” to give you the current state.

After that I connected the SD card back to the RP, and powered it on. Voila! The display was on my TV screen and I was all set to start playing with the RP.

Sunday, February 8, 2015

Untangle Network Security

If you are a network engineer or administrator, I can imagine how difficult your life is with the overwhelming cyber security threats throughout the planet. In this cat and mouse game you have to be always one step forward from the hackers, and finding the right tool and technology is one of the key factor to perform your due diligence.



In the recent past I have reviewed a book about "Untagle", the well known simple but powerful one stop shop for all of your network administration needs. This book is written in a very easy to understand language, with step-by-step instructions and demos which is quite useful for both beginners as well as experienced professionals. The chapters are strategically arranged to explore all available functionalities of Untangle from very basic ones to the most complex features. If you are looking to learn untangle, make sure you check it out. The book's name is Untangle Network Security.

Tuesday, February 4, 2014

Keyboard Mouse integration between Solaris 11.1 and Windows 7 using Synergy

Note: Please read the copyright notices and license agreements before making any changes to your software. This document is not intended to take care of legal issues.

I'm running Solaris 11.1 in my desktop machine, a keyboard and mouse is connected to this system. My laptop under the same network is running Windows 7. Following are the steps I have taken to use the same keyboard and mouse in my laptop using Synergy.

Solaris 11.1

Step 1. Install the required packages.

# pkg install SUNWPython SUNWcmake SUNWgcc SUNWxorg-headers
# pkg install pkg://solaris/SUNWxwinc

Step 2. Download and extract Synergy from -
http://synergy-foss.org/

Step 3. Navigate to the directory and run
$ ./hm.sh conf -g1

Step 4. Now run
$ ./hm.sh build

This step will fail with the following error message.

[ 89%] Building C object src/micro/CMakeFiles/micro.dir/uSynergy.o
In file included from /home/righosha/synergy-1.4.15-Source/src/micro/uSynergy.c:26:0:
/home/righosha/synergy-1.4.15-Source/src/micro/uSynergy.h:49:92: error: operator '==' has no right operand
*** Error code 1
The following command caused the error:
cd /home/righosha/synergy-1.4.15-Source/build/release/src/micro && /usr/bin/gcc  -DSYSAPI_UNIX=1 -DHAVE_CONFIG_H -DWINAPI_XWINDOWS=1 -O3 -DNDEBUG -o CMakeFiles/micro.dir/uSynergy.o   -c /home/righosha/synergy-1.4.15-Source/src/micro/uSynergy.c
make: Fatal error: Command failed for target `src/micro/CMakeFiles/micro.dir/uSynergy.o'

You will need to manually edit "src/micro/uSynergy.h" to resolve this issue. But before you do that, make sure you know if your system is little endian or big endian. Google it if you don't know how to figure that out. My system is little endian, most probably yours too.

Now open the file using your favorite editor, and comment out the following lines -

#if defined(USYNERGY_LITTLE_ENDIAN) && defined(USYNERGY_BIG_ENDIAN)
        /* Ambiguous: both endians specified */
        #error "Can't define both USYNERGY_LITTLE_ENDIAN and USYNERGY_BIG_ENDIAN"
#elif !defined(USYNERGY_LITTLE_ENDIAN) && !defined(USYNERGY_BIG_ENDIAN)
        /* Attempt to auto detect */
        #if defined(__LITTLE_ENDIAN__) || defined(LITTLE_ENDIAN) || (_BYTE_ORDER == _LITTLE_ENDIAN)
                #define USYNERGY_LITTLE_ENDIAN
        #elif defined(__BIG_ENDIAN__) || defined(BIG_ENDIAN) || (_BYTE_ORDER == _BIG_ENDIAN)
                #define USYNERGY_BIG_ENDIAN
        #else
                #error "Can't detect endian-nes, please defined either USYNERGY_LITTLE_ENDIAN or USYNERGY_BIG_ENDIAN";
        #endif
#else
        /* User-specified endian-nes, nothing to do for us */
#endif


and replace it with

#define USYNERGY_LITTLE_ENDIAN

Please clearly mark this change is done by you and this is not a part of the original software as mentioned in the copyright notice. Also if you are using a big endian machine then use "#define USYNERGY_BIG_ENDIAN" instead. Save your changes and go back to step 4 again. This time it should work fine.

Step 5. Create a synergy.conf file. You can create it anywhere e.g in your home directory. My Desktop system (hostname - host1.com and IP - a.b.c.d) is on the left side of my laptop (hostname - host2.com and IP - w.x.y.z) and my synergy.conf file looks like -

$ cat synergy.conf
section: screens
       host1:
       host2:
    end
    section: links
       host1:
           right = host2
       host2:
           left = host1
    end


Step 6. Start Synergy server from host1.
synergy-1.4.15-Source/bin$ ./synergys -f --config synergy.conf

Windows 7

Step 1. Download and install Synergy.
Step 2. Run Synergy
Step 3. Check client, enter server IP (IP of host1 i.e. a.b.c.d)
Step 4. Apply and Start.

Enjoy Synergy!

Monday, October 10, 2011

Share Picasa web album with friends who are not in Google+

Since Google+ came into the picture, I found it slightly difficult to share Picasa web albums with friends who don't have a Google+ account. However, when I clicked on the 'Share' button, a popup window appeared with an option to share my album with G+ friends. There was also a link 'Share via email only' in the bottom of the window. I clicked on that link and .. voila ! I can now share Picasa web albums with anyone.




Saturday, July 16, 2011

Virtual Box guest OS Solaris 10 U9 networking

I'm running Virtual Box 4 on Ubuntu 10.04 in my Toshiba laptop. I downloaded Oracle Solaris 10 9/10 Virtual Machine for Oracle VM VirtualBox and the installation was pretty simple and straight forward. My VBox was configured to use NAT. I chose networked - yes and name service - none during installation. After successful installation I took the following steps to enable networking by configuring DNS.

1. Added "nameserver 192.168.1.1" at /etc/resolv.conf
2. Aadded "10.0.2.2" at /etc/defaultrouter
I took these two information from another virtual machine, Solaris 11 Express 2010.11
3. Copied /etc/nsswitch.dns to /etc/nsswitch.conf
4. Enabled dns/client service using SVCS (svcadm enable dns/client)

However, I was not able to access internet after taking these steps. "netstat -rn" output was showing the default gateway was not configured properly and "route add" command was failing as well. My system was not able to ping the gateway. I got fed up with this and ran "sys-unconfig". After that I took the following configuration steps  -

Networked -> Yes
DHCP -> yes
IPV6 -> No
Kerberos -> No
Name Service -> None
NFSV4 domain config -> derived by system

and repeated steps 1-4 again. After a reboot networking started working as intended.

Sunday, January 3, 2010

Real Player 11 on Ubuntu 8.10 : Audio not working


Recently I have installed Real Player 11 on my ubuntu box , V 8.10 . I am using a Dell Precision M4400 laptop. 
 [ Note : I've download the DEB Package from   http://www.realplayer.com/linux
 and opened with  GDebi Package Manager .]
The player was working fine, but there was no sound. I tried with different formats, but there was no luck !
After googling a bit, I came to know about medibuntu. Medibuntu's repository can be added using the following command :
sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
[ Note : Be sure your package manager is not opened, otherwise you will get  an error message like : Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable) Unable to lock the administration directory (/var/lib/dpkg/), is another process  using it? ]   Then I opened Synaptic Package Manager and searched for alsa-firmware . I installed following packages and automatically determined dependencies - alsa-firmware loaders, dell-dup, firmware-tools, libertas-firmware and linux-firmware .   [Note : All above mentioned packages are not required to get audio on realplayer]    As far as I can remember, system restart was required for this updatatiion, and after a reboot, my real player started working as intended. [ Ref : https://help.ubuntu.com/community/Medibuntu ]


Thursday, November 26, 2009

Picasa surprised me


Last night this pop-up window appeared when I was trying to delete a comment from a Picasa album. I tried it thrice , same thing happened each time. Anyway, today morning it didn't happen again.
I have no clue how did this happen, but no way Google has done it intentionally.

Tuesday, September 2, 2008

Build NetBeans IDE from source : getting started

Building Netbeans IDE from source is considered as the primary task of Netbeans developers. Here I am sharing my experience in working with Netbeans source. I built it on SXDE (solaris express developer edition) 1/08 which is installed in my laptop with 1 GB of physical memory and enough harddisk space. One thing I need to mention first that if you don't have a high speed internet connection the total process will take a lots of time and don't even try it with a dial up connection.

Now the requirements : JDK , Mercurial and Apache Ant.

JDK 1.5 update 13 was already installed in my SXDE 1/08 system.
SUNWmercurial-0.9.5 was also installed in my system.
Apache Ant version 1.6.5 was also there.

I tried to build with the above said configuration but faced lots of problems and finally build failed. So don't try to build if you don't have the following configuration :

JDK 1.5 update 13 is working fine and version 1.6 will not work !

Mercurial 1.0+ is recommended.

Apace Ant 1.7.0+ is also necessary.

If you don't know whether they are already installed in your system or which version is installed , check it first :

You may have multiple instances of jdk installed in your system. In my system version 1.5 and 1.6 both were installed. '/usr/jdk/instances' contained both 1.5 and 1.6 but '/usr/java' was linked to 1.6 . You may check the version of working java by executing '$java -version' , my output was something like :

java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

It's not necessary that the output will be 1.5.0 , just make sure that 1.5 is installed in your system.

Mercurial version can be determined by : '$/usr/bin/hg -v'

first line of the o/p will contain the version name , my o/p was like :

Mercurial Distributed SCM (version 0.9.5)
------------- Many lines omitted --------------

Ant version can be determined in a similar way : '$/usr/sfw/bin/ant -v'

first line of the o/p will contain the version name, mine o/p was like :

Apache Ant version 1.6.5 compiled on November 29 2007
---------------------- Many lines omitted ----------------------

Now I will share how I updated mercurial and ant in my system but before that make sure that .profile file at your home directory doesn't contain '/usr/sfw/bin' as path variable. Otherwise you will get an error during build like : '~/main/nbbuild/build.xml:60: Class org.apache.tools.ant.taskdefs.condition.Not doesn't support the nested "antversion" element' .

I tried to update mercurial to version 1.0.2 . I downloaded it from http://www.selenic.com/mercurial/release/mercurial-1.0.2.tar.gz , extracted to /opt and tried to build it. But 'make' / 'gmake' failed with the same error : 'make: Fatal error in reader: Makefile, line 3: Unexpected end of line seen'. Same thing happened while I tried Mercurial version 1.0.1 (http://www.selenic.com/mercurial/release/mercurial-1.0.1.tar.gz) as well as Mercurial version 1.0 (http://www.selenic.com/mercurial/release/mercurial-1.0.tar.gz ). Finally I installed Mercurial 1.0 from Blastwave repository , by using '#pkg-get install mercurial'. If you don't know how to use pkg-get , Click here. I observed that mercurial-1.0 , Rev = 2008.04.03 was installed during the installation process , Python 2.5.1 and Berkleydb 4.4.20 was also installed as dependancy. After successful installation I checked the version by executing '$/opt/csw/bin/hg -v' and o/p was 1.0 . Then I removed '/usr/bin' from .profile at my home directory to avoid conflict between two hg versions and '/opt/csw/bin' was already added in my path.

Then I updated my ant version to 1.7.1 . I downloaded apache-ant-1.7.1-bin.zip from http://ant.apache.org/bindownload.cgi and extracted it to /opt. Then I added '/opt/apache-ant-1.7.1/bin' to my path :

'PATH=$PATH:/opt/apache-ant-1.7.1/bin'

and defined two environment variables ANT_HOME and JAVA_HOME :

'export ANT_HOME=/opt/apache-ant-1.7.1' &
'export JAVA_HOME=/usr/jdk/jdk1.5.0_13'.

You may check this out by executing '$env'.

Though I removed /usr/bin from my path and added /opt/csw/bin to my path , but '$hg -v' o/p was giving me version 0.9.5 .

Now you need to get a working copy by cloning the Netbeans repository. To do so , I executed :

bash-3.2$ /opt/csw/bin/hg clone http://hg.netbeans.org/main

you may also try main-golden repository which is guaranteed to always build by executing the following :

'bash-3.2$ /opt/csw/bin/hg clone http://hg.netbeans.org/main-golden'

It took a long time to be completed and produced an o/p like :

bash-3.2$ /opt/csw/bin/hg clone http://hg.netbeans.org/main
destination directory: main
requesting all changes
adding changesets
adding manifests
adding file changes
added 99216 changesets with 425778 changes to 94011 files
updating working directory
83779 files updated, 0 files merged, 0 files removed, 0 files unresolved

Now you will find a 'main' directory inside your home directory. If you have write access and want to push changes back you need to edit '~/main/.hg/hgrc' file. Initially it would be something like :

[paths]
default = http://hg.netbeans.org/main

Now edit this file so that it will look like :

[hooks]
pretxncommit.crlf = python:hgext.win32text.forbidcrlf
[ui]
username = username@netbeans.org
[paths]
default = http://hg.netbeans.org/main
default-push = https://username:password@hg.netbeans.org/main/

** Replace username and password with your original username and password.

Now if you have multiple instances of JDK installed in your system you need to mention JDK 1.5 as nbjdk.home. As some modules require additional heap to build, you need to increase javac's, the compiler's, heap size. For these purposes I created a new file '~/main/nbbuild/user.build.properties' and add the following lines:

build.compiler=extJavac
javac.compilerargs=-J-Xmx512m
nbjdk.home=/usr/jdk/instances/jdk1.5.0

Now you are almost done !! Just increase the heap size for ant as the default may not be enough by using a command like :

bash-3.2$ ANT_OPTS=-Xmx512m

Now the final building part :

bash-3.2$cd main
bash-3.2$ant

you must be connected to internet during this part as external binaries would be fetched from a server during first build. You will get an o/p like :

Buildfile: build.xml
clean-cluster-flags:
-jdk-pre-preinit:
-jdk-preinit:
-jdk-warn:
-jdk-presetdef-basic:
-jdk-default:
-jdk-init:
assure-ant:
-load-build-properties: bootstrap:
[mkdir] Created dir: /export/home/ritwik/main/nbbuild/build/antclasses
[javac] Compiling 4 source files to /export/home/ritwik/main/nbbuild/build/antclasses

After that I got a warning like :

[validate-hg-configuration] ======== WARNING ========
[validate-hg-configuration] You seem to be using a version of Mercurial older than 1.0.
[validate-hg-configuration] Please upgrade as your version may have serious bugs fixed in later versions.

Though mercurial 1.0 was installed in my system.

Anyway , build operation was going on smoothly for a long time .... but suddenly build failed due to hash check error in '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external/xmlbeans-2.1.0.zip'. I became confused and deleted all files from '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external' and tried to build again. Then it failed with a 'file not found exception' ... because I deleted the file i.e xmlbeans-2.1.0.zip which the build process was searching . Then I downloaded xmlbeans-2.1.0.zip from http://ftp.wayne.edu/apache/xmlbeans/binaries/ . Place the zipped file in '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external' and tried to build . But it failed again with another file not found error , it was searching for 'xmlpublic.jar' file to copy somewhere in the following path : '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external/xmlbeans-2.1.0/xmlpublic.jar' but it was not there. Then I found that 'xmlpublic.jar' file is present in the following path : '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external/xmlbeans-2.1.0/xmlbeans-2.1.0/lib' with 4 other *.jar files. I copied all 5 jars and paste them in the following directory : '/export/home/ritwik/main/o.n.soa.libs.xmlbeans/external/xmlbeans-2.1.0'. Then I tried to build again and this time everything was normal and finally it was successful.

Then I run '/export/home/ritwik/main/nbbuild/netbeans/bin/netbeans' , accept the license agreement and Netbeans IDE 6.5 'development version' was launched .

Everything I have already mentioned happened on yesterday. Today I tried to update my sources . I undergo the following way to pull other people's changes from the server into my repository :

bash-3.2$ hg pull -u
pulling from http://hg.netbeans.org/main

searching for changes
adding changesets
adding manifests
adding file changes
added 309 changesets with 514 changes to 414 files
414 files updated, 0 files merged, 33 files removed, 0 files unresolved

References :

http://wiki.netbeans.org/WorkingWithNetBeansSources

http://wiki.netbeans.org/HgHowTos

http://wiki.netbeans.org/ExternalBinaries

http://wiki.netbeans.org/HgMigration

Monday, September 1, 2008

Star Office 9 Beta : product review

I am trying Star Office 9 Beta on OpenSolaris 2008.05 for last few weeks. It provides some new features which are not currently available in any other office suit. I think this can be considered as a good alternative to MS Office , Adobe Acrobat Professional and Adobe Dreamweaver. I have used Star Office 8 on SXDE 1/08 and observed pretty improvements in this new version.

Download it from http://www.sun.com/software/staroffice/get_beta.jsp and don't forget to check out system requirements and Beta FAQs.

Star Office installation is simple . I have used 'pfexec' command to install it as a normal user. Command line output during installation process was something like :

ritwik@ritwik:~/Desktop$ pfexec ./so-9-beta-bin-solia-en-US.sh

Select the directory in which to save the unpacked files. [/var/tmp/unpack_staroffice]

File is being checked for errors ...
Unpacking ...
All files have been successfully unpacked.
Using /usr/bin/java
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)
Running installer /usr/bin/java -DHOME=/export/home/ritwik -jar JavaSetup.jar
System locale: en_US
Root privileges
OS: SunOS
Mode: installation
Path to packages: /var/tmp/unpack_staroffice/packages/Jar file: /var/tmp/unpack_staroffice/JavaSetup.jar

If you try to install it as a normal user (& without 'pfexec') installation would be failed with the following error message :

“ Root privileges required for installation!”. After that if you try “ pfexec ./so-9-beta-bin-solia-en-US.sh ” you will get another error message “ Directory /var/tmp/unpack_staroffice already exists. Please select a new directory name.” Actually all files were already unpacked in the said directory viz '/var/tmp/unpack_staroffice' during previous installation process. You can always continue installation in such condition by using this command : $pfexec '/var/tmp/unpack_staroffice/setup'.

After successful installation I created a launcher (right click on ~/Desktop, create launcher) 'Star office 9 Beta' with the command '/opt/staroffice9/program/soffice'. Following screenshots were taken during the installation process :

One thing I need to mention here that star office generated files would be opened by archive manager or previously installed office suit by default. You need to manually change it to open with star office 9 for each type of file for once . Say, if you save a file as *.odt , right click on the file icon, go to properties → Open With → Add and browse to '/opt/staroffice9/program/swriter'.

Star office 9 Beta introduced a lots of impressive features like online update of office suit as well as extensions. MS Office 97 to 2003 generated files are fully accessible in this suit, 'save as' option also provides support for these formats. you would be also able to read MS Office 2007 generated (like *.docx etc.) files. This multiplatform supported office suit (Currently supporting MS Windows including Vista, linux, solaris (sparc & X86), Mac with OS X) provides ODF 1.2 i.e the latest ISO standard. Spreadsheet has been improved with solver tool of calc (access it tools → solver) , spreadsheet and presentation both contains improved insert → chart option. It can import *.pdf files for editing , enhanced security feature is also available for pdf files. Notes in a writer now appearing in the sidebar , they are not only yellow icons anymore. Image cropping and other useful features are available in Drawing wizard.

Database wizard is another beautiful feature of this office suit , creating a new database and opening an existing database file worked fine for me , but I face some problems while tried to connect to an existing database by using following steps :

Connect to an existing database → MySQL → connect using jdbc → Database name and server url , port was given already(3306)→username and checked 'password required' → 'register the database for me' and 'open database for editing' was already checked → save it as a ODF database → a login form appeared asking username and password → after providing all required informations I got an error message like : “Connection to the datasource “Dbname”could not be established, The driver class 'com.mysql.jdbc.Driver' could not be loaded”. I don't know why the driver class is not being loaded. Please leave a comment if you have any idea to solve this issue.

You will find a 'Media Player' under Tools menu. This player is confusing me as it's not being able to play most of the media files I have tried. (Same thing happened on Star Office 8)

During the slide show operation of a Presentation slide transaction is not happening smoothly. I am using Open Solaris 2008.05 with screen resolution 1024X768. I have an intel motherboard 845GVSR with inbuilt graphics chip. May be I am facing a hardware related graphics problem.

The most stunning features are available as add-ons. You must check out available extensions from http://www.sun.com/software/staroffice/extensions.jsp .

“ Sun PDF Import Extension Beta” allows to import, edit and save a pdf file. Simply download the extension (I downloaded it for solaris x86 platform) : pdfimport.oxt ; go to Tools → Extension manager → Add and browse to the file 'pdfimport.oxt'. After successful installation you would be able to open any pdf document with star office writer and edit as you wish.


“ Sun Weblog Publisher” allows to publish a post to your web blog directly from star office writer. Download this platform independent extension : 'sun-weblog-publisher.oxt' (mine version was 1.1.0) and add it through extension manager.

Then go to 'options' → 'add' → select your web blog type → give user name and password → ok.


.. and your blog will be added.


In the menubar you will find two buttons viz 'To Weblog...' and 'Open Weblog entry...'. You may also right click somewhere on your document to get 'To Weblog...' , 'Open Weblog entry' is also available under 'File' menu.


Actually this post was published by using this extension , but images were not appearing in my blog. so I was needed to edit it manually later.

“ Professional Template Pack II – English” provides an option to 'Create stunning, professional documents and presentations with more than 120 templates available for Writer, Calc, and Impress.' After installation browse it from File → new → templates and documents.


Lots of more impressive extensions like “ Sun Presentation Minimizer” , “ Sun Wiki Publisher” are also available.

Be sure to check out all features !!!

Saturday, August 9, 2008

MOTOROKR E6 : file transfer


I am playing with a Motorola mobile phone (MOTOROKR E6) for last few days. Due to file transfer issue I was trying to connect this mobile phone with various operating systems. A "Motorola Phone Tools" cd was available with the phone which provides a software for windows operating system to interact with the phone. I installed the software in my windows system , connected my mobile through data cable , it was detected in my system. But when I tried to copy some files from my laptop to the phone , both systems (windows on my laptop & the phone) stopped responding. I tried it once more but same thing happened. But the phone is working fine in my Open Solaris 2008.05, linux (Fedora 7) and SXDE (Solaris Express Developer Edition 1/08) system. After connecting the phone through the cable , these systems mounted it automatically and opened all files and directories of my phone's memory card in a new window. Fedora detcted the phone as "MOTOROKR E2" (though I connected E6... anyway) , SXDE mounted it as "NO NAME" and Open Solaris 2008.05 mounted it as "AM". I didn't face any problem for these platforms to transfer files between the systems and the phone.

Monday, August 4, 2008

Discover Open Source Software with ossdiscovery

Today I take a tour to a website http://ossdiscovery.opensource.collab.net/ which provides a tool to discover open source softwares already installed in your system. I tried it in three platforms , Solaris ( Solaris express developer edition 1/08), Linux (Fedora 7) and windows xp professional. This tool scans the total system for open source products and took time according to number of files and finally saves the report in a "scanresults-local.txt" file. Basic Architecture of this tool would be clear from the following diagram :

Project Goals of this tool as described in the website is the following:
Most enterprises are using open source software in many areas of their business. However, open source typically bypasses traditional procurement processes, making it difficult for companies to accurately inventory their open source usage. OSS Discovery was created to solve this problem. It helps enterprises easily create an inventory of installed open source software. This inventory, enables enterprises to:
  • Develop support and maintenance plans

  • Comply with open source licenses

  • Measure and communicate the benefits of open source software

  • Find opportunities to use more open source software

OSS Discovery will also be used to support The Open Source Census. Learn more at About The Open Source Census.

Friday, August 1, 2008

Samba configuration on Fedora Linux


Samba server implementation allows a linux system to interact with a windows network. At my home I have a router which connects my desktop PC where Windows XP professional is installed with ip address 192.168.1.100 and a laptop where Fedora 7 is installed with ip address 192.168.1.102.


Now configuration details for windows system :

1) I have an administrator account in my windows sytem with username "ritwikghoshal" and password (say) "windows".
2) Share directories / drives as you wish. I shared Netbeans project folder and "D" drive of my system. Just right click on the directory / drive and choose sharing.
3) Go to Control panel --> Network setup wizard --> click next --> I used the existing shared connection for the computer's internet access (i.e the recommended settings) --> Click next.
4) Computer Description : "desktop" --> Computer Name : "RITWIKD" --> Click Next.
5) Workgroup Name : "mygroup" --> Click Next --> Turn on file and printer sharing --> Next.
6) Just finish the wizard

Configuration details for Linux system :

1) Ping test : First I performed a ping test to check if windows system is reachable
[root@ritwik ~]# ping 192.168.1.100
PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
64 bytes from 192.168.1.100: icmp_seq=1 ttl=128 time=10.2 ms
64 bytes from 192.168.1.100: icmp_seq=2 ttl=128 time=2.24 ms
64 bytes from 192.168.1.100: icmp_seq=3 ttl=128 time=2.06 ms
64 bytes from 192.168.1.100: icmp_seq=4 ttl=128 time=1.85 ms

--- 192.168.1.100 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 1.854/4.103/10.253/3.553 ms

2) Check whether Samba is installed :
[root@ritwik ~]# smbd -V
Version 3.0.28-0.fc7

If you don't get any o/p like "Version 3.0.28-0.fc7" that means you don't have samba installed. Then try to install it first.

3) set Firewall to consider samba as trusted service :
System -> Administration -> Firewall and SElinux
Now check samba in Firewall option's trusted services.

4) Service Configuration :Start "smb" services
System -> Administration -> server settings -> services
Start smb service.

5) Samba Server Configuration :
System -> Administration -> samba

I. Server settings : Preferences -> Server settings
Here workgroup name would be same with windows' workgroup name i.e "mygroup". (windows config : step 5).

II. Samba Users : Preferences -> Samba users -> Add user
windows' username : it would be same with the username of your windows system , mine was "ritwikghoshal" (windows config : step 1).
setup a password , mine was "fedora".

III. Add share : add a directory , give a sharename , set necessary permissions . Description field is optional. I shared three directories from my home directory : software, study and NetBeans project folder.

6) Restart samba service :
System -> Administration -> server settings -> services
Restart smb service.

Access windows' share from Fedora 7 :

After following the abovesaid steps I checked the Network directory.It contained 4 icons : "RITWIK" , "ritwik's public files on ritwik" , "SFTP File Transfer on ritwik" , "Windows Network".
"RITWIK" : contained shared files of fedora (study, software , nbproject dir etc.)
"ritwik's public files on ritwik" : contained nothing
"SFTP File Transfer on ritwik" : contained root directory.
"Windows Network" : contained 2 icons , 'mshome' & 'mygroup'.
'mshome' had 'RITWIKD' where I found all windows' shared files.
'mygroup' contained same 'RITWIK' directory.


Access Fedora's share from windows :
Go to start -> Run -> open : \\192.168.1.102
Hit the return key and a browser window will display all shared files of Fedora system.

So... you are done !!!

You may also like to use commands than GUI , in that case ..
Configure IPTABLES for firewall issue
start / restart smb service by using commnds like :
/etc/rc.d/init.d/smb start
/etc/rc.d/init.d/smb restart
Edit /etc/samba/smb.conf and /etc/samba/smbusers to configure samba server.
I have used the following command to mount windows' "E" directory to my fedora home, in a directory named "WinShare".
[root@ritwik ~]# mount -t cifs -o username=ritwik,password=fedora,ip=192.168.1.100 //Ritwikd/E /home/ritwik/WinShare
.. and the following one to unmount :
[root@ritwik ~]# umount /home/ritwik/WinShare

Thursday, July 31, 2008

Wine on Solaris and Linux


Wine -- the one and probably the only tool for Solaris, Linux (& Unix too) to execute a *.exe file. Actually , "Wine is an Open Source implementation of the Windows API on top of X, OpenGL, and Unix." Wine is available for solaris , bsd unix and various linux distros ( Redhat, Fedora, ubuntu, debian... n more), Check out the full list and get wine now !!

** I think wine installation as root will never create any problem to the system , but running wine as root may give windows viruses access to the system. So it's wise to be a bit careful while working with wine.

I tried wine on various solaris distributions like Solaris 10, SXDE (Solaris Express Developer Edition) 9/07 , SXDE 1/08 , OpenSolaris 2008.05 etc. and found 3 different ways of wine installation.

I) Build from source : Probably the most native way , but worked for me on SXDE 1/08.
What I did to install wine in my system is the following :

1) Download wine from here. Mine version was wine-1.1.0 , it was a *.tar.bz2 file.
2) Extract files using gui tool.
3) copy the wine directory to /opt, and navigate to that directory.
#cp -r /export/home/ritwik/Desktop/wine1.1.0 /opt
#cd /opt
#cd wine1.1.0
4) Add /usr/ccs/bin and /usr/sfw/bin to the path.
#PATH=$PATH:/usr/ccs/bin:/usr/sfw/bin
5) perform "#./configure" . During that process I came to know that in my system some development files were missing :

#./configure

--------------------- many lines omitted ----------------------------------
configure: libXxf86vm development files not found, XFree86 Vidmode won't besupported.
configure: libxrandr development files not found, XRandr won't be supported.
configure: libsane development files not found, scanners won't be supported.
configure: liblcms development files not found, Color Management won't be supported.
configure: libldap (OpenLDAP) development files not found, LDAP won't be supported.
configure: libcapi20 development files not found, ISDN won't be supported.
configure: libcups development files not found, CUPS won't be supported.

configure: Finished. Do 'make depend && make' to compile Wine.

6) Then I tried gmake , it was completed with some warnings like :

regsvr.c:633: warning: visibility attribute not supported in this configuration; ignored
regsvr.c:633: warning: visibility attribute not supported in this configuration; ignored
regsvr.c:633: warning: visibility attribute not supported in this configuration; ignored
regsvr.c:633: warning: visibility attribute not supported in this configuration; ignored

I got the same warning (i.e visibility attribute not supported in this configuration)from a lot of *.c files during this GNU make process.

7) Anyway , after that I added the path to the .profile file at my home. I just append this line to the file :

PATH=$PATH:/opt/wine-1.1.0

8) Now I can use "$wine *.exe" to execute a *.exe file.

I tried this method on SXDE 9/07. Check out what happened.

II) Solaris 9 and 10 : I think Blastwave.org provides the best possible way with different flavors of wine and complete installation instructions. Check out here !

III) Doug Scott's wine build instruction : Applicable for open solaris distros like SXDE (Solaris Express developer Edition ) . Check out Doug Scott's CBE wine build instruction from here !

I tried all of the above said methods on OpenSolaris 2008.05. Here is my experience.

I am also a fedora linux user , and I used to download and install wine on fedora ( Fedora 7, 8, 9) by using yum. One simple "#yum install wine" command does everything !

HP printer behaving strange on OpenSolaris 2008.05

I have a HP Deskjet 3745 printer and trying to print a page from Open Solaris 2008.05 platform. First I tried to configure my printer in the system. I did it in the following way -
1) I connect my printer to the system and powered it on.
2) system -> administration -> print manager
and Solaris print manager was opened.
3) Tools -> Find printer
This tool was able to find my printer and add it to the system. Check out the screenshot.


After that I found my printer in solaris print manager.


Again , a printer icon on the panel told me that the printer is online and ready to print.


I opened a pdf file to take a print , and I was happy to found my printer in the options.


I clicked the 'Print' button , and after that..... No reaction in my printer !!! I opened a text file (written using gedit editor) , but my printer was not present in the 'Print' option. I tried an image file (jpeg) , my printer was present in the options, but again no reaction after clicking the print button.

Finally I was not able to take a printout from any kind of file though my printer is working perfect when I am using a different operating system.

Do you have any idea ?? Please comment ...

Thursday, July 10, 2008

OpenSolaris - Linux file sharing (Fedora 7 and OpenSolaris 2008.05)

I am using NFS to share some files between my linux and open solaris system. I am working behind a router which connects my desktop pc and my laptop . My desktop pc has OpenSolaris 2008.05 installed with ip address 192.168.1.105 and Fedora 7 is installed in my laptop with ip address 192.168.1.102.

I have configured my fedora system in the following way :

*A ping test to make sure that they are reachable to each other.

[root@ritwik ~]# ping 192.168.1.105
PING 192.168.1.105 (192.168.1.105) 56(84) bytes of data.
64 bytes from 192.168.1.105: icmp_seq=1 ttl=255 time=3.53 ms
64 bytes from 192.168.1.105: icmp_seq=2 ttl=255 time=1.18 ms
64 bytes from 192.168.1.105: icmp_seq=3 ttl=255 time=1.18 ms
64 bytes from 192.168.1.105: icmp_seq=4 ttl=255 time=1.16 ms
64 bytes from 192.168.1.105: icmp_seq=5 ttl=255 time=1.30 ms
64 bytes from 192.168.1.105: icmp_seq=6 ttl=255 time=1.44 ms

--- 192.168.1.105 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5000ms
rtt min/avg/max/mdev = 1.161/1.636/3.537/0.856 ms

** System -> Administration -> Server settings -> services.
I looked for NFS service and make sure that's running.

*** System -> Preferences -> system -> NFS.
click on 'Add'. I selected '/home/ritwik/study' directory to share .
Host(s) : 192.168.1.105
I checked 'Read-Write'.

now , /etc/exports was looking like :

/home/ritwik/study 192.168.1.105(rw,sync)

I have also checked the following :

[root@ritwik ~]# exportfs -rv

exporting 192.168.1.105:/home/ritwik/study
[root@ritwik ~]# showmount -e
Export list for ritwik:
/home/ritwik/study 192.168.1.105

My firewall service trusts NFS4 as trusted service , though I have used NFS version 3 to mount shared files.

Now configuration details for OpenSolaris 2008.05 :

*A ping test to make sure that they are reachable to each other.

-bash-3.2# ping 192.168.1.102
192.168.1.102 is alive
** Go to services. (for OpenSolaris 2008.05, browse it from system -> administration -> Services). Activate NFS services.

*** Go to Administration -> Share Folder. Click on 'Add'.

1)Now select the path to the folder you want to share , by default your home directory will be selected. I have shared '/export/home/ritwik/softwares'.

2)Share with : NFS

3)Click on "Add Host"

Allowed hosts : Specify IP address
enter IP address : 192.168.1.103
Check out the 'Read Only' box in Hosts settings if necessary.

Click OK to exit the wizards.

Optional Steps :

Now check out whether NFS server is running properly :
# svcs network/nfs/server
You should get a result like :

STATE STIME FMRI
online 21:22:11 svc:/network/nfs/server:default

Now check out Shared files :
#exportfs
From my laptop I got a result like :

- /export/home/ritwik sec=sys,ro=192.168.1.105 ""

and from my desktop,

- /export/home/ritwik/softwares sec=sys,ro=192.168.1.103 ""

You may also check /etc/dfs/dfstab , the file in my laptop was looking like :

# Do not modify this file directly.
# Use the sharemgr(1m) command for all share management
# This file is reconstructed and only maintained for backward
# compatibility. Configuration lines could be lost.
#
# share [-F fstype] [ -o options] [-d ""] [resource]
# .e.g,
# share -F nfs -o rw=engineering -d "home dirs" /export/home2
share -F nfs -o sec=sys,ro=192.168.1.105 /export/home/ritwik


Now , I make a mount point in my fedora system.

[ritwik@ritwik ~]$ mkdir OSolShare

Then I used the following command to mount OpenSolaris shared files in that directory :

[root@ritwik ~]# mount -t nfs -o vers=3 192.168.1.105:/export/home/ritwik/mysql/docs /home/ritwik/OSolShare

Then I was trying to mount fedora shared files in my Opensolaris system.

first I make a mount point :

ritwik@ritwik:~$ mkdir linxShare

then I tried the following command :

-bash-3.2# mount -F nfs -o vers=3 192.168.1.102:/home/ritwik/study /export/home/ritwik/linxShare

but got the following error :

nfs mount: 192.168.1.102: : RPC: Rpcbind failure - RPC: Timed out
nfs mount: retrying: /export/home/ritwik/linxShare
nfs mount: 192.168.1.102: : RPC: Rpcbind failure - RPC: Timed out
nfs mount: 192.168.1.102: : RPC: Rpcbind failure - RPC: Timed out
nfs mount: 192.168.1.102: : RPC: Rpcbind failure - RPC: Timed out

then I checked whether rpc is running :

-bash-3.2# ps -ef | grep rpc
daemon 339 1 0 23:28:42 ? 0:00 /usr/sbin/rpcbind
root 896 716 0 00:30:12 pts/2 0:00 grep rpc

which means rpc is running !!

Now I am trying to solve this problem... I'll post the solution asap.