Skip to content

Instantly share code, notes, and snippets.

@lowendscripts
Last active June 24, 2018 19:43
Show Gist options
  • Select an option

  • Save lowendscripts/e6e1d980af9e41806296c0dd5536bfaa to your computer and use it in GitHub Desktop.

Select an option

Save lowendscripts/e6e1d980af9e41806296c0dd5536bfaa to your computer and use it in GitHub Desktop.
# **UBUNTU 14.04 TO UBUNTU 16.04**
#
#
# To run this script, enter the following line (without the preceeding #) at the command line
# apt-get update;apt-get install -y ca-certificates;wget https://gist.github.com/lowendscripts/e6e1d980af9e41806296c0dd5536bfaa/raw/0b6bfd641fb22d429a9ffb4ec9fe5a0cdf7a32c8/1404_to_1604_installer.sh;bash 1404_to_1604_installer.sh
#
# 0) This is just here for the script version. If you are running the script version, and you become disconnected,
# you can resume the session upon reconnecting to SSH by entering the command screen -dr
# Delete the next two lines if you want to disable the kernel check
kernel_version=`uname -r`
if [ "$kernel_version" != 2.6.32-48-pve ]; then echo "Sorry, your kernel version has not been tested with this script. I am exiting for your own safety. If you do want to take the additional risk of testing the script on a kernel version it has not been tested with, delete the first two lines of this script."; exit 1; fi
cat >> 1404_to_1604.sh << EOF2
# 1) Install the ubuntu-14.04-x86_64-minimal template from the hosts control panel.
# 2) Log in as root using an SSH session. I do not recommend using the novnc terminal for the purposes of this tutorial
# 3) Check your kernel version by running the command
uname -r
# If the kernel version is not 2.6.32-48-pve, this tutorial has not been tested with it.
# Continuing is more risky than normal. Please add a post to the thread if you find it works with a different version.
# 4) Make two folders that are needed for the vzfifo.service files or links to be deployed in
mkdir -p /etc/systemd/system
mkdir -p /lib/systemd/system
# 5) Create the vzfifo.service file (this is a multiline command)
cat >> /lib/systemd/system/vzfifo.service << EOF
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=Tell that Container is started
ConditionPathExists=/proc/vz
ConditionPathExists=!/proc/bc
After=multi-user.target quotaon.service quotacheck.service
[Service]
Type=forking
ExecStart=/bin/touch /.vzfifo
TimeoutSec=0
RemainAfterExit=no
[Install]
WantedBy=multi-user.target
EOF
# 6) Create a symbolic link to the vzfifo.service file manually as systemd isn't installed yet.
ln -s /lib/systemd/system/vzfifo.service /etc/systemd/system/vzfifo.service
# 11) Run apt-get update, and upgrade all the existing packages to their latest versions.
apt-get update
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -y -o "Dpkg::Options::=--force-confnew" upgrade
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -y -o "Dpkg::Options::=--force-confnew" dist-upgrade
# 12) Change the distribution used by the /etc/apt/sources.list file from wheezy to jessie.
sed -i 's/trusty/xenial/g' /etc/apt/sources.list
# 13) Run apt-get update, and upgrade all the existing packages to their latest jessie versions.
apt-get update
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -y -o "Dpkg::Options::=--force-confnew" upgrade
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -y -o "Dpkg::Options::=--force-confnew" dist-upgrade
# 14) Apply some OpenVZ customisations
sed -i -e '/getty/d' /etc/inittab
sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/*syslog.conf
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
# 19) Run an apt-get autoclean and autoremov
apt-get autoclean -y
apt-get autoremove -y
# 20) Install and remove wide-dhcpv6-client and bind9 to avoid showing annoying insserv messages
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -y -o "Dpkg::Options::=--force-confnew" install wide-dhcpv6-client bind9 -y; apt purge wide-dhcpv6-client bind9;
# 21) Install upstart-sysv as this is a bit more compatible with the OpenVZ kernel and might avoid problems later
#apt-get install upstart-sysv -y
# 22) This is just to finish up the script version - ignore if installing manually
echo " #########################################"
echo " ### THE SCRIPT HAS NOW FINISHED ###"
echo " ### We are now rebooting. Reconnect ###"
echo " ### using your SSH client in a minute ###"
echo " ### or two! ###"
echo " #########################################"
sleep 5
reboot -f
# 21) This is just here for the script version - ignore if installing manually
EOF2
apt-get update; apt-get install screen apt-utils -y
screen -dm bash 1404_to_1604.sh
screen -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment