Filip Pytloun | 60411d1 | 2015-06-25 21:14:41 +0200 | [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 | e3181af | 2015-06-25 22:11:22 +0200 | [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 trusty main restricted multiverse universe" > /etc/apt/sources.list |
| 10 | echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted multiverse universe" >> /etc/apt/sources.list |
| 11 | echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted multiverse universe" >> /etc/apt/sources.list |
| 12 | echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-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/trusty/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list |
| 16 | echo "deb [arch=amd64] http://apt.mirantis.com/trusty/ 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 | e3181af | 2015-06-25 22:11:22 +0200 | [diff] [blame] | 27 | # Cleanup old kernels, ensure latest is installed via virtual package |
Filip Pytloun | 896f37b | 2015-06-25 18:35:42 +0200 | [diff] [blame] | 28 | apt-get purge -y linux-image-* linux-headers-* |
Filip Pytloun | 7b48fd2 | 2015-06-30 23:34:01 +0200 | [diff] [blame] | 29 | if [ ! -f /tmp/no_install_kernel ]; then |
Jakub Josef | cbf2015 | 2017-03-10 16:05:08 +0100 | [diff] [blame] | 30 | apt-get install -y linux-generic-lts-xenial |
Filip Pytloun | 7b48fd2 | 2015-06-30 23:34:01 +0200 | [diff] [blame] | 31 | |
| 32 | # Update grub cmdline |
| 33 | sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub |
| 34 | sed -i 's|GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub |
| 35 | update-grub |
| 36 | fi |
Filip Pytloun | e3181af | 2015-06-25 22:11:22 +0200 | [diff] [blame] | 37 | |
jan kaufman | a519d7b | 2015-03-04 00:51:47 +0100 | [diff] [blame] | 38 | apt-get -y upgrade |
| 39 | apt-get -y dist-upgrade |
jan kaufman | dfc08f0 | 2015-04-29 20:17:55 +0200 | [diff] [blame] | 40 | |
Filip Pytloun | e3181af | 2015-06-25 22:11:22 +0200 | [diff] [blame] | 41 | apt-get autoremove --purge |
| 42 | |
Filip Pytloun | 3983236 | 2015-06-25 18:05:47 +0200 | [diff] [blame] | 43 | # Tmux fixes |
| 44 | cat << 'EOF' >> /etc/tmux.conf |
| 45 | set -g default-terminal "screen-256color" |
| 46 | set -g set-titles on |
| 47 | set -g xterm-keys on |
| 48 | EOF |
Filip Pytloun | dd27ad8 | 2015-06-18 11:12:08 +0200 | [diff] [blame] | 49 | |
Petr Micahlec | 50f87e0 | 2017-04-13 11:38:22 +0200 | [diff] [blame] | 50 | # Install common prerequisites |
Alexander Noskov | 926853e | 2017-06-02 15:47:24 +0400 | [diff] [blame] | 51 | apt-get -y install apt-transport-https libmnl0 python-apt python-m2crypto python-psutil |
Petr Micahlec | 50f87e0 | 2017-04-13 11:38:22 +0200 | [diff] [blame] | 52 | |
Filip Pytloun | dd27ad8 | 2015-06-18 11:12:08 +0200 | [diff] [blame] | 53 | # Setup cloud-init |
jan kaufman | 0fcf1a7 | 2015-05-06 10:16:12 +0200 | [diff] [blame] | 54 | apt-get -y install cloud-init |
Filip Pytloun | 4c96999 | 2017-02-20 14:42:09 +0100 | [diff] [blame] | 55 | |
| 56 | # Motd |
azvyagintsev | d8f8523 | 2017-10-02 15:30:28 +0300 | [diff] [blame] | 57 | apt-get -y install update-motd |
| 58 | rm -vf /etc/update-motd.d/* |
| 59 | echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S' -u)" > /etc/image_version |
| 60 | echo "BUILD_TIMESTAMP_RFC=\"$(date -u -R)\"" >> /etc/image_version |
| 61 | cat << 'EOF' >> /etc/update-motd.d/00-header-mirantis |
| 62 | #!/bin/sh |
| 63 | # |
| 64 | # 00-header - create the header of the MOTD |
| 65 | # |
| 66 | [ -r /etc/image_version ] && . /etc/image_version |
| 67 | echo "Ubuntu 14.04 \"Trusty\" Mirantis cloud image" |
| 68 | echo "Build date: ${BUILD_TIMESTAMP_RFC}" |
Filip Pytloun | 4c96999 | 2017-02-20 14:42:09 +0100 | [diff] [blame] | 69 | EOF |
azvyagintsev | d8f8523 | 2017-10-02 15:30:28 +0300 | [diff] [blame] | 70 | chmod +x /etc/update-motd.d/00-header-mirantis |