云网牛站
所在位置:首页 > Linux软件 > 在Linux中安装和使用topgrade将已安装的软件包升级到最新版本

在Linux中安装和使用topgrade将已安装的软件包升级到最新版本

2019-04-08 08:45:54作者:叶云稿源:云网牛站

topgrade通过检测和运行相应的包管理器,将Linux系统上所有已安装的软件包升级到最新的可用版本,本文介绍在Linux操作系统中安装和使用topgrade的方法,以Ubuntu 18.04版本为例。

在Linux中安装和使用topgrade将已安装的软件包升级到最新版本

 

背景

作为Linux管理员,你必须使系统保持最新状态,以避免出现意外问题。作为最佳实践的一部分,我们必须使用最新的补丁以保护系统,为此你需要在一个月内至少执行一次修补操作,大多数情况下,你必须在修补以激活最新Linux内核后重新启动服务器。

如果你有一个系统,那么我们可以直接登录系统并执行不太重要的修补。即便如此,如果你的服务器具有相同的风格,那么你可以在shell脚本的帮助下执行修补。如果有大量服务器,那么我建议你使用任何并行实用程序,这将有助于我们并行执行修补,与shell脚本相比,它将节省大量时间,因为这与顺序顺序一致。此外分发包管理器不会升级与其他包管理器(如pip、npm、snap等)一起安装的包,topgrade实用程序可以满足你的要求。

 

下载链接

topgrade下载地址

 

安装topgrade的方法

Arch Linux用户可以使用AUR包,MacOS用户可以通过Homebrew安装topgrade,其他Linux用户使用二进制文件包编译。

安装在基于Arch的系统上:

$ yay -S topgrade

如果安装了cargo package manager,使用以下命令进行安装:

$ cargo install topgrade

 

使用方法

运行topgrade,它将运行以下步骤:

如果有任何更新可用于topgrade,请尝试自我升级。

Arch:运行yay或者回到pacman

CentOS/RHEL:运行yum升级

Fedora:运行dnf升级

Debian/Ubuntu:运行apt update && apt dist-upgrade

openSUSE:运行zypper refresh && zypper dist-upgrade

升级Vim/Neovim套餐。

如果安装了NPM,请运行npm update -g

升级Atom包

Linux:更新Flatpak软件包(参考:在Linux系统上安装并使用Flatpak的方法

Linux:更新snap包(参考:在Ubuntu 18.04/Debian上安装和使用Snap的方法

Linux:运行fwupdmgr以显示固件升级。

最后,它将运行needrestart以反弹所有服务。

在Linux中安装和使用topgrade将已安装的软件包升级到最新版本

现在,我们已成功安装了topgrade,因此,单独运行topgrade以升级系统上的所有内容,在Ubuntu 18.04 LTS上测试该实用程序,结果如下:

$ topgrade

―― System update ―――――――――――――――――

[sudo] password for daygeek:

Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease

Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]

Get:3 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]

Get:4 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]

.      

Get:16 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [45.2 kB]

Get:17 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,460 B]

Fetched 1,565 kB in 13s (117 kB/s)

Reading package lists... Done

Building dependency tree

Reading state information... Done

119 packages can be upgraded. Run 'apt list --upgradable' to see them.

Reading package lists... Done

Building dependency tree

Reading state information... Done

Calculating upgrade... Done

The following packages were automatically installed and are no longer required:

libopts25 linux-headers-4.15.0-45 linux-headers-4.15.0-45-generic linux-image-4.15.0-45-generic

linux-modules-4.15.0-29-generic linux-modules-4.15.0-45-generic linux-modules-extra-4.15.0-45-generic sntp

Use 'sudo apt autoremove' to remove them.

The following packages will be upgraded:

apport apport-gtk apt apt-utils cups cups-bsd cups-client cups-common cups-core-drivers cups-daemon cups-ipp-utils

cups-ppdc cups-server-common distro-info-data fwupdate fwupdate-signed gir1.2-dbusmenu-glib-0.4 gir1.2-gtk-3.0

