Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install git with linux source code

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to install linux source code git, I hope you will learn something after reading this article, let's discuss it together!

Linux source code installation git method: 1, download git source code upload to the Linux server; 2, log in to the target machine, decompress and install; 3, install "gcc gcc-c++"; 4, execute the git installation command.

This article operating environment: linux5.9.8 system, git version 2.9.5, Dell G3 computer.

Linux installation git/ source code installation:

Git installation

Instead of recording the Windows/Mac OS system here, download the corresponding installer directly and install it step by step.

Linux installation

Log in to https://git-scm.com/download/linux

Source code installation

1. Download the source code

You can download the source code from another computer and upload it to the Linux server

Https://mirrors.edge.kernel.org/pub/software/scm/git/

Find the corresponding version.

two。 Upload to the server

Take git-2.9.5.tar.gz as an example, upload the downloaded file to the server.

Scp git-2.9.5.tar.gz root@192.168.0.102:/home/tools

User of scp git-2.9.5.tar.gz target machine @ target machine ip: target machine path

3. Extract and install

Log in to the target machine, extract and install. / home/Git refers to the installation directory

Tar-zxvf git-manpages-2.9.5.tar.gzcd git-2.9.5 [root@localhost git-2.9.5] #. / configure-- prefix=/home/Git [root@localhost git-2.9.5] # make & & make install4. . / configure reported an error [root@localhost git-2.9.5] # / configure-- prefix=/home/Gitconfigure: Setting lib to 'lib' (the default) configure: Will try-pthread then-lpthread to enable POSIX Threads.configure: CHECKS for site configurationchecking for gcc... Nochecking for cc... Nochecking for cl.exe... Noconfigure: error: in `/ home/tools/git-2.9.5':configure: error: no acceptable C compiler found in $PATHSee `config.log' for more details

I can see that gcc,cc,cl.exe is no when my linux server executes an error. Gcc is the c language compiler of Linux, which means that these compilers are not installed on my machine.

After installing the following gcc,gcc-c++, successfully, execute the installation command of git

[root@localhost git-2.9.5] # yum install gcc [root@localhost git-2.9.5] # yum install gcc-c++ [root@localhost git-2.9.5] #. / configure-- prefix=/home/Git

5. Make command reports an error

[root@localhost git-2.9.5] # make & & make install * new build flags CC credential-store.oIn file included from credential-store.c:1:0:cache.h:40:18: fatal error: zlib.h: no file or directory # include ^

The compilation is interrupted.

Make: * * [credential-store.o] error 1

The header file of zlib is missing and the development package is not installed. Install zlib

[root@localhost git-2.9.5] # yum install zlib [root@localhost git-2.9.5] # yum install zlib-devel [root@localhost git-2.9.5] # yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker [root@localhost git-2.9.5] # make & & make install

If no error is reported, the installation is successful.

6. Check whether the git installation is complete

Enter the previously specified installation directory to view the git version. A successful git installation is complete.

[root@localhost bin] # cd / home/Git/bin [root@localhost bin] #. / git-- versiongit version 2.9.5

7. Configure environment variables

Vi / etc/profile

Edit the environment variable configuration file and append the following string at the end to specify the address of the bin directory

Export PATH=$PATH://home/Git/bin

After the modification is completed, execute the command and take effect of the configuration file

Source / etc/profile

To check whether the configuration is successful, you can change the path to another directory and execute git-- version. Returning the git version indicates that the configuration of the environment variable is complete.

After reading this article, I believe you have a certain understanding of "linux source code how to install git". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report