CentOS安装最新版本github

本文介绍如何在CentOS上从源代码编译安装最新版本的Git,并配置必要的环境变量,确保Git能正常工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

由于CentOS仓库中git的版本没及时更新,一直停留在了1.7.1,但git最新版本已经到了2.x.x,对于想要获取最新git的系统,只能下rpm包或者用源码;具体方法如下操作:

一、下载编译工具

[root@localhost Desktop]# yum groupinstall "Development Tools"

二、下载依赖安装包

[root@localhost Desktop]# yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel

三、下载 git 最新版本源代码

wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz

四、解压源文件

tar -zxvf git-latest.tar.gz

五、cd到源文件目录,编译安装

[root@localhost git-2017-01-03]# autoconf
[root@localhost git-2017-01-03]# ./configure 
[root@localhost git-2017-01-03]# make && make install

六、【重要】添加link

[root@localhost git-2017-01-03]# ln -s /usr/local/bin/git /usr/bin/
如果提示如下:

[root@localhost git-2017-01-03]# ln -s /usr/local/bin/git /usr/bin/
ln: creating symbolic link `/usr/bin/git': File exists

请先删除/usr/bin/git

[root@localhost git-2017-01-03]# rm -rf /usr/bin/git
然后再次执行添加link命令


七、验证版本

[root@localhost git-2017-01-03]# git --version
git version 2.11.GIT

八、为了后续git https不报错,请在/etc/profile文件中添加环境变量

PATH=$PATH:/usr/libexec/git-core





您好!要在 CentOS安装最新版本的 Prometheus,可以按照以下步骤进行操作: 1. 打开终端,以 root 用户身份登录服务器。 2. 下载 Prometheus 的最新版本压缩包。您可以在 Prometheus 的官方网站(https://prometheus.io/download/)上找到最新版本的下载链接。选择适合您服务器架构的压缩包,比如选择 Linux/amd64 架构的版本。 3. 在终端中使用 wget 命令下载压缩包。例如,使用以下命令下载 Prometheus v2.30.0 版本: ``` wget https://github.com/prometheus/prometheus/releases/download/v2.30.0/prometheus-2.30.0.linux-amd64.tar.gz ``` 4. 解压下载的压缩包。使用以下命令解压: ``` tar -xvf prometheus-2.30.0.linux-amd64.tar.gz ``` 5. 进入解压后的目录: ``` cd prometheus-2.30.0.linux-amd64 ``` 6. 您可以选择将 Prometheus 的二进制文件复制到系统的某个目录中,以便全局访问。例如,将 Prometheus 复制到 /usr/local/bin 目录中: ``` cp prometheus /usr/local/bin/ cp promtool /usr/local/bin/ ``` 7. 创建一个配置文件 prometheus.yml。您可以使用示例配置文件作为起点,并根据您的需求进行自定义: ``` cp -r examples/simple.yml /etc/prometheus/prometheus.yml ``` 8. 为 Prometheus 创建一个系统服务。创建一个名为 prometheus.service 的文件,内容如下: ``` [Unit] Description=Prometheus Wants=network-online.target After=network-online.target [Service] ExecStart=/usr/local/bin/prometheus \ --config.file=/etc/prometheus/prometheus.yml \ --storage.tsdb.path=/var/lib/prometheus \ --web.console.templates=/etc/prometheus/consoles \ --web.console.libraries=/etc/prometheus/console_libraries [Install] WantedBy=default.target ``` 9. 将 prometheus.service 文件移动到 /etc/systemd/system 目录中: ``` mv prometheus.service /etc/systemd/system/ ``` 10. 启动 Prometheus 服务: ``` systemctl start prometheus ``` 11. 设置 Prometheus 服务开机自启动: ``` systemctl enable prometheus ``` 现在,您已经成功安装并启动了最新版本的 Prometheus。您可以通过访问服务器的 IP 地址或域名加上默认的端口号(9090)来访问 Prometheus 的 Web 界面。例如,http://your-server-ip:9090。 希望这对您有所帮助!如有更多问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值