BLOG

Windows to Linux transition

As a developer coding in php on windows OS, at one stage you would want to switch completely to linux, for following reasons -
1) it’s a requirement
2) you use a linux server and want to get familiar with your remote server environment
3) no license fees.
4) you think its cool or geek or both.

Whatever might be the reason, using linux for developing php applications is definitely a plus because php was made for linux.

Likewise even I wanted to make a switch to linux for a number of reasons and was checking out various options like virtual machine and multiple installations on my windows machine just to play around and understand. But I took it up seriously only last week and decided that i would code our side project (which we work on saturdays) entirely on linux. So the target was to get linux (Ubuntu 9.04 also known as Jaunty Jackalope) at a stage similar to my existing development environment on windows ie. apache, php, mysql, eclipse, subversion (subclipse). In doing so, I had my fair share of the usual eureka moments, roadblocks and a lot of google search. In the process I found out a some superb resources which I wish to share through this post.

First of all let me tell you that linux isn’t difficult anymore. The gnome interface brings it very close to windows and no extra effort is required to figure out basic stuff like working with folders, browsing the internet or playing games that come with the package. In fact, I know many non-techies who use popular linux distributions like Ubuntu for various reasons, most importantly for reasons #3 and #4 stated above. But if you are a developer the interface might not take you far because you will be doing a few things that requires root access and for that, (as it seems so far,) Terminal is must .

So the first thing you would want to do is to get yourself familiar with a few basic shell commands. Here are a few tutorials that actually take you through the process rather than just mention to commands as facts.

http://jucato.wordpress.com/2006/08/22/ubuntu-classroom-command-line-basics/

These tutorials will get you rolling and if you are really determined, you will probably start enjoying the terminal.

The next important thing is to set up LAMP. The following links explains it better than anything else I could find on Google. If you follow this, believe me, LAMP installation will be a breeze.

http://www.supriyadisw.net/2006/12/lamp-installation-on-ubuntu

Now apache, php, mysql is set up and you can see ‘It works! ‘ when you navigate to localhost. If you havent figured out yet, this file lies in /var/www/ folder. So this is your document root. But http://localhost/phpmyadmin still gives a 404 not found error . This is because you have to tell apache that mysql client is there. So put this piece of code at the end of you apache2.conf file and restart apache.

Include /etc/phpmyadmin/apache.conf

Cool. As soon as this started working i thought i was all set to migrating my code to linux. But not yet because I had still to set up eclipse. So I downloaded eclipse PDT for linux and untared it by typing a hard to grasp command in the terminal. An important command to know now is how to deal with compressed files, although you can do it using interface as well.

So that got eclipse up and running but it didn’t allow me to have /var/www/ as my workspace if I didn’t launch it with root access. Doing a sudo launch every time was quite annoying. Also, the files inside /var/www/ couldn’t be edited by a non-root user. Then the ‘home/user/public_html/’ directory on a typical linux remote server struck me. So what I wanted now was to configure virtual hosts on apache2 and I found out this link which made it so easy.

http://www.debuntu.org/2006/02/22/7-virtual-hosting-using-apache-2

After this, eclipse can be started from a launcher on the desktop. Now the most painful part, Subclipse. I remember it was easier if not very easy on windows. With linux, you can clearly make out that the problem is some version compatibilty issue with Javahl library that subclipse uses, but it seems to be impossible at one point of time until you come across something like this -

http://en.newinstance.it/2009/05/13/making-eclipse-javahl-working-recompiling-subversion-from-the-sources/

So that was it. Lot of nice things learnt and finally all good stuff working smoothly on ubuntu. Hoping to have the entire team on linux now and the next few challenges are -

1) installing php and apache extensions so that all projects work in linux.
2) instaling the APE server
3) migrating to linux full time.


3 Responses to “Windows to Linux transition”
Leave a Reply

     

     

     



Find us on

Technology

Contact Us