on lts10 help sign in
stackage/debian-bootstrap.sh
245 lines 8.0 kB history raw
1#!/usr/bin/env bash
3# Work in progress: create a list of commands necessary to get Stackage
4# up-and-running on a freshly installed Debian-based system (including Ubuntu).
6# Quick start:
7# wget -O - https://raw.github.com/fpco/stackage/master/debian-bootstrap.sh | bash -ex
9# NOTE: Requires that GHC and Cabal are installed and on your PATH. For
10# instructions, see:
11# http://www.stackage.org/install
13set -exu
15mkdir /home/stackage -p
17export DEBIAN_FRONTEND=noninteractive
18apt-get update
19apt-get install -y software-properties-common
21add-apt-repository ppa:hvr/ghc -y
22add-apt-repository -y ppa:marutter/rrutter
23apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
24add-apt-repository -y --keyserver hkp://keyserver.ubuntu.com:80 'deb http://download.mono-project.com/repo/debian wheezy main'
25add-apt-repository -y --keyserver hkp://keyserver.ubuntu.com:80 'deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main'
26add-apt-repository -y --keyserver hkp://keyserver.ubuntu.com:80 'deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main'
28GHCVER=8.2.2
30apt-get update
31apt-get install -y \
32 build-essential \
33 cmake \
34 curl \
35 freeglut3-dev \
36 fsharp \
37 g++ \
38 gawk \
39 ghc-$GHCVER \
40 ghc-$GHCVER-dyn \
41 ghc-$GHCVER-htmldocs \
42 ghc-$GHCVER-prof \
43 git \
44 gradle \
45 hscolour \
46 libadns1-dev \
47 libaio1 \
48 libalut-dev \
49 libasound2-dev \
50 libblas-dev \
51 libbz2-dev \
52 libcairo2-dev \
53 libclang-3.9-dev \
54 libcurl4-openssl-dev \
55 libcwiid-dev \
56 libdevil-dev \
57 libedit-dev \
58 libedit2 \
59 libfftw3-dev \
60 libflac-dev \
61 libfreenect-dev \
62 libgd2-xpm-dev \
63 libgeoip-dev \
64 libgirepository1.0-dev \
65 libglfw3-dev \
66 libglib2.0-dev \
67 libglu1-mesa-dev \
68 libgmp3-dev \
69 libgnutls-dev \
70 libgsasl7-dev \
71 libgsl0-dev \
72 libgtk-3-dev \
73 libgtk2.0-dev \
74 libgtksourceview-3.0-dev \
75 libhidapi-dev \
76 libi2c-dev \
77 libicu-dev \
78 libimlib2-dev \
79 libjack-jackd2-dev \
80 libjavascriptcoregtk-4.0-dev \
81 libjudy-dev \
82 liblapack-dev \
83 libleveldb-dev \
84 liblmdb-dev \
85 liblzma-dev \
86 libmagic-dev \
87 libmagickcore-dev \
88 libmagickwand-dev \
89 libmarkdown2-dev \
90 libmono-2.0-dev \
91 libmp3lame-dev \
92 libmpfr-dev \
93 libmysqlclient-dev \
94 libncurses-dev \
95 libnfc-dev \
96 liboath-dev \
97 libnotify-dev \
98 libopenal-dev \
99 libpango1.0-dev \
100 libpcap0.8-dev \
101 libpq-dev \
102 libre2-dev \
103 libsdl1.2-dev \
104 libsdl2-dev \
105 libsdl2-gfx-dev \
106 libsdl2-image-dev \
107 libsdl2-mixer-dev \
108 libsdl2-ttf-dev \
109 libsnappy-dev \
110 libsndfile1-dev \
111 libsox-dev \
112 libsqlite3-dev \
113 libssl-dev \
114 libsystemd-dev \
115 libtagc0-dev \
116 libtre-dev \
117 libudev-dev \
118 libusb-1.0-0-dev \
119 libwebkitgtk-3.0-dev \
120 libxau-dev \
121 libxml2-dev \
122 libxrandr-dev \
123 libxss-dev \
124 libyaml-dev \
125 libzip-dev \
126 libzstd-dev \
127 libzmq3-dev \
128 llvm-3.9 \
129 locales \
130 m4 \
131 minisat \
132 mono-mcs \
133 nettle-dev \
134 ninja-build \
135 nodejs \
136 npm \
137 openjdk-8-jdk \
138 python-mpltoolkits.basemap \
139 python3-matplotlib \
140 python3-numpy \
141 python3-pip \
142 r-base \
143 r-base-dev \
144 ruby-dev \
145 sudo \
146 wget \
147 xclip \
148 z3 \
149 zip \
150 zlib1g-dev
152locale-gen en_US.UTF-8
154curl -sSL https://get.haskellstack.org/ | sh
156# Put documentation where we expect it
157mv /opt/ghc/$GHCVER/share/doc/ghc-$GHCVER/ /opt/ghc/$GHCVER/share/doc/ghc
159# Buggy versions of ld.bfd fail to link some Haskell packages:
160# https://sourceware.org/bugzilla/show_bug.cgi?id=17689. Gold is
161# faster anyways and uses less RAM.
162update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20
163update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
165# GHC requires a specific LLVM version on the system PATH for its LLVM backend.
166# This version is tracked here:
167# https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/LLVM/Installing
169# GHC 8.2 requires LLVM 3.9 tools (specifically, llc-3.9 and opt-3.9).
170update-alternatives --install "/usr/bin/llc" "llc" "/usr/bin/llc-3.9" 50
171update-alternatives --install "/usr/bin/opt" "opt" "/usr/bin/opt-3.9" 50
173# Made sure a "node" binary is in the path, as well as "nodejs".
174# A historical naming collision on Debian means that the binary is called "nodejs",
175# but some tools like tsc still expect "node" to exist.
176ln -s /usr/bin/nodejs /usr/bin/node
178# install ocilib dependencies then build and install ocilib
179cd /tmp \
180 && wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb \
181 && dpkg -i oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb \
182 && rm -f oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb \
183 && wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb \
184 && dpkg -i oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb \
185 && rm -f oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb \
186 && wget https://github.com/vrogier/ocilib/archive/v4.3.2.tar.gz \
187 && tar xvf v4.3.2.tar.gz \
188 && cd /tmp/ocilib-4.3.2 \
189 && ./configure --with-oracle-import=linkage \
190 --with-oracle-charset=ansi \
191 --with-oracle-headers-path=/usr/include/oracle/12.1/client64 \
192 --with-oracle-lib-path=/usr/lib/oracle/12.1/client64/lib \
193 && make \
194 && make install \
195 && cd \
196 && rm -rf /tmp/ocilib-4.3.2 \
197 && echo "/usr/local/lib" > /etc/ld.so.conf.d/usr-local.conf \
198 && echo "/usr/lib/oracle/12.1/client64/lib" > /etc/ld.so.conf.d/oracle-client.conf \
199 && ldconfig
201# Add JDK to system paths.
202echo "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/" > /etc/ld.so.conf.d/openjdk.conf \
203 && ldconfig
205# llvm-4.0 for llvm-hs (separate since it needs wget)
206wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
207 && add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" \
208 && apt-get update \
209 && apt-get install -y llvm-5.0
211# Install version 3 of the protobuf compiler. (The `protobuf-compiler` package only
212# supports version 2.)
213curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip \
214 && sudo unzip -o protoc-3.3.0-linux-x86_64.zip -d /usr bin/protoc \
215 && rm -f protoc-3.3.0-linux-x84_64.zip
217# Install the TensorFlow C API.
218curl https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.1.0.tar.gz > libtensorflow.tar.gz \
219 && sudo tar zxf libtensorflow.tar.gz -C /usr \
220 && rm libtensorflow.tar.gz \
221 && ldconfig
223# NOTE: also update Dockerfile when cuda version changes
224# Install CUDA toolkit
225# The current version can be found at: https://developer.nvidia.com/cuda-downloads
226CUDA_PKG=8.0.61-1 # update this on new version
227CUDA_VER=${CUDA_PKG:0:3}
228CUDA_APT=${CUDA_VER/./-}
230pushd /tmp \
231 && wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_${CUDA_PKG}_amd64.deb \
232 && dpkg -i cuda-repo-ubuntu1604_${CUDA_PKG}_amd64.deb \
233 && apt-get update -qq \
234 && apt-get install -y cuda-drivers cuda-core-${CUDA_APT} cuda-cudart-dev-${CUDA_APT} cuda-cufft-dev-${CUDA_APT} cuda-cublas-dev-${CUDA_APT} cuda-cusparse-dev-${CUDA_APT} cuda-cusolver-dev-${CUDA_APT} \
235 && rm cuda-repo-ubuntu1604_${CUDA_PKG}_amd64.deb \
236 && export CUDA_PATH=/usr/local/cuda-${CUDA_VER} \
237 && export LD_LIBRARY_PATH=${CUDA_PATH}/nvvm/lib64:${LD_LIBRARY_PATH+x} \
238 && export LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH} \
239 && export PATH=${CUDA_PATH}/bin:${PATH} \
240 && popd
242# non-free repo for mediabus-fdk-aac
243apt-add-repository multiverse \
244 && apt-get update \
245 && apt-get install -y nvidia-cuda-dev