Tag Archives: how to

PPA(Personal Package Archive) is great for installing new and cool apps/utils in Ubuntu or similar GNU/Linux distro such as Linux Mint etc. Due to PPA, publishing and distributing apps has become very easy.

Sometimes you may want to remove an application installed using PPA (may be because some sort of conflict occurred between the app installed from official repository and PPA) or may be you added a wrong PPA address and you get some error messages (on terminal, e.g file not found) or update manager is not working properly due to broken PPA etc. In that case, just follow any of the method (to uninstall the ppa) –

Now a Days, Ubuntu is one of the most popular OS among programmers (not only nerds but also the beginners who just entered into the programming world) but for a beginner Ubuntu user coming from Windows may feel some problem in programming with Ubuntu.

On Windows they use nice GUI based IDE, but in Ubuntu things are little different. In Ubuntu it’s better to use Terminal (specially for the beginners), instead of GUI based IDEs such as Eclipse, Netbeans etc for compiling programs. In fact, the command line approach is much easier and efficient, due to the powerful shell such as bash, zsh etc.

So, in this post – you will learn – how to compile and execute (run) C/C++ programs in Ubuntu 12.04 (Precise Pangolin)/12.10(Quantal Quetzal) or other Linux distributions such as Linux Mint 13 (Maya). You don’t need to install any extra applications or tools other than the compiler. The default text editor – gedit will work fine for source code editing (unless you have a preferred source editor such as Emacs, Vim, Nano, Kate or something else).

#1. Install the C/C++ Compiler

First make sure that you have GCC (GNU Compiler Collection, for C language) and G++ (for C++ language) installed on your system. If not, then install it by typing the following commands on Terminal –

For C

sudo apt-get install gcc

For C++

sudo apt-get install g++

#2. Write the Program (Source Code)

Open gedit and write the following lines of code (it’s a simple program that contains one print line and one comment, just for explanation purpose) –

Then save the file as hello_human.c on your Home Directory (~). If you ae writing a c++ program, then give it the extension as .cpp (and of course you will also have to change the command accordingly during compilation)

#3. Compile it

The command structure is :

gcc source_file_name.c -o executable_file_name

if leave the -o option (name of the output file) then by default a.out will be created as the executable output file.

To execute the above example program, open a terminal and type –

cd ~
gcc hello_human.c -o hello_human

[In case of C++, just replace gcc with g++, rest of the things are same, e.g g++ source_file.cpp -o executable_file]

#4. Execute It

On Terminal, type (from the same directory where you have the executable file, in this case, it’s Home Directory(~) ) –

Root account is disabled by default, in Ubuntu and some other GNU/Linux distributions because the super user created by default (during installation process) can easily gain root privileges through the help of sudo (super user Do) command. But in some cases it might be good to have access to root power in GUI mode (or may be just for fun), although I’m sure most of such administrative tasks can be easily accomplished by sudo utility (which is installed by default in Ubuntu).

Unlocking Root Account in Ubuntu 12.04 LTS (Precise Pangolin)

Open a terminal (Ctrl+Alt+t) and execute the command –

sudo passwd root

Then enter the root password twice (followed by your login password). Then logout from the current session and choose root user at login prompt. Then you can enjoy root power in GUI mode. Or you can use su command to gain root power at terminal –

su

Then enter root password and Enjoy

NOTE : But actually you shouldn’t be using root account for administrative tasks. simply use sudo (if you want to gain root power in terminal) or gksudo or gksu for GUI applications such as File Manager. So if any command requires root power i.e gives permission denied error or something like that then just put sudo before that command.

sudo command_that_requires_root_power

Open Nautilus with ROOT privileges (it’s required unless you do file management over command line – in that case sudo will work fine)

gksudo nautilus

For KDE Desktop users KDESUDO utility is there (it’s a frontend for sudo) –

Ubuntu 12.04 (code named as : Precise Pangolin) is a LTS release (right now only beta version is available, stable will be out in a couple of weeks) – with 5 years of official support and updates. So LTS version is well suitable for production environment and if you’re using 11.10 or any other versions then you may want to switch to 12.04 for latest features, packages and stability.

This guide is made for absolute beginners, and will help in setting up Ubuntu 12.04 along with their existing operating system; although it’s not necessary because now you can do everything on Ubuntu and it’s fairly simple to use (and the absolute Freedom offered by Free ‘n’ Open Source softwares) , so you may swap out your current operating system completely with Ubuntu 12.04.

To install Ubuntu – first create a live USB, CD or DVD installer and boot your system – you may need to change your BIOS settings if your computer doesn’t boot from the live media installer. To get into the BIOS menu simply hit F2 or F12 or Del key – it depends on your system. Then, navigate through the arrow key and go boot devices/options and enable the USB boot, then change the order of bootable media (put USB on top) and save it (you may have to hit F10 for that).

