[{"data":1,"prerenderedAt":599},["ShallowReactive",2],{"content:\u002F2023\u002Farchlinux-configure":3,"surround:\u002F2023\u002Farchlinux-configure":590},{"id":4,"title":5,"body":6,"categories":563,"date":565,"description":566,"draft":567,"extension":568,"image":569,"meta":570,"navigation":572,"path":573,"permalink":574,"published":574,"readingTime":575,"recommend":574,"references":574,"seo":580,"sitemap":581,"stem":582,"tags":583,"type":587,"updated":588,"__hash__":589},"content\u002Fposts\u002F2023\u002Farchlinux-configure.md","Arch Linux 初步配置",{"type":7,"value":8,"toc":543},"minimark",[9,13,17,41,44,47,50,70,78,81,95,98,104,112,121,124,132,155,192,195,199,202,206,221,255,259,296,299,302,306,326,329,343,347,350,354,357,371,374,410,417,446,450,453,493,496,534,537],[10,11,12],"h2",{"id":12},"如果你没有浏览器",[14,15,16],"p",{},"这篇文章中有大量命令，如果你的 Arch Linux 没有浏览器，可以这样做：",[18,19,20,28,34],"ul",{},[21,22,23,24],"li",{},"启动 SSH 服务\n",[25,26],"copy",{"code":27},"sudo systemctl start sshd",[21,29,30,31],{},"查看 IP 地址\n",[25,32],{"code":33},"ip -br a",[21,35,36,37],{},"在其他有浏览器的设备上通过 SSH 连接到这台设备（复制后按 Ctrl+Shift+V 粘贴内容）\n",[25,38],{"code":39,"prompt":40},"ssh 用户名@IP地址","PS>",[10,42,43],{"id":43},"换源",[14,45,46],{},"Pacman（Arch Linux 的包管理器）会使用安装时的镜像源列表设置。",[14,48,49],{},"如果在安装时使用 ArchInstall 里的 Mirror 选项设置了源，建议使用 Reflector 来更新源。",[18,51,52,58,64],{},[21,53,54,55],{},"安装\n",[25,56],{"code":57},"sudo pacman -S reflector",[21,59,60,61],{},"使用 Reflector 更新源\n",[25,62],{"code":63},"sudo reflector --verbose --country China --sort rate --save \u002Fetc\u002Fpacman.d\u002Fmirrorlist",[21,65,66,67],{},"移除风控严格的镜像源，防止滚包中断或损坏本地数据库\n",[25,68],{"code":69},"sudo sed -i '\u002Fzju\u002Fd' \u002Fetc\u002Fpacman.d\u002Fmirrorlist",[14,71,72,73,77],{},"如果你在日常滚包时更新时提示 ",[74,75,76],"code",{"code":76},"-> could not open file \u002Fvar\u002Flib\u002Fpacman\u002Fsync\u002Fcore.db: Unrecognized archive format","，说明数据库文件被替换为风控页面的 HTML 文件，需要手动删除被篡改的本地数据库，然后重新滚包。",[10,79,80],{"id":80},"字体",[18,82,83,89],{},[21,84,85,86],{},"中文字体\n",[25,87],{"code":88},"sudo pacman -S ttf-sarasa-gothic",[21,90,91,92],{},"Nerd 字体 (zsh 主题需要)\n",[25,93],{"code":94},"sudo pacman -S ttf-nerd-fonts-symbols",[10,96,97],{"id":97},"设置时间策略",[99,100,101],"blockquote",{},[14,102,103],{},"Linux 一般认为主板时间是 UTC 时间，而 Windows 认为主板时间是当地时间。如果在双系统之间切换，则开机时时间会不正常，所以需要设置时间策略。",[18,105,106],{},[21,107,108,109],{},"让 Linux 认为主板时间是当地时间，而不是 UTC\n",[25,110],{"code":111},"sudo timedatectl set-local-rtc true",[99,113,114,117],{},[14,115,116],{},"如果不想这样设置，还可以在 Windows 中添加注册表项，让 Windows 认为主板时间是 UTC。但是不要在两个系统中同时设置，否则矫枉过正会导致切换系统时产生反向时间差。",[25,118],{"code":119,"prompt":120},"reg add HKLM\\SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation \u002Fv RealTimeIsUniversal \u002Ft REG_DWORD \u002Fd 1","PS(管理员)>",[10,122,123],{"id":123},"显卡驱动",[18,125,126],{},[21,127,128,129],{},"仅限主流 Nvidia 显卡\n",[25,130],{"code":131},"sudo pacman -S nvidia",[14,133,134,135,142,143,148,149,154],{},"一般情况下不需要做出更多的配置，如果遇到问题，请参考 ",[136,137,141],"a",{"href":138,"rel":139},"https:\u002F\u002Fwiki.archlinuxcn.org\u002Fwiki\u002FNVIDIA",[140],"nofollow","ArchWiki - NVIDIA"," 和 ",[136,144,147],{"href":145,"rel":146},"https:\u002F\u002Farch.icekylin.online\u002Fguide\u002Frookie\u002Fgraphic-driver",[140],"archlinux 简明指南 - 显卡驱动","（",[136,150,153],{"href":151,"rel":152},"https:\u002F\u002Farch.cooo.site\u002Fguide\u002Frookie\u002Fgraphic-driver",[140],"镜像站","）。另外，Nvidia 对于 Wayland 的兼容不佳，所以尽可能选择 X11 相关的桌面环境。",[18,156,157,163],{},[21,158,159,160],{},"安装完显卡驱动后重启，检测 Nvidia 显卡驱动是否正常工作\n",[25,161],{"code":162},"nvidia-smi",[21,164,165,166,169,170],{},"如果显示 ",[74,167,168],{"code":168},"couldn't communicate with the NVIDIA driver"," 提示，可能是显卡驱动没有安装成功\n",[18,171,172,178,184,189],{},[21,173,174,175],{},"可以先卸载 Nvidia 相关软件包\n",[25,176],{"code":177},"sudo pacman -Rs nvidia nvidia-utils",[21,179,180,181],{},"强制更新 Pacman 软件包列表\n",[25,182],{"code":183},"sudo pacman -Syyuu",[21,185,186,187],{},"重新安装 Nvidia 驱动\n",[25,188],{"code":131},[21,190,191],{},"重启",[14,193,194],{},"之后在桌面右键菜单第二项“配置显示设置…”，将显示器缩放调整为一个合适的倍数。",[10,196,198],{"id":197},"git","Git",[25,200],{"code":201},"sudo pacman -S git",[10,203,205],{"id":204},"goproxy-环境变量","GOPROXY 环境变量",[14,207,208,209,214,215,220],{},"可以使用 ",[136,210,213],{"href":211,"rel":212},"https:\u002F\u002Fgoproxy.cn\u002F",[140],"七牛云Goproxy.cn","、",[136,216,219],{"href":217,"rel":218},"https:\u002F\u002Fgoproxy.io\u002Fzh\u002F",[140],"goproxy.io"," 镜像加速。",[18,222,223,229],{},[21,224,225,226],{},"编辑环境变量文件\n",[25,227],{"code":228},"sudo vim \u002Fetc\u002Fenvironment",[21,230,231,232,235,236,239,240,243,244],{},"向环境变量中添加以下内容（按 ",[74,233,234],{"code":234},"i"," 键进入编辑模式，按 ",[74,237,238],{"code":238},"Esc"," 键退出编辑模式，输入 ",[74,241,242],{"code":242},":wq"," 保存并退出）\n",[245,246,253],"pre",{"className":247,"code":249,"filename":250,"language":251,"meta":252},[248],"language-ini","# GOPROXY\nGO111MODULE=on\nGOPROXY=https:\u002F\u002Fgoproxy.cn\n","\u002Fetc\u002Fenvironment","ini","",[74,254,249],{"__ignoreMap":252},[10,256,258],{"id":257},"pacmanyay-加速编译","Pacman\u002FYay 加速编译",[18,260,261,267,273],{},[21,262,263,264],{},"查看 CPU 线程数\n",[25,265],{"code":266},"cat \u002Fproc\u002Fcpuinfo | grep processor | wc -l",[21,268,269,270],{},"编辑 makepkg 配置文件\n",[25,271],{"code":272},"sudo vim \u002Fetc\u002Fmakepkg.conf",[21,274,275,276,280,281,284,285,288,289],{},"修改编译线程数：删除 ",[74,277,279],{"className":278,"code":279,"language":251},[248],"MAKEFLAGS=j[N]"," 前面的注释标记，并将 ",[74,282,283],{"code":283},"N"," 替换为 CPU 线程数（输入 ",[74,286,287],{"code":287},"\u002FMAKE"," 搜索）\n",[245,290,294],{"className":291,"code":292,"filename":293,"language":251,"meta":252},[248],"MAKEFLAGS=\"-j8\"\n","\u002Fetc\u002Fmakepkg.conf",[74,295,292],{"__ignoreMap":252},[10,297,298],{"id":298},"启用蓝牙",[25,300],{"code":301},"sudo systemctl enable --now bluetooth",[10,303,305],{"id":304},"yay","Yay",[18,307,308,314,320],{},[21,309,310,311],{},"下载，需要先安装 Git。\n",[25,312],{"code":313},"git clone http:\u002F\u002Faur.archlinux.org\u002Fyay.git && cd yay",[21,315,316,317],{},"编译安装，不行就多试几次或者换个网络。\n",[25,318],{"code":319},"GOPROXY=http:\u002F\u002Fgoproxy.cn makepkg -si",[21,321,322,323],{},"安装后就能清除 Git 目录了。\n",[25,324],{"code":325},"cd .. && rm -rf yay",[10,327,328],{"id":328},"浏览器",[18,330,331,337],{},[21,332,333,334],{},"Microsoft Edge\n",[25,335],{"code":336},"yay -S microsoft-edge-dev-bin",[21,338,339,340],{},"Google Chrome\n",[25,341],{"code":342},"yay -S google-chrome",[10,344,346],{"id":345},"vs-code","VS Code",[25,348],{"code":349},"yay -S visual-studio-code-bin",[10,351,353],{"id":352},"v2echo-raya","V2$(echo r)aya",[14,355,356],{},"需要先安装浏览器，或者局域网下其他设备访问本设备的 2017 端口的 Web 控制台。",[18,358,359,365],{},[21,360,361,362],{},"安装 V2$(echo r)aya-bin\n",[25,363],{"code":364},"yay -S v2$(echo r)aya-bin",[21,366,367,368],{},"启动 V2$(echo r)aya 服务并设置开机启动\n",[25,369],{"code":370},"sudo systemctl enable --now v2$(echo r)aya",[14,372,373],{},"如果遇到问题，可以手动安装。",[18,375,376,382,388,402,407],{},[21,377,378,379],{},"切换到 yay\u002Fv2$(echo r)aya 目录\n",[25,380],{"code":381},"cd ~\u002F.cache\u002Fyay\u002Fv2$(echo r)aya-bin",[21,383,384,385],{},"编辑 PKGBUILD 文件\n",[25,386],{"code":387},"vim PKGBUILD",[21,389,390,391,394,395],{},"删除报错的 ",[74,392,393],{"code":393},"armv6h"," 架构，并保存退出\n",[245,396,400],{"className":397,"code":398,"filename":399,"language":251,"meta":252},[248],"arch=('x86_64') # 主要保留 x86_64 架构即可\n","PKGBUILD",[74,401,398],{"__ignoreMap":252},[21,403,404,405],{},"编译安装\n",[25,406],{"code":319},[21,408,409],{},"启动 V2$(echo r)aya 服务并设置开机启动",[14,411,412,413,416],{},"随后点击图标会自动访问 ",[74,414,415],{"code":415},"http:\u002F\u002F127.0.0.1:2017","，配置即可。",[18,418,419,422,428,434,440,443],{},[21,420,421],{},"点击右上角的“设置”",[21,423,424,425],{},"透明Proxy\u002F系统Proxy：",[74,426,427],{"code":427},"启用: 分流规则与规则端口所选规则一致",[21,429,430,431],{},"透明Proxy\u002F系统Proxy实现方式：",[74,432,433],{"code":433},"tproxy",[21,435,436,437],{},"规则端口的分流模式：",[74,438,439],{"code":439},"Mainland 白名单模式",[21,441,442],{},"点击“保存并应用”",[21,444,445],{},"在左上角启停 V2$(echo r)aya",[10,447,449],{"id":448},"zsh","Zsh",[14,451,452],{},"大多数 Zsh 主题需要 Nerd 字体才能显示图标。",[18,454,455,461,467,473,482],{},[21,456,457,458],{},"安装 Zsh 和常用插件\n",[25,459],{"code":460},"sudo pacman -S zsh zsh-completions zsh-autosuggestions zsh-syntax-highlighting",[21,462,463,464],{},"安装 Powerlevel10k 主题\n",[25,465],{"code":466},"yay -S zsh-theme-powerlevel10k",[21,468,469,470],{},"设置本用户的默认 Shell 为 Zsh\n",[25,471],{"code":472},"chsh -s \u002Fusr\u002Fbin\u002Fzsh",[21,474,475,476,479],{},"编辑 ",[74,477,478],{"code":478},"~\u002F.zshrc",[25,480],{"code":481},"vim ~\u002F.zshrc",[21,483,484,485],{},"向配置文件中添加以下内容\n",[245,486,491],{"className":487,"code":489,"filename":478,"language":490,"meta":252},[488],"language-sh","# Lines configured by zsh-newuser-install\nHISTFILE=~\u002F.histfile\nHISTSIZE=1000\nSAVEHIST=1000\nbindkey -e\n# End of lines configured by zsh-newuser-install\n\n# The following lines were added by compinstall\nautoload -Uz compinit\ncompinit\n# End of lines added by compinstall\n\nsource \u002Fusr\u002Fshare\u002Fzsh\u002Fplugins\u002Fzsh-autosuggestions\u002Fzsh-autosuggestions.zsh\nsource \u002Fusr\u002Fshare\u002Fzsh\u002Fplugins\u002Fzsh-syntax-highlighting\u002Fzsh-syntax-highlighting.zsh\nsource \u002Fusr\u002Fshare\u002Fzsh-theme-powerlevel10k\u002Fpowerlevel10k.zsh-theme\n\nbindkey '^[[H' beginning-of-line\nbindkey '^[[F' end-of-line\nbindkey '^[[1;5C' forward-word\nbindkey '^[[1;5D' backward-word\nbindkey '^H' backward-kill-word\nbindkey '^[[3~' delete-char\n\nzstyle ':completion:*' menu select\n\nalias ls='ls --color=auto'\nalias ll='ls -alFh --time-style=iso'\nalias ip='ip --color'\nalias grep='grep --color=auto'\n","sh",[74,492,489],{"__ignoreMap":252},[10,494,495],{"id":495},"输入法",[18,497,498,504,509,518,527],{},[21,499,500,501],{},"安装 Fcitx5 和中文输入插件\n",[25,502],{"code":503},"yay -S fcitx5-im fcitx5-chinese-addons",[21,505,506,507],{},"配置环境变量\n",[25,508],{"code":228},[21,510,511,512],{},"如果使用 X11，向环境变量添加以下内容\n",[245,513,516],{"className":514,"code":515,"filename":250,"language":251,"meta":252},[248],"# Fcitx5\nGTK_IM_MODULE=fcitx\nQT_IM_MODULE=fcitx\nXMODIFIERS=@im=fcitx\nSDL_IM_MODULE=fcitx\nINPUT_METHOD=fcitx\nGLFW_IM_MODULE=ibus\n",[74,517,515],{"__ignoreMap":252},[21,519,520,521,526],{},"如果使用 Wayland，请参考 ",[136,522,525],{"href":523,"rel":524},"https:\u002F\u002Fwiki.archlinuxcn.org\u002Fwiki\u002FFcitx5",[140],"Fcitx5 - Arch Linux 中文维基","。",[21,528,529,530,533],{},"还可以将 ",[74,531,532],{"code":532},"fcitx5-chinese-addons"," 替换为中州韵和 Rime。",[10,535,536],{"id":536},"继续优化其他体验",[538,539],"link-banner",{"banner":540,"link":541,"title":542},"https:\u002F\u002Fassets.zhilu.cyou\u002Fcover3\u002Farchlinux-beautify.jpg","\u002F2023\u002Farchlinux-beautify","Arch Linux 易用性及美化",{"title":252,"searchDepth":544,"depth":544,"links":545},4,[546,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562],{"id":12,"depth":547,"text":12},2,{"id":43,"depth":547,"text":43},{"id":80,"depth":547,"text":80},{"id":97,"depth":547,"text":97},{"id":123,"depth":547,"text":123},{"id":197,"depth":547,"text":198},{"id":204,"depth":547,"text":205},{"id":257,"depth":547,"text":258},{"id":298,"depth":547,"text":298},{"id":304,"depth":547,"text":305},{"id":328,"depth":547,"text":328},{"id":345,"depth":547,"text":346},{"id":352,"depth":547,"text":353},{"id":448,"depth":547,"text":449},{"id":495,"depth":547,"text":495},{"id":536,"depth":547,"text":536},[564],"技术","2023-06-24 09:31:15","在 Arch Linux 系统上安装配置必备软件，如蓝牙、Yay、Zsh、输入法等。",false,"md","https:\u002F\u002Fassets.zhilu.cyou\u002Fcover3\u002Farchlinux-configure.jpg",{"slots":571},{},true,"\u002F2023\u002Farchlinux-configure",null,{"text":576,"minutes":577,"time":578,"words":579},"6 min read",5.505,330300,1101,{"title":5,"description":566},{"loc":573},"posts\u002F2023\u002Farchlinux-configure",[584,585,586],"Arch Linux","系统配置","教程","tech","2024-12-19 08:23:15","L3E442N8AcfYlQmj1xp9JjHjZvA3Bo41WHCp2ea75dI",[591,596],{"title":592,"path":593,"stem":594,"date":595,"type":587,"children":-1},"使用 ArchInstall 安装 Arch Linux","\u002F2023\u002Farchinstall-guide","posts\u002F2023\u002Farchinstall-guide","2023-05-23 20:37:07",{"title":542,"path":541,"stem":597,"date":598,"type":587,"children":-1},"posts\u002F2023\u002Farchlinux-beautify","2023-07-24 21:27:45",1782091376738]