Solution to failure to install git on centos:
1. Uninstall the old version of git
yum remove git
2. Download the compressed package and unzip it
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz
tar -zxvf git-2.9.0.tar.gz
3. Install some dependency packages needed for git installation
If you unzip If you install git directly after that, you may encounter many problems (I did this at the beginning), most of which are caused by the lack of certain necessary packages during installation. git relies on zlib-devel, openssl-devel
,
perl
, cpio, expat-devel, gettext-devel
these packages, so make sure you have these packages before installing git. The following are the missing packages Errors that may occur and their solutions
1. Error one:
usr/bin/perl Makefile.PL PREFIX=’/usr/local/git’ INSTALL_BASE=’’ --localedir=’/usr/local/git/share/locale’ Can’t locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3. BEGIN failed–compilation aborted at Makefile.PL line 3. make[1]: *** [perl.mak] Error 2 make: *** [perl/perl.mak] Error 2
Solution:
yum install perl-ExtUtils-MakeMaker package yum -y install perl-devel perl-CPAN
2.Error two:
/bin/sh: msgfmt: command not found
Solution:
yum install gettext-devel
3. Error three:
tclsh failed; using unoptimized loading MSGFMT po/bg.msg make[1]: *** [po/bg.msg] 错误 127
Solution:
yum install tcl build-essential tk gettext
4. Install git
Check if there are some necessary packages in the three steps After solving the problem, you can install git (under normal circumstances, after solving the three-step common problems, the following command will not report an error. If there are still errors, please solve it according to the error Baidu)
cd git-2.9.0 ./configure --prefix=/usr/local/git make make install
5. When checking the git version, bash appears: git:command not found
bash:git:command not found
appears when git --version, and Enter the installation directory /usr/local/git/bin
, execute ./git --version
is git version 2.9.0
, it can be seen that our git is installed Successfully, if you want to use the git command in a non-installation directory, the solution is as follows:
Open /etc/profile
, find the line path manipulation
, below Add the pathmunge
command path in if then
(for example: pathmunge /usr/loccl/git/bin
). Then execute source /etc/profile
, and execute git --version again. The execution will be successful, and the git version number will be displayed.
6. Using https to operate git appears: fatal: Unable to find remote helper for 'https'
Solution:
yum install -y curl curl-devel
7. git clone reports SSL connect error
Solution:
yum update -y nss curl libcurl
Recommended tutorial: "centos tutorial"
The above is the detailed content of What should I do if the installation of git on centos fails?. For more information, please follow other related articles on the PHP Chinese website!

CentOS is a stable, enterprise-grade Linux distribution suitable for server and enterprise environments. 1) It is based on RedHatEnterpriseLinux and provides a free, open source and compatible operating system. 2) CentOS uses the Yum package management system to simplify software installation and updates. 3) Support advanced automation management, such as using Ansible. 4) Common errors include package dependency and service startup issues, which can be solved through log files. 5) Performance optimization suggestions include the use of lightweight software, regular cleaning of the system and optimization of kernel parameters.

Alternatives to CentOS include RockyLinux, AlmaLinux, OracleLinux, and SLES. 1) RockyLinux and AlmaLinux provide RHEL-compatible binary packages and long-term support. 2) OracleLinux provides enterprise-level support and Ksplice technology. 3) SLES provides long-term support and stability, but commercial licensing may increase costs.

Alternatives to CentOS include UbuntuServer, Debian, Fedora, RockyLinux, and AlmaLinux. 1) UbuntuServer is suitable for basic operations, such as updating software packages and configuring the network. 2) Debian is suitable for advanced usage, such as using LXC to manage containers. 3) RockyLinux can optimize performance by adjusting kernel parameters.

The CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.

The key differences between CentOS and Ubuntu are: origin (CentOS originates from Red Hat, for enterprises; Ubuntu originates from Debian, for individuals), package management (CentOS uses yum, focusing on stability; Ubuntu uses apt, for high update frequency), support cycle (CentOS provides 10 years of support, Ubuntu provides 5 years of LTS support), community support (CentOS focuses on stability, Ubuntu provides a wide range of tutorials and documents), uses (CentOS is biased towards servers, Ubuntu is suitable for servers and desktops), other differences include installation simplicity (CentOS is thin)

Steps to configure IP address in CentOS: View the current network configuration: ip addr Edit the network configuration file: sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0 Change IP address: Edit IPADDR= Line changes the subnet mask and gateway (optional): Edit NETMASK= and GATEWAY= Lines Restart the network service: sudo systemctl restart network verification IP address: ip addr

CentOS installation steps: Download the ISO image and burn bootable media; boot and select the installation source; select the language and keyboard layout; configure the network; partition the hard disk; set the system clock; create the root user; select the software package; start the installation; restart and boot from the hard disk after the installation is completed.

The command to restart the SSH service is: systemctl restart sshd. Detailed steps: 1. Access the terminal and connect to the server; 2. Enter the command: systemctl restart sshd; 3. Verify the service status: systemctl status sshd.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6
Visual web development tools