< OS 有关 > Ubuntu 版本升级 实践 24.04 -> 24.10, 安装 .NET

原因:

想安装 .NET 9 去编译 GitHut 项目,这回用不熟悉的 Ubuntu来做,不知道怎么拐去给 Ubuntu 升级,看到现在版本是 24.10 但不是 LTS 版本,记录下升级过程。

一、实践过程:

1. 查看当前版本

命令1: 

lsb_release -a

命令 2:

hostnamectl

这个在 QNAP 的 Ubuntu Linux Station 是 24.04.01 LTS

命令 3:

cat /etc/os-release

2. 版本升级

1)必要的软件包:

  • update-manager (需要有图形显示)  : 管理软件更新与升级的,以命令行来运行的工具。我读文章时没领悟到,当运后明白了 “update-manager is a command-line utility in Ubuntu that provides a graphical interface for managing software updates and upgrades” :
  • update-manager-core :核心软件包,在 Ubuntu 中管理软件更新功能。

2)安装必要软件包:

sudo apt install update-manager update-manager-core

3)安装升级 (终端里,无图形界面)

sudo do-release-upgrade -c

上面信息表示:在 /etc/update-manager/release-upgrades 文件里,被设置为不支持升级。

不支持升级的解决方法:

修改上面提到的文件

sudo vi /etc/update-manager/release-upgrades

把 Prompt 从 never 改为你想要到,我用的是 lts,防止误升级到非 LTS 版。

解释各参数含义:

Prompt=normal:如果有多个升级,升级到最新的。但不升会级到 LTS 版本。
Prompt=lts:如果有多个升级,升级到最近的 LTS。
我在网上查,还有个 any,但在我的配置文件中,没有提到。

再次运行:

程序已经测试到有新的版本,但不是 LTS 版本,所以没有升级。

说明正常

如果你使用非 TLS 或接受从 TLS 升级到非 TLS版本,在上面的文件里,参数改为 normal,再运行这个命令。 大版本升级需要重启系统的,做之前先备份。 不然跟做 rm -fr / 没什么区别。 

业务系统,先在测试环境跑通,写出 SOP 验证后再上手。

二、在 Ubuntu 安装 .NET

参考文档:

Install .NET on Ubuntu - .NET | Microsoft Learn

以下只是翻译

1. 添加软件仓库

sudo add-apt-repository ppa:dotnet/backports

2. 安装 SDK

sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-9.0

3. 安装 Runtime

1) 有 ASP.NET core

sudo apt-get update && \
  sudo apt-get install -y aspnetcore-runtime-9.0

2) 没有 ASP.NET core

sudo apt-get install -y dotnet-runtime-9.0

在微软文章中有提:依赖关系

Breaking change: System.Drawing.Common only supported on Windows - .NET | Microsoft Learn

检查安装依赖包:

多说一点, 用 dpkg 命令查询是否已经安装上图中和软件包:

for package in ca-certificates libc6 libgcc-s1 libicu74 liblttng-ust1 libssl3 libstdc++6 libunwind8 zlib1g; do dpkg -s "$package"; done

输出如下:

admin@ub1:~$ for package in ca-certificates libc6 libgcc-s1 libicu74 liblttng-ust1 libssl3 libstdc++6 libunwind8 zlib1g; do dpkg -s "$package"; done
Package: ca-certificates
Status: install ok installed
Priority: standard
Section: misc
Installed-Size: 386
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: all
Multi-Arch: foreign
Version: 20240203
Depends: openssl (>= 1.1.1), debconf (>= 0.5) | debconf-2.0
Breaks: ca-certificates-java (<< 20121112+nmu1)
Enhances: openssl
Description: Common CA certificates
 Contains the certificate authorities shipped with Mozilla's browser to allow
 SSL-based applications to check for the authenticity of SSL connections.
 .
 Please note that Debian can neither confirm nor deny whether the
 certificate authorities whose certificates are included in this package
 have in any way been audited for trustworthiness or RFC 3647 compliance.
 Full responsibility to assess them belongs to the local system
 administrator.
Original-Maintainer: Julien Cristau <jcristau@debian.org>
Package: libc6
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 13431
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: glibc
Version: 2.39-0ubuntu8.3
Replaces: libc6-amd64
Depends: libgcc-s1
Recommends: libidn2-0 (>= 2.0.5~)
Suggests: glibc-doc, debconf | debconf-2.0, locales, libnss-nis, libnss-nisplus
Breaks: chrony (<< 4.2-3~), cyrus-imapd (<< 3.6.1-2ubuntu1), fakechroot (<< 2.19-3.5), firefox (<< 91~), firefox-esr (<< 91~), gnumach-image-1.8-486 (<< 2:1.8+git20210923~), gnumach-image-1.8-486-dbg (<< 2:1.8+git20210923~), gnumach-image-1.8-xen-486 (<< 2:1.8+git20210923~), gnumach-image-1.8-xen-486-dbg (<< 2:1.8+git20210923~), hurd (<< 1:0.9.git20220301-2), locales (<< 2.39), locales-all (<< 2.39), nscd (<< 2.39), python3-iptables (<< 1.0.0-2), scipy (<< 1.10.1-10build1), tinydns (<< 1:1.05-14), valgrind (<< 1:3.19.0-1~)
Conffiles:
 /etc/ld.so.conf.d/x86_64-linux-gnu.conf d4e7a7b88a71b5ffd9e2644e71a0cfab
