如何在日本买iphone xCentOS 6.x/7.x上安装git及最新版

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)有回复时邮件通知我
Linux--不是那么难,学习Linux--那么难是不?Legion是一个个人的linux学习记录型博客,本人不望博客多出名,只期待自己能把自己在linux路上的点点滴滴都做个记录。只期望自己能很好的坚持写下去。
记住我的登录信息
输入用户名或电子邮箱地址,您会收到一封新密码链接的电子邮件。
用户名或电子邮件地址25887 次浏览
之前本博介绍过
加速效果还不错。
最近大佬 @Yankee 更新了一份 BBR魔改方案,使得BBR加速效果更明显了。
目前还没有关于CentOS 和 Ubuntu 14 详细安装说明。本文解决这一个空白。
由于本人技术太渣,暂时不提供一键安装方案。
本文手动安装都经过作者亲测可以使用。
对于一些基本Linux命令,请百度查询使用方法。手动安装涉及到系统文件的修改,不建议小白操作。
安装BBR加速需要升级系统内核,可能造成系统无法启动。请备份重要数据后再操作。
左侧为原BBR
右侧为魔改BBR
(能看懂的可以瞅瞅)
源码地址:
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/plain/net/ipv4/tcp_bbr.c
https://gist.github.com/anonymous/baeafbbaf3a/raw/55ff1e45c97b46f633a9922ad55d/tcp_tsunami.c
大佬特别提醒:编译时系统必须安装4.10以上版本的kernel及对应的linux-header,gcc版本应在4.9以上
鉴于之前的那篇文章内核是 4.9的,所以再水一篇文章吧!!
特别提醒:OpenVZ虚拟不能直接升级。升级内核可能会造成服务器无法启动。请酌情使用。
CentOS 6 X64
CentOS系统本文演示使用 4.11.8 内核。如果下面代码中的内核地址失效,请自行搜索最新的内核地址即可。
内核地址:
升级系统内核
1)依次执行以下代码。
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.orgyum install -y http://elrepo.org/linux/kernel/el6/x86_64/RPMS/kernel-ml-4.11.8-1.el6.elrepo.x86_64.rpmyum remove -y kernel-headersyum install -y http://elrepo.org/linux/kernel/el6/x86_64/RPMS/kernel-ml-headers-4.11.8-1.el6.elrepo.x86_64.rpmyum install -y http://elrepo.org/linux/kernel/el6/x86_64/RPMS/kernel-ml-devel-4.11.8-1.el6.elrepo.x86_64.rpm
设置启动引导
2)修改启动引导,修改配置文件即可。
执行命令:
vi /etc/grub.conf
红框可看见我们新安装的内核。修改 default=0
即可。然后保存。重启服务器。
依次执行以下脚本
12345678910
yum install -y make gccwget -O ./tcp_tsunami.c https://gist.github.com/anonymous/baeafbbaf3a/raw/55ff1e45c97b46f633a9922ad55d/tcp_tsunami.cecho "obj-m:=tcp_tsunami.o" & Makefilemake -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gccchmod +x ./tcp_tsunami.kocp -rf ./tcp_tsunami.ko /lib/modules/$(uname -r)/kernel/net/ipv4insmod tcp_tsunami.kodepmod -aecho "net.core.default_qdisc=fq" && /etc/sysctl.confecho "net.ipv4.tcp_congestion_control=tsunami" && /etc/sysctl.conf
执行完之后 重启一下服务器。
重启成功后,执行以下命令。如果有显示内容说明启动成功。
lsmod | grep tsunami
&& tcp_tsunami 6053 5
CentOS 7 X64
由于手头暂时没有CentOS7 系统的服务器。以下代码并没有测试。
升级系统内核,请执行以下代码。其他的请参考 CentOS 6 X64!!
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.orgyum install -y http://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-4.11.8-1.el7.elrepo.x86_64.rpmyum remove -y kernel-headersyum install -y http://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-headers-4.11.8-1.el7.elrepo.x86_64.rpmyum install -y http://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-devel-4.11.8-1.el7.elrepo.x86_64.rpm
Debian 8/Ubuntu 14
升级系统内核
分别安装 headers
和 images 即可。
内核地址:
你可以选择更高版本的内核试一试,注意自己替换命令中的 v4.10.9
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.9/linux-headers-4.10.9-.10.9-_all.debdpkg -i linux-headers-4.10.9*.deb&wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.9/linux-image-4.10.9-041009-generic_4.10.9-_amd64.debdpkg -i linux-image-4.10.9*.deb&
设置启动引导
1)查看系统内核列表,执行以下命令
dpkg -l|grep linux-image
执行命令后,可见多个内核如下:
ii linux-image-3.16.0-4-amd64 3.16.7-ckt9-3~deb8u1 amd64 Linux 3.16 for 64-bit PCsii linux-image-4.10.9-041009-generic 4.10.9- amd64 Linux kernel image for version 4.10.9 on 64 bit x86 SMPii linux-image-amd64 3.16+63 amd64 Linux for 64-bit PCs (meta-package)
上面显示的我们需要将 linux-image-3.16.0
这个删除掉。
PS : 如果你显示的是其他的内核版本,那么就删掉它。只保留 4.10.9。
2)删除内核。
apt-get remove linux-image-3.16.0-4-amd64
注意:Debian8 系统会弹出一个提示,直接【Tab】选择 【NO】然后回车。
3)重新生成启动引导。
update-grub
4)重启系统。
根据大佬的要求 gcc版本必须 &= 4.9 ,否则无法编译。
我在 Ubuntu 14上安装gcc的时候竟然是 4.8版本,可能是由于 Ubuntu 14版本的问题。
1)查看 gcc 版本 。如果 版本 &= 4.9 可跳过这个步骤了。
2) 执行以下命令来安装 gcc-4.9
apt-get install build-essentialadd-apt-repository ppa:ubuntu-toolchain-r/testapt-get updateapt-get install gcc-4.9
1)请依次执行以下脚本。执行完重启服务器。
apt-get install make gcc-4.9wget -O ./tcp_tsunami.c https://gist.github.com/anonymous/baeafbbaf3a/raw/55ff1e45c97b46f633a9922ad55d/tcp_tsunami.cecho "obj-m:=tcp_tsunami.o" & Makefilemake -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gcc-4.9install tcp_tsunami.ko /lib/modules/$(uname -r)/kernelcp -rf ./tcp_tsunami.ko /lib/modules/$(uname -r)/kernel/net/ipv4depmod -aecho "net.core.default_qdisc=fq" && /etc/sysctl.confecho "net.ipv4.tcp_congestion_control=tsunami" && /etc/sysctl.conf
2)重启成功后,执行以下命令。如果有显示内容 说明启动成功。
lsmod | grep tsunami
&& tcp_tsunami 6053 5
一键安装脚本
对于小白用户,以上手动安装可能有点复杂。那么就推荐你使用大佬的一键脚本吧。
提醒一下几位大佬的一键暂不支持 CentOS系统。大佬们的一键脚本可能在 Ubuntu14 下执行可能出问题。
如果一键出错,那么只能上面的内容手动安装了。
谢谢 收集以下内容。
落雨无声版本
原文地址:
注意只支持 Debian8 / Ubuntu16 +
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/YankeeBBR/master/bbr.sh && bash bbr.sh install
原文地址:
注意只支持 Debian8 / Ubuntu16 +
wget --no-check-certificate -qO 'BBR_POWERED.sh' 'https://moeclub.org/attachment/LinuxShell/BBR_POWERED.sh' && chmod a+x BBR_POWERED.sh && bash BBR_POWERED.sh
原文地址:
注意只支持 Debian8 / Ubuntu16 +
wget https://raw.githubusercontent.com/singhigh/502newbbr/master/502newbbr.shchmod +x 502newbbr.sh./502newbbr.sh
感谢 Hostloc众多大佬
参考文献:
Related posts:
没有个人说明linux - How to install latest version of git on CentOS 6.x/7.x - Stack Overflow
Join Stack Overflow to learn, share knowledge, and build your career.
or sign in with
I used the usual:
yum install git
But it did not install the latest version of git on my CentOS 6.4. So, how can I update to the latest version for CentOS 6.4?
The solution can be applicable to other newly released versions of CentOS such as CentOS 7.x.
17.7k156489
4,68992452
You can use
to install Git 2.x.
Install WANDisco repo package:
yum install http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm
Install the latest version of Git 2.x:
yum install git
Verify the version of Git that was installed:
git --version
As of , the latest available version from WANDisco is 2.11.0.
Having a look at the blog
I found the solution in one of the comments. Make sure you got the rpmforge repository added to your CentOS yum and just run the flowing command:
yum --disablerepo=base,updates --enablerepo=rpmforge-extras install git
If you already have git installed then use:
yum --disablerepo=base,updates --enablerepo=rpmforge-extras update git
Related question(s):
Note update:
Thanks to Anthony Hatzopoulos, for git v1.8x you'll need to use git18 as in:
yum --disablerepo=base,updates --enablerepo=rpmforge-extras install git18
Note update 2:
Also thanks to
@Axlrod for the below hint and @Hiphip for the feedback:
Change the rpmforge.repo file to have rpmforge-extras to enabled,
yum update git. Otherwise it complained about dependency problems.
Note update 3:
Installing a specific version of git say 2.x
I found this nice and easy-to-follow guide on how to download the GIT source and compile it yourself (and install it). If the accepted answer does not give you the version you want, try the following instructions:
(And pasted/reformatted from above source in case it is removed later)
Step 1: Install Required Packages
Firstly we need to make sure that we have installed required packages on your system. Use following command to install required packages before compiling Git source.
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum install
gcc perl-ExtUtils-MakeMaker
Step 2: Uninstall old Git RPM
Now remove any prior installation of Git through RPM file or Yum package manager. If your older version is also compiled through source, then skip this step.
# yum remove git
Step 3: Download and Compile Git Source
Download git source code from kernel git or simply use following command to download Git 2.0.4.
# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.0.4.tar.gz
# tar xzf git-2.0.4.tar.gz
After downloading and extracting Git source code, Use following command to compile source code.
# cd git-2.0.4
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo 'export PATH=$PATH:/usr/local/git/bin' && /etc/bashrc
# echo 'export PATH=$PATH:/usr/local/git/bin' & /etc/profile.d/git.sh
# source /etc/bashrc
Updated method of adding compiled git bin directory to bashrc. Because echo "export PATH=$PATH:/usr/local/git/bin" && /etc/bashrc used "" instead of '', it would expand the current session's value for $PATH instead of keeping it as a variable, and could adversely affect the entire system. At the minimum, it should use '' instead of "" and should really be a separate script in /etc/profile.d/
HINT 2 (@DJB):
/usr/local/git/bin before $PATH, since the older version of git was already on $PATH: export PATH=/usr/local/git/bin:$PATH
Step 4. Check Git Version
One completion of above steps, you have successfully install Git in your system. Let use following command to check git version
# git --version
git version 2.0.4
I also wanted to add that the "Getting Started" guide at the GIT website also includes instructions on how to download and compile it yourself:
4,68992452
I found this nice and easy-to-follow guide on how to download the GIT source and compile it yourself (and install it). If the accepted answer does not give you the version you want, try the following instructions:
(And pasted/reformatted from above source in case it is removed later)
Step 1: Install Required Packages
Firstly we need to make sure that we have installed required packages on your system. Use following command to install required packages before compiling Git source.
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum install
gcc perl-ExtUtils-MakeMaker
Step 2: Uninstall old Git RPM
Now remove any prior installation of Git through RPM file or Yum package manager. If your older version is also compiled through source, then skip this step.
# yum remove git
Step 3: Download and Compile Git Source
Download git source code from kernel git or simply use following command to download Git 2.5.3.
# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.5.3.tar.gz
# tar xzf git-2.5.3.tar.gz
After downloading and extracting Git source code, Use following command to compile source code.
# cd git-2.5.3
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo 'pathmunge /usr/local/git/bin/' & /etc/profile.d/git.sh
# chmod +x /etc/profile.d/git.sh
# source /etc/bashrc
Step 4. Check Git Version
On completion of above steps, you have successfully install Git in your system. Use the following command to check the git version
# git --version
git version 2.5.3
I also wanted to add that the "Getting Started" guide at the GIT website also includes instructions on how to download and compile it yourself:
Rackspace maintains the , which contains a reasonably up-to-date git (edit: remove stock git first):
$ sudo yum remove git
$ sudo yum install epel-release
$ sudo yum install https://centos6.iuscommunity.org/ius-release.rpm
$ sudo yum install git2u
edit: CentOS 7.2 instructions (thanks !):
$ sudo yum remove git
$ sudo yum install epel-release
$ sudo yum install https://centos7.iuscommunity.org/ius-release.rpm
$ sudo yum install git2u
My personal preference is to build rpm packages for CentOS when installing non-standard software and replacing distributed components.
For this I recommend that you use Mock to create a clean build environment.
The procedure is:
Obtain the source RPMS or a suitable SPEC file and pristine source tarball.
In this case one may find source RPM packages for git2X for CentOS-6 at:
http://dl.iuscommunity.org/pub/ius/archive/CentOS/6/SRPMS/. Packages for other CentOS releases are also available.
Install the necessary support software:
yum install epel-release
# you need this for mock
yum install rpm-build
yum install redhat-rpm-config
yum install rpmdevtools
yum install mock
Add a rpm build user account (do not build as root or as a real user - security issues will come back to bite you).
sudo adduser builder --home-dir /home/builder \
--create-home --user-group --groups mock \
--shell /bin/bash --comment "rpm package builder"
Next we need a build environment.
su -l builder
rpmdev-setuptree
This produces the following directory structure:
└── rpmbuild
├── BUILD
├── RPMS
├── SOURCES
├── SPECS
└── SRPMS
We are using a prepared SRPMS so the SOURCES tarballs can be ignored for this case and we can go direct to SRPMS.
wget http://dl.iuscommunity.org/pub/ius/archive/CentOS/6/SRPMS/git2u-2.5.3-1.ius.centos6.src.rpm \
-O ~/rpmbuild/SRPMS/git2u-2.5.3-1.ius.centos6.src.rpm
Configure mock (as root)
cd /etc/mock
rm default.cfg
ln -s epel-6-x86_64.cfg default.cfg
vim default.cfg
Disable the beta repos. Enable the base and update repos.
Initialize the build tree (/var/lib/mock is default)
mock --init
If we were building from SOURCES then this is where we would employ the SPEC file and use mock --buildsrpm . . ..
But in this case we go directly to the binary build step:
mock --no-clean --rebuild ~/rpmbuild/SRPMS/git2u-2.5.3-1.ius.centos6.src.rpm
This will resolve the build dependencies and download them (about 95 or so packages) into the clean build root. It will then extract the sources and build the binary from the provided SRPM and leave it in /var/lib/mock/epel-6-x86_64/result; or in whatever custom build root location and architecture you provided.
It will take a long time. There is a particularly documentation.
If all goes well then you should end up with a suit of RPM packages suitable for installation in place of the distro version.
This is what I ended up with:
ll /var/lib/mock/epel-6-x86_64/result
total 34996
-rw-rw-r--. 1 byrnejb mock
448455 Oct 30 10:09 build.log
-rw-rw-r--. 1 byrnejb mock
52464 Oct 30 10:09 emacs-git2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
47228 Oct 30 10:09 emacs-git2u-el-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
8474478 Oct 30 09:57 git2u-2.5.3-1.ius.el6.src.rpm
-rw-rw-r--. 1 byrnejb mock
8877584 Oct 30 10:09 git2u-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock
27284 Oct 30 10:09 git2u-all-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
27800 Oct 30 10:09 git2u-bzr-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
112564 Oct 30 10:09 git2u-cvs-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
436176 Oct 30 10:09 git2u-daemon-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock
Oct 30 10:09 git2u-debuginfo-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock
60556 Oct 30 10:09 git2u-email-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
274888 Oct 30 10:09 git2u-gui-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
79176 Oct 30 10:09 git2u-p4-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
483132 Oct 30 10:09 git2u-svn-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock
173732 Oct 30 10:09 gitk2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
115692 Oct 30 10:09 gitweb2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
57196 Oct 30 10:09 perl-Git2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
89900 Oct 30 10:09 perl-Git2u-SVN-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock
101026 Oct 30 10:09 root.log
-rw-rw-r--. 1 byrnejb mock
980 Oct 30 10:09 state.log
Install using yum or rpm.
You will require git2u-2.5.3-1.ius.el6.x86_64.rpm at a minimum and such additional support packages as it requires (perl-Git2u-2.5.3-1.ius.el6.noarch.rpm) or you desire.
This build has a cyclic dependency: git2u-2.5.3-1.ius.el6.x86_64.rpm depends upon perl-Git2u-2.5.3-1.ius.el6.noarch.rpm and perl-Git2u-2.5.3-1.ius.el6.noarch.rpm depends upon git2u-2.5.3-1.ius.el6.x86_64.rpm. A straight install with rpm will thus fail.
There are two ways of dealing with it:
Install both at the same time via yum:
yum localinstall \
git2u-2.5.3-1.ius.el6.x86_64.rpm \
perl-Git2u-2.5.3-1.ius.el6.noarch.rpm`
Setup a local yum repo.
I am including my LocalFile.repo file below as it contains instructions on how to do this and provides the necessary repo file at the same time.
cat /etc/yum.repos.d/LocalFile.repo
# LocalFile.repo
This repo is used with a local filesystem repo.
# To use this repo place the rpm package in /root/RPMS/yum.repo/Packages.
# Then run: createrepo --database --update /root/RPMS/yum.repo.
yum --enablerepo=localfile [command]
# or to use only ONLY this repo, do this:
yum --disablerepo=\* --enablerepo=localfile [command]
[localfile]
baseurl=file:///root/RPMS/yum.repo
name=CentOS-$releasever - Local Filesystem repo
# Before persistently enabling this repo see the priority note below.
gpgcheck=0
# When this repo is enabled all packages in repos with priority&5
# will not be updated even when they have a more recent version.
# Be careful with this.
priority=5
You also may be required to manually pre-install additional dependency packages such as perl-TermReadKey available from the usual repositories.
59.7k865149
To build and install modern Git on CentOS 6:
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
export GIT_VERSION=2.6.4
mkdir /root/git
cd /root/git
wget "https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz"
tar xvzf "git-${GIT_VERSION}.tar.gz"
cd git-${GIT_VERSION}
make prefix=/usr/local all
make prefix=/usr/local install
yum remove -y git
git --version # should be GIT_VERSION
Here's my method to install git on centos 6.
sudo yum groupinstall "Development Tools"
sudo yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel curl-devel
sudo yum install wget
wget -O git.zip https://github.com/git/git/archive/v2.7.2.zip
unzip git.zip
cd git-2.7.2
make configure
./configure --prefix=/usr/local
make all doc
sudo make install install-doc install-html
Adding a roundabout answer here. I was struggling to install git on an RHEL 6.0 Amazon instance, and what ended up saving me was ... conda, as in Anaconda Python.
I installed conda on the command line from the
(code modeled after ):
wget http://repo.continuum.io/miniconda/Miniconda2-4.2.12-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
and then ran
conda install git
and a relatively recent version git was installed. Today is 12/26/2016 and the version is 2.9.3.
This may be irrelevant. It is for people don't want build the latest git on the host meanwhile they still can get the latest git.
I think most people don't like building the latest git on CentOS because the dependencies will contaminate the host and you have to run lots of commands. Therefore, I have an idea which is building git inside the Docker container and then install the executable via the docker volume mount. After that, you can delete the image and container.
Yes, the downside is you have to install docker. But the least dependencies are introduced to the host and you don't have to install other yum repo.
Here is my repository.
It can be very confusing, and dangerous, to replace the upstream base repositories with add-on repositories without considerable testing and thought. RPMforge, in particularly, is effectively moribund and is not getting updates.
I personally publish tools for building git 2.4, wrapped as an alternatively named "git24" package, at . Feel free to access and fork those if you want packages distinguished from the standard system packages, much as "samba" and "samba4" packages are differentiated.
10.7k64171
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled}

我要回帖

更多关于 苹果x如何关机 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信