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