**Warning: **As with almost any upgrade between major operating system versions, this process has inherent risks of failure, data loss, or software configuration corruption. It is strongly recommended to conduct a full backup and extensive testing.
To avoid these problems, we recommend migrating to a new Ubuntu 16.04 server as much as possible instead of upgrading in place. You may still need to check the software configuration differences when upgrading, but the core system may have higher stability.
The next long-term support version of the Ubuntu operating system 16.04 (Xenial Xerus) will be released on April 21, 2016.
Although it has not been released at the time of writing, it is possible to upgrade the 15.10 system to the 16.04 development version. This may help to test the upgrade process and the features of 16.04 itself before the official release date.
This guide will explain the process of the system, including (but not limited to) Tencent Cloud CVM running Ubuntu 15.10.
An Ubuntu server with a non-root account that can use the sudo
command has been set up, and the firewall has been turned on. Students who don’t have a server can buy it from here, but I personally recommend you to use the free Tencent Cloud Developer Lab for experimentation, and then buy server.
Although many systems can be upgraded without accidents, it is usually safer and more secure to migrate to a major new version by installing and distributing from scratch, carefully testing configuration services throughout the process, and migrating applications or user data as a separate migration. Predictable steps.
If you do not first test all deployed software and services for upgrades in the upgrade environment, you should not upgrade the production system. Keep in mind that libraries, languages, and system services may have changed significantly. In Ubuntu 16.04, important changes since the last LTS version include the switch to the systemd init system instead of Upstart, the emphasis on Python 3 support, and PHP 7 instead of PHP 5.
Before upgrading, please consider reading Xenial Xerus Release Notes.
Before attempting a major upgrade to any system, you should ensure that you will not lose data if the upgrade fails. The best way to achieve this is to back up the entire file system. If this is not possible, make sure you have a copy of the user home directory, any custom configuration files, and data stored by services such as relational databases.
On Tencent Cloud CVM, the easiest way is to shut down the system and take a snapshot (turning off the power ensures that the file system is more consistent). After confirming that the update is successful, you can delete the snapshot so that you are no longer charged.
Before starting to release an upgrade, the safest thing is to install the latest version of all packages for the current version. First update the package list:
sudo apt-get update
Next, upgrade the installed package to its latest version:
sudo apt-get upgrade
You will see the upgrade list and prompt to continue. Answer y to indicate yes, and then press Enter.
This process may take some time. After completion, use the dist-upgrade
command to perform the upgrade, including changing dependencies and adding or removing new packages as needed. This will handle a set of upgrades that may be blocked by the apt-get upgrade
aspect:
sudo apt-get dist-upgrade
Again, answer y when prompted to continue, and wait for the upgrade to complete.
Now that you have installed the latest version of Ubuntu 15.10, you can use do-release-upgrade
to upgrade to version 16.04.
First, make sure to install the update-manager-core
package:
sudo apt-get install update-manager-core
Traditionally, the Debian version can make the upgrade possible by changing the Apt/etc/apt/sources.list
that can specify the package repository, and use apt-get dist-upgrade
to perform the upgrade. Ubuntu is still a Debian-derived distribution, so this process may still be useful. Instead, we will use the tools provided by the do-release-upgrade
Ubuntu project to handle the release of new versions, update sources.list
, and a series of other tasks. This is the official recommended upgrade path for server upgrades and must be performed through a remote connection.
First run do-release-upgrade
without options:
sudo do-release-upgrade
If Ubuntu 16.04 has not been released, you should see the following:
Checking for a newUbuntu release
No newrelease found
To upgrade to 16.04 before the official release, please specify the -d
option to use the development version:
sudo do-release-upgrade -d
If you connect to your system via SSH, just like using Tencent Cloud CVM, you will be asked if you want to continue.
On CVM, upgrading via SSH is safe. Although do-upgrade-release
did not tell us this, you can use the console provided in the Tencent Cloud control panel to connect to your CVM without running SSH.
For virtual machines or hosted servers hosted by other providers, you should remember that losing SSH connections is a risk, especially if you have no other way to connect to the system's console remotely. For other systems you control, remember that major operating system upgrades can be performed most safely only when you have direct physical access to the machine.
At the prompt, type y and press Enter to continue:
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 incaseof 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] y
Next, you will be informed that do-release-upgrade
is starting a new instance sshd
on port 1022:
Starting additional sshd
To make recovery incaseof 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 the mirror entry cannot be found. On Tencent Cloud systems, you can safely ignore this warning and continue to upgrade, because the 16.04 local mirror is actually available. Enter y:
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 'trusty' to 'xenial' entries.
If you select 'No' the upgrade will cancel.
Continue [yN] y
After downloading the new package list and calculating the changes, you will be asked if you want to start the upgrade. Enter y again to continue:
Do you want to start the upgrade?
6 installed packages are no longer supported by Canonical. You can
still get support from the community.
9 packages are going to be removed.104newpackages are going to be
installed.399 packages are going to be upgraded.
You have to download a total of232 M. This download will take about
46 seconds with your connection.
Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.
Continue [yN] Details [d]y
The new package will now be retrieved, then unzipped and installed. Even if your system is in a fast connection state, it will take a while.
During the installation process, you may receive interactive dialogs with various questions. For example, you may be asked if you want to restart the service automatically when needed:
In this case, answering "yes" is safe. In other cases, the system may ask you if you want to replace the configuration file modified with the default version from the package being installed. This is usually a judgment call and may require knowledge of specific software outside the scope of this tutorial.
After the new package is installed, you will be asked if you are ready to remove the outdated package. On an inventory system without custom configuration, it should be safe to enter y here. On a system where you have made a lot of modifications, you may want to enter d and check the list of packages to be removed in case it contains anything you need to reinstall later.
Remove obsolete packages?
53 packages are going to be removed.
Continue [yN] Details [d]y
Finally, assuming everything went well, you will be told that the upgrade is complete and needs to be restarted. Enter y to continue:
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] y
In the SSH session, you may see the following:
=== Command detached fromwindow(Thu Apr 713:13:332016)====== Command terminated normally(Thu Apr 713:13:432016)===
You may need to press a key here to exit the local prompt, because your SSH session will be terminated on the server side. Wait for the system to restart, and then reconnect. When you log in, you will see a message confirming that you are using Xenial Xerus:
Welcome to Ubuntu Xenial Xerus(development branch)(GNU/Linux 4.4.0-17-generic x86_64)
You should now have a working Ubuntu 16.04 installation. From here, you may need to investigate necessary configuration changes to services and deployed applications.
For more Ubuntu tutorials, please go to [Tencent Cloud + Community] (https://cloud.tencent.com/developer?from=10680) to learn more.
Reference: "How To Upgrade to Ubuntu 16.04 LTS"
Recommended Posts