2020-04-29 13:16:12 +08:00
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
sudo apt -y update
sudo apt -y dist-upgrade
# Install common build dependencies and partitioning tools
2020-04-30 10:33:41 +08:00
sudo apt -y install at curl unzip tar libxt-dev gperf libxaw7-dev cifs-utils build-essential g++ zip libx11-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxinerama-dev libxcursor-dev yasm libnuma1 libnuma-dev python-six python3-six python-yaml flex libbison-dev autoconf libudev-dev libncurses5-dev libtool libxrandr-dev xutils-dev dh-autoreconf libgles2-mesa-dev ruby-full pkg-config
2020-04-29 13:16:12 +08:00
# Required by qt5-x11extras
sudo apt -y install libxkbcommon-dev libxkbcommon-x11-dev
# Required by libhdfs3
sudo apt -y install libkrb5-dev
2020-04-30 10:33:41 +08:00
# Install newer version of nasm than the apt package, required by intel-ipsec
2020-04-29 13:16:12 +08:00
mkdir /tmp/nasm
cd /tmp/nasm
curl -O https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.gz
tar -xf nasm-2.14.02.tar.gz
cd nasm-2.14.02/
2020-04-30 10:33:41 +08:00
./configure --prefix= /usr && make -j
2020-04-29 13:16:12 +08:00
sudo make install
cd ~
# Install the latest Haskell stack
2020-04-30 10:33:41 +08:00
curl -sSL https://get.haskellstack.org/ | sudo sh
2020-04-29 13:16:12 +08:00
# Install CUDA
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.2.89-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo dpkg -i cuda-repo-ubuntu1804_10.2.89-1_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo dpkg -i nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt -y update
sudo apt install -y --no-install-recommends cuda-compiler-10-2 cuda-libraries-dev-10-2 cuda-driver-dev-10-2 cuda-cudart-dev-10-2 libcublas10 cuda-curand-dev-10-2
sudo apt install -y --no-install-recommends libcudnn7-dev
sudo ln -s /usr/local/cuda-10.1/lib64/stubs/libcuda.so /usr/local/cuda-10.1/lib64/stubs/libcuda.so.1
# Install PowerShell
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt update
sudo add-apt-repository universe
sudo apt install -y powershell
2020-05-20 05:47:19 +08:00
# Install odbc
sudo apt install -y unixodbc-dev
2020-04-29 13:16:12 +08:00
# Write SMB credentials
sudo mkdir /etc/smbcredentials
smbCredentialFile = /etc/smbcredentials/$StorageAccountName .cred
echo " username= $StorageAccountName " | sudo tee $smbCredentialFile > /dev/null
echo " password= $StorageAccountKey " | sudo tee -a $smbCredentialFile > /dev/null
sudo chmod 600 $smbCredentialFile
2020-05-11 06:17:27 +08:00
# Mount the archives SMB share to /archives
sudo mkdir /archives -m= 777
echo " // $StorageAccountName .file.core.windows.net/archives /archives cifs nofail,vers=3.0,credentials= $smbCredentialFile ,serverino,dir_mode=0777,file_mode=0777 0 0 " | sudo tee -a /etc/fstab
# Create 'home' directory for haskell stack bits that want this
sudo mkdir -p /home/root -m= 777
2020-04-29 13:16:12 +08:00
# Delete /etc/debian_version to prevent Azure Pipelines Scale Set Agents from removing some of the above
sudo rm /etc/debian_version
# Install dependencies that the Azure Pipelines agent will want later to make launching VMs faster
# https://docs.microsoft.com/en-us/dotnet/core/install/dependencies?tabs=netcore31&pivots=os-linux
# (we assume libssl1.0.0 or equivalent is already installed to not accidentially change SSL certs)
apt install -y liblttng-ust0 libkrb5-3 zlib1g libicu60
2020-05-11 06:17:27 +08:00
# Create work trees for the Azure Pipelines agent so that it puts its work tree into temporary storage.
sudo chmod 777 /mnt
sudo mkdir /agent -m= 777
sudo ln -s /mnt /agent/_work