How do I upgrade my existing Ubuntu installation?
It appears I'm unable to upgrade my Ubuntu version remotely from doing some research online. How should I go about updating my version of Ubuntu?
There are a couple of approaches to upgrading a server running Ubuntu. Below I've outlined a couple of popular approaches, highlighting pros/cons for each one.
First things first: BACK UP YOUR DATA. Sorry if that's a little aggressive, but I don't think I can overstate the importance of a backup whenever you're making any changes to your Linode. We have an excellent introductory guide on backups, including how to perform them yourself, using Linode's Backup Service, or using third-party tools:
A migration upgrade is when you create a separate server to migrate your data to. The one disadvantage of this, in comparison to an inline upgrade, is the cost involved with having multiple servers up and running. The benefit of this is that you can test configurations and services and verify that new packages are working while the out-dated OS is still operating, resulting in much less downtime.
Once you have your new Linode up and running, you can transfer the files from the old Linode to the new server. I'd recommend using the scp command to securely transfer the files.
One downside is that with any new server, you'll need to not only install and configure the packages, but you'll also need to take the time to make sure it's secure. For this, you can follow our Secure your Server guide.
*A benefit of this approach: if you spin up the server in the same data center as your other Linode, you can Swap the IPv4 address for the old Linode. After a reboot, your Linode's IP addresses are swapped, thus removing the need to update any DNS records.
Inline Upgrade / In-Place Upgrade
An inline upgrade can be done with a command of
sudo do-release-upgrade. That sounds great, right? A simple command to upgrade the OS. Unfortunately, this approach usually causes things to break, and then you're left with a server that's not working. This can be fine with a Linode that's meant as a side project, but if you need your server to be up for business, this won't work. Not only will you risk issues with packages, but it will also take time to run through the updates. Also, what happens if you borked server and don't have any backup? Yeah, not good.
Variation of Migration Upgrade
Instead of directly upgrading, or creating a whole new Linode, you can create a new Ubuntu image on your Linode, if there is space available to do so. You'll still need to move files around, but the migration would be from one disk to another on the same Linode. This would require downtime, as you shut down the Linode, perform set up, and migrate files. It's not recommended over the Migration Upgrade outlined above, but it is an option, should your Linode be a side project and you're looking to challenge yourself to do something new:
You can accomplish this on Linode Manager:
- From the Linode's Advanced screen, select Add a Disk
- On the pop-up, choose Create from Image, choosing the version of Ubuntu you want to upgrade to.
- This will create a new disk, but you'll need to create a new Configuration Profile.
- Create a new Configuration Profile:
- Put in a Label (I recommend using the Ubuntu version)
- Under Block Device Assignment, put the new Ubuntu disk in
- Add Swap to
/sdband the old Ubuntu disk in
- From the additional options of this new Configuration Profile, select `Boot this Config
- Once the Linode has rebooted, log in via SSH and install all the services you need
- After you have finished installing your services, mount your old Ubuntu disk:
- Your old files will then be listed under the
/media/sdcdirectory, and you can copy them to your new Ubuntu environment using the cp command.
Because this approach to an upgrade combines the reasons for downtime for both of the earlier approaches, it's not recommended, but I wanted to add it here in case you're looking for a challenge.
Thank you for the comments. One more question with regard to this. Is it a bad thing to stay on Ubuntu 19.0.4? I'm concerned about security more than anything. Do security updates still get delivered on an end of life version of Ubuntu?
Once it reaches end of life, it oes not get security updates. As a general rule, you are better to run an LTS (Long Term Support) version of Ubuntu if it's a more "critical" site you are running. LTS's are done on the even years in the 4th month with Ubuntu (i.e. 18.04, 20.04). LTS's are supported for 5 years.