I recently came across a scenario where I wanted to access the NetBeans projects located in another computer. That was a Ubuntu machine as well so I naturally went for the “Remote Desktop Viewer” (since I’m used to it when I was using Windows) feature available in my Ubuntu and opened NetBeans IDE in the remote machine to work with the projects. That was painfully slow, so I went to the “Terminal Server Client” with the protocol as “VNC”. Not much difference. These options were ok to just connect to a remote machine and perform simple operations. But when you want to work on a set of files for a long period of time inside an IDE, that’s a different story.
I use keyboard shortcuts heavily in NetBeans IDE and whenever I issue a series of commans via the keyboard, the remote desktop connection went havoc and got struck inbetween. I had to periodically disconnect and connect to the remote session again which was really painful.
Here my need is to access a set of files located in another machine. I really don’t want to view the desktop of the remote machine nor need to run some applications from there. So I was looking for other options and came across a really fantastic concept called Network File System or shortly NFS.
Basically, NFS allows you to mount a remote file system in your network into your machine, as though it’s a local file system. This opens up a wide range of options. For example, you can have a centralized server to contain all the “home” directories of your users. Users can seamlessly mount them as though the “home” directory is available on their machine locally.
This is exactly the solution I was looking for. So I quickly installed the NFS server on the remote machine by typing the command “sudo apt-get install nfs-kernel-server“, and then configured the directory I want to access remotely in the “/etc/exports” file. The configuration can be made in a single line like this:
(Where “*” means any computer connected to the network. If you want to give access to a single machine, give the ip address or host name of the respective machine instead of “*”.)
Once the NFS server was started on the remote machine using the command “sudo /etc/init.d/nfs-kernel-server start“, all I had to do is to mount the remote file system on my machine.
But I had to install the “nfs-common” package on my machine using the command “sudo apt-get install nfs-common” to mount remote network file systems. Once this package was installed on my machine, I issued the command “sudo mount my-remote-machine:/home/user-name/projects /home/remote-projects” to mount the file system in the remote machine. Everything was very straightforward.
For a complete step by step tutorial, kindly refer to this great manual about NFS in Ubuntu.
Wow, then I was able to open all the NetBeans projects in the remote machine from the NetBeans IDE installed in my machine. It looked as though I’m working on the NetBeans projects configured in my machine. It was really fast and I never felt any noticeable difference from my other locally available NetBeans projects.
I switched to Ubuntu Linux before 2 months and I’m thoroughly enjoying all the benefits it brings along. For the past 2 months I never felt any need to go back to Windows XP. I know this is just a tip of the ice berg and waiting to explore more Linux treasures in the coming days…!