You are here
Installing software yourself on DICE
Major frameworks covered:
- C/C++/many others (autotools)
- EMACS (MELPA)
- Haskell (Cabal)
- LaTeX (tlmgr)
- Lua (rocks)
- Python (Pip et al)
- Ruby (gems)
Although DICE prohibits its users from becoming root, this is not usually a limitation to installing software yourself. Most normal installations, including those where software must be built from source, are able to install themselves into your home directory with a few modifications to the build process.
Most software does not need to be "installed" in any sense. For binary distributions, simply unpacking the software into your home directory and running the binary (sometimes found in a ./bin/
subdirectory) is the one and only step to using the software. You may optionally add this to your $PATH
for your convenience.
Most software installation follows a similar pattern. In general the only thing that must be changed is that the install prefix (that is, the base directory into which all files are placed) be changed from /usr
or /usr/local to $HOME/usr/
or similar. Alternatively, some software packaging environments have their own special flags to very simply allow per-user installations.
Automated installation
Several tools exist for users of different languages to distribute library packages, particularly where full compilation is not required. In these cases software needn't even be downloaded or unpacked: one command should do it all.
Emacs: the MELPA repository
Emacs users can install their own packages from the comprehensive MELPA repository. To set this up, put the following lines into your preferred emacs startup file (~/.emacs
or ~/.emacs.d/init.el
) then restart emacs:
(require 'package) (add-to-list 'package-archives (cons "melpa-stable" "https://stable.melpa.org/packages/") t) (package-initialize)
To browse the repository and install packages:
M-x list-packages
Python: pip3 / pip
See also the more general information on our python environment on DICE for instructions including the use of alternative python versions and the virtualenv
tools.
DICE carries the pip3
command for python3 library installation, respectively.
These allow automated download, build and installation of python packages to your home directory. This is usually as simple as typing one of:
$ pip3 install --user packagename
If you need the now-deprecated python 2 version, it's much the same:
$ pip install --user packagename
Software that you've obtained some other way will probably still use setuptools
; for these the process is just the same:
$ cd <project-directory> $ python3 setup.py --user install
— or, for much older software, you might still see —
$ easy_install --prefix=$HOME/.local packagename
to install your package for local use. Remember, if the package includes an executable you may wish to add $HOME/.local/bin
to your PATH
(see below).
Ruby: rubygems
DICE carries multiple versions of Ruby, all of which include the Ruby Gem system allowing simple user installation of ruby packages. Typically all that is required is:
$ gem install packagename
See also our Ruby page for further details including how to find all available versions.
Perl: CPAN
Using CPAN is rather unfortunately a skill in itself, but in theory it is very simple to install new software in this way. Simply type
$ cpan packagename
for the package of your choosing, and follow the prompts while CPAN sets up your environment, then downloads and installs the software for you.
Haskell: cabal
Cabal
is a package database for GHC which automates fetching, configuration, compilation and installation of Haskell libraries and programs. On DICE it is installed as part of the Haskell Platform, and also accessible via the stack
command. These tools (stack
and cabal
) can be used with locally-downloaded packages, or can automatically retrieve anything listed in Hackage.
For full details on use of these commands please see our Haskell page.
Building it yourself
If the repositories above don't have the software you require, it is assumed that you will have instead downloaded a piece of software, typically as a .zip
or .tar.gz
or similar, and unpacked it into a temporary directory. It is also assumed that you have downloaded the software from a trusted source. Step one is to open a terminal and cd
to that directory.
The next step is to identify what sort of software and build system the software uses. This can be determined by the presence or absence of a few files in the root of the unpacked files (or by reading the installation guide, typically on the application website or in a file named INSTALL
or README
.
The autoconf / automake process
A great deal of software is distributed as source files and uses a loosely standardised process for compilation and installation, sometimes known as the autoconf toolchain. You can usually tell this process by the presence of files such as 'configure', 'autoconf.*', 'Makefile.in' or the like. It generally doesn't hurt (but see the note below about --dry-run
to try a sequence along the lines of:
$ autoconf # (usually not required) $ ./configure --prefix=$HOME/usr/ $ make # sometimes with the PREFIX variable set $ make install # sometimes with the PREFIX or INSTALL_DIR variables set
checking carefully for errors along the way. If the ./configure
portion of the process is not possible or necessary, then it is usually necessary to set the PREFIX parameter in the Makefile to a directory in your home directory. It would also be wise to check first what the install process is planning on writing, since poorly-configured scripts could cause widespread damage to your home directory. You can do this with the --dry-run
argument to make
/ make install
.
Python: with setuptools
If your downloaded software takes the form of a python library, very often it will use the setuptools
system to automate installation. It's easy to see if the package uses setuptools: look for a file called setup.py
in the root of the pacakge. If this is the case, installation is usually very simple.
$ python3 setup.py install --user
This will install a copy of the software into your home directory and automatically add it to your python path. If the package includes executables, for example in ~/.local/bin
, you might need to add this directory to your PATH
(see below).
Latex: with tlmgr (the TeXLive manager)
TeX users normally maintain their packages in an ad-hoc manner for each typset document, but TeX Live supports user-specific package trees. You can learn about the tlmgr
command on our LaTeX on DICE page.
Lua: with luarocks
Users can install their own packages using the lua "rocks" system:
$ luarocks install --local twitter
Remember you will need to add $HOME/.luarocks/bin
to your path if your package includes an executable.
After Installation
Paths
Following installation, you might find that the executables you want to run aren't accessible from your shell. This is usually because the path to which the files have been installed, for example ~/.local/bin
or ~/usr/bin/
, haven't been added to your system path. The good news is that this only needs to be fixed once: simply add the relevant bin path in a line to your ~/.brc
file, like:
PATH=$PATH:$HOME/path/to/local/bin/dir
or
PATH=$HOME/path/to/local/bin/dir:$PATH
if you'd prefer the new binary to be executed in preference to a system-provided file.
See also more general information on software within informatics.