March 10, 2008

Installing Git on Ubuntu

I watched Scott’s great screencast on Git and figured I should make use of the old server that I have sitting around. Unfortunately, my install didn’t go as smoothly as Scott’s, mostly because the Ubuntu server edition has a few less libraries than the developer edition. So to make things a little smoother for others here are the libraries that I had to install.

sudo apt-get install build-essential tcl8.4 tk8.4 gettext
1 # expat
2 wget http://superb-west.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz
3 tar zxfv expat-2.0.1.tar.gz
4 cd expat-2.0.1
5 ./configure
6 make
7 make install
1 # curl
2 wget http://curl.linux-mirror.org/download/curl-7.18.0.tar.gz
3 tar zxfv curl-7.18.0.tar.gz
4 cd curl-7.18.0/
5 ./configure
6 make prefix=/usr all
7 make prefix=/usr all install
1 # zlib
2 wget http://www.zlib.net/zlib-1.2.3.tar.gz
3 tar -xzvf zlib-1.2.3.tar.gz
4 cd zlib-1.2.3/
5 ./configure
6 make
7 sudo make install
1 # openssl
2 wget http://www.openssl.org/source/openssl-0.9.8c.tar.gz
3 tar -xzvf openssl-0.9.8c.tar.gz
4 cd openssl-0.9.8c/
5 ./config --prefix=/usr/local/ssl-0.9.8c shared zlib-dynamic enable-camellia
6 make depend
7 make
8 sudo make install

Now you should be able to install git

1 # git
2 wget http://kernel.org/pub/software/scm/git/git-1.5.4.4.tar.gz
3 tar -xzvf git-1.5.4.4.tar.gz
4 cd git-1.5.4.4/
5 make MOZILLA_SHA1=1 prefix=/usr all
6 sudo make MOZILLA_SHA1=1 prefix=/usr install

The steps above may not be perfect as I posted them after retracing my steps after a successful install. My fingers are crossed.

Hopefully this saves someone a little time.

Previous Comments

  1. Sascha Konietzke Wed, 02 Apr 2008 12:12:12 MDT

    Thanks for the instructions. I found a typo. You are missing a dash on the openssl configure. Should be –prefix instead of -prefix.

  2. Sascha Konietzke Wed, 02 Apr 2008 12:13:24 MDT

    Wordpress seems to remove the double dash out of the comment. Should be double dash in front of prefix.

  3. Andrew Lenards Sat, 05 Apr 2008 20:30:38 MDT

    Thanks – only thing that I had to change was a `sudo make install` for expat. (it’s seems FF has the desired OpenSSL version so I didn’t need to install that) Seriously, I’d say it was perfect! I really appreciate the install guidelines. Thanks Chris

  4. Andrew Lenards Sat, 05 Apr 2008 20:33:33 MDT

    hehe just realized you’re configuring open-ssl with zlib/etc – so I went ahead and did that. Sasha – I believe it’s a long-dash in the post, which is how wordpress (and other word processing apps) will infer double dash. It’s sort of annoying until you see it a few times.

    Thanks again Chris!

  5. chris olsen Sun, 06 Apr 2008 22:09:58 MDT

    Sorry about the double dash issue. I will look for a way around this for later posts.

    Glad to see it has helped someone else out.

  6. Chris Bailey Fri, 25 Apr 2008 00:23:35 MDT

    Thanks for this, worked great!

  7. Cássio Marques Tue, 03 Jun 2008 05:00:47 MDT

    Thanks, installed it in Hardy Heron and everything works fine!

  8. Anlek Thu, 19 Jun 2008 20:16:31 MDT

    Thanks, these instructions really helped me lots!

  9. Kyle Cordes Tue, 08 Jul 2008 07:35:40 MDT

    Even if you compile git from source (to get the latest), it is still wise to install as many of those other libraries as possible using “apt-get install ___”. This is faster, easier, will get future upgrades to the libraries automatically, and will make them available to other packages that need them.

  10. Falk Pauser Wed, 09 Jul 2008 09:11:38 MDT

    It’s also a good idea to use checkinstall for installing git from source. This creates a ubuntu-package (deb) which can be easily removed from your system.

  11. Alex Sharp Wed, 09 Jul 2008 13:01:25 MDT

    Chris, thanks so much for the great post! Just a thought: you might want to update this post to include installing the git documentation. Thanks again!

  12. Andrew Thu, 21 Aug 2008 10:24:41 MDT

    If you want to include the manpages, you just need to do:

    apt-get install asciidoc xmlto

    then you can do:

    make MOZILLA_SHA1=1 prefix=/usr all doc
    sudo make MOZILLA_SHA1=1 prefix=/usr install install-doc

    It’s a real help to have the manpages around – I’ve found

  13. Charles Foster Thu, 04 Sep 2008 09:09:29 MDT

    Works great, no problems, thanks very much for sharing this.

  14. Arvind Gupta Sat, 06 Sep 2008 23:06:14 MDT

    Thankyou chris . Your tutorial helped a lot.

  15. Jake Causier Fri, 02 Jan 2009 07:18:03 MST

    Everything works, except when i attempt:
    “tar zxfv expat-2.0.1.tar.gz”
    it dosn’t recoginse it in GZIP format, although it clearly is, so it dosn’t allow me to continue.

    Any help?

  16. Stephan Wehner Sat, 10 Jan 2009 04:33:30 MST

    Following your instructions, managed to install git on AMD-64 / Ubuntu 7.10 / hardy
    with newer git version

    http://kernel.org/pub/software/scm/git/git-1.6.1.tar.gz

    Thanks!

    Stephan

  17. otto Fri, 16 Jan 2009 00:00:55 MST

    Jake Causier writes:
    >“tar zxfv expat-2.0.1.tar.gz” it dosn’t recoginse…

    Jake,

    Try ‘man tar’ as a first pass.
    tar(1) requires certain first arguments, x for extract being one of them. The z is not a valid first argument. Scroll up and look, Chris had it right, you mis-typed.

    ..Otto

  18. scaught Wed, 21 Jan 2009 19:31:55 MST

    otto writes:
    > tar(1) requires certain first arguments, x for extract being one of them.
    > The z is not a valid first argument.

    otto,

    Try actually running “tar” as a first pass.
    tar(1) does not insist on any order whatsoever, x for extract included. The z is a perfectly valid first argument, last argument, or some argument in the middle. Heck, even moving the “f” amongst the rest of the arguments does not matter. Scroll up and look, Jake had it right, you mis-replied.

    It’s more likely Jake had a corrupted download.

    ..scott, using tar (GNU tar) 1.19

  19. Constantin Mon, 01 Jun 2009 10:17:24 MDT

    Great thanks for the instructions! I wonder how you found all those deps!
    Just installed git-1.6.3.1 on Ubuntu 8.10.
    A little correction is needed for your tutorial, – must run “./configure” before making Git.

  20. ARVIND gUPTA Wed, 03 Jun 2009 04:26:07 MDT

    WORKED ON JAUNTY also.