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

ops/2025/2/11 2:07:44/

原因:

想安装 .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 certificatesContains the certificate authorities shipped with Mozilla's browser to allowSSL-based applications to check for the authenticity of SSL connections..Please note that Debian can neither confirm nor deny whether thecertificate authorities whose certificates are included in this packagehave in any way been audited for trustworthiness or RFC 3647 compliance.Full responsibility to assess them belongs to the local systemadministrator.
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 librariesContains the standard libraries that are used by nearly all programs onthe system. This package includes shared versions of the standard C libraryand 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 libraryShared version of the support library, a library of internal subroutinesthat GCC uses to overcome shortcomings of particular machines, orspecial 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 UnicodeICU is a C++ and C library that provides robust and full-featuredUnicode and locale support.  This package contains the runtimelibraries 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 v3This package contains an additional runtime library for C++ programsbuilt with the GNU compiler..libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, whichwas included up to g++-2.95. The first version of libstdc++-v3 appearedin 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 - runtimeThe primary goal of this project is to define a portable and efficient Cprogramming 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 anypoint in the call-chain (non-local goto). The API supports both local(same-process) and remote (across-process) operation. As such, the APIis 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 - runtimezlib is a library implementing the deflate compression method foundin gzip and PKZIP.  This package includes the shared library.
Homepage: http://zlib.net/
Original-Maintainer: Mark Brown <broonie@debian.org>

总结,

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


http://www.ppmy.cn/ops/157414.html

相关文章

2.6 寒假训练营补题

C Tokitsukaze and Balance String (hard) 题目描述 本题为《Tokitsukaze and Balance String (easy)》的困难版本&#xff0c;两题的唯一区别在于 n n n 的范围。 一个字符串是平衡的&#xff0c;当且仅当字符串中 "01" 连续子串的个数与 "10" 连续子…

2025.1.8(qt图形化界面之消息框)

笔记&#xff08;后期复习补充&#xff09; 作业 1> 手动将登录项目实现&#xff0c;不要使用拖拽编程 并且&#xff0c;当点击登录按钮时&#xff0c;后台会判断账号和密码是否相等&#xff0c;如果相等给出登录成功的提示&#xff0c;并且关闭当前界面&#xff0c;发射一…

‌双非硕士的抉择:自学嵌入式硬件开发还是深入Linux C/C++走软开?

今天给大家分享的是一位粉丝的提问&#xff0c;双非硕研一是自学嵌入式走偏硬件还是说深入学习Linuxc/c走软开呢&#xff1f; 接下来把粉丝的具体提问和我的回复分享给大家&#xff0c;希望也能给一些类似情况的小伙伴一些启发和帮助。 粉丝提问&#xff1a; 老师好&#xff…

【DeepSeek论文翻译】DeepSeek-R1: 通过强化学习激励大型语言模型的推理能力

目录 摘要 1. 引言 2. 方法 2.1. 概述 2.2. DeepSeek-R1-Zero&#xff1a;在基础模型上进行强化学习 2.2.1. 强化学习算法 2.2.2. 奖励建模 2.2.3. 训练模板 2.2.4. DeepSeek-R1-Zero 的性能、自我进化过程和顿悟时刻 2.3. DeepSeek-R1&#xff1a;具有冷启动的强化学…

游戏引擎学习第90天

查看我们现在的进度 目标是完整地手写一个游戏&#xff0c;而不依赖任何现有的游戏引擎或库。这样做的主要原因是希望能够从头到尾掌握游戏开发的全部流程&#xff0c;确保对系统的每个部分都有清晰的理解。此外&#xff0c;现有的引擎和库往往存在各种设计上的问题&#xff0…

WordPress wp-recall插件存在SQL注入漏洞(CVE-2024-32709)

免责声明: 本文旨在提供有关特定漏洞的深入信息,帮助用户充分了解潜在的安全风险。发布此信息的目的在于提升网络安全意识和推动技术进步,未经授权访问系统、网络或应用程序,可能会导致法律责任或严重后果。因此,作者不对读者基于本文内容所采取的任何行为承担责任。读者在…

Linux进阶——web服务器

一、相关名词解释及概念&#xff1a; www&#xff1a;(world wide web)全球信息广播&#xff0c;通常来说的上网就是使用www来查询用户所需的信息。使用http超文本传输协议。 过程&#xff1a;web浏览器向web服务&#xff08;Apache&#xff0c;Microsoft&#xff0c;nginx&…

【IoCDI】_@Autowired存在的问题及解决

目录 1. Autowired存在问题 2. 解决方法 2.1 方法1&#xff1a;属性名与需要使用的对象名保持一致 2.2 方法2&#xff1a;使用Primary指定要使用的对象 2.3 方法3&#xff1a;使用Qualifier指定要使用的对象 2.4 方法4&#xff1a;使用Resource指定要使用的对象 3. 关于…