,

Installing via Terminal and Compiling Files from Source

·


Installing files under Windows is simple: a double click on the file, then repeated hitting of the “next” button until you get to that license agreement, before you accept it. Once accepted, it does it’s thing, then hocus pocus, the job’s done and you can use that new application/game. But in Linux, I’m afraid life’s not that simple.

While we do have the Ubuntu Software Center, the Add/Remove programs of Gnome, and other such applications to which we have a graphical shell, like everything in Windows, we can also run these programs from command line. And while I can’t tell you that this way is better (it can be helpful to troubleshoot when things go wrong), if you are forced one day to use a terminal, you can know what you’re doing without even confronting those manual pages. Plus, the honest truth is most times you are able to install something the same way if you use the terminal. Linux Mint, Xubuntu, Debian, FreeSpire… seeing as they’re all based on the same base, if you learn the terminal, you can install from all of them without knowing much about how they specialize in installing programs.


If you’re looking to install something the easiest possible way, in Ubuntu and Debian based systems via a terminal prompt, the best and the easiest way is:

sudo apt-get install ****

where **** is the name of the package you are trying to install. If you would like it to automatically install without asking you for your approval for more packages, you may add the -y switch to the end. To refresh and update from the repositories you have installed (where the majority of your pre-compiled packages should/would come from), it’s just a simple

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

which will check the repositories for the newest versions and to automatically update you to the newest packages.

However, I can assure you, there is a time and a place where you will one day have to compile your own program from source files. It’s not pretty, it’s not nice… but it works, and that’s what we’re aiming to do here, to give you a working program. I’m aware that this is going to make a few people antsy, so if you don’t feel up to doing it, you could always ask someone to make you a pre-compiled package, such as a deb file for Debian-based distributions, or an RPM for Red Hat based ones. However, the command line options to do a manual install aren’t that difficult.

Quite simply, they are:

./configure
(which checks to see if you have the dependencies to allow it to work, if not, you’ll have to manually install them)
make
(actually compiles the source code)
sudo make install
(actually installs the now compiled source code)
clean install
(cleans the temp files used to compile the source code)

while you’re in the folder that has the source files. It’s just a simple CD (change directory) command to jump into the folder that you uncompressed your saved source file to. If you’re using Ubuntu and compiling files from source for the first time, you have to install the build-essentials, which are installed by an even simpler:

sudo apt-get build-essential

I’m aware this will be complex subject matter, which is why I suggest if you are a Linux user to save this information and to make sure it’s near you at all times. I’ve personally printed off a copy of the commands I have to use to compile, because while I don’t often have to compile from source. Keep in mind this will not work for everything, so when you download a package, make sure to read the ‘README’ or ‘INSTALL’ file, which should walk you though it step by step. Always follow the provided documentation first, if you can’t get it working from using that, then this is a secondary solution that should work for you fine.

The nice thing about Debian and distros based off Debian, is ever since the introduction of Ubuntu and Linux Mint, there are more and more packages being written and compiled for them. This will lessen your chances of running across the need to compile files from source, but it will never fully eliminate the need to know this skill.