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.

This entry is 2 of 5 in the Upgrade On a Ubuntu Server Tutorial series. Keep reading the rest of the series:
  1. How to upgrade Ubuntu 16.04 to 18.04 LTS using terminal
  2. AWS Lightsail upgrade Ubuntu 16.04 LTS to 18.04 LTS
  3. How Do I Update Ubuntu Linux Softwares Using Command Line?
  4. HowTo: Upgrade To a Newer Version of Ubuntu 14.04 LTS
  5. Upgrade Ubuntu 18.04 to 20.04 LTS using command line

🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @