on 0de8be9 help sign in
stackage/debian-bootstrap.sh
232 lines 7.6 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.1
30apt-get update
31apt-get install -y \
32 build-essential \
33 curl \
34 freeglut3-dev \
35 fsharp \
36 ghc-$GHCVER \
37 ghc-$GHCVER-dyn \
38 ghc-$GHCVER-htmldocs \
39 ghc-$GHCVER-prof \
40 git \
41 gradle \
42 hscolour \
43 libadns1-dev \
44 libaio1 \
45 libalut-dev \
46 libasound2-dev \
47 libblas-dev \
48 libbz2-dev \
49 libcairo2-dev \
50 libclang-3.9-dev \
51 libcurl4-openssl-dev \
52 libcwiid-dev \
53 libdevil-dev \
54 libedit-dev \
55 libedit2 \
56 libfftw3-dev \
57 libflac-dev \
58 libfreenect-dev \
59 libgd2-xpm-dev \
60 libgeoip-dev \
61 libgirepository1.0-dev \
62 libglfw3-dev \
63 libglib2.0-dev \
64 libglu1-mesa-dev \
65 libgmp3-dev \
66 libgnutls-dev \
67 libgsasl7-dev \
68 libgsl0-dev \
69 libgtk-3-dev \
70 libgtk2.0-dev \
71 libgtksourceview-3.0-dev \
72 libhidapi-dev \
73 libi2c-dev \
74 libicu-dev \
75 libimlib2-dev \
76 libjack-jackd2-dev \
77 libjudy-dev \
78 liblapack-dev \
79 libleveldb-dev \
80 liblmdb-dev \
81 liblzma-dev \
82 libmagic-dev \
83 libmagickcore-dev \
84 libmagickwand-dev \
85 libmarkdown2-dev \
86 libmono-2.0-dev \
87 libmp3lame-dev \
88 libmpfr-dev \
89 libmysqlclient-dev \
90 libncurses-dev \
91 libnfc-dev \
92 libnotify-dev \
93 libopenal-dev \
94 libpango1.0-dev \
95 libpcap0.8-dev \
96 libpq-dev \
97 libsdl1.2-dev \
98 libsdl2-dev \
99 libsdl2-gfx-dev \
100 libsdl2-image-dev \
101 libsdl2-mixer-dev \
102 libsdl2-ttf-dev \
103 libsnappy-dev \
104 libsndfile1-dev \
105 libsox-dev \
106 libsqlite3-dev \
107 libssl-dev \
108 libsystemd-dev \
109 libtagc0-dev \
110 libtre-dev \
111 libudev-dev \
112 libusb-1.0-0-dev \
113 libwebkitgtk-3.0-dev \
114 libxau-dev \
115 libxml2-dev \
116 libxrandr-dev \
117 libxss-dev \
118 libyaml-dev \
119 libzip-dev \
120 libzmq3-dev \
121 llvm-3.9 \
122 locales \
123 m4 \
124 minisat \
125 mono-mcs \
126 nettle-dev \
127 nodejs \
128 npm \
129 openjdk-8-jdk \
130 python-mpltoolkits.basemap \
131 python3-matplotlib \
132 python3-numpy \
133 python3-pip \
134 r-base \
135 r-base-dev \
136 ruby-dev \
137 sudo \
138 wget \
139 xclip \
140 z3 \
141 zip \
142 zlib1g-dev
144locale-gen en_US.UTF-8
146curl -sSL https://get.haskellstack.org/ | sh
148# Put documentation where we expect it
149mv /opt/ghc/$GHCVER/share/doc/ghc-$GHCVER/ /opt/ghc/$GHCVER/share/doc/ghc
151# Buggy versions of ld.bfd fail to link some Haskell packages:
152# https://sourceware.org/bugzilla/show_bug.cgi?id=17689. Gold is
153# faster anyways and uses less RAM.
154update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20
155update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
157# GHC requires a specific LLVM version on the system PATH for its LLVM backend.
158# This version is tracked here:
159# https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/LLVM/Installing
161# GHC 8.2 requires LLVM 3.9 tools (specifically, llc-3.9 and opt-3.9).
162update-alternatives --install "/usr/bin/llc" "llc" "/usr/bin/llc-3.9" 50
163update-alternatives --install "/usr/bin/opt" "opt" "/usr/bin/opt-3.9" 50
165# install ocilib dependencies then build and install ocilib
166cd /tmp \
167 && wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb \
168 && dpkg -i oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb \
169 && rm -f oracle-instantclient12.1-basiclite_12.1.0.2.0-2_amd64.deb \
170 && wget https://storage.googleapis.com/oracle.fpinsight.com/instantClient/oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb \
171 && dpkg -i oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb \
172 && rm -f oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb \
173 && wget https://github.com/vrogier/ocilib/archive/v4.3.2.tar.gz \
174 && tar xvf v4.3.2.tar.gz \
175 && cd /tmp/ocilib-4.3.2 \
176 && ./configure --with-oracle-import=linkage \
177 --with-oracle-charset=ansi \
178 --with-oracle-headers-path=/usr/include/oracle/12.1/client64 \
179 --with-oracle-lib-path=/usr/lib/oracle/12.1/client64/lib \
180 && make \
181 && make install \
182 && cd \
183 && rm -rf /tmp/ocilib-4.3.2 \
184 && echo "/usr/local/lib" > /etc/ld.so.conf.d/usr-local.conf \
185 && echo "/usr/lib/oracle/12.1/client64/lib" > /etc/ld.so.conf.d/oracle-client.conf \
186 && ldconfig
188# Add JDK to system paths.
189echo "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/" > /etc/ld.so.conf.d/openjdk.conf \
190 && ldconfig
192# llvm-4.0 for llvm-hs (separate since it needs wget)
193wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
194 && add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" \
195 && apt-get update \
196 && apt-get install -y llvm-5.0
198# Install version 3 of the protobuf compiler. (The `protobuf-compiler` package only
199# supports version 2.)
200curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip \
201 && sudo unzip -o protoc-3.3.0-linux-x86_64.zip -d /usr bin/protoc \
202 && rm -f protoc-3.3.0-linux-x84_64.zip
204# Install the TensorFlow C API.
205curl https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.1.0.tar.gz > libtensorflow.tar.gz \
206 && sudo tar zxf libtensorflow.tar.gz -C /usr \
207 && rm libtensorflow.tar.gz \
208 && ldconfig
210# NOTE: also update Dockerfile when cuda version changes
211# Install CUDA toolkit
212# The current version can be found at: https://developer.nvidia.com/cuda-downloads
213CUDA_PKG=8.0.61-1 # update this on new version
214CUDA_VER=${CUDA_PKG:0:3}
215CUDA_APT=${CUDA_VER/./-}
217pushd /tmp \
218 && wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_${CUDA_PKG}_amd64.deb \
219 && dpkg -i cuda-repo-ubuntu1604_${CUDA_PKG}_amd64.deb \
220 && apt-get update -qq \
221 && 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} \
222 && rm cuda-repo-ubuntu1604_${CUDA_PKG}_amd64.deb \
223 && export CUDA_PATH=/usr/local/cuda-${CUDA_VER} \
224 && export LD_LIBRARY_PATH=${CUDA_PATH}/nvvm/lib64:${LD_LIBRARY_PATH+x} \
225 && export LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH} \
226 && export PATH=${CUDA_PATH}/bin:${PATH} \
227 && popd
229## non-free repo for mediabus-fdk-aac
230#apt-add-repository multiverse \
231# && apt-get update \
232# && apt-get install -y libfdk-aac-dev