This can be a nightmare, but if you stick to the rules it shouldn’t be. If you’ve got a pesky archive that needs installing, the following method will create a package, install said package and provide a nice clean way to remove the software afterwards via your package manager. Command lines at the ready, deep breath please…
Tarballs Of Steel
A .TAR.GZ/BZ2 file is a compressed tarball (the uncompressed extension being .TAR) which contains the raw source code for your chosen application. Installation requires these files to be compiled, processed and linked in a way that Ubuntu can then execute the program.
The tarball format was standardised in 1988 (and again in 2001) and continues to be widely used on both Linux and Windows for the distribution of software. Originally tarballs were designed to facilitate the backup of data onto tape devices, not that you’ll be doing that.
If you’ve not used the Linux command line before there’s no need to worry, the commands are straight-forward and cohesive. We also have an article that should get you up to speed with the Linux command line which will probably help you out if you’re going to be spending a lot of time there.
Preparing Your System
You’ll need to install a package called build-essential for creating the package from source and checkinstall to add it to your package manager for easy removal. This can be done quickly via the console, simply open up Terminal (Applications, Accessories, Terminal) and type:
sudo apt-get install build-essential checkinstall
Allow time for these to download and install, and once done you may also want to install version management software for upgrades, though you can always do this later. In any case, these three will do the trick:
sudo apt-get install subversion git-core mercurial
Next you’ll want a common directory to use when building these packages. You can technically put this anywhere, as long as it is writeable. The official Ubuntu documentation recommends
so we’ll stick with that:
sudo chown $USER /usr/local/src
Then make sure it’s writeable:
sudo chmod u+rwx /usr/local/src
Finally we’ll also install apt-file, which is used to resolve any dependency issues you encounter:
sudo apt-get install apt-file
You’ll probably get a pop-up telling you need to update apt-file, if not run the following command and let it finish:
sudo apt-file update
Once you’ve done this, you’ll never need to do it again as your system will be prepared for any tarballs you throw at it.
Extract & Configure
Assuming you’ve already downloaded a mysterious .TAR.GZ file you’re first going to need to move it to your designated build folder (I used
). You can do this with your normal file browser, and once done, open up a new Terminal.
Change to the build folder by typing:
Next extract the archive. For .TAR.GZ files type:
tar -xzvf <filename>.tar.gz
And for .TAR.BZ2 files type:
tar -xjvf <filename>.tar.bz2
If all went well you’ll see a long list of extracted files, like in the screenshot above. Don’t close the Terminal yet, we’re not done.
It is at this point I urge you to navigate to the folder your archive just created (with your usual file browser) and open either README or INSTALL should the files exist. If your particular software requires a different method to the one I’m about to go into then this file will hold the key. You can save yourself a lot of hassle by doing this.
You may also be able to choose different install options depending on the software, and the INSTALL or README will stipulate what these are. The files may have no extension, but are plain text and should open in Gedit or any text editor you choose.
As a general rule, the following commands will install your software with the default installation method.
Your tarball will have been extracted to a folder with the same name as the file, so change to this folder with the cd command you used earlier, like so:
cd /usr/local/src/<extracted folder>
Replace <extracted folder> with the name of the folder the archive created. Next you’ll need to configure the source files by typing:
Note: If your software does not have a configure file, you might want to try skipping straight to the Build & Install section of this article, though consult your INSTALL or README documentation first.
If you receive an error message related to autoconf, then you’ll need to install it by typing:
sudo apt-get install autoconf
This command will verify whether you have all the installed packages required to use your software. You can use apt-file which you installed earlier to fill in the blanks.
If you do receive an error (something like
configure: error: Library requirements ... not met
) have a look for the file not found above the error message, then using apt-file search by typing:
apt-file search <filename>.<extension>
This will tell you which package the file you require is in, so you can download it using:
sudo apt-get install <package>
This won’t necessarily always happen, but it is very useful if you don’t have the required dependencies.
When you’re satisfied you’ve got the packages (if you needed any) run the
If all went well you’ll see
config.status: creating Makefile
““ congratulations, you’re very nearly there! Lots of people give up before they get to this point, but you’re better than that.
Build & Install
Into the same Terminal window type:
Sit back, grab a coffee and breathe for a second. Depending on the size of your install this can take a while.
Now you can install the program with the following command:
Follow the on-screen prompts, add a description for your software and hit Enter on this screen:
If everything went well you’ll see Installation Successful. Pat yourself on the back. You’ve done well.
Your software should now be installed to
and you’ll be able to run it from there without any problems.
Did you make it all the way through? Isn’t it easier just waiting for a package or getting it from the repositories? Maybe you found it… easy? Let us know in the comments.
More articles about: