150 lines
2.8 KiB
Markdown
150 lines
2.8 KiB
Markdown
---
|
||
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
|
||
```
|
||
|