class="align-left" style="border: 0px none; margin-left: 20px; margin-top: 5px; float: right;" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/install1.jpg" alt="how to install tar gz" width="150" height="175" />Unlike Windows, installing software in
class="vt-p" href="http://www.makeuseof.com/pages/getting-started-guide-linux">Linux has the potential to be slightly more complicated. Unless your chosen software is already in package form or
class="vt-p" href="http://www.makeuseof.com/tag/repositories-package-management-ubuntu/">resides in a repository and can be installed with a simple line of text, the chances are you’re going to need to compile and install from a .TAR.GZ or .TAR.BZ2 file.
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…
id="more-61739">
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
class="vt-p" href="http://www.makeuseof.com/tag/ubuntu-1010-maverick-meerkat-linux/">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
class="vt-p" href="http://www.makeuseof.com/tag/3-backup-tools/">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
class="vt-p" href="http://www.makeuseof.com/tag/an-introduction-to-the-linux-command-line/">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
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/instalpackages.png" alt="how to install tar gz" width="580" height="332" />
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 /usr/local/src 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
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/apt-file.png" alt="" width="556" height="425" />
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 /usr/local/src). You can do this with your
class="vt-p" href="http://www.makeuseof.com/tag/nautilus-elementary-simplifies-file-browsing-linux/">normal file browser, and once done, open up a new Terminal.
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/tarinsrc.png" alt="" width="580" height="145" />
Change to the build folder by typing:
cd /usr/local/src
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
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/untarpmw.png" alt="" width="568" height="416" />
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>
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/changetopmw.png" alt="install tar gz" width="580" height="65" />
Replace <extracted folder> with the name of the folder the archive created. Next you’ll need to configure the source files by typing:
./configure
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
Then run ./configure again.
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/configure.png" alt="install tar gz" width="568" height="416" />
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 ./configure command again.
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/configuresuccess.png" alt="how to install a tar gz file ubuntu" width="580" height="235" />
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:
make
Sit back, grab a coffee and breathe for a second. Depending on the size of your install this can take a while.
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/make.png" alt="how to install a tar gz file ubuntu" width="580" height="132" />
Now you can install the program with the following command:
sudo checkinstall
Follow the on-screen prompts, add a description for your software and hit Enter on this screen:
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/checkinstall.png" alt="install tar gz" width="568" height="416" />
If everything went well you’ll see Installation Successful. Pat yourself on the back. You’ve done well.
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/youWIN.png" alt="how to install a tar gz file ubuntu" width="568" height="416" />
Your software should now be installed to /usr/local/bin and you’ll be able to run it from there without any problems.
style="text-align: center;">
![]()
class="aligncenter" src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/12/pmwinbin.png" alt="how to install tar gz" width="580" height="176" />
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.
/>
/>
Hey Facebookers, make sure to check out
href="http://www.facebook.com/makeuseof">MakeUseOf page on Facebook. Over 24,000 fans already!
/>
/>
href="http://www.facebook.com/makeuseof">
src="http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2010/04/fbfeedfooter.png" />
href="http://api.tweetmeme.com/share?url=http://www.makeuseof.com/tag/compile-install-tar-gz-tar-bz2-files-ubuntu-linux/">
src="http://api.tweetmeme.com/imagebutton.gif?url=http://www.makeuseof.com/tag/compile-install-tar-gz-tar-bz2-files-ubuntu-linux/">
href="http://digg.com/tools/diggthis/login?url=http://www.makeuseof.com/tag/compile-install-tar-gz-tar-bz2-files-ubuntu-linux/">
src="http://www.makeuseof.com/images/rss-buttons/diggme.png">
href="http://www.facebook.com/sharer.php?u=http://www.makeuseof.com/tag/compile-install-tar-gz-tar-bz2-files-ubuntu-linux/">
src="http://www.makeuseof.com/images/rss-buttons/fb.jpg">
href="http://www.google.com/reader/link?url=http://www.makeuseof.com/tag/compile-install-tar-gz-tar-bz2-files-ubuntu-linux/&title=How To Compile & Install TAR GZ & TAR BZ2 Files In Ubuntu Linux&srcTitle=MakeUseOf.com">
src="http://www.makeuseof.com/images/rss-buttons/gbuzz-feed.png">
href="http://www.stumbleupon.com/submit?url=http://www.makeuseof.com/tag/compile-install-tar-gz-tar-bz2-files-ubuntu-linux/">
src="http://www.makeuseof.com/images/rss-buttons/stumble.png">
Similar MakeUseOf Articles
class="st-related-posts">
href="http://www.makeuseof.com/tag/the-top-3-file-compression-extraction-softwares/" title="The Top 3 File Compression & Extraction Softwares">The Top 3 File Compression & Extraction Softwares (21 comments)
href="http://www.makeuseof.com/tag/quick-free-compressor-extractor-for-zip-files/" title="Quick Zip File Compressor & Extractor (Free WinZip Alternative)">Quick Zip File Compressor & Extractor (Free WinZip Alternative) (24 comments)
href="http://www.makeuseof.com/tag/7zip-a-free-program-to-unzip-and-compress-uncommon-compression-formats/" title="7Zip – A Free Program to Unzip Uncommon Archive Formats">7Zip – A Free Program to Unzip Uncommon Archive Formats (15 comments)
href="http://www.makeuseof.com/tag/repositories-package-management-ubuntu/" title="Your Guide To Ubuntu Repositories and Package Management">Your Guide To Ubuntu Repositories and Package Management (27 comments)
href="http://www.makeuseof.com/tag/versions-ubuntu-technology-explained/" title="Why Are There So Many Versions of Ubuntu? [Technology Explained]">Why Are There So Many Versions of Ubuntu? [Technology Explained] (38 comments)
href="http://www.makeuseof.com/tag/ubuntu-1010-maverick-meerkat-linux/" title="What’s New In Ubuntu 10.10, “Maverick Meerkat”? [Linux]">What’s New In Ubuntu 10.10, “Maverick Meerkat”? [Linux] (41 comments)
href="http://www.makeuseof.com/tag/ubuntu-ppa-technology-explained/" title="What Is An Ubuntu PPA & Why Would I Want To Use One? [Technology Explained]">What Is An Ubuntu PPA & Why Would I Want To Use One? [Technology Explained] (1 comments)
href="http://www.makeuseof.com/tag/unity-modern-lightweight-desktop-ubuntu-linux/" title="Unity – A Modern Lightweight Desktop For Ubuntu [Linux]">Unity – A Modern Lightweight Desktop For Ubuntu [Linux] (12 comments)
href="http://www.makeuseof.com/tag/ubuntus-netbook-edition-unity/" title="Ubuntu’s Netbook Edition: Now With More “Unity”!">Ubuntu’s Netbook Edition: Now With More “Unity”! (24 comments)
href="http://www.makeuseof.com/tag/ubuntu-system-panel-gives-you-quick-access-to-your-applications/" title="Ubuntu System Panel Gives Quick Access To Your Applications">Ubuntu System Panel Gives Quick Access To Your Applications (22 comments)



View full post on MakeUseOf.com