Home > Delphi, Linux, Object Pascal > Moving to Linux – Part 2

Moving to Linux – Part 2

September 26, 2014 Leave a comment Go to comments

Before you decide to try this, I want to urge you to be clever about it. First of all, make sure you back up everything. If possible, download Acronis and make a disk image of your present Windows Installation. Acronis is a fantastic tool which will pack your entire drive(s) neatly onto a series of DVD’s or external USB media, and you can restore your system back to its present state later without any hassle.

Secondly, always – and I mean always use the Live CD before you make up your mind. This is actually one of the great things about Linux, that you can boot from a CD and test the system first, without any damage done to your present operative system installation.

VMWare, clever programming

I must also urge you to move your development onto VMWare, not because you must – but because it will make your life easier in the future. If you are a Delphi programmer then this is the perfect situation to get this done, and it’s going to make your Delphi life so much better. Even if you decide to stick with Windows, creating separate Windows environments for each version of Delphi you own, getting to know the snapshot and clone tools — is going to revolutionize your programming. For instance, you set all your Virtual Machines to share a common source code repository (there is a time saver), which is so much easier when you work with different versions of Delphi and Windows. It also makes sense for your backup schedule, because you can back up everything in one go. Your Dropbox folder is a good place to keep your source-code and component packages (just a tip).

Delphi on Linux, you just saved $300 in License fees

Delphi on Linux, you just saved $300 in License fees

Also make sure you clone each machine from a fresh install of Windows with just the essentials (virus killer, SVN client etc), and later reserve that clean root image for testing software. Before you install a program to test, take a snapshot of the virtual machine, test, then revert back to clean state afterwards. once you get the hang of developing with virtual machines, you will wonder how you ever managed to build programs professionally without them.

Creating these virtual machines will take some time, so allocate a day or two to get the job done. Get an external drive (2TB costs near to nothing these days) and back up everything there, both your vmware images and your Acronis disk image of windows. Remember to always have a secondary backup of your vmware disks. Should shit hit the fan, you don’t want to be left with nothing.

Selecting a Linux distro

On the face of it, Linux comes down to two factors: your hardware and your personal preference. My personal favorite is Fedora Linux; I don’t know why but I love the theme they use and how they organize things.Β  But sadly it doesn’t recognize my laptop (which I used as a “test” machine when trying out Linux). And this is why I hated Linux before – I was always missing a driver, or some part of my PC just did not work properly after installing. Which brings us to a third, more subtle factor, and that is funding.

The more money someone has thrown into a Linux distro, the more drivers and work will be invested in it. And it so happens that Ubuntu is maintained and evolved by a dot-com millionaire, which have thrown a ton of cash at the project (and it really shows). As such, Ubuntu is estimated to have roughly 3 times more drivers in their database than Fedora. If this is true or not I can’t say, but Ubuntu immediately recognized the built-in wi-fi on my laptop (even the on/off switch underneath it) so I can only presume the rumours are correct.

Ubuntu is an excellent Linux distro

Ubuntu is an excellent Linux distro

So for this article I will focus on Ubuntu, because that is the distro which has done wonders for me. It is also a distro that is polished, spit and shine polished. Someone has clearly spent a lot of time and money to make sure Ubuntu is pleasant to use, that all the tiny details which makes all the difference (like two-finger scrolling) in daily use are in place, often associated with other operative systems (like OS X) or Windows. Basically, they have cherry picked ideas and details that makes sense from other systems – and combined them into an operative system which is a joy to use.

Downloading Ubuntu

