Reputation: 73788
I would like to install Mercurial on a Linux system where I don't have root
access.
How can I do this in a way so that I can easily uninstall Mercurial again and upgrade it when new versions are released?
Also, can I get a package for Windows that does not require admin rights to install?
Upvotes: 5
Views: 3120
Reputation: 73788
The Mercurial source comes with a Makefile
that has a local
target. If you run this, then you'll build the C extensions in-place:
$ make local
... (lots of output) ...
python hg version
Mercurial Distributed SCM (version 5b66e55c0d93+20111216)
(see https://www.mercurial-scm.org for more information)
Copyright (C) 2005-2011 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You will need the Python header files, they typically come in a python-dev
package. You can then symlink the hg
script into a directory in your PATH
. I use ~/bin
for this:
$ cd ~/bin
$ ln -s ../src/mercurial/hg
You can now run hg
from any directory.
If you want to uninstall Mercurial, it's as simple as deleting the directory where you did the compile. Upgrading is also easy: unpack a new release in the directory and run make local
again. You can also use the newly install Mercurial to clone the Mercurial repository itself:
$ hg clone https://www.mercurial-scm.org/repo/hg
$ cd hg
$ make local
This gives you a version of Mercurial from the default
branch. Use hg update stable
before compiling if you want a build from the stable
branch instead. That branch is only updated with bugfixes.
On that platform, you can use a the Inno setup installers. They do not require admin rights. You can couple that with a portable version of TortoiseHg if you like.
Upvotes: 2
Reputation: 1586
I'm aware that this question is already answered but someone could be in the situation I was and that is to have to install without C compiler and make.
Full description of the solution can be found on following link.
List of commands, without using make
wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg
mkdir -p ~/software/lib/python2.5/site-packages
export PYTHONPATH=~/software/lib/python2.5/site-packages
sh setuptools-0.6c11-py2.5.egg --prefix=~/software
export PATH=${PATH}:~/software/bin
easy_install --prefix=~/software docutils
cd ~/software
wget https://www.mercurial-scm.org/release/mercurial-2.5.2.tar.gz
tar xzvf mercurial-2.5.2.tar.gz
cd mercurial-2.5.2.tar.gz
python setup.py --pure install --home="~/software" --force
cd ~/software/lib/python
mv hgext/ ../python2.5/site-packages/
mv mercurial ../python2.5/site-packages/
mv mercurial-2.5.2.egg-info ../python2.5/site-packages/
Append following lines to .bashrc
:
export PYTHONPATH=~/software/lib/python2.5/site-packages
export PATH=${PATH}:~/software/bin
Check:
~$ hg
Mercurial Distributed SCM
etc...
Upvotes: 2
Reputation: 63832
It is very easy to compile and install Mercurial in your home directory, I've done so myself.
This linked wiki-post will certainly provide some aid if you have questions;
Use make install-home
to install hg
to your home directory, it'll put the binary file in ~/bin and associative files in ~/lib.
When uninstalling or upgrading to a new version you could either delete the files that the makefile have put in, or let make install-home
(if upgrading) overwrite the existing files.
Make sure to update your $PATH
after installation so that it includes ~/bin
.
Following the link below will lead you to the download section of Mercurial. There you'll be able to find installation bundles for Windows that doesn't require administration rights.
Upvotes: 7