gir1.2-packagekitglib-1.0 gir1.2-snapd-1 gnome-settings-daemon gnome-settings-daemon-schemas grub-common grub-pc

python3-httplib2 python3-problem-report samba-libs systemd systemd-sysv ubuntu-drivers-common udev ufw

unattended-upgrades xdg-desktop-portal xdg-desktop-portal-gtk

119 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Need to get 38.5 MB of archives.

After this operation, 475 kB of additional disk space will be used.

Do you want to continue? [Y/n]

.

.

Setting up grub-pc (2.02-2ubuntu8.13) ...

Installing for i386-pc platform.

Installation finished. No error reported.

Sourcing file `/etc/default/grub'

Generating grub configuration file ...

Found memtest86+ image: /boot/memtest86+.elf

Found memtest86+ image: /boot/memtest86+.bin

done

Setting up mesa-vdpau-drivers:amd64 (18.2.8-0ubuntu0~18.04.2) ...

Updating PPD files for cups ...

Setting up apport-gtk (2.20.9-0ubuntu7.6) ...

Setting up pulseaudio-module-bluetooth (1:11.1-1ubuntu7.2) ...

Processing triggers for libc-bin (2.27-3ubuntu1) ...

Processing triggers for initramfs-tools (0.130ubuntu3.7) ...

update-initramfs: Generating /boot/initrd.img-4.15.0-47-generic

一旦分发官方软件包更新完成,它将运行自我更新:

―― rustup ―――――――――――――――――

info: checking for self-updates

info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'

info: checking for self-updates

stable-x86_64-unknown-linux-gnu unchanged - rustc 1.33.0 (2aa4c46cf 2019-02-28)

然后,它将尝试更新与其他包管理器一起安装的包:

―― Flatpak User Packages ―――――――――――――――――

Looking for updates...

Looking for updates...

Updating in system:

org.gnome.Platform/x86_64/3.30                          flathub 862e6b8ec2b5

org.gnome.Platform.Locale/x86_64/3.30                   flathub 5e66e981ae00

org.freedesktop.Platform.html5-codecs/x86_64/18.08      flathub 282fd2c4ef33

com.github.muriloventuroso.easyssh/x86_64/stable        flathub c6bc3a3e72fb

new permissions: ssh-auth

com.github.muriloventuroso.easyssh.Locale/x86_64/stable flathub b705864b8d78

Updating: org.gnome.Platform/x86_64/3.30 from flathub

[####################] 16 delta parts, 10 loose fetched; 65539 KiB transferred in 63 seconds

Error: Failed to update org.gnome.Platform/x86_64/3.30: Flatpak system operation Deploy not allowed for user

Skipping org.gnome.Platform.Locale/x86_64/3.30 due to previous error

Skipping org.freedesktop.Platform.html5-codecs/x86_64/18.08 due to previous error

Updating: com.github.muriloventuroso.easyssh/x86_64/stable from flathub

[####################] 2 delta parts, 3 loose fetched; 1532 KiB transferred in 5 seconds

Error: Failed to update com.github.muriloventuroso.easyssh/x86_64/stable: Flatpak system operation Deploy not allowed for user

Skipping com.github.muriloventuroso.easyssh.Locale/x86_64/stable due to previous error

error: There were one or more errors

Retry? [y/N]

然后它将运行firmwre升级:

―― Firmware upgrades ―――――――――――――――――

Fetching metadata https://cdn.fwupd.org/downloads/firmware.xml.gz

Downloading…           [***************************************]

Fetching signature https://cdn.fwupd.org/downloads/firmware.xml.gz.asc

最后,它显示了有关修补的信息:

―― Summary ―――――――――――――――――

System update: OK

rustup: OK

Flatpak User Packages: FAILED

Firmware upgrade: OK

至此,使用topgrade达到了目的。

 

相关主题

使用apt-get在Ubuntu/Debian系统中升级单个软件包的方法

精选文章
热门文章