Home Linux AWS Lightsail upgrade Ubuntu 16.04 LTS to 18.04 LTS

AWS Lightsail upgrade Ubuntu 16.04 LTS to 18.04 LTS


By default, Lightsail will install Ubuntu 16.04 LTS. How do I upgrade to Ubuntu Linux 18.04 LTS when using AWS Lightsail cloud server? How do I upgrade to a newer version of Ubuntu such as Ubuntu Linux 18.04 LTS?

Ubuntu team recommend upgrading a Server Edition installation by using the do-release-upgrade command. Part of the update-manager-core package, it does not have any graphical dependencies and is installed by default. This page shows how to use the recommended upgrade method for AWS Lightsail box powered by Ubuntu Linux 16.04 LTS.


AWS Lightsail upgrade Ubuntu 16.04 LTS to 18.04 LTS

The procedure to upgrade Ubuntu 16.04 LTS to 18.04 LTS is as follows for AWS Lightsail server:

Step 1. Login to AWS Lightsail box

Use the ssh command:
$ ssh -i ~/path/to/your-key ubuntu@aws-ip-address

Step 2. Update existing system

Type the apt-get command or apt command:
$ sudo apt update
$ sudo apt upgrade

Reboot the Linux box if kernel was updated
$ sudo reboot
After reboot makes sure either UFW firewall is temporarily disabled or TCP port 1022 is open. One could use the TCP port 1022 during upgrade procedure if something went wrong. The following command can verify if any software firewall is working on your system or not:
$ sudo iptables -L -n -v

I have no firewall running on my box. However, if you have a firewall running, open ssh port 1022 using the following ufw syntax:
$ sudo ufw allow 1022/tcp comment 'Temp open port ssh tcp port 1022 for upgrade'

Step 3. How to upgrade to Ubuntu 18.04 LTS using do-release-upgrade

Upgrade the operating system to the latest release from the command-line by typing the following command:
$ sudo do-release-upgrade

Before continuing with the procedure, you must open port TCP port # 1022 for safety reasons if port ssh failed during updates. Login to aws lightsail console, click on the networking tab and open port 1022 as follows:

Now follow on-screen instructions. During upgrade procedure, you may be promoted to replace existing grub or ssh config file. Make sure you choose to keep existing version to avoid problems. After some time you will see “System upgrade is complete” message. Press y to restart your system to load updates kernel and operating system for your cloud server:

Step 4. Verification for AWS Lightsail instance

Login using the ssh command:
$ ssh -i ~/path/to/your-key ubuntu@aws-ip-address

Verify Ubuntu Linux kernel version with uname:
$ uname -r
Make sure all needed ports are open and running with the ss command or netstat command:
$ sudo ss -tulpn
$ sudo netstat -tulpn

Use grep command/egrep command or tail command/cat command to verify log files for errors:
$ dmesg
$ tail -f /path/to/log/files
$ egrep -i 'err|cri' /var/log/nginx/error.log

Step 5. Remove tcp port 1022 added to AWS Lightsail instance/networking

Login to AWS Lightsail, choose networking and edit rules link:

Remove custom TCP 1022 rule and click on the save button/link:

Finally, remove ufw rule if added:
$ sudo ufw delete allow 1022/tcp


And there you have it Ubuntu Linux 16.04 LTS updated to Ubuntu 18.04 LTS running on AWS Lightsail cloud. See this page for more info.




Please enter your comment!
Please enter your name here

Exit mobile version