ArchWSL项目地址
yuk7/ArchWSL: ArchLinux based WSL Distribution. Supports multiple install. (github.com)
ArchWsl卸载
windows系统下在ArchWSL安装目录下执行
./Arch.exe clean
ArchWSL退出
ArchWSL系统下执行
exit
ArchWSL设置默认用户
windows系统下在ArchWSL安装目录下执行
./Arch.exe config --default-user [用户名]
ArchWSL使用教程
如何安装 | ArchWSL official documentation (wsldl-pg.github.io)
Arch Linux 中文社区 - 搜索 (bing.com)
Arch Linux 系统相关设置
查看软件的安装目录
which [软件名]
Linux新手入门如何知道程序安装在了哪里qq_2190630418的博客-CSDN博客linux安装的软件在哪里
新增用户
echo "%wheel ALL=(ALL) ALL" > /etc/sudoers.d/wheel #设置 sudoers 文件
useradd -m -G wheel -s /bin/bash {username} #新增用户
passwd {username} #为用户设置密码
如何安装 | ArchWSL official documentation (wsldl-pg.github.io)
添加环境变量
换源
执行命令
su root #切换值root用户
sudo nano /etc/pacman.conf #修改pacman.conf文件
pacman.conf文末追加
[archlinuxcn]
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch #清华源
Server = http://mirrors.aliyun.com/archlinux/$repo/os/$arch #阿里源
升级前需避免问题 pacman glibc not fount
pacman -Sw glibc lib32-glibc #下载包
pacman -Syy #更新系统 #别用
pacman -S glibc lib32-glibc #安装
执行命令
sudo pacman -Sy #更新源
sudo pacman -S archlinuxcn-keyring #安装GPG key
Arch Linux CN 源使用帮助 — USTC Mirror Help 文档
arch Linux添加源,在Arch Linux系统中使用Archlinuxcn源(清华源)的方法_Minimalism-Mei的博客-CSDN博客
arch/Manjaro 添加国内源以及社区源,防踩坑。 - 知乎 (zhihu.com)
Arch Linux应用软件安装与卸载
软件安装的方式
- Pacman
sudo pacman -S [包名] #安装软件包
sudo pacman -Ss [包名] #搜索软件包
sudo pacman -Sy #更新软件源
sudo pacman -Sy [包名] #更新软件源,并安装软件包
sudo pacman -Sc #清理软件包
sudo pacman -Syy #更新系统 #慎用
pacman常用命令-昨夜星辰 (hustlei.github.io)
(36条消息) msys2 pacman 安装 删除等常见命令汇总子燕若水的博客-CSDN博客pacman 卸载
系列命令简介
ArchLinux软件安装命令weixi6的博客-CSDN博客archlinux安装软件命令
Pacman 命令详解 - 我心狂野 - 博客园 (cnblogs.com)
常用软件安装
- glibc 安装 重点
安装最新版lib32-glibc
sudo pacman -S glibc lib32-glibc
Linux(manjaro)安装glibc指定版本HD2killers的博客-CSDN博客安装指定版本glibc
- 安装基本构建工具
sudo pacman -S base-devel
ManjaroWSL2开发环境搭建-记录 - 掘金 (juejin.cn)
- git
pacman -Ss git #搜索git包
sudo pacman -Sy git #安装git
- node.js
最新版,非LTS版
sudo pacman -S nodejs npm #会安装最新版nodejs,非lts版,不建议使用
Arch Linux 下安装 Node.js 最新版或长期支持版 (zzz.buzz)
LTS版安装
pacman -Ss nodejs-lts #搜索长期版
LTS版包搜索结果
community/nodejs-lts-erbium 12.22.12-2
Evented I/O for V8 javascript (LTS release: Erbium)
community/nodejs-lts-fermium 14.19.3-1
Evented I/O for V8 javascript (LTS release: Fermium)
community/nodejs-lts-gallium 16.15.0-1
Evented I/O for V8 javascript (LTS release: Gallium)
安装指定nodejs-LTS版
sudo pacman -S nodejs-lts-gallium #安装指定版本
通过包管理器安装 Node.js | Node.js (nodejs.org)
nodejs安装错误:node: error while loading shared libraries: libicui18n.so.71:
直接搜索缺失的libicui18n.so.71
sudo pacman -Ss libicui18n
搜索结果
core/icu 71.1-1 [installed: 70.1-1]
International Components for Unicode library
直接安装确实的icu
sudo pacman -S icu
重新安装nodejs-lts
sudo pacman -S nodejs-lts-gallium
- npm pnpm
搜索npm包
pacman -Ss npm
搜索结果
extra/openpmix 4.1.2-1
Extended version of the PMI standard
community/nodejs-nopt 5.0.0-2
Node/npm Option Parsing library
community/npm 8.5.5-1
A package manager for javascript
community/npm-check-updates 13.0.0-1
Find newer versions of dependencies than what your package.json or bower.json allows
community/semver 7.3.7-1
The semantic version parser used by npm
archlinuxcn/lazynpm 0.1.4-1
A simple terminal UI for npm commands
archlinuxcn/pnpm 7.1.2-1
按需安装指定版本
sudo pacman -S npm pnpm #同时安装npm、pnpm
npm添加环境变量 未实现
查看全局环境变量
printenv 和 export 两个指令都可以查看全部环境变量,后者的输出会比较美观有序。
sudo nano /etc/profile #全局环境变量配置文件,推荐
sudo nano ~/.bashrc #用户环境变量配置文件
设置pnpm 国内源
pnpm config set registry https://registry.npm.taobao.org #淘宝源
pnpm config get registry #查看当前源
- vscode
前提:安装wget
code .
- gdb 与gcc版本保持一致
sudo pacman -S gdb
- dotnet-sdk
pacman -Ss dotnet-sdk #搜索 dotnet-sdk
sudo pacman -S dotnet-sdk
- clang server
下载clang server 包地址:clangd/clangd: clangd language server (github.com)
windows系统上直接解压好,拷贝至/home/...下
我此处拷贝至
\home\xkp\software
执行clangd,错误:-bash: ./clangd_14.0.3/bin/clangd: Permission denied
缺少执行权限
ls -l ##查看权限
clangd权限结果
-rw-r--r-- 1 root root 103744000 May 1 03:37 clangd
添加执行权限
sudo chmod a+x ./clangd #为clangd文件,添加全部用户添加执行权限
clangd 修改权限结果
-rwxr-xr-x 1 root root 103744000 May 1 03:37 clangd
执行clangd
./clangd
在vscode中进行clangd配置
code . #linux子系统中开启vscode,在windows会打开vscode,并于wsl建立远程
- xmake 安装 - xmake
不建议的安装:github过不去
sudo pacman -Ss yay #安装yay
sudo yay -S xmake #安装xmake #太慢
错误:error fetching xmake: fatal: could not create work tree dir 'xmake': Permission denied 缺少写权限
解决方法,不适用sudo即可
yay -S ncurses #安装ncurses #xmake的依赖
yay -S xmake #安装xmake
fatal: could not create work tree dir Permission denied · Issue #1422 · docksal/docksal (github.com)
安装方式二:下载xmake-v2.6.5.xz.run自行安装 使用代理从GitHub自行下载 问题:提示安装成功,确配置环境失败
wget https://hub.連接.台灣/xmake-io/xmake/releases/download/v2.6.5/xmake-v2.6.5.gz.run #下载自安装包
sudo chmod 777 ./xmake-x.x.x.gz.run #赋予执行权限
sudo ./xmake-v2.6.5.gz.run #运行自安包
安装方式三:下载源码自行安装 安装 - xmake-源码编译 未通
wget https://hub.連接.台灣/xmake-io/xmake/archive/refs/tags/v2.6.5.tar.gz #下载
tar -zxvf ./v2.6.5.tar.gz #解压
cd ./xmake-2.6.5/ #cd到解压路径下
make build #编译
sudo ./scripts/get.sh __local__ __install_only__
source ~/.xmake/profile #环境变量
安装方式四:下载.dep文件自行安装
wget https://hub.連接.台灣/xmake-io/xmake/releases/download/v2.6.5/xmake-v2.6.5.amd64.deb #下载.deb
sudo pacman dpkg #安装dpkg
sudo dpkg -i ./xmake-v2.6.5.amd64.deb #安装
运行xmake提示错误:xmake: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory
cd /usr/lib64/
ls #看是否包含libncurses.so
mysql 源码安装 ( ncurses 找不到)-阿里云开发者社区 (aliyun.com)
xmake从入门到精通1:安装和更新 (tboox.org)
- docker 先安装subsystemctl,在安装docker
安装最新版docker
sudo pacman -S docker-rootless-extras #指定最新版本,20.10.16-1
修复systemctl在wsl中无法使用的问题
使用geine 不推荐
arkane-systems/genie: A quick way into a systemd "bottle" for WSL (github.com)
yay -Ss genie #搜索最新版genie,应pcaman源最新为1.41版本 #genie太慢了
搜索geine包结果
aur/catstalker 0.0.1-1 (+0 0.00)
Python library for energenie remote board access on a Raspberry Pi
aur/rasp 4.2-1 (+0 0.00)
Reconstruct Ancestral State in Phylogenies is a tool for inferring ancestral state
aur/tempest-bin 1.5.3-1 (+0 0.00)
a tool for investigating the temporal signal and 'clocklikeness' of molecular phylogenies
aur/homegenie-bin 1.3_stable.19-1 (+0 0.00)
HomeGenie: Embeddable, Smart Home server for Windows, Mac and Linux.
aur/quasar-icongenie 2.5.2-1 (+0 0.00)
CLI tool for building web application icons
aur/genie-git r923.78817a9-1 (+1 0.00)
GENie project generator tool (a fork of premake by Branimir Karadžić)
aur/genie-systemd-git 2.2.r11.g577a561-1 (+1 0.33)
A quick way into a systemd "bottle" for WSL
aur/vim-vala-git r2.a23aa5a-1 (+1 0.00)
Support for vala and genie languages
aur/phyml-mpi 1:3.3.20220408-1 (+1 0.00)
Builds phylogenies from DNA or protein sequences using a maximum likelihood approach, using multiple proccessors
aur/genieutils-git 710.808d3cc-1 (+2 0.00)
A library to read/write certain data and resource files of genie engine games
aur/advancedgenieeditor-git r756.ea2db9c-1 (+2 0.00)
A program for editing data of genie files.
aur/razergenie-git 0.7.r111.g312a836-1 (+6 0.61)
Qt application for configuring your Razer devices under GNU/Linux.
aur/phyml 1:3.3.20220408-1 (+6 0.00)
Builds phylogenies from DNA or protein sequences using a maximum likelihood approach
aur/phylip 3.698-1 (+7 0.00)
A collection of programmes for evolutive genetics and inferring phylogenies
aur/razergenie 0.9.0-1 (+17 1.31)
Qt application for configuring your Razer devices under GNU/Linux.
archlinuxcn/genie-systemd 1.44-1 (540.5 KiB 1.8 MiB)
A quick way into a systemd "bottle" for WSL
community/systemdgenie 0.99.0-4 (89.5 KiB 283.7 KiB)
Systemd management utility
安装指定版genie
sudo yay -S quasar-icongenie #2.2版 #不推荐,太慢了
安装genie错误提示: 同xmake
-> error fetching quasar-icongenie: fatal: could not create work tree dir 'quasar-icongenie': Permission denied context: exit status 128
解决办法,不使用管理员身份sudo
yay -S genie-systemd-git #2.4.1版 #不推荐,太慢了
sudo pacman -Ss genie-systemd #1.41版,推荐,速度快,且不会出现 缺少写入权限问题 #依赖dotnet-sdk 5
fatal: could not create work tree dir Permission denied · Issue #1422 · docksal/docksal (github.com)
安装genie 1.41的dotnet-sdk 5.0的依赖
yay -S dotnet-sdk-5.0-bin #安装指定版本 #sudo会出现写入权限问题
genie命令
usage: genie [-h] [-V] [-v] [-a USER] (-i | -s | -l | -c ... | -u | -r | -b)
Handles transitions to the "bottle" namespace for systemd under WSL.
optional arguments:
-h, --help show this help message and exit
-V, --version show program's version number and exit
-v, --verbose display verbose progress messages
-a USER, --as-user USER
specify user to run shell or command as (use with -s or -c)
commands:
-i, --initialize initialize the bottle (if necessary) only
-s, --shell initialize the bottle (if necessary), and run a shell in it
-l, --login initialize the bottle (if necessary), and open a logon prompt in it
-c ..., --command ...
initialize the bottle (if necessary), and run the specified command in it
-u, --shutdown shut down systemd and exit the bottle
-r, --is-running check whether systemd is running in genie, or not
-b, --is-in-bottle check whether currently executing within the bottle, or not
For more information, see https://github.com/arkane-systems/genie/
genie 的使用 包含开机启动设置,都可参看链接 dotnet-sdk 5
# 启动 systemd 环境
genie -i
# 启动 systemd 环境,并在环境中打开 shell
genie -s
# 启动 systemd 环境,并在环境中运行命令
genie -c command
在wsl上使用systemd - lautumn's blog
使用subsystemctl 推荐
项目地址:sorah/subsystemctl: Utility to run systemd in WSL2 with a Linux namespace (github.com)
cd ~/Software #cd到自己安装软件的目录下
mkdir systemctl #新建systemctl文件夹
git clone https://hub.xn--gzu630h.xn--kpry57d/sorah/arch.sorah.jp.git #下载源码
#git clone 的项目地址PKGBUILD: https://github.com/sorah/arch.sorah.jp/tree/master/aur-sorah/PKGBUILDs/subsystemctl
cd ./aur-sorah/PKGBUILDs/subsystemctl/ #进入带有PKGBUILD文件的目录
# /home/xkp/software/subsystemctl/arch.sorah.jp/aur-sorah/PKGBUILDs/subsystemctl
sudo yay -S cargo #安装rust等环境,这是makepkg依赖的
sudo pacman -Syu #更新软件,可解决libicuuc.so.70缺少的erro
makepkg #制作.pkg.tar.xz包
执行makepkg提示erro:缺少依赖
==> Making package: subsystemctl 0.1.2-1 (Sun 22 May 2022 12:47:34 PM CST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Missing dependencies:
-> cargo
==> ERROR: Could not resolve all dependencies.
安装在rust环境
sudo yay -S cargo #安装rust等环境,这是makepkg依赖
后续错误:缺少libicuuc.so.70
error: process didn't exit successfully: `rustc -vV` (exit status: 127)
--- stderr
rustc: error while loading shared libraries: libicuuc.so.70: cannot open shared object file: No such file or directory
==> ERROR: A failure occurred in build().
解决缺少libicuuc.so.70,且编译的过程出错 推荐 正确解法
sudo pacman -Syu #升级软件包
subsystemctl 使用
sudo subsystemctl start #检查systemd是否正常运行
sudo systemctl start docker #启动docker
sudo systemctl enable docker #docker 加入自启动项
Windows10 wsl2 archwsl 指北 - 知乎 (zhihu.com)
(36条消息) ArchLinux安装Docker并简单配置陌年微凉II的博客-CSDN博客archlinux docker
docker 执行异常:Failed to restart docker.service: Transport endpoint is not connected
- CMake
sudo pacman -S cmake #安装最新版cmake
WSL2安装Archlinux - ZongweiBai - 博客园 (cnblogs.com)
Windows10 wsl2 archwsl 指北 - 知乎 (zhihu.com)
参考:
已知问题 | ArchWSL official documentation (wsldl-pg.github.io)
Arch Linux (Manjaro) 配置与常用软件安装指南 | KAAAsS's blog
ArchLinux使用问题
- pacman下载软件包时,提示Network utility to retrieve files from the Web,已更换国内源,且ping通
更新pacman
sudo pacman -S pacman
3种方法解决pacman无法从源下载数据问题 - 云途主机 (vpsvt.com)
- pacman -Sy 或 yay -Sy一直错误 arch linux 无法联网
error: failed retrieving file 'core.db' from mirrors.kernel.org : Resolving timed out after 10000 milliseconds
error: failed retrieving file 'extra.db' from mirrors.kernel.org : Could not resolve host: mirrors.kernel.org
error: failed retrieving file 'community.db' from mirrors.kernel.org : Could not resolve host: mirrors.kernel.org
warning: too many errors from mirrors.kernel.org, skipping for the remainder of this transaction
error: failed retrieving file 'archlinuxcn.db' from mirrors.ustc.edu.cn : Could not resolve host: mirrors.ustc.edu.cn
warning: too many errors from mirrors.ustc.edu.cn, skipping for the remainder of this transaction
error: failed retrieving file 'archlinuxcn.db' from mirrors.tuna.tsinghua.edu.cn : Resolving timed out after 10000 milliseconds
error: failed to synchronize all databases (download library error)
管理员方式启动powershell,执行如下命令后重启电脑即可
wsl --shutdown
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns