Installing Git on Ubuntu 10.04 Lucid Lynx (Should Work for 10.10 Maverick Meerkat, too)
In my current job one of the most frequent things I do is to setup/install git for the developers which is very much essential tool for them as per our organization’s development architecture. Previously we built a customized deb package and added that to our local debian and ubuntu repository and the “apt-get install -t local git” used to work for us (the Sys. Admins here). But with the updated versions and increased workload on other sectors somehow that process is now obsolete for us. So now we’ve gone back to that sweet old “build from source file” approach. Here’s how I do that stuff for git 1.7.3 🙂
Step 1. Resolve The Dependencies:
$ sudo apt-get install curl libcurl4-openssl-dev libexpat1-dev gettext zlib1g-dev
Step 2. Download, untar and build:
$ wget http://kernel.org/pub/software/scm/git/git-1.7.3.tar.gz
$ tar -zxvf git-1.7.3.tar.gz
$ cd git-1.7.3
$ ./configure –prefix=/usr/local/git
$ make
$ sudo make install
Step 3. Check & Confirm Installation:
$ /usr/local/git/bin/git –version
** Errors You May Find During Installation:
Error Type 1:
* tclsh failed; using unoptimized loading
MSGFMT po/de.msg make[1]: *** [po/de.msg] Error 127
make: *** [all] Error 2
Solution:
$ sudo apt-get install gettext
Error Type 2:
CC fast-import.oIn file included from builtin.h:6,from fast-import.c:147:cache.h:17:18: error: zlib.h: No such file or directoryIn file included from builtin.h:6,from fast-import.c:147:cache.h:22: error: expected ‘)’ before ‘strm’cache.h:23: error: expected ‘)’ before ‘strm’cache.h:24: error: expected ‘)’ before ‘strm’fast-import.c:285: error: ‘Z_DEFAULT_COMPRESSION’ undeclared here (not in a function)fast-import.c: In function ‘store_object’:fast-import.c:996: error: ‘z_stream’ undeclared (first use in this function)fast-import.c:996: error: (Each undeclared identifier is reported only oncefast-import.c:996: error: for each function it appears in.)fast-import.c:996: error: expected ‘;’ before ‘s’fast-import.c:1028: error: ‘s’ undeclared (first use in this function)fast-import.c:1039: error: ‘Z_FINISH’ undeclared (first use in this function)fast-import.c:1039: error: ‘Z_OK’ undeclared (first use in this function)fast-import.c: In function ‘stream_blob’:fast-import.c:1142: error: ‘z_stream’ undeclared (first use in this function)fast-import.c:1142: error: expected ‘;’ before ‘s’fast-import.c:1143: error: ‘Z_OK’ undeclared (first use in this function)fast-import.c:1165: error: ‘s’ undeclared (first use in this function)fast-import.c:1175: error: ‘Z_STREAM_END’ undeclared (first use in this function)fast-import.c:1188: error: ‘Z_FINISH’ undeclared (first use in this function)fast-import.c:1200: error: ‘Z_BUF_ERROR’ undeclared (first use in this function)fast-import.c: In function ‘git_pack_config’:fast-import.c:2846: error: ‘Z_BEST_COMPRESSION’ undeclared (first use in this function)make: *** [fast-import.o] Error 1CC fast-import.oIn file included from builtin.h:6,from fast-import.c:147:cache.h:17:18: error: zlib.h: No such file or directoryIn file included from builtin.h:6,from fast-import.c:147:cache.h:22: error: expected ‘)’ before ‘strm’cache.h:23: error: expected ‘)’ before ‘strm’cache.h:24: error: expected ‘)’ before ‘strm’fast-import.c:285: error: ‘Z_DEFAULT_COMPRESSION’ undeclared here (not in a function)fast-import.c: In function ‘store_object’:fast-import.c:996: error: ‘z_stream’ undeclared (first use in this function)fast-import.c:996: error: (Each undeclared identifier is reported only oncefast-import.c:996: error: for each function it appears in.)fast-import.c:996: error: expected ‘;’ before ‘s’fast-import.c:1028: error: ‘s’ undeclared (first use in this function)fast-import.c:1039: error: ‘Z_FINISH’ undeclared (first use in this function)fast-import.c:1039: error: ‘Z_OK’ undeclared (first use in this function)fast-import.c: In function ‘stream_blob’:fast-import.c:1142: error: ‘z_stream’ undeclared (first use in this function)fast-import.c:1142: error: expected ‘;’ before ‘s’fast-import.c:1143: error: ‘Z_OK’ undeclared (first use in this function)fast-import.c:1165: error: ‘s’ undeclared (first use in this function)fast-import.c:1175: error: ‘Z_STREAM_END’ undeclared (first use in this function)fast-import.c:1188: error: ‘Z_FINISH’ undeclared (first use in this function)fast-import.c:1200: error: ‘Z_BUF_ERROR’ undeclared (first use in this function)fast-import.c: In function ‘git_pack_config’:fast-import.c:2846: error: ‘Z_BEST_COMPRESSION’ undeclared (first use in this function)make: *** [fast-import.o] Error 1
Solution:
$ sudo apt-get install zlib1g-dev
Now that should do for your Git installation 🙂