Compiling software from source (on Debian/Ubuntu)
From time to time, especially if you're a developer, you may find yourself needing to compile software from source. There is may reasons to to this, including but no limited to: security, acquiring a later version than in your repositories, or to add a modification. To compile nearly all programs, you need to install build-essential, which is a package containing C compilers, C++ compilers, make, and many other handy tools. It is also included in (correct me if I'm wrong) all versions of Debian and Ubuntu. To install build-essential, run
$ sudo apt-get update
$ sudo apt-get install build-essential
Once you've done this, you should go onto the applications website and look for a list of compilation dependencies - if it doesn't list any, it's likely the application doesn't require any - many don't. Upon installing (if needed) the dependencies, look for and download the source code. The majority of times, this will be in the form of a .tar.gz (a Gzip'd tar file) or a plain .zip (zip) file. Assuming you've saved it into your downloads, you can run:
$ cd ~/Downloads
$ ls
randomfile.cpp
mysourcefile.tar.gz
$ tar xvfs mysourcefile.tar.gz # For a tar file
$ unzip mysourcefile.zip # For a zip file
Once you've done this, you can look for a folder of the same name using the ls command. Then enter the folder corresponding to the extracted archive.
$ ls
randomfile.cpp
mysourcefile.tar.gz
mysourcefile
$ cd "mysourcefile"
Aha! You're ready to rock and roll. All you have to do now is configure the application using ./configure. Note: some applications do not require this step. They should state if they do not. After that, you can continue by using the main command make. This may take some time, as this is the step that actually compiles your program. Note the -j argument, which allows you to set the amount of threads - this should be set to twice the amount of cores in your system, for best-case performance. If you want to continue using the computer as your program compiles, I suggest you set it to the amount of cores in your system.
$ ./configure
$ make -j 8
If the previous completed with no errors, you're a successful man! Your program is now compiled and is ready to install. From there, run the last and final command sudo make install. Note: this requires root privileges as it is installing into either /usr/bin/ or /usr/local/ (depending on your configuration) .
You can now run the application from terminal (or from your desktop environment)
$ myapplication