One place for hosting & domains

      Upgrade

      How To Upgrade to Ubuntu 20.04 Focal Fossa


      Introduction

      The Ubuntu operating system’s latest Long Term Support (LTS) release, Ubuntu 20.04 (Focal Fossa), was released on April 23, 2020. This guide will explain how to upgrade an Ubuntu system of version 18.04 or later to Ubuntu 20.04.

      Warning: As with almost any upgrade between major releases of an operating system, this process carries an inherent risk of failure, data loss, or broken software configuration. Comprehensive backups and extensive testing are strongly advised.

      To avoid these problems, we recommend migrating to a fresh Ubuntu 20.04 server rather than upgrading in-place. You may still need to review differences in software configuration when upgrading, but the core system will likely have greater stability. You can follow our series on how to migrate to a new Linux server to learn how to migrate between servers.

      Prerequisites

      This guide assumes that you have an Ubuntu 18.04 or later system configured with a sudo-enabled non-root user.

      Potential Pitfalls

      Although many systems can be upgraded in place without incident, it is often safer and more predictable to migrate to a major new release by installing the distribution from scratch, configuring services with careful testing along the way, and migrating application or user data as a separate step.

      You should never upgrade a production system without first testing all of your deployed software and services against the upgrade in a staging environment. Keep in mind that libraries, languages, and system services may have changed substantially. Before upgrading, consider reading the Focal Fossa Release Notes.

      Step 1 – Backing Up Your System

      Before attempting a major upgrade on any system, you should make sure you won’t lose data if the upgrade goes awry. The best way to accomplish this is to make a backup of your entire filesystem. Failing that, ensure that you have copies of user home directories, any custom configuration files, and data stored by services such as relational databases.

      On a DigitalOcean Droplet, one approach is to power down the system and take a snapshot (powering down ensures that the filesystem will be more consistent). See How to Create Snapshots of Droplets for more details on the snapshot process. After you have verified that the Ubuntu update was successful, you can delete the snapshot so that you will no longer be charged for its storage.

      For backup methods which will work on most Ubuntu systems, see How To Choose an Effective Backup Strategy for your VPS.

      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. Begin by updating the package list:

      Next, upgrade installed packages to their latest available versions:

      You will be shown a list of upgrades, and prompted to continue. Answer y for yes and press Enter.

      This process may take some time. Once it finishes, use the dist-upgrade command with apt-get, which will perform any additional upgrades that involve changing dependencies, adding or removing new packages as necessary. This will handle a set of upgrades which may have been held back by the previous apt upgrade step:

      Again, answer y when prompted to continue, and wait for upgrades to finish.

      Now that you have an up-to-date installation of Ubuntu, you can use do-release-upgrade to upgrade to the 20.04 release.

      Traditionally, Ubuntu releases have been upgradeable by changing Apt’s /etc/apt/sources.list – which specifies package repositories – and using apt-get dist-upgrade to perform the upgrade itself. Though this process is still likely to work, Ubuntu provides a tool called do-release-upgrade to make the upgrade safer and easier.

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

      Start by running do-release-upgrade with no options:

      If the new Ubuntu version has not been officially released yet, you may get the following output:

      Output

      Checking for a new Ubuntu release No new release found

      Note that on Ubuntu Server, the new LTS release isn’t made available to do-release-upgrade until its first point release, in this case 20.04.1. This usually comes a few months after the initial release date.

      If you don’t see an available release, add the -d option to upgrade to the development release:

      • sudo do-release-upgrade -d

      If you’re connected to your system over SSH, you’ll be asked whether you wish to continue. For virtual machines or managed servers you should keep in mind that losing SSH connectivity is a risk, particularly if you don’t have another means of remotely connecting to the system’s console (such as a web-based console feature, for example).

      For other systems under your control, remember that it’s safest to perform major operating system upgrades only when you have direct physical access to the machine.

      At the prompt, type y and press Enter to continue:

      Output

      Reading cache Checking package manager Continue running under SSH? This session appears to be running under ssh. It is not recommended to perform a upgrade over ssh currently because in case of failure it is harder to recover. If you continue, an additional ssh daemon will be started at port '1022'. Do you want to continue? Continue [yN]

      Next, you’ll be informed that do-release-upgrade is starting a new instance of sshd on port 1022:

      Output

      Starting additional sshd To make recovery in case of failure easier, an additional sshd will be started on port '1022'. If anything goes wrong with the running ssh you can still connect to the additional one. If you run a firewall, you may need to temporarily open this port. As this is potentially dangerous it's not done automatically. You can open the port with e.g.: 'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT' To continue please press [ENTER]

      Press Enter. Next, you may be warned that a mirror entry was not found. On DigitalOcean systems, it is safe to ignore this warning and proceed with the upgrade, since a local mirror for 20.04 is in fact available. Enter y:

      Output

      Updating repository information No valid mirror found While scanning your repository information no mirror entry for the upgrade was found. This can happen if you run an internal mirror or if the mirror information is out of date. Do you want to rewrite your 'sources.list' file anyway? If you choose 'Yes' here it will update all 'bionic' to 'focal' entries. If you select 'No' the upgrade will cancel. Continue [yN]

      Once the new package lists have been downloaded and changes calculated, you’ll be asked if you want to start the upgrade. Again, enter y to continue:

      Output

      Do you want to start the upgrade? 18 installed packages are no longer supported by Canonical. You can still get support from the community. 3 packages are going to be removed. 142 new packages are going to be installed. 452 packages are going to be upgraded. You have to download a total of 338 M. This download will take about 42 minutes with a 1Mbit DSL connection and about 13 hours with a 56k modem. Fetching and installing the upgrade can take several hours. Once the download has finished, the process cannot be canceled. Continue [yN] Details [d]

      New packages will now be retrieved, unpacked, and installed. Even if your system is on a fast connection, this will take a while.

      During the installation, you may be presented with interactive dialogs for various questions. For example, you may be asked if you want to automatically restart services when required:

      Service Restart Dialog

      In this case, it is safe to answer Yes. In other cases, you may be asked if you wish to replace a configuration file that you have modified. This is often a judgment call, and is likely to require knowledge about specific software that is outside the scope of this tutorial.

      Once new packages have finished installing, you’ll be asked whether you’re ready to remove obsolete packages. On a stock system with no custom configuration, it should be safe to enter y here. On a system you have modified heavily, you may wish to enter d and inspect the list of packages to be removed, in case it includes anything you’ll need to reinstall later.

      Output

      Remove obsolete packages? 53 packages are going to be removed. Continue [yN] Details [d]

      Finally, assuming all has gone well, you’ll be informed that the upgrade is complete and a restart is required. Enter y to continue:

      Output

      System upgrade is complete. Restart required To finish the upgrade, a restart is required. If you select 'y' the system will be restarted. Continue [yN]

      On an SSH session, you’ll likely see something like the following:

      Output

      Connection to 203.0.113.241 closed by remote host. Connection to 203.0.113.241 closed.

      You may need to press a key here to exit to your local prompt, since your SSH session will have terminated on the server end.

      Wait a moment for your server to reboot, then reconnect. On login, you should be greeted by a message confirming that you’re now on Focal Fossa :

      Output

      Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-29-generic x86_64)

      Conclusion

      You should now have a working Ubuntu 20.04 installation. From here, you likely need to investigate necessary configuration changes to services and deployed applications.

      You can find more 20.04 tutorials and questions on our Ubuntu 20.04 Tutorials tag page.



      Source link

      Upgrade Debian to the Newest Release


      Updated by Linode

      Written by Linode

      Debian repositories can be tracked either by codename (Wheezy, Jessie, etc.), or by status name (stable, testing, etc.). For example, Debian 9 Stretch is the stable release at the time of this writing; the status of Debian 8 (Jessie) is oldstable. Debian stable releases are eventually managed by the Debian Long Term Support (LTS) team for a total lifespan of about 5 years.

      Linode offers Debian’s stable and oldstable releases. When exclusively tracking the stable releases with APT, your system will upgrade whenever the stable release reaches its end of life. For example, if you’re tracking the stable release of Debian 8 and it reaches its end of life, your system will make available a number of new packages which will upgrade you to Debian 9.

      On the other hand, if you’re currently tracking repositories by codename, as Debian does by default, you will never upgrade beyond that codename release. This is the safest option and you can still manually upgrade to a newer Debian codename or release status name at any time.

      Caution

      While upstream maintainers try to ensure cross-compatibility and problem-free upgrades, there is risk involved in upgrading operating system versions.

      Before You Begin

      • You will need root access to your Linode, or a user account with sudo privileges.

      • Back up any important data stored on your Linode! If you subscribe to the Linode Backups service, we recommend taking a manual snapshot before upgrading your system. If you use a different backup service or application, you should do a manual backup now.

        Note

        You may also want to back up your configuration files (usually located in /etc/) in case they have changed in later versions of the software you are using. See our backup guides for more information.

      Prepare to Upgrade

      1. Verify that you are booting with Debian’s kernel using the GRUB 2 boot setting in the Linode Cloud Manager. We recommend you use the distribution-supplied kernel unless you have a specific reason not to.

      2. Exit the SSH session if you’re currently logged in to one and instead open a Lish session to your Linode. Lish will give you continuous access to your Linode whereas SSH could disconnect during the upgrade. Read more about Lish here.

      3. Install all available updates for your current Debian system:

        sudo apt update && sudo apt upgrade
        
      4. If you’ve set APT to pin any packages to a specific Debian version other than stable, You’ll need to disable APT pinning for those packages if you want them upgraded to those offered in the newest release.

      5. You may want to stop services which are non-essential to the system but important to your setup, such as a database service. This would be to ensure a graceful shutdown of the service to prevent data loss or system locks from causing problems. To stop a service, enter the following command, replacing mariadb with the name of the service you want to stop:

        sudo systemctl stop mariadb
        

        You can view all enabled services with:

        sudo systemctl list-unit-files --state=enabled
        

        View all currently running services:

        sudo systemctl list-units --state=running
        

      Upgrade Debian

      1. Edit your sources.list file to change all instances of the current codename to the new release codename. The example of upgrading from Debian 8 (Jessie) to Debian 9 (Stretch) is used below, so jessie is changed to stretch (or, alternatively from jessie to stable).

        /etc/apt/sources.list
        1
        2
        3
        4
        5
        6
        7
        8
        9
        
        deb http://mirrors.linode.com/debian stretch main
        deb-src http://mirrors.linode.com/debian stretch main
        
        deb http://mirrors.linode.com/debian-security/ stretch/updates main
        deb-src http://mirrors.linode.com/debian-security/ stretch/updates main
        
        # stretch-updates, previously known as 'volatile'
        deb http://mirrors.linode.com/debian stretch-updates main
        deb-src http://mirrors.linode.com/debian stretch-updates main

        Note

        Ensure any third party repositories are also tracking stretch. You will need to check with the maintainers of each package to ensure that their own repositories have been updated.

      2. Update your package lists and remove any old packages which were previously downloaded for installation:

        sudo apt update
        sudo apt-get clean
        
      3. The Debian 8 release notes recommend a two-part upgrade path to avoid removing packages you may want to keep. Perform the minimal upgrade.

        sudo apt upgrade
        
        • During the upgrade process, you will prompted whether you want to replace or keep the current GRUB 2 file. This is because Linode must edit /etc/default/grub from upstream to work properly with our infrastructure.

          Keep current Grub 2 configuration

          Choose Keep the local version currently installed. Further prompts about installing GRUB should be answered with installing to /dev/sda, then Continue without installing GRUB. GRUB is not needed in your disk MBR because your Linode boots from a GRUB installation provided by Linode’s host servers.

        • During the upgrade process, you’ll be prompted to review configuration files which you’ve modified to decide whether to keep or replace them with the upstream default file. An example:

            
          Configuration file '/etc/mysql/my.cnf'
          ==> Modified (by you or by a script) since installation.
          ==> Package distributor has shipped an updated version.
          What would you like to do about it ?  Your options are:
          Y or I  : install the package maintainer's version
          N or O  : keep your currently-installed version
          D     : show the differences between the versions
          
          
        • If your system is running Fail2ban, the upgrade will end with the error shown below. This is a known issue. See the troubleshooting section of this page to fix before proceeding further.

            
          Errors were encountered while processing:
           fail2ban
          E: Sub-process /usr/bin/dpkg returned an error code (1)
          
          
      4. Once the minimal upgrade above is completed, start the main upgrade:

        sudo apt dist-upgrade
        
      5. Reboot your system when the upgrade completes. You should still be in Lish. Monitor the Linode’s console output for errors as the system shuts down and reboots. Your Linode is now running the newest version of Debian Stable.

      6. Remove old and unused packages:

        sudo apt-get autoremove
        

      Troubleshooting

      Below are some known issues you may encounter when upgrading Debian. These are mainly just issues reported by our customers so you’ll want to monitor the debian-announce mailing list for more comprehensive information, and the lists of any third party packages you will install.

      Fail2ban

      When upgrading from Debian 8 to 9, you may experience problems because of a duplicate configuration option in /etc/fail2ban/jail.local if you copied it directly from /etc/fail2ban/jail.conf. This is currently a known issue. To fix this:

      1. Comment out port = anyport in /etc/fail2ban/jail.local (around line 155). The block should look similar to below:

        /etc/fail2ban/jail.local
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        
        [pam-generic]
        
        enabled  = false
        # pam-generic filter can be customized to monitor specific subset of 'tty's
        filter   = pam-generic
        # port actually must be irrelevant but lets leave it all for some possible uses
        port     = all
        banaction = iptables-allports
        #port     = anyport
        logpath  = /var/log/auth.log
        maxretry = 6
      2. Tell dpkg to reconfigure anything necessary:

        sudo dpkg --configure -a
        sudo apt-get install --fix-broken
        

      Upgrading Apache 2.2 to 2.4

      Upgrading from Debian 7 to 8 moves Apache from version 2.2 to 2.4. This version change can break existing websites if you’re already running Apache and requires adjusting configuration files. See our Upgrading Apache guide for more information.

      Find answers, ask questions, and help others.

      This guide is published under a CC BY-ND 4.0 license.



      Source link