# Upgrading Ubuntu Server LTS from 16.04 to 18.04

Ubuntu 18.04, aka Bionic Beaver, was released on 26 April 2018. In this post, I will try to explain how do I upgrade my Ubuntu server. I will also inform you about how I overcome the obstacles related to Python hosting.

## Step 1  -  Backing Up Your System

Before attempting a major upgrade to any system, you should make sure you won’t lose data if the upgrade fails. The best way to accomplish this is to make a backup of your entire file system.

On a DigitalOcean Droplet, one approach is to power down the system and take a snapshot (powering down ensures that the file system will be more consistent).

## Step 2  -  Updating Currently Installed Packages

Before beginning the release upgrade, it’s safest to update to the latest versions of all packages for the current release.

```bash
sudo apt-get update  
sudo apt-get upgrade  
sudo apt-get dist-upgrade
```

## Step 3  -  Upgrading with Ubuntu’s do-release-upgrade Tool

Ubuntu provides a tool called **do-release-upgrade** to make the upgrade safer and easier.

`do-release-upgrade` handles checking for new releases, updating `sources.list`, and a range of other tasks, and is the officially recommended upgrade path for server upgrades that must be performed over a remote connection.

```bash
sudo do-release-upgrade
```

If there is no new release, you can try to add `-d` option to upgrade to the development release. If everything goes well, you should reboot and use it happily.

### Problem 1: Python Virtual Environment

But I have a minor problem after upgrading, my python virtual environment doesn’t work. I have solved this by recreating each virtual environment and installing requirements by using the `requirements.txt` file.

### References

1.  [https://ubuntu.com/server/docs/upgrade-introduction](https://ubuntu.com/server/docs/upgrade-introduction)
    
2.  [https://docs.python.org/3/library/venv.html](https://docs.python.org/3/library/venv.html)
    
3.  [https://pip.pypa.io/en/stable/getting-started/?highlight=requirements.txt#install-multiple-packages-using-a-requirements-file](https://pip.pypa.io/en/stable/getting-started/?highlight=requirements.txt#install-multiple-packages-using-a-requirements-file)
