fossa网络库_如何升级到Ubuntu 20.04 Focal Fossa

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.

Ubuntu操作系统的最新长期支持(LTS)版本Ubuntu 20.04(Focal Fossa)于2020年4月23日发布。本指南将说明如何将版本18.04或更高版本的Ubuntu系统升级到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.

为了避免这些问题,我们建议迁移到新的Ubuntu 20.04服务器,而不是就地升级。 升级时,您可能仍然需要检查软件配置的差异,但是核心系统可能会具有更高的稳定性。 您可以按照有关如何迁移到新Linux服务器的系列文章来学习如何在服务器之间迁移。

先决条件 (Prerequisites)

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

本指南假定您具有配置了启用了sudo的非root用户的Ubuntu 18.04或更高版本的系统。

潜在的陷阱 (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.

在临时环境中,首先对升级的所有软件和服务进行测试,然后再升级生产系统。 请记住,库,语言和系统服务可能已发生重大变化。 升级之前,请考虑阅读Focal Fossa发行说明

步骤1 –备份系统 (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.

在DigitalOcean Droplet上,一种方法是关闭系统电源并拍摄快照(关闭电源可确保文件系统更加一致)。 有关快照过程的更多详细信息,请参见如何创建液滴的快照。 确认Ubuntu更新成功后,您可以删除快照,这样就不再需要为它的存储付费。

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

有关适用于大多数Ubuntu系统的备份方法,请参见如何为VPS选择有效的备份策略

步骤2 –更新当前安装的软件包 (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:

在开始发行版本升级之前,最安全的是将当前版本的所有软件包更新为最新版本。 首先更新软件包列表:

  • sudo apt update

    sudo apt更新

Next, upgrade installed packages to their latest available versions:

接下来,将已安装的软件包升级到其最新可用版本:

  • sudo apt upgrade

    sudo apt升级

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

系统将显示升级列表,并提示您继续。 对y回答是,然后按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:

此过程可能需要一些时间。 完成后,将dist-upgrade命令与apt-get ,它将执行涉及更改依赖项,根据需要添加或删除新软件包的任何其他升级。 这将处理一组可能被先前的apt upgrade步骤阻止的apt upgrade

  • sudo apt dist-upgrade

    sudo apt dist-upgrade

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

同样,在提示您继续时回答y ,并等待升级完成。

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

现在您已经安装了最新的Ubuntu,可以使用do-release-upgrade升级到20.04版本。

第3步–使用Ubuntu的do-release-upgrade工具进行升级 (Step 3 – Upgrading with Ubuntu’s do-release-upgrade Tool)

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.

传统上,可以通过更改Apt的/etc/apt/sources.list (指定软件包存储库)并使用apt-get dist-upgrade upgrade自行执行apt-get dist-upgrade来升级Ubuntu版本。 尽管此过程仍然可行,但Ubuntu提供了一个名为do-release-upgrade的工具,以使升级更安全,更轻松。

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.

do-release-upgrade负责检查是否有新版本,更新sources.list和一系列其他任务,这是服务器升级的官方推荐升级路径,必须通过远程连接执行。

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

首先运行do-release-upgrade带任何选项的do-release-upgrade

  • sudo do-release-upgrade

    sudo do-release-upgrade

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

如果尚未正式发布新的Ubuntu版本,则可能会得到以下输出:


   
   
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.

请注意,在Ubuntu Server上,新的LTS版本直到其第一个发行版 (在本例中为20.04.1才可以用于do-release-upgrade 。 通常是在初始发布日期之后的几个月。

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

如果看不到可用版本,请添加-d选项以升级到开发版本:

  • sudo do-release-upgrade -d

    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).

如果通过SSH连接到系统,则会询问您是否要继续。 对于虚拟机或受管服务器,您应该记住,失去SSH连接是一种风险,特别是如果您没有其他远程连接到系统控制台的方法(例如,基于Web的控制台功能)时。

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:

在提示符下,键入y并按Enter继续:


   
   
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:

接下来,将通知您do-release-upgrade正在端口1022上启动sshd的新实例:


   
   
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:

Enter 。 接下来,可能会警告您未找到镜像条目。 在DigitalOcean系统上,可以忽略此警告并继续进行升级,因为实际上可以使用20.04的本地镜像。 输入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:

下载新的软件包列表并计算更改后,将询问您是否要开始升级。 再次输入y继续:


   
   
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:

在安装过程中,可能会向您显示有关各种问题的交互式对话框。 例如,系统可能会询问您是否要在需要时自动重新启动服务:

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.

新软件包安装完成后,系统会询问您是否准备删除过时的软件包。 在没有自定义配置的库存系统上,应该可以在此处输入y 。 在已进行大量修改的系统上,您可能希望输入d并检查要删除的软件包列表,以防万一它包含您以后需要重新安装的所有内容。


   
   
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:

最后,假设一切顺利,您将被告知升级已完成,并且需要重新启动。 输入y继续:


   
   
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:

在SSH会话上,您可能会看到类似以下的内容:


   
   
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.

您可能需要在此处按一个键以退出本地提示,因为您的SSH会话将在服务器端终止。

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 :

等待服务器重新启动,然后重新连接。 登录时,系统会显示一条消息,确认您现在位于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.

您现在应该可以正常工作的Ubuntu 20.04安装。 从这里开始,您可能需要研究对服务和已部署的应用程序进行必要的配置更改。

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

您可以在我们的Ubuntu 20.04 Tutorials标签页面上找到更多20.04教程和问题。

翻译自: https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-ubuntu-20-04-focal-fossa

fossa网络库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值