commit
This commit is contained in:
parent
c128cbd8a8
commit
fe95f27dbb
58
source/_posts/NET.md
Normal file
58
source/_posts/NET.md
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
title: .NET
|
||||||
|
date: 2025-07-22 10:32:51
|
||||||
|
tags:
|
||||||
|
---
|
||||||
|
|
||||||
|
# Nuget包管理器
|
||||||
|
|
||||||
|
## 无法联网的情况下导入包
|
||||||
|
|
||||||
|
### 使用本地文件夹作为 NuGet 源
|
||||||
|
|
||||||
|
#### 步骤 1:准备本地 NuGet 包
|
||||||
|
|
||||||
|
你需要提前从能联网的机器上下载所需的 `.nupkg` 文件。
|
||||||
|
|
||||||
|
使用命令行下载:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
.\nuget.exe install MathNet.Numerics -OutputDirectory D:\NuGetOfflinePackages
|
||||||
|
```
|
||||||
|
|
||||||
|
这会下载包及其依赖到 `D:\NuGetOfflinePackages` 目录。
|
||||||
|
|
||||||
|
> ⚠️ 注意:有些包有多个依赖项,需要把所有 `.nupkg` 都拷贝过来。
|
||||||
|
|
||||||
|
#### 步骤 2:将包复制到离线机器的某个目录
|
||||||
|
|
||||||
|
比如:
|
||||||
|
|
||||||
|
```
|
||||||
|
D:\NuGetOfflinePackages\
|
||||||
|
├── Newtonsoft.Json.13.0.3.nupkg
|
||||||
|
├── System.Net.Http.4.3.4.nupkg
|
||||||
|
└── ...
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 步骤 3:配置 Visual Studio 使用本地包源
|
||||||
|
|
||||||
|
1. 打开 Visual Studio。
|
||||||
|
|
||||||
|
2. 进入:**工具 (Tools) → NuGet 包管理器 → 程序包管理器设置** 。
|
||||||
|
|
||||||
|
3. 左侧选择 **NuGet 包管理器 → 程序包源** 。
|
||||||
|
|
||||||
|
4. 点击
|
||||||
|
|
||||||
|
\+
|
||||||
|
|
||||||
|
添加新的源:
|
||||||
|
|
||||||
|
- 名称:比如 `Local Packages`
|
||||||
|
- 源:填写你的文件夹路径,如 `D:\NuGetOfflinePackages`
|
||||||
|
|
||||||
|
5. 点击 **更新** ,然后确定。
|
||||||
|
|
||||||
|
✅ 完成后,在“管理 NuGet 包”时就可以看到并安装本地包了。
|
||||||
|
|
||||||
@ -205,6 +205,12 @@ sudo apt install tasksel
|
|||||||
|
|
||||||
默认情况下,只有一个显示管理器可以管理服务器。仅当配置为管理其他服务器时,它们才能同时运行。本文假定您将使用单个默认显示管理器。
|
默认情况下,只有一个显示管理器可以管理服务器。仅当配置为管理其他服务器时,它们才能同时运行。本文假定您将使用单个默认显示管理器。
|
||||||
|
|
||||||
|
显示当前使用的显示管理器:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cat /etc/X11/default-display-manager
|
||||||
|
```
|
||||||
|
|
||||||
要安装特定的显示管理器,请使用**apt-get**程序包管理器:
|
要安装特定的显示管理器,请使用**apt-get**程序包管理器:
|
||||||
|
|
||||||
要安装SLiM:
|
要安装SLiM:
|
||||||
@ -221,6 +227,14 @@ sudo apt-get install lightdm
|
|||||||
|
|
||||||
该**SDDM**显示管理器可从安装**中的tasksel** KDE的安装过程中的菜单。
|
该**SDDM**显示管理器可从安装**中的tasksel** KDE的安装过程中的菜单。
|
||||||
|
|
||||||
|
切换显示管理器
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo dpkg-reconfigure gdm3
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 选择服务器的GUI
|
### 选择服务器的GUI
|
||||||
|
|
||||||
GNOME是大多数Ubuntu安装的默认GUI,并且(宽松地)基于Apple生态系统。
|
GNOME是大多数Ubuntu安装的默认GUI,并且(宽松地)基于Apple生态系统。
|
||||||
@ -239,10 +253,27 @@ tasksel
|
|||||||
|
|
||||||
使用**空格**键将其选中`ubuntu-desktop`,然后按**Tab**键选择底部的**确定**,然后按**Enter键**。
|
使用**空格**键将其选中`ubuntu-desktop`,然后按**Tab**键选择底部的**确定**,然后按**Enter键**。
|
||||||
|
|
||||||
|
> 要使用`ubuntu-desktop`,需事先安装好,通过 sudo apt install -y ubuntu-desktop
|
||||||
|
|
||||||
系统将安装软件并重新引导,为您提供由默认显示管理器生成的图形登录屏幕。在我们的例子中是SLiM。
|
系统将安装软件并重新引导,为您提供由默认显示管理器生成的图形登录屏幕。在我们的例子中是SLiM。
|
||||||
|
|
||||||
输入您的**登录凭据**。如果您安装了多个接口,请使用**F1**在GUI之间切换。
|
输入您的**登录凭据**。如果您安装了多个接口,请使用**F1**在GUI之间切换。
|
||||||
|
|
||||||
|
卸载ubuntu-desktop
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo apt remove -y --purge ubuntu-desktop
|
||||||
|
sudo apt-get autoremove
|
||||||
|
sudo snap remove thunderbird
|
||||||
|
sudo snap remove gnome-42-2204
|
||||||
|
sudo snap remove firefox
|
||||||
|
sudo snap remove gtk-common-themes
|
||||||
|
sudo apt-get remove gnome-tweak-tool
|
||||||
|
sudo apt-get remove gnome-shell
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### KDE Plasma
|
#### KDE Plasma
|
||||||
|
|
||||||
要安装KDE Plasma,请使用以下Linux命令:
|
要安装KDE Plasma,请使用以下Linux命令:
|
||||||
@ -419,6 +450,30 @@ sudo ufw allow from any to any port 3389 proto tcp
|
|||||||
ip a
|
ip a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### KDE Plasma解决XRDP无法连接的问题
|
||||||
|
|
||||||
|
> [Installing KDE Plasma and XRDP Service on Remote Ubuntu 22](https://www.vps-mart.com/blog/install-kde-plasma-and-xrdp-service-on-remote-ubuntu)
|
||||||
|
|
||||||
|
通过XRDP登录时启动KDE等离子会话。 CAT命令用于创建具有指定环境变量的.xsessionrc文件。执行这些命令后,将使用指定内容创建或覆盖〜/.xsession和〜/.xsessionRC文件。这些文件通常在X会话启动过程中用于设置环境变量并定义要执行的启动命令或脚本。
|
||||||
|
|
||||||
|
```shell
|
||||||
|
echo "/usr/bin/startplasma-x11" > ~/.xsession
|
||||||
|
D=/usr/share/plasma:/usr/local/share:/usr/share:/var/lib/snapd/desktop
|
||||||
|
C=/etc/xdg/xdg-plasma:/etc/xdg
|
||||||
|
C=${C}:/usr/share/kubuntu-default-settings/kf5-settings
|
||||||
|
cat < ~/.xsessionrc
|
||||||
|
export XDG_SESSION_DESKTOP=KDE
|
||||||
|
export XDG_DATA_DIRS=${D}
|
||||||
|
export XDG_CONFIG_DIRS=${C}
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
重启 XRDP服务
|
||||||
|
|
||||||
|
```shell
|
||||||
|
systemctl restart xrdp
|
||||||
|
```
|
||||||
|
|
||||||
## 更换时区
|
## 更换时区
|
||||||
|
|
||||||
### 查看当前时区:
|
### 查看当前时区:
|
||||||
@ -471,3 +526,68 @@ sudo timedatectl set-timezone Asia/Shanghai
|
|||||||
timedatectl
|
timedatectl
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## snap包管理器
|
||||||
|
|
||||||
|
> [Linux snap 命令 | 菜鸟教程](https://www.runoob.com/linux/linux-comm-snap.html)
|
||||||
|
|
||||||
|
### 安装snap软件
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo snap install hello-world
|
||||||
|
```
|
||||||
|
|
||||||
|
### 卸载snap软件
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo snap remove hello-world
|
||||||
|
```
|
||||||
|
|
||||||
|
### 查看已安装的snap软件
|
||||||
|
|
||||||
|
```shell
|
||||||
|
snap list
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 解决snap包管理器下载报错 x509: certificate signed by unknown authority
|
||||||
|
|
||||||
|
#### 代理方式
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo snap set system proxy.https="http://127.0.0.1:7890"
|
||||||
|
sudo snap set system proxy.http="http://127.0.0.1:7890"
|
||||||
|
```
|
||||||
|
|
||||||
|
然后可以正常安装:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo snap install hello-world
|
||||||
|
```
|
||||||
|
|
||||||
|
## 禁止自动挂起
|
||||||
|
|
||||||
|
```shell
|
||||||
|
Broadcast message from user@ubuntu-ai-dev-server (Tue 2025-07-22 15:34:31 CST):
|
||||||
|
|
||||||
|
The system will suspend now!
|
||||||
|
```
|
||||||
|
|
||||||
|
### 解决方式
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo vim /etc/systemd/logind.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
将里面的
|
||||||
|
|
||||||
|
```shell
|
||||||
|
IdleAction=suspend
|
||||||
|
```
|
||||||
|
|
||||||
|
改为
|
||||||
|
|
||||||
|
```shell
|
||||||
|
IdleAction=ignore
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@ -298,31 +298,31 @@ modelscope download --model deepseek-ai/DeepSeek-R1-Distill-Qwen-7B README.md --
|
|||||||
#### 指定下载单个文件(以'tokenizer.json'文件为例)
|
#### 指定下载单个文件(以'tokenizer.json'文件为例)
|
||||||
|
|
||||||
```
|
```
|
||||||
modelscope download --model 'Qwen/Qwen2-7b' tokenizer.json
|
modelscope download --model 'Qwen/Qwen2-7b' tokenizer.json
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 指定下载多个个文件
|
#### 指定下载多个个文件
|
||||||
|
|
||||||
```
|
```
|
||||||
modelscope download --model 'Qwen/Qwen2-7b' tokenizer.json config.json
|
modelscope download --model 'Qwen/Qwen2-7b' tokenizer.json config.json
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 指定下载某些文件
|
#### 指定下载某些文件
|
||||||
|
|
||||||
```
|
```
|
||||||
modelscope download --model 'Qwen/Qwen2-7b' --include '*.safetensors'
|
modelscope download --model 'Qwen/Qwen2-7b' --include '*.safetensors'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 过滤指定文件
|
#### 过滤指定文件
|
||||||
|
|
||||||
```
|
```
|
||||||
modelscope download --model 'Qwen/Qwen2-7b' --exclude '*.safetensors'
|
modelscope download --model 'Qwen/Qwen2-7b' --exclude '*.safetensors'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 指定下载cache_dir
|
#### 指定下载cache_dir
|
||||||
|
|
||||||
```
|
```
|
||||||
modelscope download --model 'Qwen/Qwen2-7b' --include '*.json' --cache_dir './cache_dir'
|
modelscope download --model 'Qwen/Qwen2-7b' --include '*.json' --cache_dir './cache_dir'
|
||||||
```
|
```
|
||||||
|
|
||||||
模型文件将被下载到`'cache_dir/Qwen/Qwen2-7b'`。
|
模型文件将被下载到`'cache_dir/Qwen/Qwen2-7b'`。
|
||||||
@ -330,7 +330,7 @@ modelscope download --model deepseek-ai/DeepSeek-R1-Distill-Qwen-7B README.md --
|
|||||||
#### 指定下载local_dir
|
#### 指定下载local_dir
|
||||||
|
|
||||||
```
|
```
|
||||||
modelscope download --model 'Qwen/Qwen2-7b' --include '*.json' --local_dir './local_dir'
|
modelscope download --model 'Qwen/Qwen2-7b' --include '*.json' --local_dir './local_dir'
|
||||||
```
|
```
|
||||||
|
|
||||||
模型文件将被下载到`'./local_dir'`。
|
模型文件将被下载到`'./local_dir'`。
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user