1

As a non-root user, I want to install git (version = 2.38.1-1) on a shared host CentOS 7 server because the original version of git on the host is too old. I tried to use the method in this answer to install git from the file git-2.38.1-1.ep7.x86_64.rpm.

  1. I use wget command to download file git-2.38.1-1.ep7.x86_64.rpm on the host.
  2. I use command rpm -ivh git-2.38.1-1.ep7.x86_64.rpm to check whether some dependencies are lack. The output is as follow.
    warning: git-2.38.1-1.ep7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 703df089: NOKEY
    error: Failed dependencies:
        git-core = 2.38.1-1.ep7 is needed by git-2.38.1-1.ep7.x86_64
        git-core-doc = 2.38.1-1.ep7 is needed by git-2.38.1-1.ep7.x86_64
        perl-Git = 2.38.1-1.ep7 is needed by git-2.38.1-1.ep7.x86_64
    
    And I download git-core-2.38.1-1.ep7.x86_64.rpm,git-core-doc-2.38.1-1.ep7.noarch.rpm, and perl-Git-2.38.1-1.ep7.noarch.rpm respectively.
  3. And I also use rpm -ivh package_name to check some lack dependencies. However, the output for perl-Git-2.38.1-1.ep7.noarch.rpm is
    git = 2.38.1-1.ep7 is needed by perl-Git-2.38.1-1.ep7.noarch
    
    It is impossible for me to install perl-Git under the lack of git.

Are there any mistakes during my installation process? Is there any convenient method to intall some softwares for non-root users on the shared host?

AdminBee
  • 22,803
echo
  • 31
  • 1
    Download the sources, make configure && ./configure --prefix=$HOME/mygit && make -j && make install. You do not need RPMs. Later on, export PREFIX=$HOME/mygit/bin:$PREFIX – Artem S. Tashkinov Jan 17 '23 at 10:54
  • Thank you for your reply. Before trying to install git rpm package, I have installed git using sources code. However, after installation, when I run the command git clone https://github.com/kaldi-asr/kaldi.git, the output is git: 'remote-https' is not a git command. See 'git --help'.. https://stackoverflow.com/questions/51366101/git-remote-https-is-not-a-git-command might be a solution for my error. But when I run curl --version, output curl 7.84.0 (x86_64-conda-linux-gnu) libcurl/7.84.0 OpenSSL/1.1.1q zlib/1.2.12 libssh2/1.10.0 nghttp2/1.46.0 indicates libcurl has been installed. – echo Jan 17 '23 at 11:24
  • RPMs are meant to be installed by the root user into system wide locations. Your question states you want to install git as a non-root user. I absolutely don't understand your comment and I want to stop wasting my time and nerve cells. – Artem S. Tashkinov Jan 17 '23 at 12:28
  • You need to extend your path with path to your local git install so it can find it's helper utilities ie PATH="$PATH:/path/to/local/git". – etosan Jan 26 '23 at 13:24
  • Also instead of mucking around with this crap, you don't understand, you should ask machine administrator to install the git for you - that's proper solution to you problem. – etosan Jan 26 '23 at 13:26

2 Answers2

2

As for the foreground problem:

  1. You can't install an RPM package without root privileges, even if you have downloaded the RPM file.
  2. Even so, if you want to manually install two RPM packages, where one of them will provide a not yet fulfilled dependency of the other, you have to state both as arguments to rpm so that this is correctly handled.

So, you will need to install the software "from source".

In a comment, you stated that you did, but received an error about missing HTTPS support. The likely reason is that the development headers of libcurl so that the Git plugin git-remote-http plugin can be built. See this issue on GitHub that deals with the problem. However, this implies having to install libcurl-devel - which again would require root privileges.

Further reading (which unfortunately confirms that you have to go the manual way):

AdminBee
  • 22,803
0

I have try my best to install git from rpm package or source code. But these two methods failed. I used an alternative way to install git on my centos machine without root priviledge successfully.

  1. install anaconda
  2. run the command in terminal: conda install -c anaconda git

Then git is installed successfully.

echo
  • 31
  • Just so you know, installing unapprowed binaries might be breach of security or breach of usage contract in some environments, so would you be so kind to explain why contacting the machine owner/maintainer was not an option? – etosan Jan 27 '23 at 17:54
  • Thanks for your reply. Contacting IT office may be a good option. But I have installed git successfully using conda before I read your suggestion. So I don't try to contact them. – echo Jan 28 '23 at 04:46