Build a “Geek Machine” with Ubuntu 14.04 LTS

Old 2 Comments on Build a “Geek Machine” with Ubuntu 14.04 LTS 2160

Got yourself a brand new Ubuntu 14.04 LTS system to do geeky stuff? Well, if you are into development, you probably want to set your development system without much fuss. If so, follow along…

I recently installed Ubuntu 14.04 LTS on my Dell Inspiron 1545 laptop, 5+ years old for development purposes. This was the second time I installed Ubuntu 14.04 on my laptop, as I pretty much screwed up the previous version by experimenting with the CLI.

This time, I made sure I did all my installations in a clean, ordered way. After putting a lot of effort into it, I realized that this is something that other geeks also might be stuck with, so I put it all into this post for you to quickly get installing all the required software and get your brains up and running for some of your awesome pending projects.

This will be a long trip with the command line, so be ready with a decent network bandwidth and patience. At the end, you will have a properly set up development environment for most of the well-known languages. If you do not need a particular piece of software, you may skip it, as I listed down everything I did for what I required. I have used nano for editing text files, but feel free to use your favorite editor. Also, the order of installations won’t matter much, unless otherwise specified.

So, let’s get going…

1. Remove unnecessary applications

Ubuntu comes with a load of apps pre-installed, most of which you might not need. Uninstalling them through the software center will reclaim some disk space and probably performance.

I removed the games and apps like backup tool, screen reader, some lenses, etc. It is up to you what apps you want to remove.

2. Enable hibernation

Hibernation is very useful as it allows you to dump all your work safely and power off your system, and resume it later on. However, Ubuntu doesn’t have hibernation enabled by default.

Check whether hibernation works properly by running:

sudo pm-hibernate

If you are able to log back on successfully, enable it by creating a file using the following command:

sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

Fill the file with the following contents:

