diff --git a/source/_posts/ArchLinux.md b/source/_posts/ArchLinux.md new file mode 100644 index 0000000..9380b9b --- /dev/null +++ b/source/_posts/ArchLinux.md @@ -0,0 +1,149 @@ +--- +title: ArchLinux +date: 2025-07-28 10:26:05 +tags: +--- + +# WSL + +## 安装 + +### 在线安装 + +```powershell +wsl --install archlinux +``` + +# 包管理器 pacman + +> [pacman - Arch Linux 中文维基](https://wiki.archlinuxcn.org/wiki/Pacman) + +## 安装软件 + +```shell +pacman -S fastfetch +``` + +## 更新库 + +```shell +pacman -Syyu +``` + +# Vim设置 + +编辑当前用户下的vim配置文件`~/.vimrc` + +```shell +if has('mouse') + set mouse-=a +endif + +set number +syntax on +set ignorecase +set t_Co=256 +``` + +# Containerd + Nerdctl + +## 安装 + +**1. 更新系统** + +首先,确保你的 Arch Linux 系统是最新的: + +Bash + +``` +sudo pacman -Syu +``` + +**2. 安装 Containerd** + +Containerd 是一个核心的容器运行时。它作为 `containerd` 包在官方仓库中提供。 + +Bash + +``` +sudo pacman -S containerd +``` + +安装完成后,你需要启动并启用 Containerd 服务,以便它在系统启动时自动运行: + +Bash + +``` +sudo systemctl enable --now containerd +``` + +你可以通过以下命令检查 Containerd 的运行状态: + +Bash + +``` +sudo systemctl status containerd +``` + +确保它显示为 `active (running)`。 + +## Containerd的config.toml实现镜像加速 + +> [containerd/docs/cri/config.md at main · containerd/containerd](https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration) + +如果没有`/etc/containerd/config.toml`,执行以下命令生成默认配置 + +```bash +sudo containerd config default | sudo tee /etc/containerd/config.toml +``` + +编辑Containerd的配置文件,添加以下镜像配置 + +```toml + # 找到[plugins.'io.containerd.grpc.v1.cri']配置处 +[plugins.'io.containerd.grpc.v1.cri'] + disable_tcp_service = true + stream_server_address = '127.0.0.1' + stream_server_port = '0' + stream_idle_timeout = '4h0m0s' + enable_tls_streaming = false + + [plugins.'io.containerd.grpc.v1.cri'.x509_key_pair_streaming] + tls_cert_file = '' + tls_key_file = '' + + [plugins."io.containerd.grpc.v1.cri".containerd] + [plugins."io.containerd.grpc.v1.cri".containerd.runtimes] + [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] + runtime_type = "io.containerd.runc.v2" + [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] + SystemdCgroup = true + + [plugins."io.containerd.grpc.v1.cri".registry] #在这里增加 + config_path = "/etc/containerd/certs.d" +``` + +创建目录`/etc/containerd/certs.d/docker.io` + +```shell +mkdir -p /etc/containerd/certs.d/docker.io +``` + +进入到创建好的目录下,编辑文件`hosts.toml` + +```toml +server = "https://docker.io" + +[host."https://docker.m.daocloud.io"] + capabilities = ["pull", "resolve"] + +[host."https://docker.imgdb.de"] + capabilities = ["pull", "resolve"] +``` + +然后重启`containerd`服务即可 + +```shell +systemctl restart containerd +``` + diff --git a/source/_posts/Docker-Compose.md b/source/_posts/Docker-Compose.md index 553059b..81d6ded 100644 --- a/source/_posts/Docker-Compose.md +++ b/source/_posts/Docker-Compose.md @@ -80,6 +80,32 @@ docker compose down docker compose --project-name dify-docker down ``` +## 修改Dockerfile后,通过Docker Compose重新构建镜像 + +1. **修改 `Dockerfile`**。 + +2. 进入到 `Dockerfile` 和 `docker-compose.yml` 所在的目录。 + +3. **构建新镜像:** + + Bash + + ``` + docker-compose build jenkins + ``` + + (如果遇到问题或想完全重来,可以加 `--no-cache`:`docker-compose build --no-cache jenkins`) + +4. **使用新镜像启动容器:** + + Bash + + ``` + docker-compose up -d --force-recreate jenkins + ``` + +执行这些步骤后,你的 Jenkins 容器就会运行在新修改并构建的 Docker 镜像上,其中包含了你所有新增的工具和配置。 + # 集群搭建 diff --git a/source/_posts/Linux.md b/source/_posts/Linux.md index 6a4ba8b..f332e2e 100644 --- a/source/_posts/Linux.md +++ b/source/_posts/Linux.md @@ -1312,7 +1312,7 @@ UUID=0EAB-5879 /boot/efi vfat umask=0077,shortname=win systemctl daemon-reload ``` -## 挂载远程卷 +## 挂载卷 ### Windows 网络共享位置 @@ -1344,6 +1344,72 @@ mount -t cifs -o username=user,password=backup //192.168.0.1/备份 /mnt/wdshare //192.168.0.1/备份 /mnt/wdshare/ cifs username=user,password=backup 0 0 ``` +### NTFS 分区 + +#### 可读可写 + +**识别NTFS分区** + +```shell +sudo parted -l +``` + +![image-20250728084352055](https://rustfs.wenyongdalucky.club:443/hexo/image-20250728084352055.png) + +**创建挂载点**:使用*mkdir*命令创建一个挂载点 + +```shell +sudo mkdir /mnt/ntfs1 +``` + +**安装依赖**:更新包仓库并安装*fuse*和*ntfs-3g* + +```shell +sudo apt update +sudo apt install fuse -y +sudo apt install ntfs-3g -y +``` + +**挂载分区**:使用*mount*命令挂载分区 + +```shell +sudo mount -t ntfs-3g /dev/sda1 /mnt/ntfs1/ +``` + +> 其中 /dev/sda1 就是由上述命令的 sudo parted -l 得来的,Disk /dev/sda: 1000GB ,这行标识出了 设备的路径,Disk Flags: 及下述表格的列 Number 则标识出了具体的 设备号,也可通过这个命令进行验证 `sudo blkid /dev/sda1` +> +> ![image-20250728085224181](https://rustfs.wenyongdalucky.club:443/hexo/image-20250728085224181.png) +> +> 可以看到 `TYPE="ntfs"`字样 + +**验证挂载**:使用*df*命令检查所有文件系统的详细信息,验证分区是否成功挂载 + +```shell +df -Th +``` + +![image-20250728084611261](https://rustfs.wenyongdalucky.club:443/hexo/image-20250728084611261.png) + +可以看到最后一行的就是刚刚挂载上的设备卷 + +这个只是临时挂载,还需要编辑`/etc/fstab`配置文件,防止系统重启后,还需再手动挂载 + +```shell +sudo vim /etc/fstab +``` + +在最后一行下面添加这一行 + +```shell +/dev/sda1 /mnt/ntfs1 fuseblk defaults 0 0 +``` + +`:wq`保存好,使用以下命令使修改生效 + +```shell +sudo systemctl daemon-reload +``` + ## 分配Swap @@ -2148,6 +2214,19 @@ fc-cache -f -v #### 安装 +进入控制面板中的 程序和功能 页面 + +用组合键 Win + R 启动运行窗口 `appwiz.cpl` 回车 + +启用或关闭 Windows 功能,勾选适用于 Linux 的 Windows 子系统 + +![image-20250728082044688](https://rustfs.wenyongdalucky.club:443/hexo/image-20250728082044688.png) + +也可解决安装发行版时的报错问题 + +由于未安装所需的特性,无法启动操作。 +错误代码: Wsl/InstallDistro/Service/RegisterDistro/CreateVm/HCS/HCS_E_SERVICE_NOT_AVAILABLE + ```powershell wsl --install ``` @@ -2170,6 +2249,35 @@ wsl --install -d wsl --manage Ubuntu-24.04 --move d:\ubuntu ``` +#### 导出 + +**查看当前 WSL 分发版** + +```powershell +wsl -l +``` + +输出示例: + +```powershell +适用于 Linux 的 Windows 子系统分发: +archlinux (默认值) +``` + +**停止运行中的 WSL** + +```powershell +wsl --terminate archlinux +``` + +**导出镜像** + +使用 *wsl --export* 命令将分发版导出为 *.tar* 文件: + +```powershell +wsl --export archlinux E:\Backup\archlinux.tar +``` + #### 通过FinalShell连接WSL2 @@ -2784,7 +2892,7 @@ Are you sure you want to remove Oh My Zsh? [y/N] Y upgrade_oh_my_zsh ``` -安装Nerd Fonts +### 安装Nerd Fonts ```shell unzip nerd-fonts.zip diff --git a/source/_posts/VsCode.md b/source/_posts/VsCode.md index 6fb951f..a2d17ec 100644 --- a/source/_posts/VsCode.md +++ b/source/_posts/VsCode.md @@ -16,6 +16,32 @@ tags: ### 配置远程连接Linux密码免登录 +首先使用 `PuTTY Key Generator`生成ppk + +![image-20250725142159081](https://rustfs.wenyongdalucky.club:443/hexo/image-20250725142159081.png) + +出现进度条,在框内摇晃鼠标,直到进度条满,就可以看到生成的公钥了,私钥是需要保存到本地的,最好保存到`~/.ssh`目录下 + +![image-20250725142313290](https://rustfs.wenyongdalucky.club:443/hexo/image-20250725142313290.png) + +![image-20250725142335929](https://rustfs.wenyongdalucky.club:443/hexo/image-20250725142335929.png) + +![image-20250725142501371](https://rustfs.wenyongdalucky.club:443/hexo/image-20250725142501371.png) + +框内是生成的公钥,可以保存到本地,也可以直接复制到要连接的Linux服务器上的`~/.ssh/authorized_keys`文件内 + +![image-20250725142604044](https://rustfs.wenyongdalucky.club:443/hexo/image-20250725142604044.png) + +因为刚刚保存的私钥是`ppk`格式的,如果是SSH连接用,需要转换一下,`PuTTY Key Generator`同样有这个功能 + +如果是刚生成好的,可以直接点击上方工具栏 Conversions -> Export OpenSSH Key 然后保存到`~/.ssh`目录下。 + +![image-20250725142721334](https://rustfs.wenyongdalucky.club:443/hexo/image-20250725142721334.png) + +如果是要打开以前生成的密钥,File -> Load private Key。然后再重复上述 Conversions -> Export OpenSSH Key 步骤即可。 + +![image-20250725142840387](https://rustfs.wenyongdalucky.club:443/hexo/image-20250725142840387.png) + 编辑配置文件,一般位于`~/.ssh/config` ```shell @@ -50,8 +76,10 @@ vim /etc/ssh/sshd_config PubkeyAuthentication yes # :wq 保存 -# 重启sshd服务 +# 重启sshd服务 AlmaLinux 下 systemctl restart sshd +# ubuntu 下 +sudo systemctl restart ssh ``` Windows `~/.ssh` 目录属性中 安全 -> 高级 diff --git a/source/_posts/Windows-Server.md b/source/_posts/Windows-Server.md index 614911c..2a62d6f 100644 --- a/source/_posts/Windows-Server.md +++ b/source/_posts/Windows-Server.md @@ -71,3 +71,29 @@ control regedit ``` +# PowerShell + +## 激活工具命令 + +```powershell +irm https://massgrave.dev/get | iex +``` + +# CMD + +## 7zip + +### 解压压缩包内的部分文件或目录到指定目录下 + +```cmd +"C:\Users\yun\AppData\Local\Microsoft\WindowsApps\7z.exe" x "D:\source\source.7z" -o"D:" "source\repos\ruoyi-ai\*" +``` + +**详细解释:** + +- `"C:\Users\yun\AppData\Local\Microsoft\WindowsApps\7z.exe"`: 这是 7-Zip 可执行文件的完整路径。 +- `x`: 解压命令,会保留压缩包内的目录结构。 +- `"D:\source\source.7z"`: 要解压的源压缩包的完整路径。 +- `-o"D:"`: 这是指定**目标解压目录**。所有从压缩包中解压出来的内容都会放到这个目录下。 + - **注意:** `-o` 后面直接跟目标文件夹的完整路径,不带 `*`。 +- `"source\repos\ruoyi-ai\*"`: 这是**压缩包内部想要解压的目录名称**。请确保这个名称与压缩包内的实际目录名完全一致(大小写敏感)。