Wednesday, March 25, 2009

Linux: How Tux Stole my Heart


Recently, I've been doing a lot of "work" on Linux-based machines, and for me there is no equal. As crazy as it sounds, a lot of Linux software out there just doesn't have an equivalent on Windows or Mac. This post is dedicated to those who proudly shed their blood making Linux what it is today. This is coming from a 19-year Windows user, converting to Linux only a few short months ago.

I am so glad that I did. Here are a few reasons why any developer should convert to using Linux:

GNU Screen
Screen will save you so much time and so much headache. Screen is a freaking awesome program, small and simple, yet so powerful, kind of like what Ant did for Java. The concept is this: run multiple terminals inside of one terminal and make it possible to detach from terminals. What does this mean? Fire up a terminal, start screen, run a time-consuming process like a backup, and close your terminal window. Yep, it'll keep running. Nope, no non-dev will be able to see that it's running, and it's not possible to "accidentally" terminals running under Screen. SSH to a server, start a few different processes (eg X-Server, VNC, Red5... whatever you want) and disconnect. The server (or your computer) will run these processes as long as your session is open. Don't worry, you can close the SSH session, we're talking about user sessions here. Today, I read that some guy configured his work computer to accept SSH connections, and what he'd do is this: on his long commute to work, he'd fire up his laptop, connect to the machine at work, start it doing some time-consuming tasks with Screen, then shut off his laptop, and when he got to work, everything would be done. Get some with Screen.

Linux is a LIVING Operating System
Some may find it hard to believe, but Linux was designed with ease in mind. Linux is constantly learning and growing. What if 95% of the software on your computer could update itself uniformly and cleanly? What if you could install common programs with one line of code in your terminal? Linux can. On Windows, installing Java and Ant are pretty time-consuming and take a lot of fooling around. When I first installed Java on my Vista laptop, I nearly ruined my OS. I was a n00b back then, and I accidentally wiped my PATH environment variable, which is kind of really important on Windows OS's. Lots of stuff broke, and it was a complete nightmare. Installing Java on Windows kind of looks like this:
1. Go to Sun's Java JDK download site.
2. Find and download the latest Java JDK.
3. Run the installer.
4. After it's done, set the JAVA_HOME environment variable to the root directory of where you installed Java, eg "C:\Program Files\Java\1.6.X\". (This is a chore in itself... environment variables are a major pain on windows)
5. After that, add "C:\Program Files\Java\1.6.X\bin" to your PATH environment variable.

Then, basically do the same thing for Apache Ant. Make sure it's all working by running "java -version" and "ant -version" in a command prompt.

What about Linux? Run this line in Ubuntu and guess what? you're done:
sudo apt-get install openjdk-6-jdk ant

Pretty significant difference if you ask me. Oh, and how about updates to software? When new software comes out, you are notified in one centralized place, you hit "install updates" and it runs. You get the newest version of your music player, Java, PHP, Python... whatever you have installed. You also get new updates to the Linux kernel, making your operating system more secure, fast, and stable by the day.

Linux is Terminal Based
It's an operating system built by developers! Almost everything that you can do visually in Linux, you can do in a terminal. This makes for really nice shortcuts. Pop open a terminal with a keyboard shortcut, start a lengthy filesystem operation in a Screen session, close the terminal (or detach the Screen session), and pop up another terminal and keep hacking.

Linux (Ubuntu and Fedora at least) Support Keyboard Shortcuts out of the box
It's super-nice to have keyboard shortcuts, let alone ones that run right out of the box. For me, I can open a terminal with Ctrl+Shift+T, I can start Firefox with Ctrl+Shift+F, I can get to my home folder with Ctrl+Shift+H... so nice.

Of course, this post could go on and on, but was largely inspired by my deep frustration over having to do with Windows today. Installing Cron on Windows was next to impossible, and installing a C/C++ compiler and Make on Windows was almost not worth it, especially when I can install Make on Ubuntu with one line in the terminal.

Oh, and did I mention that I'm posting this blog over an internet connection using my phone as a modem... from UBUNTU!? You heard it right. I'm connected to the internet with Ubuntu over my phone. Linux rocks. Until next time, here's hoping I can get over my Linux saga and write a post on Red5 next time...

Labels: ,

Friday, March 13, 2009

Virtualization: Using VirtualBox to run a different OS

Sun's xVM VirtualBox product is pretty sweet. Imagine being able to test out any operating system from any operating system without causing any problems to your host operating system. All this is possible from Sun's VirtualBox, and more.

I found VirtualBox when first trying to migrate over to Linux. I have always had my issues with Windows, but I didn't want to wipe a computer and install Linux, or do anything strange with my startup and forge a dualboot system. After using VirtualBox for a little while to preview Ubuntu, I was convinced. Linux was and IS the operating system for me, in so many ways. In my own opinion, as a user of Windows for 19 years, Linux and its philosophy of free software is far superior to a system of ownership of ideas, proprietary software, and inflexibility.

I have noticed nothing but flexibility since moving to Linux, but that's not what this post is about.

There are some things that I learned with VirtualBox that are important to take note of. Make sure that the hard disk you create for your virtual OS is more than big enough. A dynamically expanding hard drive that VirtualBox creates will expand... but only up to the size that you specify. I thought that 'dynamically expanding hard drive' meant that it would grow to fit whatever content that is on it, but that's not the case.

I learned that the hard way after a whole day of downloading stuff over a 20 kbps connection. I filled up my hard drive in no time flat and I had nowhere to go, so here's attempt 2.

Another thing that you need to do immediately is use the Guest Additions. Installing the Guest Additions will make your life so much easier. Afterward, you'll be able to scale the guest OS up as far as your host will allow, rather than just keeping it at the default 800x600, which is really annoying to say the least. Guest Additions also remove the mouse grabbing nature of a virtual OS by default. After installing, you should be able to move your mouse seamlessly between host and guest, which is nice.

Afraid of using a new OS? Install VirtualBox and run it, without any damage to your host. If you can imagine this, you can create disposable operating systems that you can throw out at any time without any side effects.

Labels: , , ,