If you havent done so already, head over to ubuntu.com and download the latest version (http://www.ubuntu.com/download/desktop). The download is an ISO image, so you need a CD/DVD burner and an empty cd for it. Once downloaded use Nero or any other cd/dvd utility to burn the ISO to disk.

Once you have the disk ready, reboot your PC with the CD in the drive (you may have to enter the bios and make sure the PC boots from the CD first). You will be presented with the option to either install Ubuntu or just try it out. I strongly suggest you spend a few hours playing with it before you install anything. This will also make sure Ubuntu recognizes the majority of your hardware. In my case, my gaming keyboard was not recognized immediately – and only when I installed it (and downloaded updates for the system) did Ubuntu find a driver for it, and all the keys lighted up, just like under Windows.

Installing

When you decide to install, make sure you check the “download updates from the internet” option. Ubuntu will compare the files on disk with the online versions, and use the online and more recent files instead. Since the install process is extremely quick and easy – there is not much to say about it. Make a cup of coffee and relax, you are almost there.

Starting for the first time

Once Ubuntu is properly installed, you are greeted by the Desktop. To a Windows user it may look strange. No start button in sight, a bunch of tool-icons to the left, and an Amiga like header at the top of the screen. Well, this is where the fun begins, because now we are going to install VMWare and get your Delphi environment(s) up and running again!

The Ubuntu desktop, more or less

The Ubuntu desktop, more or less

In order to install VMWare we have to take a small trip to the shell. Click on the blue Ubuntu icon (on the button dock), this is actually the “Ubuntu Start Button”. But it’s a bit different. When you click it, a search window appears. At the bottom of this semi-transparent window there are some icons. Click on the second icon from the left. This is the “program” icon, which means that Ubuntu will display a list of all installed programs. If you type anything, this list will be filtered accordingly. Look through the list until you find “Terminal”, then drag that icon onto the button-dock so you keep it handy for later.

The Ubuntu start/search button has everything you need

The Ubuntu start/search button has everything you need

Right, fire up the terminal by clicking on it and type in the following:

sudo apt-get install build-essential linux-headers-$(uname -r)

Tip: Just copy the text from this website, right-click on the terminal window and click “paste”.

Next, download VMWare Player and store that in “Downloads” (happens automatically), so click on the Firefox browser icon on the dock, and go to this website: https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0. Pick the Linux download, either 32bit or 64bit, depending on your system. When the download is complete, you have to make the VMWare package executable. So simply open up the folder “Downloads” (you can do this from the browser), right-click the file, select “properties”, and check the “executable” checkbox.

And last but not least, let’s fire up the installer:

gksudo bash ~/Downloads/VMware-Player-6.0.2-1744117.x86_64.bundle

Note: You may get the message “gksudo” not installed, just follow the 2-line instruction on how to install it

Also, in the command above – make sure the filename (wmware-player-6.0. … etc) matches the file you downloaded. The version is no doubt higher by the time you read this. Also, Linux is case-sensitive (!)

VMWare installing on our spanking new Linux system

VMWare installing on our spanking new Linux system

What, no automatic install?

If you are thinking that this is crap and that you were expecting an app-store like interface, don’t loose it. VMWare has chosen not to package their software, and Ubuntu cannot legally kidnap software and publish it. So VMWare has to be manually installed outside the ordinary app-store like system Ubuntu has to offer, but that is the only piece of software you need to do this with, unless you want some other non-packaged app on your system.

Either way — with VMWare installed you should now find the VMWare program icon if you click the “Ubuntu blue start-button” and select programs (second icon on the bottom of the window). Again you may want to drag the icon to the button-dock to keep it there, since you are going to use it daily πŸ™‚

Going bananas on app-store

With VMWare in place you can now start to copy over your virtual machines (or perhaps you prefer keeping them on the external drive? Makes sense if you work in-office, then you just need to carry the disk with you in the morning). I presume you are not a complete computer novice and that you will have noticed the explorer icon light up when you opened the Downloads folder, so you wont have any problems finding the drive, copying the files to your documents folder and so on.

Now sit back, start-up your favorite Delphi and Windows virtual machine — ah! the joys of being a programmer πŸ™‚

Now it’s time to go bananas on app store, which for Ubuntu is special for two occasions:

  • 99.9% of all the apps are free
  • It’s not called “app store” but rather “Ubuntu software center”
Download whatever you want, its free!

Download whatever you want, its free!

As a programmer you want something to edit graphics with in the line of Photoshop, so type in “gimp” in the search window – select it and click install. That’s really all there is to it. Everything is downloaded and adjusted automatically.

Secondly, you also want Lazarus, so type that in and do the same. Note: after installing Lazarus, search for “fpc” and install the dependency package (source files). Congratulations, you now have one hell of a compiler system free of charge.

If you are into 3d graphics I suggest you install Blender, and for audio there is audacity – which is also a great program on Windows. VLC is also a de-facto video program, a simply “must have” if you download .. ahem.. documentaries using bit-torrent (he said knowingly).

Β Next time

In the next article on Linux we are going to focus more on common chores, like backup systems and how you can keep your Linux system and your data safe. We are also going to make a rescue USB pen-drive, with a full install of Ubuntu! In effect, the only thing you need to take to work – is that Linux pen + your VMWare machines on a secondary disk. Leave your bulky laptop at the office, you got everything you need to be a Delphi superhero on a stick!

 

Advertisements
  1. Gustavo Carreno
    September 26, 2014 at 6:18 am

    These series about Linux and Lazarus/FPC are great!!

    Just want to add something to your post:
    1. You can also use a Thumb/Pen/USB Drive to install Ubuntu. I always carry around a 1GB one with the latest 64b version of Ubuntu. I never know when I’m getting another friend into the Linux bandwagon πŸ™‚
    2. The Terminal is not on the Launcher (Left Icon thing) because you can use Ctrl+Alt+T to access it.

    Thanks for the series and keep’em coming!

    • Jon Lennart Aasenden
      September 26, 2014 at 7:57 am

      Well that is odd, because i typed in “terminal” and it came up. Otherwise I would not have found it πŸ™‚

  2. Gustavo Carreno
    September 26, 2014 at 6:20 am

    Sorry for not mentioning this early: If you are starting your virtual machines from scratch, I mean, you don’t have any to start with, I would recomend thinking about VirtualBox. Unlike VMWare it is packaged for Ubuntu and you can get it right out of the Ubuntu Software Centre.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: