| ## Base packages and setup |
| export DEBIAN_FRONTEND=noninteractive |
| echo "exit 101" > /usr/sbin/policy-rc.d |
| chmod +x /usr/sbin/policy-rc.d |
| apt-get clean |
| apt-get update |
| |
| # Useful tools |
| apt-get -y install curl wget tmux vim-nox byobu iputils-ping traceroute htop tree lsof |
| |
| # Add apt-mk repository |
| echo "deb [arch=amd64] http://apt-mk.mirantis.com/xenial/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list |
| echo "deb [arch=amd64] http://apt-mk.mirantis.com/xenial/ nightly extra" > /etc/apt/sources.list.d/mcp_extra.list |
| curl -sf http://apt-mk.mirantis.com/public.gpg | apt-key add - |
| |
| # Cleanup old kernels, ensure latest is installed via virtual package |
| apt-get purge -y linux-image-* linux-headers-* |
| if [ ! -f /tmp/no_install_kernel ]; then |
| # Use HWE kernel |
| apt-get install -y linux-image-generic-hwe-16.04 |
| |
| # Update grub cmdline |
| sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub |
| sed -i 's|GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub |
| update-grub |
| fi |
| |
| apt-get -y upgrade |
| apt-get -y dist-upgrade |
| |
| apt-get autoremove --purge |
| |
| # Tmux fixes |
| cat << 'EOF' >> /etc/tmux.conf |
| set -g default-terminal "screen-256color" |
| set -g set-titles on |
| set -g xterm-keys on |
| EOF |
| |
| # Install common prerequisites |
| apt-get -y install apt-transport-https python-apt python-m2crypto python-psutil |
| |
| # Setup cloud-init |
| apt-get -y install cloud-init |
| |
| # Motd |
| apt-get install -y update-motd |
| rm -f /etc/update-motd.d/* |
| cat << EOF >> /etc/update-motd.d/52-info |
| Ubuntu 16.04 "Xenial" Mirantis cloud image |
| Build date: $(date -u -R) |
| |
| EOF |
| chmod +x /etc/update-motd.d/52-info |