The installation process is quite easy but first of all you must create a backup of all your important data – it’s not like you’re going to lose the data but you can’t blame me if anything goes wrong. So it’s better to have everything backed up before you start.

Although, step by step manual is described below, this screencast may help you a lot.

Step by Step Instruction for installing Ubuntu 12.04

step 0. Make Sure, You’ve backed up your important data

First of All, Backup All Your Important Data (either online, using Amazon s3 or offline or whatever way you prefer – but you must have backed up your critical data before moving to the next step)

step 1. Create USB installer

Download Ubuntu 12.04 ISO (according to your computer architecture such as 32 bit or 64 bit, and of course the Desktop Edition)

If you’re using Windows 7(most probably you’re, otherwise you wouldn’t be reading this, just kidding move on) or XP/Vista – then create a USB installer using the application – Universal USB Installer. It’s quite easy – download and run this installer – and locate the ISO file, select the target USB drive.

If you’re using any older version of Ubuntu such as 11.10 or 10.04 then there is one application you need to use – Startup Disk Creator, installed by default on Ubuntu. Run the application, locate the ISO image and make your pen-drive bootable.

Anyway, at the end of this step – you must have a USB stick installer for Ubuntu 12.04.

step 2. Initiating Installation procedure

Now, you got the live usb installer for Ubuntu 12.04 LTS, restart you computer and boot it from the installer. If there is any booting problem check your BIOS settings – it should be able to boot from a USB and the priority should be #1 (although it’s not really required if you manually select the bootable media).

First look at Ubuntu 12.04 (with the default Unity interface)-

Click on Install Ubuntu 12.04 LTS button to start the installation process – although you can get an overview without even installing it on your hard-drive.

Now select Language – The default is English, but Ubuntu supports a lot of other languages – so you can run ubuntu in your native language.

Now’re you’re ready to install Ubuntu 12.04 on your hard disk. Although Internet connection is recommended but it’s not strictly required during installation as you can always updates or install new packages later. In some cases – Wifi network it may not be detected automatically – just relax you can configure that later.

step 3. Create hard drive partition for Ubuntu

Select Installation type – ‘something else’, the third option as it’s the safest method and you get more control over what’s going on.

Now you need to create a ext4 partition for Ubuntu 12.04; use the partition manager – swap out Windows (if you don’t want to keep windows) or unused partition or create new partition from existing hard drives.

Now click on Free Space -> Add -> Create Partition.

select the target partition (check the box), where Ubuntu 12.04 will be installed.

Until now, no hard disk changes has been committed – Now you can click on install Now button to begin installation.

step 4. Installing Ubuntu 12.04

Select your physical location from Map.

Next, choose the keyboard layout, if you’re not sure what option you should choose – then you should probably go for default value.

Enter the user (You, the sudo user) account detail – that will be created during installation procedure (you can create/manager user later).

Wait until the installation process is complete. If you’re connected to internet – it may take little extra time because of update/extra language packs – if you don’t want them, then skip those steps. (if don’t get it clearly, then watch the video)

In earlier versions of Ubuntu, actually up to 10.10, a Mac OS X transformation pack was available for Ubuntu users (based on GTK 2.*) but now the Ubuntu 11.10 (the latest stable version) or 12.04 LTS (only alpha versions are available right now) as well as other Ubuntu derivatives such as Linux Mint, are based on GTK 3 – so the transformation pack doesn’t work anymore. Both of the desktop – Unity (The default interface in 11.10) and Gnome 3 shell are quite popular. I’ve already covered a post about getting a Mac like look in Ubuntu 11.10 with Gnome shell desktop so this article is about Unity desktop.

If you want to make Ubuntu 11.10/12.04 look like Mac OS X Lion, then you need to install few basic things –

GTK Theme

Icon Theme

Cursor Theme

Gnome Tweak Tool (To manage themes)

A dock application (Docky or Cairo Dock)

A cool snapshot – exploring Cairo Dock effects (using OpenGL, although you may choose to ‘no OpenGL’ version of Cairo Dock if the graphics performance of your computer is poor), of my desktop after install above stuffs :

Installing Mac Theme by ‘MBoss’ Packages

First of all – download the theme package (it contains theme, icons and cursors) and extract it to appropriate locations as specified –

Gnome Tweak Tool is very handy for changing themes or tweaking other settings of Desktop so If you haven’t already installed it Gnome Tweak Tool then install it by executing the command –

sudo apt-get install gnome-tweak-tool

Now, open Gnome Tweak Tool and select Mac_OS_X_Lion_Theme – as indicated in above snapshot. Then, start Cairo Dock or Docky whatever you have installed. That’s all I hope you are enjoying the cool look of Mac on your Ubuntu 11.10/12.04 computer. Have Fun – let me know if any problem occurs.

Besides Gnome Tweak Tool, you could also use ‘Ubuntu Tweak‘ – a small application to tweak/customize desktop in easy way.