Skip to content

Install Git without root

Install Git without root published on No Comments on Install Git without root

The old git version on workstation can not satisfy me. It is not convenient to used, and cannot push to GitHub. Then I want to install Git from source code. This really killing me. Here are some experience.

There are a lot of articles online to show that compile git from source code, as long as you can "sudo apt-get install ****(a lot of libraries)". This is ridiculous. If I can use sudo, why not directly install it from repository?

Here are some ideas about what we need to install. http://www.angularjs.cn/A0HC. However, the author use brew, which needs ruby to install. I don't know how to install ruby without root. However, this is an elegant idea to do this work, and can be referred if possible. The linuxbrew can be found at: http://linuxbrew.sh/. Besides, it seems that it requires curl supporting https, which is exactly the problem I will talk about next.

Install Git is not big. However, it depends several libraries. During the installation, it requires something like xmlto, asciidoc, etc. Just download and compile them, not big deal. Then we can

$ ./make configure
$ ./configure --prefix=$HOME/git
$ make & make install

Seems wonderful. It can be used without problem locally. However, when I want to push or clone from repository, it shows:
fatal: Unable to find remote helper for 'https'

After searching on the internet, it seems that this is caused by curl. We need to install the curl.

So, download and install as usual. It works, but without https support, when git push/pull, we have error

fatal: unable to access 'https://***@bitbucket.org/***/***': Protocol "https" not supported or disabled in libcurl

In order to configure curl with hppts, t seems we need libssh2

./configure --prefix=$HOME/curl --with-libssh2

Still cannot, there is no libssh2, so we download libssh2. Still cannot, since we need gnu-crypto, so download, it requires javac. There is no javac...... I want to stop. I think there is way to compile libssh2 with system crypto, but I have no time to try.