Description: GNU C Library: Shared libraries
 Contains the standard libraries that are used by nearly all programs on
 the system. This package includes shared versions of the standard C library
 and the standard math library, as well as many others.
Homepage: https://www.gnu.org/software/libc/libc.html
Original-Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
Original-Vcs-Browser: https://salsa.debian.org/glibc-team/glibc
Original-Vcs-Git: https://salsa.debian.org/glibc-team/glibc.git
Package: libgcc-s1
Protected: yes
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 197
Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: gcc-14
Version: 14.2.0-4ubuntu2~24.04
Replaces: libgcc1 (<< 1:10)
Provides: libgcc1 (= 1:14.2.0-4ubuntu2~24.04)
Depends: gcc-14-base (= 14.2.0-4ubuntu2~24.04), libc6 (>= 2.35)
Description: GCC support library
 Shared version of the support library, a library of internal subroutines
 that GCC uses to overcome shortcomings of particular machines, or
 special needs for some languages.
Homepage: http://gcc.gnu.org/
Important: yes
Original-Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Package: libicu74
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 35919
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: icu
Version: 74.2-1ubuntu3.1
Replaces: libiculx63 (<< 63.1-5)
Depends: libc6 (>= 2.38), libgcc-s1 (>= 3.3.1), libstdc++6 (>= 13.1)
Breaks: libiculx63 (<< 63.1-5), openttd (<< 1.8.0-2~)
Description: International Components for Unicode
 ICU is a C++ and C library that provides robust and full-featured
 Unicode and locale support.  This package contains the runtime
 libraries for ICU.
Homepage: https://icu.unicode.org/
Original-Maintainer: Laszlo Boszormenyi (GCS) <gcs@debian.org>
dpkg-query: package 'liblttng-ust1' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files.
dpkg-query: package 'libssl3' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files.
Package: libstdc++6
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 3110
Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: gcc-14
Version: 14.2.0-4ubuntu2~24.04
Replaces: libstdc++6-14-dbg (<< 4.9.0-3)
Depends: gcc-14-base (= 14.2.0-4ubuntu2~24.04), libc6 (>= 2.38), libgcc-s1 (>= 4.3)
Breaks: gcc-4.3 (<< 4.3.6-1), gcc-4.4 (<< 4.4.6-4), gcc-4.5 (<< 4.5.3-2)
Conflicts: scim (<< 1.4.2-1)
Description: GNU Standard C++ Library v3
 This package contains an additional runtime library for C++ programs
 built with the GNU compiler.
 .
 libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which
 was included up to g++-2.95. The first version of libstdc++-v3 appeared
 in g++-3.0.
Homepage: http://gcc.gnu.org/
Original-Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Package: libunwind8
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 187
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: libunwind
Version: 1.6.2-3build1.1
Replaces: libgcc1 (<< 1:4.0.0-2)
Depends: libc6 (>= 2.34), liblzma5 (>= 5.1.1alpha+20110809)
Conflicts: libunwind1-dev
Description: library to determine the call-chain of a program - runtime
 The primary goal of this project is to define a portable and efficient C
 programming interface (API) to determine the call-chain of a program.
 The API additionally provides the means to manipulate the preserved
 (callee-saved) state of each call-frame and to resume execution at any
 point in the call-chain (non-local goto). The API supports both local
 (same-process) and remote (across-process) operation. As such, the API
 is useful in a number of applications.
 .
 This package includes the shared libraries
Homepage: http://www.nongnu.org/libunwind
Original-Maintainer: Adrian Bunk <bunk@debian.org>
Package: zlib1g
Status: install ok installed
Priority: required
Section: libs
Installed-Size: 163
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: zlib
Version: 1:1.3.dfsg-3.1ubuntu2.1
Provides: libz1
Depends: libc6 (>= 2.14)
Breaks: libxml2 (<< 2.7.6.dfsg-2), texlive-binaries (<< 2023.20230311.66589-8)
Conflicts: zlib1 (<= 1:1.0.4-7)
Description: compression library - runtime
 zlib is a library implementing the deflate compression method found
 in gzip and PKZIP.  This package includes the shared library.
Homepage: http://zlib.net/
Original-Maintainer: Mark Brown <broonie@debian.org>

总结,

我在文章里,介绍 Ubuntu 怎样版本升级。觉得内容简单,参考微软文档,演示安装 .NET 的过程。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值