在RedHat上使用非root用户帐户安装Git

时间:2018-02-15 20:31:45

标签: git install

我试图在没有root的情况下在RedHat上安装git。安装失败,因为它无法找到zlib.h

我找到this,建议安装anaconda,因为它会删除所有依赖项(包括zlib.h,现在位于/home/foo/anaconda2/include/zlib.h)

我跑了

./configure --prefix=/home/foo

因为我希望它安装在/ home / foo / bin中,但我仍然得到

    CC credential-store.o
In file included from credential-store.c:1:
cache.h:40:18: warning: zlib.h: No such file or directory
In file included from credential-store.c:1:
cache.h:42: error: expected specifier-qualifier-list before ‘z_stream’
make: *** [credential-store.o] Error 1

如何告诉它找到zlib.h,并将所有内容安装在/ home / foo / bin中?

所以,感谢下面的评论,我试过了:

export PERL5LIB=/home/foo/share/perl5

wget http://search.cpan.org/CPAN/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.30.tar.gz
tar xzf ExtUtils-MakeMaker-7.30.tar.gz 
cd ExtUtils-MakeMaker-7.30
perl Makefile.PL PREFIX=/home/foo
make PREFIX=/home/foo
make install PREFIX=/home/foo

wget http://search.cpan.org/CPAN/authors/id/J/JK/JKEENAN/ExtUtils-ModuleMaker-0.56.tar.gz
tar -xzf ExtUtils-ModuleMaker-0.56.tar.gz 
cd ExtUtils-ModuleMaker-0.56
perl Makefile.PL PREFIX=/home/foo
make PREFIX=/home/foo
make install PREFIX=/home/foo

CFLAGS="-m64" CPPFLAGS="-I /home/foo/anaconda2/include" LDFLAGS="-L /home/foo/anaconda2/lib" ./configure --prefix=/home/foo
make all doc info

让我更接近:

    SUBDIR perl
/usr/bin/perl Makefile.PL PREFIX='/home/foo' INSTALL_BASE='' --localedir='/home/foo/share/locale'
Generating a Unix-style perl.mak
Writing perl.mak for Git
Writing MYMETA.yml and MYMETA.json
    * new perl-specific parameters
    ...
    * new Python interpreter location
    ..
    LINK git
    BUILTIN git-add
    ...
    SUBDIR git-gui
GITGUI_VERSION = 0.20.GITGUI
    * new locations or Tcl/Tk interpreter
    ...
    SUBDIR gitk-git
    * new Tcl/Tk interpreter location
    GEN gitk-wish
    ...
    SUBDIR perl
    ...
Manifying 9 pod documents
    SUBDIR templates
    MSGFMT po/build/locale/bg/LC_MESSAGES/git.mo
/bin/sh: msgfmt: command not found
make: *** [po/build/locale/bg/LC_MESSAGES/git.mo] Error 127

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

构建git w / o root的解决方案:

安装Anaconda(在本例中为/ home / foo / anaconda2 /)

安装所需的perl

export PERL5LIB=/home/foo/share/perl5

wget http://search.cpan.org/CPAN/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.30.tar.gz
tar xzf ExtUtils-MakeMaker-7.30.tar.gz 
cd ExtUtils-MakeMaker-7.30
perl Makefile.PL PREFIX=/home/foo
make PREFIX=/home/foo
make install PREFIX=/home/foo

wget http://search.cpan.org/CPAN/authors/id/J/JK/JKEENAN/ExtUtils-ModuleMaker-0.56.tar.gz
tar -xzf ExtUtils-ModuleMaker-0.56.tar.gz 
cd ExtUtils-ModuleMaker-0.56
perl Makefile.PL PREFIX=/home/foo
make PREFIX=/home/foo
make install PREFIX=/home/foo

下载git。提取并切换到目录

make configure
CFLAGS="-m64" CPPFLAGS="-I /home/foo/anaconda2/include" LDFLAGS="-L/home/foo/anaconda2/lib" ./configure --prefix=/home/foo
make NO_GETTEXT=1 all 
make install NO_GETTEXT=1 all 

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/foo/anaconda2/lib

我本来也想编译doc和info,但是我得到了一些我无法立即解决的错误,我现在需要实际使用git。

相关问题