vcpkg/scripts/azure-pipelines/linux/provision-image.sh
Alexander Neumann b4f3e5854a
[CI|gfortran] Install gfortran for OSX and Linux CI (#11693)
* [CI|gfortran] Install gfortran for OSX and Linux CI

* [osx] use cask
2020-06-05 12:13:32 -07:00

75 lines
3.5 KiB
Bash
Executable File

#!/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
sudo apt -y install at curl unzip tar libxt-dev gperf libxaw7-dev cifs-utils build-essential g++ gfortran 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
# Required by qt5-x11extras
sudo apt -y install libxkbcommon-dev libxkbcommon-x11-dev
# Required by libhdfs3
sudo apt -y install libkrb5-dev
# Required by mesa
sudo apt -y install python3-setuptools
# Install newer version of nasm than the apt package, required by intel-ipsec
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/
./configure --prefix=/usr && make -j
sudo make install
cd ~
# Install the latest Haskell stack
curl -sSL https://get.haskellstack.org/ | sudo sh
# 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
# 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
# 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
# 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
# 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