[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes

Save, exit, restart, and hibernation will be visible in the menu appearing when you try to shutdown, restart, suspend, etc.

3. Configure GRUB

For those dual booting Ubuntu alongside Windows, you might want to speed up your boot if you use Ubuntu most of the time. I use Ubuntu almost 95% of my time, so I reduced the GRUB boot menu timer to just 1 second and also disabled graphical menu. Who needs fancy graphics for a boot menu? For Windows, I just make sure I press the arrow keys the moment I see the GRUB boot menu. You may set this to your preference.

Enter the command:

sudo nano /etc/default/grub

Change the field GRUB_TIMEOUT from its default value 10 to 1.
Then, scroll down and find the following lines:

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

Simply uncomment the second line to enable console-style GRUB menu. Save and exit and then update the GRUB configuration by running:

sudo update-grub

Restart. You will be able to see the shortened timer and a simple boot menu which loads faster than the graphical one.

4. Upgrade your system

Ubuntu keeps on delivering important updates. Also, updating your repository information helps the system locate new or latest versions of a software or package. So simply issue the following command and sit back and relax as this will take time. You can tweak your system settings in the meantime. After updating, the system might prompt you for upgrading, so don’t doze off!

sudo apt-get update && sudo apt-get upgrade

It is better to restart after this to get the upgraded system up and running.

5. Enable hidden startup entries

This is one of the things geeks want to tweak for the best startup performance. Ubuntu has most of its startup entries hidden by default. To enable them, run the following command and then access the Startup Applications program from the Dash:

sudo sed -i "s/NoDisplay=true/NoDisplay=false/g" /etc/xdg/autostart/*.desktop

6. Have a terminal open within any folder

This is something developers truly need, which saves one from typing the whole location in the terminal to get somewhere. It is an extension for the Nautilus file browser, and the command goes as:

sudo apt-get install nautilus-open-terminal

Note that Nautilus needs a restart for this. So, run this:

nautilus -q && nautilus &

7. dconf-editor

dconf-editor is a tool very much analogous to the Windows registry. Although not everyone needs it, it is nevertheless a useful tool to keep just in case you need to meddle with some internal configuration or customization. Run the following command:

sudo apt-get install dconf-editor

8. C++ and development utilities

Every Linux distribution comes with C built-in as gcc, but not C++ (g++). C++ is required by Qt which is covered in the next section. Also, every C++ programmer also needs other tools required for developing programs. All those tools are packed into the build-essential package. cmake is also a great tool to have. So, execute the following command:

sudo apt-get install build-essential cmake

9. Qt

Qt is my favorite SDK and has a great IDE. I suggest every C++ developer to have one. Get the latest version of Qt here. You may choose either an online or offline installer, the steps are the same. I downloaded the offline one, which was qt-opensource-linux-x64-5.2.1.run. Substitute your downloaded version in the commands wherever it appears.
Give executable rights:

sudo chmod u+x qt-opensource-linux-x64-5.2.1.run

Install:

sudo ./qt-opensource-linux-x64-5.2.1.run

As Qt was installed as the superuser, you will need superuser access to run Qt IDE. To avoid this and make it available, change ownership to your user:

sudo chmod -R 777 /opt/Qt5.2.1/

10. Java

OpenJDK is the Java I installed which is also needed by some other applications which require Java, like Arduino IDE (covered in the next section). If you need the latest one (Java 8 at the time of this writing), you can separately get it from Oracle, extract it somewhere and link it with your IDE to develop using the latest version. I did this with Netbeans IDE (more on this in a later section) and it works well.

sudo apt-get install openjdk-7-jdk

Note that JRE is also installed along-with JDK with the above command.

11. Arduino

Arduino is a platform for hardware enthusiasts to develop electronic systems. For more information, check out this post. If you are not into such development, proceed to the next section.

Along-with Arduino, I also install arduino-mk, which is a great package allowing for development in any text editor or any other IDE. I personally prefer Qt for Arduino development with the help of this package, although Arduino IDE isn’t that bad, and works without it. Also, because I don’t want to always keep Arduino IDE open for Serial output, I use gtkterm, which is similar to PuTTY.

Run the following command to get the entire Arduino development tools:

sudo apt-get install arduino arduino-mk gtkterm

12. Netbeans IDE

Netbeans IDE is like an all-rounder for application development as it supports Java, C++, PHP and many frameworks. Read about it here. Download the latest version here.

As I mentioned previously, you can configure Netbeans IDE to use another version of Java instead of OpenJDK, which it will automatically detect during installation. You can change the default Java to use in the installation wizard, or by adding the Java platform after Netbeans IDE is installed. I changed it in the wizard itself so that Netbeans itself can take advantage of the latest Java, as it is built in Java and cannot run without it.

Replace the file name in the following commands with the one you downloaded:
Enable execution:

sudo chmod u+x ./netbeans-8.0-linux.sh

Install:

sudo ./netbeans-8.0-linux.sh

13. Artha

Artha is a great dictionary to use. Install it using this command:

sudo apt-get install artha

14. OpenCV

Installing OpenCV was the most tedious for me as even after installing I wasn’t able to run OpenCV programs. It actually required a GTK library. Make sure you have it by running the following command:

sudo apt-get install libgtk2.0-dev

Download OpenCV and extract it. Go into the extracted directory using the command line. If you have done section 5, you can directly open a terminal there after a right-click. Then issue the following commands:

Make a directory to build the required libraries:

mkdir build
cd build

Configure installation:

cmake ..

Compile the source code by:

make

Finally, put the library files and header files in standard paths:

sudo make install

Test a program to see if it works compiling with the following command, filling in the required fields:

g++ <source_file> -o <executable_file> `pkg-config --cflags --libs opencv`

If it doesn’t work, check out what the errors say you to install, or follow this guide.

15. Apache Web Server

I prefer installing components separately to simulate a production environment instead of a LAMP stack. This is my geek way of doing web development. The next sections will focus on MySQL and PHP. If you prefer LAMP stack, do use it. It is easy to install and use.

Install Apache web server:

sudo apt-get install apache2

Create your configuration file for your site, which may be located in your home folder. I put mine in a directory called public_html and named my configuration file as vivp1545.conf. Replace it with whatever you prefer.

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/vivp1545.conf

Edit the configuration file:

sudo nano /etc/apache2/sites-available/vivp1545.conf

Specify the server name which you will type in the address bar to access your website. It will probably be commented out already.
Then specify your root directory. Mine was:

/home/vivp/public_html

Copy and paste the following lines after the document root line. This is required to grant access to the Apache web server to your files. Don’t forget to replace the path with yours.

<Directory /home/vivp/public_html/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

Save and quit. Then disable the default site and enable your site by:

sudo a2dissite 000-default && sudo a2ensite vivp1545

Again, don’t forget to replace vivp1545 with your configuration file name (without .conf extension). Then restart the server using:

sudo service apache2 restart

Check out a static dummy page on your site to see if it worked. If you get permission error, enable full permission using the chmod command used for Qt before.

16. MySQL

Installing MySQL is simple as it has almost zero configuration to do. Run the following command:

sudo apt-get install mysql-server libapache2-mod-auth-mysql

Note that the second package is required for Apache to talk to MySQL.

17. PHP

The final thing for your web development setup. The following command includes packages for PHP to talk to Apache and MySQL, apart from the core PHP package:

sudo apt-get install php5 libapache2-mod-php5 php5-dev php5-mysql

Check out any of your PHP sites whether the whole Apache, MySQL and PHP system works. Don’t forget to load your databases in MySQL. Otherwise, check for the classic phpinfo() call to check whether everything is in place.

18. Mercurial

No developer’s system is complete without a version control system. I prefer Mercurial. If you are new to version control, I recommend using Mercurial. Follow this guide to learn it. Also, most of your IDEs will readily be configurable for Mercurial with a single click, so that you do not need to learn all the Mercurial commands. Qt and Netbeans IDEs which I use readily detect Mercurial. Run this single command to set it up:

sudo apt-get install mercurial

19. Happy Coding!

So finally we are at the end of all this. Phew! It was sure a long one. Now you can start developing your projects in your brand new Ubuntu “Geek Machine”. Do check out my next post which is a sequel to this one and will be shorter (hopefully!), suggesting you some cool applications to gear up your system a bit more, such as performance, visuals, etc.

This post took me a week to get it as accurate as possible. If you encountered some errors or failures regarding installations or configurations, post a comment below or search its solution on the web which might be faster in case I am busy with other stuff.

Author

Vivek Prajapati

A moderate level programmer interested in administration and Arduino. Familiar with C++, Java, PHP, C# with my favourite being C++. Just finished my bachelor's degree in IT.

Related Articles

2 Comments

  1. Ebrahim Jahanshiri July 7, 2014 at 1:28 am

    Is it possible to do version control simultaneously in linux and over the web?
    How github fita in here?

    Thank you

    • Vivek Prajapati July 7, 2014 at 9:45 am

      Yes. The version control systems I know of operate both locally and over the web so as to maintain backup or redundancy in case something happens to your local copy.

      Mercurial also stores repositories in the cloud, although I presently use it only locally being a single programmer with no team as such. GitHub presently has the most members and repositories. Do use it if most of your team members use it.

      With all version control systems also utilizing the web, the decision of which one to use just comes down to which system most of the members are comfortable with.

Leave a comment

Back to Top