Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 1 | ## Base packages and setup |
Filip Pytloun | 2516a61 | 2016-02-12 10:50:29 +0100 | [diff] [blame] | 2 | export DEBIAN_FRONTEND=noninteractive |
Filip Pytloun | cb52dd5 | 2016-02-01 10:42:54 +0100 | [diff] [blame] | 3 | echo "exit 101" > /usr/sbin/policy-rc.d |
| 4 | chmod +x /usr/sbin/policy-rc.d |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 5 | |
Filip Pytloun | aee95a8 | 2018-01-05 13:20:57 +0100 | [diff] [blame] | 6 | echo "Acquire::CompressionTypes::Order gz;" >/etc/apt/apt.conf.d/99compression-workaround-salt |
| 7 | |
azvyagintsev | d8f8523 | 2017-10-02 15:30:28 +0300 | [diff] [blame] | 8 | # Overwrite default mirrors |
| 9 | echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial main restricted multiverse universe" > /etc/apt/sources.list |
| 10 | echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-updates main restricted multiverse universe" >> /etc/apt/sources.list |
| 11 | echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-security main restricted multiverse universe" >> /etc/apt/sources.list |
| 12 | echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-backports main restricted multiverse universe" >> /etc/apt/sources.list |
Filip Pytloun | 4c96999 | 2017-02-20 14:42:09 +0100 | [diff] [blame] | 13 | |
Filip Pytloun | 2d3628a | 2017-10-03 12:22:51 +0200 | [diff] [blame] | 14 | # Add apt repository |
| 15 | echo "deb [arch=amd64] http://apt.mirantis.com/xenial/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list |
| 16 | echo "deb [arch=amd64] http://apt.mirantis.com/xenial/ nightly extra" > /etc/apt/sources.list.d/mcp_extra.list |
| 17 | curl -sf http://apt.mirantis.com/public.gpg | apt-key add - |
Filip Pytloun | 4c96999 | 2017-02-20 14:42:09 +0100 | [diff] [blame] | 18 | |
azvyagintsev | d8f8523 | 2017-10-02 15:30:28 +0300 | [diff] [blame] | 19 | apt-get clean |
| 20 | apt-get update |
| 21 | |
| 22 | # Useful tools |
| 23 | apt-get -y install byobu curl ethtool htop iputils-ping lsof strace tcpdump tmux traceroute tree vim-nox wget |
| 24 | # Install common prerequisites |
| 25 | apt-get -y install apt-transport-https libmnl0 python-apt python-m2crypto python-psutil |
| 26 | |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 27 | # Cleanup old kernels, ensure latest is installed via virtual package |
Filip Pytloun | 81fa31c | 2017-02-23 09:37:06 +0100 | [diff] [blame] | 28 | apt-get purge -y linux-image-* linux-headers-* |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 29 | if [ ! -f /tmp/no_install_kernel ]; then |
Filip Pytloun | 81fa31c | 2017-02-23 09:37:06 +0100 | [diff] [blame] | 30 | # Use HWE kernel |
Marek Celoud | b5ba6b7 | 2017-05-22 10:30:48 +0200 | [diff] [blame] | 31 | ## Temporary disable latest hwe due to: https://bugs.launchpad.net/ubuntu/+source/linux-hwe-edge/+bug/1679823 |
Richard Felkl | f8ed179 | 2018-03-19 14:21:06 +0100 | [diff] [blame^] | 32 | #apt-get install -y linux-image-4.8.0-41-generic linux-image-extra-4.8.0-41-generic |
| 33 | apt-get install -y linux-image-generic-hwe-16.04 |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 34 | |
| 35 | # Update grub cmdline |
| 36 | sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub |
| 37 | sed -i 's|GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub |
| 38 | update-grub |
| 39 | fi |
| 40 | |
| 41 | apt-get -y upgrade |
| 42 | apt-get -y dist-upgrade |
| 43 | |
| 44 | apt-get autoremove --purge |
| 45 | |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 46 | # Tmux fixes |
| 47 | cat << 'EOF' >> /etc/tmux.conf |
| 48 | set -g default-terminal "screen-256color" |
| 49 | set -g set-titles on |
| 50 | set -g xterm-keys on |
| 51 | EOF |
| 52 | |
| 53 | # Setup cloud-init |
| 54 | apt-get -y install cloud-init |
Filip Pytloun | 4c96999 | 2017-02-20 14:42:09 +0100 | [diff] [blame] | 55 | |
Jakub Josef | 4e8e332 | 2017-06-13 16:56:58 +0200 | [diff] [blame] | 56 | # Disable apt-daily |
azvyagintsev | d8f8523 | 2017-10-02 15:30:28 +0300 | [diff] [blame] | 57 | systemctl disable apt-daily.timer |
| 58 | |
| 59 | # Motd |
| 60 | apt-get -y install update-motd |
| 61 | rm -vf /etc/update-motd.d/* |
| 62 | echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S' -u)" > /etc/image_version |
| 63 | echo "BUILD_TIMESTAMP_RFC=\"$(date -u -R)\"" >> /etc/image_version |
| 64 | cat << 'EOF' >> /etc/update-motd.d/00-header-mirantis |
| 65 | #!/bin/sh |
| 66 | # |
| 67 | # 00-header - create the header of the MOTD |
| 68 | # |
| 69 | [ -r /etc/image_version ] && . /etc/image_version |
| 70 | echo "Ubuntu 16.04 \"Xenial\" Mirantis cloud image" |
| 71 | echo "Build date: ${BUILD_TIMESTAMP_RFC}" |
| 72 | EOF |
| 73 | chmod +x /etc/update-motd.d/00-header-mirantis |
| 74 | |