on lts13 help sign in
stackage/debian-bootstrap.sh
306 lines 10 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/commercialhaskell/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.6.5
30apt-get update
31apt-get install -y \
32 apt-transport-https \
33 build-essential \
34 cmake \
35 curl \
36 freeglut3-dev \
37 freetds-dev \
38 fsharp \
39 g++ \
40 gawk \
41 ghc-$GHCVER \
42 ghc-$GHCVER-dyn \
43 ghc-$GHCVER-htmldocs \
44 ghc-$GHCVER-prof \
45 git \
46 gnupg \
47 gradle \
48 hscolour \
49 libadns1-dev \
50 libaio1 \
51 libalut-dev \
52 libasound2-dev \
53 libblas-dev \
54 libbz2-dev \
55 libcairo2-dev \
56 libclang-3.9-dev \
57 libcurl4-openssl-dev \
58 libcwiid-dev \
59 libdevil-dev \
60 libedit-dev \
61 libedit2 \
62 libfftw3-dev \
63 libflac-dev \
64 libfreenect-dev \
65 libgd2-xpm-dev \
66 libgeoip-dev \
67 libgirepository1.0-dev \
68 libglfw3-dev \
69 libglib2.0-dev \
70 libglu1-mesa-dev \
71 libgmp3-dev \
72 libgnutls-dev \
73 libgsasl7-dev \
74 libgsl0-dev \
75 libgtk-3-dev \
76 libgtk2.0-dev \
77 libgtksourceview-3.0-dev \
78 libhidapi-dev \
79 libi2c-dev \
80 libicu-dev \
81 libimlib2-dev \
82 libjack-jackd2-dev \
83 libjavascriptcoregtk-4.0-dev \
84 libjudy-dev \
85 liblapack-dev \
86 libleveldb-dev \
87 liblmdb-dev \
88 liblzma-dev \
89 libmagic-dev \
90 libmagickcore-dev \
91 libmagickwand-dev \
92 libmarkdown2-dev \
93 libmono-2.0-dev \
94 libmp3lame-dev \
95 libmpfr-dev \
96 libmysqlclient-dev \
97 libncurses-dev \
98 libnfc-dev \
99 liboath-dev \
100 libnotify-dev \
101 libopenal-dev \
102 libopenmpi-dev \
103 libpango1.0-dev \
104 libpcap0.8-dev \
105 libpq-dev \
106 libre2-dev \
107 librocksdb-dev \
108 libsdl1.2-dev \
109 libsdl2-dev \
110 libsdl2-gfx-dev \
111 libsdl2-image-dev \
112 libsdl2-mixer-dev \
113 libsdl2-ttf-dev \
114 libsnappy-dev \
115 libsndfile1-dev \
116 libsox-dev \
117 libsqlite3-dev \
118 libssl-dev \
119 libsystemd-dev \
120 libtagc0-dev \
121 libtre-dev \
122 libudev-dev \
123 libusb-1.0-0-dev \
124 libvte-2.91-dev \
125 libwebkitgtk-3.0-dev \
126 libxau-dev \
127 libxml2-dev \
128 libxrandr-dev \
129 libxss-dev \
130 libyaml-dev \
131 libzip-dev \
132 libzstd-dev \
133 libzmq3-dev \
134 llvm-3.9 \
135 locales \
136 m4 \
137 minisat \
138 mono-mcs \
139 nettle-dev \
140 ninja-build \
141 nodejs \
142 npm \
143 openjdk-8-jdk \
144 python-mpltoolkits.basemap \
145 python3-matplotlib \
146 python3-numpy \
147 python3-pip \
148 r-base \
149 r-base-dev \
150 ruby-dev \
151 sudo \
152 unixodbc-dev \
153 wget \
154 xclip \
155 z3 \
156 zip \
157 zlib1g-dev
159# odbc
160curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
161curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list
162apt-get update
163ACCEPT_EULA=Y apt-get install msodbcsql17 -y
165locale-gen en_US.UTF-8
167curl -sSL https://get.haskellstack.org/ | sh
169# Put documentation where we expect it
170mv /opt/ghc/$GHCVER/share/doc/ghc-$GHCVER/ /opt/ghc/$GHCVER/share/doc/ghc
172# llvm-5.0 for GHC (separate since it needs wget)
173wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
174 && add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" \
175 && apt-get update \
176 && apt-get install -y llvm-5.0
178# llvm-7.0 for llvm-hs (separate since it needs wget)
179wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
180 && add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" \
181 && apt-get update \
182 && apt-get install -y llvm-7
184# Buggy versions of ld.bfd fail to link some Haskell packages:
185# https://sourceware.org/bugzilla/show_bug.cgi?id=17689. Gold is
186# faster anyways and uses less RAM.
187update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20
188update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
190# GHC requires a specific LLVM version on the system PATH for its LLVM backend.
191# This version is tracked here:
192# https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/LLVM/Installing
194# GHC 8.4 requires LLVM 5.0 tools (specifically, llc-5.0 and opt-5.0).
195update-alternatives --install "/usr/bin/llc" "llc" "/usr/bin/llc-5.0" 50
196update-alternatives --install "/usr/bin/opt" "opt" "/usr/bin/opt-5.0" 50
198# Made sure a "node" binary is in the path, as well as "nodejs".
199# A historical naming collision on Debian means that the binary is called "nodejs",
200# but some tools like tsc still expect "node" to exist.
201ln -s /usr/bin/nodejs /usr/bin/node
203# install ocilib dependencies then build and install ocilib
204cd /tmp \
205 && wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb \
206 && dpkg -i oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb \
207 && rm -f oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb \
208 && wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb \
209 && dpkg -i oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb \
210 && rm -f oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb \
211 && wget https://github.com/vrogier/ocilib/archive/v4.3.2.tar.gz \
212 && tar xvf v4.3.2.tar.gz \
213 && cd /tmp/ocilib-4.3.2 \
214 && ./configure --with-oracle-import=linkage \
215 --with-oracle-charset=ansi \
216 --with-oracle-headers-path=/usr/include/oracle/12.1/client64 \
217 --with-oracle-lib-path=/usr/lib/oracle/12.1/client64/lib \
218 && make \
219 && make install \
220 && cd \
221 && rm -rf /tmp/ocilib-4.3.2 \
222 && echo "/usr/local/lib" > /etc/ld.so.conf.d/usr-local.conf \
223 && echo "/usr/lib/oracle/12.1/client64/lib" > /etc/ld.so.conf.d/oracle-client.conf \
224 && ldconfig
226# Add JDK to system paths.
227echo "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/" > /etc/ld.so.conf.d/openjdk.conf \
228 && ldconfig
230# Install erlang/otp platform and its dependencies
231ERLANG_VERSION="20.2.2"
232ERLANG_DEB_FILE="esl-erlang_${ERLANG_VERSION}-1~debian~jessie_amd64.deb"
233pushd /tmp \
234 && wget https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/${ERLANG_DEB_FILE} \
235 && (dpkg -i ${ERLANG_DEB_FILE}; apt-get install -yf) \
236 && rm ${ERLANG_DEB_FILE} \
237 && popd
239# Install version 3 of the protobuf compiler. (The `protobuf-compiler` package only
240# supports version 2.)
241curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip \
242 && sudo unzip -o protoc-3.3.0-linux-x86_64.zip -d /usr bin/protoc \
243 && rm -f protoc-3.3.0-linux-x84_64.zip
245# Install the TensorFlow C API.
246curl https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.1.0.tar.gz > libtensorflow.tar.gz \
247 && sudo tar zxf libtensorflow.tar.gz -C /usr \
248 && rm libtensorflow.tar.gz \
249 && ldconfig
251# Install libsodium
252curl https://download.libsodium.org/libsodium/releases/LATEST.tar.gz > libsodium.tar.gz \
253 && sudo tar xfz libsodium.tar.gz -C /tmp \
254 && rm libsodium.tar.gz \
255 && cd /tmp/libsodium-stable \
256 && ./configure \
257 && make install
259# Install secp256k1
260cd /tmp \
261 && git clone https://github.com/bitcoin-core/secp256k1.git \
262 && cd secp256k1 \
263 && ./autogen.sh \
264 && ./configure --enable-module-recovery \
265 && make \
266 && make install
269# NOTE: also update Dockerfile when cuda version changes
270# Install CUDA toolkit
271# The current version can be found at: https://developer.nvidia.com/cuda-downloads
272CUDA_PKG=10.0.130-1
273CUDA_VER=10.0
274CUDA_APT=10-0
276pushd /tmp \
277 && wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_${CUDA_PKG}_amd64.deb \
278 && apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub \
279 && dpkg -i cuda-repo-ubuntu1604_${CUDA_PKG}_amd64.deb \
280 && apt-get update -qq \
281 && 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} \
282 && rm cuda-repo-ubuntu1604_${CUDA_PKG}_amd64.deb \
283 && export CUDA_PATH=/usr/local/cuda-${CUDA_VER} \
284 && export LD_LIBRARY_PATH=${CUDA_PATH}/nvvm/lib64:${LD_LIBRARY_PATH+x} \
285 && export LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH} \
286 && export PATH=${CUDA_PATH}/bin:${PATH} \
287 && popd
289# non-free repo for mediabus-fdk-aac
290apt-add-repository multiverse \
291 && apt-get update \
292 && apt-get install -y nvidia-cuda-dev
294# newer gcc version for yoga
295add-apt-repository ppa:ubuntu-toolchain-r/test \
296 && apt-get update \
297 && apt-get install gcc-7 \
298 && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
300export CLANG_PURE_LLVM_LIB_DIR=/usr/lib/llvm-3.9/lib;
301export CLANG_PURE_LLVM_INCLUDE_DIR=/usr/lib/llvm-3.9/include;
304# finally run:
305ldconfig
306# EOF: don't build anything below this line