
ubuntu软件包降级命令

Ubuntu’s Update Manager keeps your packages at the latest version, but occasionally a new package version may not work properly. You can downgrade an installed package and lock it at a specific version to prevent it from being updated.
Ubuntu的更新管理器使您的软件包保持最新版本,但有时新版本的软件包可能无法正常工作。 您可以降级已安装的软件包并将其锁定在特定版本,以防止其被更新。
This is particularly useful when you run into an updated package with a regression – a bug that prevents things from working properly.
当您遇到带有回归的更新程序包时,此功能特别有用-一个导致事情无法正常进行的错误。
怎么运行的 (How It Works)
Your system generally has multiple versions of a package available in its repositories – for example, when Ubuntu updates a package, it places the new, updated package in a special updates repository. The old package is still located an Ubuntu’s main repository and can be installed with a few tricks. If you’ve installed a newer version of a package from a personal package archive (PPA), the older packages included with Ubuntu are still located in Ubuntu’s repositories.
您的系统通常在其存储库中有可用的软件包的多个版本-例如,当Ubuntu更新软件包时,它将新的,更新的软件包放置在特殊的更新存储库中。 旧软件包仍然位于Ubuntu的主存储库中,可以通过一些技巧进行安装。 如果您已经从个人软件包档案(PPA)安装了较新版本的软件包,则Ubuntu随附的旧软件包仍位于Ubuntu的存储库中。
As Synaptic warns us, this can cause problems with the package’s dependencies. Ubuntu’s software management system isn’t designed for downgrading packages – considering this an unsupported trick.
正如Synaptic警告我们的那样,这可能会导致程序包依赖项出现问题。 Ubuntu的软件管理系统不是为降级软件包而设计的-认为这是不受支持的技巧。
图形–突触 (Graphically – Synaptic)
The Ubuntu Software Center’s simplified interface doesn’t offer the option to downgrade packages. However, Synaptic, a more advanced graphical package manager interface that Ubuntu used to include, offers this option. To downgrade a package graphically, first install the Synaptic application.
Ubuntu软件中心的简化界面不提供降级软件包的选项。 但是,Synaptic(Ubuntu以前包括的更高级的图形包管理器界面)提供了此选项。 要以图形方式降级软件包,请首先安装Synaptic应用程序。

After you do, open the Synaptic Package Manager from the Dash.
完成后,从Dash打开Synaptic软件包管理器。

Search for the package you want to install an older version of in Synaptic, select it, and use the Package –> Force Version option.
搜索要在Synaptic中安装旧版本的软件包,选择它,然后使用Package –> Force Version选项。

Select the version you want to install and click Force Version. Synaptic will only show you versions available in your repositories.
选择要安装的版本,然后单击“强制版本”。 Synaptic只会向您显示存储库中可用的版本。

Click the Apply button to apply your changes and install the older version of the package, assuming everything works properly.
假定一切正常,请单击“应用”按钮以应用更改并安装较旧版本的软件包。

After you downgrade the package, select it and use the Package –> Lock Version option. If you don’t do this, Ubuntu will try to upgrade the installed package the next time you update your installed packages.
降级软件包后,选择它并使用Package –> Lock Version选项。 如果不这样做,Ubuntu将在下次更新已安装的软件包时尝试升级已安装的软件包。

终端机-apt-get (Terminal – apt-get)
You can install a specific version of a package with apt-get in the terminal. First, determine the available versions you can install with the following command
您可以在终端中使用apt-get安装特定版本的软件包。 首先,使用以下命令确定可以安装的可用版本
apt-cache showpkg packagename
apt-cache showpkg软件包名称

Next, run the apt-get install command and specify the package version you want to install.
接下来,运行apt-get install命令并指定要安装的软件包版本。
sudo apt-get install packagename=version
sudo apt-get install packagename =版本

After it’s installed, run the following command to hold your installed version, preventing the package manager from automatically updating it in the future:
安装后,运行以下命令来保存已安装的版本,以防止程序包管理器将来自动更新它:
sudo echo “package hold” | sudo dpkg –set-selections
sudo回声“包保持” | sudo dpkg –设置选择

翻译自: https://www.howtogeek.com/117929/how-to-downgrade-packages-on-ubuntu/
ubuntu软件包降级命令