TMPDIR does not change build directory for pip install - python-3.x

I'm running pip various versions of pip over 20.X. For some reason, the --build option was removed from these later versions for install. I want to change the location of the pip builds because /tmp is occasionally cleaned up mid-install by a Jenkins plugin that cleans /tmp. Please don't tell me to disable the plugin :)
It's documented that setting TMPDIR environment variable will allow me to set the build directory. When I run in verbose mode, I still see /tmp being used for req-tracker and unpack folders.
What am I doing wrong? How can I change the build directory for pip install?
Setup of virtualenv
VENV=$(mktemp -d venv.XXXXXXX)
python -m venv $VENV
. $VENV/bin/activate
export TMPDIR=$VENV/build
python -m pip install --verbose -r requirements.txt
I stopped the job and I see folders newly created in /tmp
$ lt /tmp/
total 116
drwx------ 47 dom.larosa dom.larosa 4096 Feb 17 06:54 pip-build-sx9op49f
drwx------ 2 dom.larosa dom.larosa 4096 Feb 17 06:54 pip-3at9dsy4-record
I see nothing in TMPDIR which is where I would like the temporary build directories to be
$ lt $VENV/build
ls: cannot access 'venv.WFWImFB/build': No such file or directory

Related

-bash: /usr/bin/virtualenvwrapper.sh: No such file or directory

