github.com/hpcng/singularity@v3.1.1+incompatible/INSTALL.md (about) 1 # Installing Singularity 2 3 Since you are reading this from the Singularity source code, it will be assumed 4 that you are building/compiling. 5 6 For full instructions on installation, check out our 7 [installation guide](https://www.sylabs.io/guides/3.0/user-guide/installation.html). 8 9 ## Install system dependencies 10 11 You must first install development tools and libraries to your host. 12 On Debian-based systems: 13 14 ``` 15 $ sudo apt-get update && \ 16 sudo apt-get install -y build-essential \ 17 libssl-dev uuid-dev libgpgme11-dev libseccomp-dev pkg-config squashfs-tools 18 ``` 19 20 On CentOS/RHEL: 21 22 ``` 23 $ sudo yum groupinstall -y 'Development Tools' && \ 24 sudo yum install -y epel-release && \ 25 sudo yum install -y golang openssl-devel libuuid-devel libseccomp-devel squashfs-tools 26 ``` 27 28 On CentOS/RHEL 6 or less, you may skip `libseccomp-devel`. 29 30 ## Install Golang 31 32 This is one of several ways to [install and configure golang](https://golang.org/doc/install). The CentOS/RHEL instructions above already installed it so this method is not needed there. 33 34 First, download the Golang archive to `/tmp/`, then extract the archive to `/usr/local`. 35 36 ``` 37 $ export VERSION=1.11.4 OS=linux ARCH=amd64 # change this as you need 38 39 $ wget -O /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz https://dl.google.com/go/go${VERSION}.${OS}-${ARCH}.tar.gz && \ 40 sudo tar -C /usr/local -xzf /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz 41 ``` 42 43 Finally, set up your environment for Go: 44 45 ``` 46 $ echo 'export GOPATH=${HOME}/go' >> ~/.bashrc && \ 47 echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc && \ 48 source ~/.bashrc 49 ``` 50 51 ## Clone the repo 52 53 Golang is a bit finicky about where things are placed. Here is the correct way 54 to build Singularity from source: 55 56 ``` 57 $ mkdir -p ${GOPATH}/src/github.com/sylabs && \ 58 cd ${GOPATH}/src/github.com/sylabs && \ 59 git clone https://github.com/sylabs/singularity.git && \ 60 cd singularity 61 ``` 62 63 To build a stable version of Singularity, check out a [release tag](https://github.com/sylabs/singularity/tags) before compiling: 64 65 ``` 66 $ git checkout v3.1.1 67 ``` 68 69 ## Compiling Singularity 70 71 You can build Singularity using the following commands: 72 73 ``` 74 $ cd ${GOPATH}/src/github.com/sylabs/singularity && \ 75 ./mconfig && \ 76 cd ./builddir && \ 77 make && \ 78 sudo make install 79 ``` 80 81 And that's it! Now you can check your Singularity version by running: 82 83 ``` 84 $ singularity version 85 ``` 86 To build in a different folder and to set the install prefix to a different path: 87 88 ``` 89 $ ./mconfig -p /usr/local -b ./buildtree 90 ``` 91 92 ## Install from the RPM 93 94 *NOTE: You should only atempt to build the RPM on a CentOS/RHEL system.* 95 96 To build the RPM, you first need to install `rpm-build` and `wget`: 97 98 ``` 99 $ sudo yum -y update && sudo yum install -y rpm-build wget 100 ``` 101 102 Then download the latest 103 [release tarball](https://github.com/sylabs/singularity/releases) and use it to 104 install the RPM. Since we are building from the RPM, you don't need to install 105 Golang, but you do need to 106 [install the other dependencies](#install-system-dependencies). 107 108 ``` 109 $ export VERSION=3.1.1 # this is the singularity version, change as you need 110 111 $ wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz && \ 112 rpmbuild -tb singularity-${VERSION}.tar.gz && \ 113 sudo rpm -ivh ~/rpmbuild/RPMS/x86_64/singularity-${VERSION}-1.el7.x86_64.rpm && \ 114 rm -rf ~/rpmbuild singularity-${VERSION}*.tar.gz 115 ``` 116 117 Alternatively, to build an RPM from the latest master you can 118 [clone the repo as detailed above](#clone-the-repo). Then create your own 119 tarball and use it to install Singularity: 120 121 ``` 122 $ cd $GOPATH/src/github.com/sylabs/singularity && \ 123 ./mconfig && \ 124 make -C builddir rpm && \ 125 sudo rpm -ivh ~/rpmbuild/RPMS/x86_64/singularity-3.0.3-687.gf3da9de.el7.x86_64.rpm # or whatever version you built 126 ``` 127 128 To build an rpm with an alternative install prefix set RPMPREFIX on the 129 make step, for example: 130 131 ``` 132 $ make -C builddir rpm RPMPREFIX=/usr/local 133 ``` 134 135 For more information on installing/updating/uninstalling the RPM, check out our 136 [admin docs](https://www.sylabs.io/guides/3.0/admin-guide/admin_quickstart.html).