github.com/emate/nomad@v0.8.2-wo-binpacking/scripts/vagrant-linux-priv-config.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  export DEBIAN_FRONTEND=noninteractive
     4  
     5  # Update and ensure we have apt-add-repository
     6  apt-get update
     7  apt-get install -y software-properties-common
     8  
     9  # Add i386 architecture (for libraries)
    10  dpkg --add-architecture i386
    11  
    12  # Add the Docker repository
    13  apt-key adv \
    14  	--keyserver hkp://p80.pool.sks-keyservers.net:80 \
    15  	--recv-keys 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
    16  add-apt-repository \
    17  	"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    18  	$(lsb_release -cs) \
    19  	stable"
    20  
    21  # Update with i386, Go and Docker
    22  apt-get update
    23  
    24  # Install Core build utilities for Linux
    25  apt-get install -y \
    26  	build-essential \
    27  	git \
    28  	libc6-dev-i386 \
    29  	liblxc1 \
    30  	libpcre3-dev \
    31  	linux-libc-dev:i386 \
    32  	lxc-dev \
    33  	lxc-templates \
    34  	pkg-config \
    35  	zip
    36  
    37  # Install Development utilities
    38  apt-get install -y \
    39  	curl \
    40  	default-jre \
    41  	docker-ce \
    42  	htop \
    43  	jq \
    44  	qemu \
    45  	silversearcher-ag \
    46  	tree \
    47  	unzip \
    48  	vim
    49  
    50  # Install ARM build utilities
    51  apt-get install -y \
    52  	binutils-aarch64-linux-gnu \
    53  	binutils-arm-linux-gnueabihf \
    54  	gcc-5-aarch64-linux-gnu \
    55  	gcc-5-arm-linux-gnueabihf \
    56  	gcc-5-multilib-arm-linux-gnueabihf
    57  
    58  # Install Windows build utilities
    59  apt-get install -y \
    60  	binutils-mingw-w64 \
    61  	gcc-mingw-w64
    62  
    63  # Ensure everything is up to date
    64  apt-get upgrade -y
    65  
    66  # Restart Docker in case it got upgraded
    67  systemctl restart docker.service
    68  
    69  # Ensure Docker can be used by vagrant user
    70  usermod -aG docker vagrant
    71  
    72  # Set hostname -> IP to make advertisement work as expected
    73  ip=$(ip route get 1 | awk '{print $NF; exit}')
    74  hostname=$(hostname)
    75  sed -i -e "s/.*nomad.*/${ip} ${hostname}/" /etc/hosts
    76  
    77  # Ensure we cd into the working directory on login
    78  if ! grep "cd /opt/gopath/src/github.com/hashicorp/nomad" /home/vagrant/.profile ; then
    79  	echo 'cd /opt/gopath/src/github.com/hashicorp/nomad' >> /home/vagrant/.profile
    80  fi