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 | 2516a61 | 2016-02-12 10:50:29 +0100 | [diff] [blame] | 5 | apt-get clean |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 6 | apt-get update |
| 7 | |
Filip Pytloun | 4c96999 | 2017-02-20 14:42:09 +0100 | [diff] [blame] | 8 | # Useful tools |
Filip Pytloun | 59641ac | 2017-03-23 17:06:08 +0100 | [diff] [blame] | 9 | apt-get -y install curl wget tmux vim-nox byobu iputils-ping traceroute htop tree lsof |
Filip Pytloun | 4c96999 | 2017-02-20 14:42:09 +0100 | [diff] [blame] | 10 | |
| 11 | # Add apt-mk repository |
Filip Pytloun | b975949 | 2017-03-22 18:41:00 +0100 | [diff] [blame] | 12 | echo "deb [arch=amd64] http://apt-mk.mirantis.com/xenial/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list |
| 13 | echo "deb [arch=amd64] http://apt-mk.mirantis.com/xenial/ nightly extra" > /etc/apt/sources.list.d/mcp_extra.list |
Filip Pytloun | 4c96999 | 2017-02-20 14:42:09 +0100 | [diff] [blame] | 14 | curl -sf http://apt-mk.mirantis.com/public.gpg | apt-key add - |
| 15 | |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 16 | # Cleanup old kernels, ensure latest is installed via virtual package |
Filip Pytloun | 81fa31c | 2017-02-23 09:37:06 +0100 | [diff] [blame] | 17 | apt-get purge -y linux-image-* linux-headers-* |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 18 | if [ ! -f /tmp/no_install_kernel ]; then |
Filip Pytloun | 81fa31c | 2017-02-23 09:37:06 +0100 | [diff] [blame] | 19 | # Use HWE kernel |
| 20 | apt-get install -y linux-image-generic-hwe-16.04 |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 21 | |
| 22 | # Update grub cmdline |
| 23 | sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub |
| 24 | sed -i 's|GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub |
| 25 | update-grub |
| 26 | fi |
| 27 | |
| 28 | apt-get -y upgrade |
| 29 | apt-get -y dist-upgrade |
| 30 | |
| 31 | apt-get autoremove --purge |
| 32 | |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 33 | # Tmux fixes |
| 34 | cat << 'EOF' >> /etc/tmux.conf |
| 35 | set -g default-terminal "screen-256color" |
| 36 | set -g set-titles on |
| 37 | set -g xterm-keys on |
| 38 | EOF |
| 39 | |
Petr Micahlec | 50f87e0 | 2017-04-13 11:38:22 +0200 | [diff] [blame^] | 40 | # Install common prerequisites |
| 41 | apt-get -y install apt-transport-https python-apt python-m2crypto python-psutil |
| 42 | |
Filip Pytloun | 7ae5c75 | 2016-01-15 13:48:38 +0100 | [diff] [blame] | 43 | # Setup cloud-init |
| 44 | apt-get -y install cloud-init |
Filip Pytloun | 4c96999 | 2017-02-20 14:42:09 +0100 | [diff] [blame] | 45 | |
| 46 | # Motd |
| 47 | apt-get install -y update-motd |
| 48 | rm -f /etc/update-motd.d/* |
| 49 | cat << EOF >> /etc/update-motd.d/52-info |
| 50 | Ubuntu 16.04 "Xenial" Mirantis cloud image |
| 51 | Build date: $(date -u -R) |
| 52 | |
| 53 | EOF |
| 54 | chmod +x /etc/update-motd.d/52-info |