I can't figure out where the shell is trying to run /usr/bin/virtualenvwrapper.sh upon server login. I want virtualenvwrapper permanently uninstalled, not just removed from the shell instance. I thought I uninstalled it with pip uninstall virtualenvwrapper, but every time I log into the server I get the error -bash: /usr/bin/virtualenvwrapper.sh: No such file or directory, as if there is some sort of leftover artifact. Yesterday I did a lot of tinkering and I can't remember all the changes I made or how I made this happen. Where is it executing the search for virtualenvwrapper.sh?
SUPPLEMENTARY INFO
$ echo $PATH
/usr/lib64/qt-3.3/bin
/usr/local/bin/ibm/lsf/9.1/linux2.6-glibc2.3-x86_64/etc
/usr/local/bin/ibm/lsf/9.1/linux2.6-glibc2.3-x86_64/bin
/usr/local/bin
/bin
/usr/bin
/usr/local/sbin
/usr/sbin
/sbin/usr/local/bin/CASAVA-1.8.2/bin
/usr/local/bin/blast
/usr/local/bin/mirdeep2
/usr/local/bin/velvet
$ sudo vim ~/.bashrc
1 # .bashrc
2
3 # Source global definitions
4 if [ -f /etc/bashrc ]; then
5 . /etc/bashrc
6 fi
7
8 # User specific aliases and functions
on ubuntu 12.04 LTS, installing through pip, it is installed to
/usr/local/bin/virtualenvwrapper.sh
And if you are using Ubuntu 16.04 or later, it is installed to
~/.local/bin/virtualenvwrapper.sh
Setting up a Virtual Environment
Now open your terminal in the home directory by right clicking and choosing the option “Open in Terminal”. You can also press the CTRL, ALT, and T keys on your keyboard at the same time to open the Terminal application automatically.
You first need to create a special directory that will hold all of your virtual environments. So proceed with creating a new hidden directory called virtualenv.
$ mkdir .virtualenv
Now you should install pip for Python3.
$ sudo apt install python3-pip
Confirm the pip3 installation.
$ pip3 --version
Now install virtualenv via pip3.
$ pip3 install virtualenv
To find where your virtualenv was installed, type:
$ which virtualenv
Install virtualenvwrapper via pip3:
$ pip3 install virtualenvwrapper
We are going to modify your .bashrc file by adding a row that will adjust every new virtual environment to use Python 3. We will point virtual environments to the directory we created above (.virtualenv) and we will also point to the locations of the virtualenv and virtualenvwrapper.
Now open the .bashrc file using Vim editor.
$ vim .bashrc
If you still haven’t used the Vim editor or you don’t have it installed on your computer you should install it now. It is a widely used Linux editor, and for good reason.
$ sudo apt install vim
After you've installed Vim open the file .bashrc file by typing the vim .bashrc command in your terminal. Navigate to the bottom of the .bashrc file, press the letter i to enter the insert mode of Vim, and add these rows:
#Virtualenvwrapper settings:
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_VIRTUALENV=/home/your_username/.local/bin/virtualenv
source ~/.local/bin/virtualenvwrapper.sh
After you are done, press the esc key. Then type :wq and press enter. This command will save and exit the Vim editor. Close and reopen your terminal when you’re done.
To create a virtual environment in Python3 and activate it immediately, use this command in your terminal:
$ mkvirtualenv name_of_your_env
You should confirm that this environment is set up for Python3:
$ Python -V
To deactivate the environment use the deactivate command.
$ deactivate
To list all available virtual environments use the command workon or lsvirtualenv (same result as workon but shown in a fancy way) in your terminal:
$ workon
$ lsvirtualenv
To activate one specific environment use workon + name of your environment:
$ workon name_of_your_env
There are several useful command you might need to use someday:
Rmvirtualenv will remove a specific virtual environment located in your .virtualenv directory.
$ rmvirtualenv name_of_your_env
Cpvirtualenv will copy the existing virtual environment to a new virtual environment and activate it.
$ cpvirtualenv old_virtual_env new_virtual_env
Well done! You have now created your first isolated Python 3 environment.
There are a number of files that might be run when you login to your terminal if you are using the bash shell.
You should check ~/.bashrc, ~/.bash_profile, ~/.bash_login and ~/.profile for "/usr/bin/virtualenvwrapper.sh".
Likely one of those files is being run on login and contains the missing script which you uninstalled.
It can be that you python packages are installed somewhere else. So try:
$ which python
/home/tesla/miniconda3/bin/python
or
$ which virtualenvwrapper.sh
/home/tesla/miniconda3/bin/virtualenvwrapper.sh
To check the location of python installation. In my case I was using miniconda, therefore system was not able to find the location mentioned in the documentation.
If the above location is not /usr/local/bin/virtualenvwrapper.sh
then now use :
source /home/tesla/miniconda3/bin/virtualenvwrapper.sh
Should work.
UPDATE Nov-2022:
I would recommend using pipenv (official docs) for creating and managing virtual environments.
For anyone finding this in the future. The virtualenvwrapper.sh script is/was now located at /usr/share/virtualenvwrapper/virtualenvwrapper.sh on Ubuntu 20.04.1 LTS (at least for me in my VM).
(Sadly i can't just comment on the above post mentioning the locations so it would all be together, because new user reputation)
sudo -H pip3 install virtualenvwrapper
i ran into to similar problem where installation could not suceed because ~/.cache/pip and ~/.cache/pip/http is not owned by the current user. installing with -H or --set-home option solved my problem.
Confirmed for Ubuntu 18 , as already answered by #Tarique . The shell script virtualenvwrapper.sh for the wrapper is within - ~/.local/bin/
(base) dhankar#dhankar-1:~/opencv_cuda$ cd ~/.local/bin/
(base) dhankar#dhankar-1:~/.local/bin$ ls -ltr
total 100
-rwxr-xr-x 1 dhankar dhankar 41703 Jul 23 20:56 virtualenvwrapper.sh
-rwxr-xr-x 1 dhankar dhankar 2210 Jul 23 20:56 virtualenvwrapper_lazy.sh
-rwxr-xr-x 1 dhankar dhankar 259 Jul 23 20:56 virtualenv
I also confronted the same problem, but this worked for me: -
Create a directory to hold the virtual environments.mkdir $HOME/.virtualenvs
Add a line like export WORKON_HOME=$HOME/.virtualenvsto your
.bashrc.
Add a line like source /path/to/this/file/virtualenvwrapper.sh
to your .bashrc.
Run: source ~/.bashrc
Run: mkvirtualenv temp
This time, the "temp" environment is included.
Run: workon temp
The virtual environment is activated.
If you are on Ubuntu 20 then use the code given below in ~/.bashrc
export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source ~/.local/bin/virtualenvwrapper.sh
In my case on Ubuntu 20, I found this script in:
/usr/share/virtualenvwrapper/

I'm tried installing aws command line tool

I tried installing the aws command line tool to run the command
aws
on linux
i tried installing it using pip but I get an error
http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-bundle-other-os
/bin/aws: Permission denied
whenever I run the command
aws help
what should I do?
The output of ls -l /bin/aws shows:
-rw-r--r--. 1 root root 814 Oct 22 18:09 /bin/aws
Which means you have read/write permissions, but no execute permissions. To fix that, you have to run chmod like this:
chmod 755 /bin/aws
After this the output of ls -l /bin/aws should show:
-rwxr-xr-x. 1 root root 814 Oct 22 18:09 /bin/aws
The x means you also have execute permissions now. Also other users will have execute permission. If there are no other limitations, other users can execute it too.
I had the same issue, and couldn't get it to work.
I uninstalled it using the directions on the aws site
I then installed it using homebrew on linux instead, and it works fine:
# as of writing installs aws-cli v2.X
brew install awscli

How to make a ubuntu executable and run it in my install file

This is the install file below (sandhi-install.sh). Currently after installing it can only be run from the terminal. I want to make it terminal independent. Making a Ubuntu executable explains how to create an executable but where should I put that code. I think it should be in the install file itself because we want the icon to appear on the desktop after installation completes.
I have no prior experience in Shell scripting and bash so sorry if i miss any important information. Please ask if you need any other file. My aim is basically to run sandhi independent of the terminal.
#!/bin/bash
echo "Installing the required dependencies"
sudo apt-get -y install git-core autoconf automake make libtool g++ python-dev swig \
pkg-config libboost1.48-all-dev libfftw3-dev libcppunit-dev libgsl0-dev \
libusb-dev sdcc libsdl1.2-dev python-wxgtk2.8 python-numpy \
python-cheetah python-lxml doxygen python-qt4 python-qwt5-qt4 libxi-dev \
libqt4-opengl-dev libqwt5-qt4-dev libfontconfig1-dev libxrender-dev \
python-serial python-matplotlib
echo "Sciscipy installation starting"
git clone https://github.com/manojgudi/sciscipy-1.0.0.git
cd sciscipy-1.0.0/
sudo ./install
echo "Starting Sandhi installation"
cd ../
git clone http://github.com/manojgudi/sandhi.git
cd sandhi/
git submodule init
git submodule update
git pull origin master
git submodule update
mkdir build
cd build/
cmake ../
make -j 2
sudo make install
sudo ldconfig
echo "Sandhi installation complete. Go to command line and type Sandhi to start Sandhi"
Your script already has all the right ingredients for being a *nix executable - a shebang line and what at least looks like valid code for the interpreter (/bin/bash). All you need to do is to give the relevant user and/or group (or everybody) execute access on the file. For example, if you're the owner of the file:
sandhi#host$ ls -l sandhi.sh
-rw-r--r-- 1 purak users 3.5K Oct 11 16:55 sandhi.sh
sandhi#host$ chmod u+x sandhi.sh
Now you can execute it:
sandhi#host$ ls -l sandhi.sh
-rwxr--r-- 1 purak users 3.5K Oct 11 16:55 sandhi.sh
sandhi#host$ ./sandhi.sh
For the rest of the question it's unclear what you're asking. The accepted answer to Making a Ubuntu executable says that if the executable foo.bin is in /usr/local/bin (a sensible destination for custom executables) the line in the desktop entry should be Exec=/usr/local/bin/foo.bin.

Configuring Terminal on Mac

I installed Node.js via the precompiled package but I can't access it correctly via the Terminal.
> node
does not work instead I have to type:
> sudo /usr/local/bin/node
My $PATH reads:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin
What do I need to configure?
I am running OSX 10.10 (14A299l) (XCode6 Beta 4 is installed)
If you compiled this package as root it is likely that the file structure all has root ownership. What do you see when you type,
ls -l /usr/local/bin/
If the node.js folder says something like root:root before it then you need to change the permissions via
chmod -R user:user /usr/local/bin/node....

How to install latest version of git on CentOS 8.x/7.x/6.x

I used the usual:
yum install git
It did not install the latest version of git on my CentOS 6. How can I update to the latest version of git for CentOS 6? The solution can be applicable to newer versions of CentOS such as CentOS 7.
You can use WANDisco's CentOS repository to install Git 2.x: for CentOS 6, for CentOS 7
Install WANDisco repo package:
yum install http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm
- or -
yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-1.noarch.rpm
- or -
yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.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 02 Mar. 2020, the latest available version from WANDisco is 2.22.0.
Having a look at the blog here 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):
Facing issues while upgrading git to latest version on CentOS 6.4
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:
http://tecadmin.net/install-git-2-0-on-centos-rhel-fedora/
(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
# or
# echo 'export PATH=$PATH:/usr/local/git/bin' > /etc/profile.d/git.sh
#
# source /etc/bashrc
HINT 1:
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:
http://git-scm.com/book/en/v2/Getting-Started-Installing-Git
Rackspace maintains the ius repository, which contains a reasonably up-to-date git, but the stock git has to first be removed.
CentOS 6 or 7 instructions (run as root or with sudo):
# retrieve and check CENTOS_MAIN_VERSION (6 or 7):
CENTOS_MAIN_VERSION=$(cat /etc/centos-release | awk -F 'release[ ]*' '{print $2}' | awk -F '.' '{print $1}')
echo $CENTOS_MAIN_VERSION
# output should be "6" or "7"
# Install IUS Repo and Epel-Release:
yum install -y https://repo.ius.io/ius-release-el${CENTOS_MAIN_VERSION}.rpm
yum install -y epel-release
# re-install git:
yum erase -y git*
yum install -y git-core
# check version:
git --version
# output: git version 2.24.3
Note: git-all instead of git-core often installs an old version. Try e.g. git224-all instead.
The script is tested on a CentOS 7 docker image (7e6257c9f8d8) and on a CentOS 6 docker image (d0957ffdf8a2).
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:
http://tecadmin.net/install-git-2-0-on-centos-rhel-fedora/
(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:
http://git-scm.com/book/en/v2/Getting-Started-Installing-Git
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 lot to this package; 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 15858600 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.
#
# To use:
# 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.
enabled=0
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.
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
as git says:
RHEL and derivatives typically ship older versions of git. You can
download a tarball and build from source, or use a 3rd-party
repository such as the IUS Community Project to obtain a more recent
version of git.
there is good tutorial here.
in my case (Centos7 server) after install had to logout and login again.
Build latest version of git on Centos 6/7
Preparing system to building rpms
Install epel:
For EL6, use:
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
For EL7, use:
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Install fedpkg:
sudo yum install fedpkg
Add yourself into group mock (you might need to re-login to server after this change):
sudo usermod -a -G mock $USER
Download git
Download git sources:
fedpkg clone -a git && cd git
fedpkg sources
Verify sources:
sha512sum -c sources
Build rpm
Create srmp. Use el6 for RHEL6, el7 for RHEL7.
fedpkg --dist el7 srpm
Build package in mock:
mock -r epel-7-x86_64 git-2.16.0-1.el7.src.rpm
Install latest version of git rpm from /var/lib/mock/epel-7-x86_64/result/. Note, you might need to uninstall existing version of the git from your system first.
This instruction is based on the mailing list post by Todd Zullinger.
This guide worked:
# hostnamectl
Operating System: CentOS Linux 7 (Core)
# git --version
git version 1.8.3.1
# sudo yum remove git*
# sudo yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
# sudo yum install git
# git --version
git version 2.24.1
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
cd ~
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 archives (code modeled after this):
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. https://github.com/wood1986/docker-library/tree/master/git
If git already installed first remove old git
sudo yum remove git*
And install latest version of git
yum install -y git-core
Check Version
git --version
bingo!!
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 https://github.com/nkadel/git24-srpm/. 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.

Resources