Do it another way. I found that there is also curl in anaconda package, so we can try to compile Git it like this (http://www.cnblogs.com/wowarsenal/p/4319002.html)

$ ./make configure
$ ./configure --prefix=$HOME/git --with-curl=$HOME/anaconda
$ make & make install

Configure without problem. However, when running, it shows:
git: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory

Obviously we still need this crypto library. Try this in the system lib, we can find a /usr/lib64/libcrypt.so. So here's a tricky,

$ mkdir -p $HOME/usr/lib
$ ln -s /usr/lib64/libcrypt.so libcrypto.so.1.0.0

Then add $HOME/usr/lib to LD_LIBRARY_DIR

Anyway, it works. So stop now.

 

PS:
1. There is still problem in the config.log
ac_cv_lib_curl_Curl_ssl_init=no
/usr/bin/ld: cannot find -lexpat ( it seems this is required, http://stackoverflow.com/questions/8329485/git-clone-fatal-unable-to-find-remote-helper-for-https)

2. make install will exit error, don't know why

3. make doc will have problem

New update on configure deal.ii with trilinos

New update on configure deal.ii with trilinos published on 1 Comment on New update on configure deal.ii with trilinos

Since mpi environment is essential and all package require the same mpi environment, it is better to separate the MPICH into the home folder, not downloaded with petsc. Here is some refined procedures

1,2,3,4. The same as "Tips on setting up deal.ii and petsc"

5. Download and install mpich-3.2.    https://www.mpich.org/. Setup environment variable,

$ export PATH=$PATH:HOME/mpich-3.2/bin

6. Download and install petsc, as in https://www.dealii.org/developer/external-libs/petsc.html. It should be noted that "--download-hypre=1" is required for deal.ii 8.4.0 and later, otherwise there  is error "undefined reference to `PCHYPRESetType' " when compiling program. MPI environment needs to be assigned. However, blas and lapack can be downloaded, since not all softwares require the same blas&lapack. Here is a configuration

./config/configure.py PETSC_ARCH=arch-linux-release \
--with-shared=1 --with-x=0 --with-mpi=1 --download-hypre=1 --with-debugging=0 \
--with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90 --download-fblaslapack
(or specify --with-blas-lapack-dir=$MYHOME/fblaslapack-3.4.2)

7. Download and install METIS, P4EST, OpenBLAS as before

8. Download and install trilinos using:

cmake \
-D Trilinos_ENABLE_Sacado=ON \
-D Trilinos_ENABLE_MueLu:BOOL=ON \
-D Trilinos_ENABLE_Anasazi:BOOL=ON \
-D Trilinos_ENABLE_Epetra:BOOL=ON \
-D Trilinos_ENABLE_EpetraExt:BOOL=ON \
-D Trilinos_ENABLE_Triutils:BOOL=ON \
-D Trilinos_ENABLE_Belos:BOOL=ON \
-D Trilinos_ENABLE_Ifpack:BOOL=ON \
-D Trilinos_ENABLE_TESTS:BOOL=ON \
-D Trilinos_ENABLE_Stratimikos=ON \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_CXX_FLAGS="-g -O3" \
-D CMAKE_C_FLAGS="-g -O3" \
-D CMAKE_FORTRAN_FLAGS="-g -O5" \
-D Trilinos_EXTRA_LINK_FLAGS="-lgfortran -pthread" \
-D CMAKE_VERBOSE_MAKEFILE=ON \
-D Trilinos_VERBOSE_CONFIGURE=OFF \
-D TPL_ENABLE_MPI=ON \
-D MPI_BASE_DIR=$MYHOME/mpich-3.2/bin \
-D BUILD_SHARED_LIBS=ON \
\
-D TPL_ENABLE_BLAS:BOOL=ON \
-D BLAS_INCLUDE_DIRS=$MYHOME/OpenBLAS-0.2.15/include \
-D BLAS_LIBRARY_DIRS=$MYHOME/OpenBLAS-0.2.15/lib \
-D BLAS_LIBRARY_NAMES:STRING="libopenblas.a" \
-D TPL_ENABLE_LAPACK=ON \
-D LAPACK_INCLUDE_DIRS=$MYHOME/OpenBLAS-0.2.15/include \
-D LAPACK_LIBRARY_DIRS=$MYHOME/OpenBLAS-0.2.15/lib \
-D LAPACK_LIBRARY_NAMES:STRING="libopenblas.a" \
\
-D CMAKE_INSTALL_PREFIX:PATH=$MYHOME/trilinos-11.14.3 \
../

9. If we want to use UMFPACK compiled by ourselves (not significant speed change), download it from http://faculty.cse.tamu.edu/davis/suitesparse.html, unzip to the home folder. It requires blas&lapack, we can use OpenBLAS.
Add "$MYHOME/OpenBLAS-0.2.15/lib" to LD_LIBRARY_PATH, and LIBRARY_PATH environment variable$ make install BLAS=-lopenblas LAPACK=-lopenblas
Since SparseSuite needs to be found by dynamics link at runtime, we need to add $MYHOME/SparseSuite/lib to LD_LIBRARY_PATH

10. Download deal.II 8.4.0 and install (Be careful only deal.II 8.3.0 comes with meshconvert)

cmake \
-DCMAKE_C_COMPILER="mpicc" -DCMAKE_CXX_COMPILER="mpicxx" -DCMAKE_Fortran_COMPILER="mpif90" \
-DCMAKE_INSTALL_PREFIX=$MYHOME/dealii-8.4.0 \
-DDEAL_II_WITH_METIS=ON -DMETIS_DIR=$MYHOME/metis-5.1.0 \
-DDEAL_II_WITH_P4EST=ON -DP4EST_DIR=$MYHOME/p4est-1.1 \
-DDEAL_II_WITH_TRILINOS=ON -DTRILINOS_DIR=$MYHOME/trilinos-11.14.3 \
(-DUMFPACK_DIR=$MYHOME/SuiteSparse -DDEAL_II_COMPONENT_PARAMETER_GUI=ON ) ../