安装ArchLinux

下载

archlinux下载 中找到合适的资源下载镜像。推荐使用 国内镜像下载。

安装启动盘

这里使用 Ventoy 做PE。

安装

常用命令

修改默认编辑器

.bashrc.zshrc 中加入: export EDITOR=/usr/bin/vim

设置镜像

  1. sudo pacman-mirrors -i -c China -m rank

重启桌面

  1. ps -ef | grep plasmashell
  2. kill -9 pid
  3. kstart5 plasmashell

国内镜像

使用国内源:

  1. ## Our main server (Amsterdam, the Netherlands) (ipv4, ipv6, http, https)
  2. [archlinuxcn]
  3. Server = https://repo.archlinuxcn.org/$arch
  4. ## OpenTUNA (China CDN) (ipv4, https)
  5. [archlinuxcn]
  6. Server = https://opentuna.cn/archlinuxcn/$arch
  7. ## 北京外国语大学 (北京) (ipv4, ipv6, http, https)
  8. ## Added: 2020-05-18
  9. [archlinuxcn]
  10. Server = https://mirrors.bfsu.edu.cn/archlinuxcn/$arch
  11. ## 腾讯云 (Global CDN) (ipv4, http, https)
  12. ## Added: 2018-11-23
  13. [archlinuxcn]
  14. Server = https://mirrors.cloud.tencent.com/archlinuxcn/$arch
  15. ## 网易 (China CDN) (ipv4, http, https)
  16. [archlinuxcn]
  17. Server = https://mirrors.163.com/archlinux-cn/$arch
  18. ## 阿里云 (Global CDN) (ipv4, http, https)
  19. ## Added: 2020-07-03
  20. [archlinuxcn]
  21. Server = https://mirrors.aliyun.com/archlinuxcn/$arch
  22. ## 华为云 (Global CDN) (ipv4, http, https)
  23. ## Added: 2020-10-31
  24. [archlinuxcn]
  25. Server = https://repo.huaweicloud.com/archlinuxcn/$arch
  26. ## 清华大学 (北京) (ipv4, ipv6, http, https)
  27. [archlinuxcn]
  28. Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
  29. ## 中国科学技术大学 (安徽合肥) (ipv4, ipv6, http, https)
  30. [archlinuxcn]
  31. Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
  32. ## 哈尔滨工业大学 (黑龙江哈尔滨) (ipv4, ipv6, http, https)
  33. ## Added: 2021-01-09
  34. [archlinuxcn]
  35. Server = https://mirrors.hit.edu.cn/archlinuxcn/$arch
  36. ## 浙江大学 (浙江杭州) (ipv4, http, https)
  37. ## Added: 2017-06-05
  38. [archlinuxcn]
  39. Server = https://mirrors.zju.edu.cn/archlinuxcn/$arch
  40. ## 重庆大学 (重庆) (ipv4, ipv6, https)
  41. [archlinuxcn]
  42. Server = https://mirrors.cqu.edu.cn/archlinuxcn/$arch
  43. ## SJTUG 软件源镜像服务 (上海) (ipv4, https)
  44. ## Added: 2018-05-21
  45. [archlinuxcn]
  46. Server = https://mirrors.sjtug.sjtu.edu.cn/archlinux-cn/$arch
  47. ## 南京大学 (江苏南京) (ipv4, ipv6, http, https)
  48. [archlinuxcn]
  49. Server = https://mirrors.nju.edu.cn/archlinuxcn/$arch
  50. ## 莞工 GNU/Linux 协会 开源软件镜像站 (广东东莞) (ipv4, https)
  51. ## Added: 2018-11-03
  52. [archlinuxcn]
  53. Server = https://mirrors.dgut.edu.cn/archlinuxcn/$arch
  54. ## 南方科技大学 (广东深圳) (ipv4, ipv6, http, https)
  55. ## Added: 2021-08-17
  56. [archlinuxcn]
  57. Server = https://mirrors.sustech.edu.cn/archlinuxcn/$arch

来源:
安装:

  1. sudo pacman -Sy && sudo pacman -S archlinuxcn-keyring

在每次启动后,运行 sudo pacman -Syyuparu -Syyu 来重新系统。

常用软件

列表

  1. paru -S --needed zsh jetbrains-toolbox goldendict fcitx5-im fcitx5-rime ranger vim xclip mycli tldr oh-my-zsh virtuallbox nvm deno thefuck pamac iredis rdesktop
  2. paru -S --needed wqy-microhei wqy-zenhei wqy-bitmapfont noto-fonts-sc adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts
  3. paru -S --needed ttf-twemoji ttf-twemoji-color ttf-symbola otf-openmoji ttf-mac-fonts
  • zsh
  • rdesktop
  • jetbrains-toolbox
  • goldendict
  • paru
  • fcitx5-im
  • fcitx5-rime
  • ranger
  • vim
  • xclip
  • mycli
  • tldr
  • oh-my-zsh
  • virtualbox
  • nvm
  • deno
  • thefuck
  • pamac
  • iredis
  • gimp

    Paru

    Paru is a AUR.

    install

    1. sudo pacman -S --needed base-devel
    2. git glone https://aur.archlinux.org/paru.git
    3. cd paru
    4. makepkg -si

    使用

    paru中常用的一些命令:

  • paru 同步源,并更新系统(同_paru -Syu_)

  • _paru -Sy_仅同步源
  • paru -Su -ignore foo升级时不升级包foo
  • paru -Sua 更新当前安装的所有AUR包
  • paru -S fooreposAuR安装foo
  • paru -Ss foo搜索foo
  • paru -Si foo获取foo包的信息
  • paru abc交互式安装abc
  • paru -S abc从本地数据库中得到abc的信息,下载安装abc包
  • paru -c删除没有依赖的包
  • paru -U foo 安装本地包foo

    xfce桌面环境

    1. paru -S xfce4 xfce4-goodies

    Asbru-cm

    远程终端管理器,类似于window下的 xshell

    安装

    1. paru -S asbru-cm

    Remmina

    remmina也是一个远程终端管理器。

    安装

    1. paru -S remmina

    ZSH

    安装oh-my-zsh

    manjaro自带zsh,要额外安装一下 .oh-my-zsh 插件来让zsh更好用。
    1. sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    安装完成后,会把之前的 .zshrc 配置文件复制为 .zshrc.pre-oh-my-zsh 文件。把之前的配置复制到新的 zshrc 文件底部。
    添加插件:
    1. plugins=(
    2. git
    3. autojump
    4. )
    要使用 autojump 需要安装 autojump 本身。
    1. paru -S autojump
    安装完成后,要在 .zshrc 中加入以下内容:

    [[ -s /etc/profile.d/autojump.sh ]] && source /etc/profile.d/autojump.sh

更新oh-my-zsh

  1. omz update

修改主题

安装 powerlevel10k

  1. git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

.zshrc中的ZSH-THEME内容修改为ZSH-THEME='powerlevel10k/powerlevel10k'

使用自定义插件

如果我们有能力的话,我们可以为使用自定义插件。只要我们把自定义插件放到$HOME/.oh-my-zsh/custom/plugins中并以xxx.plugin.zsh命令,最后在.zshrc文件的plugins字段中添加我们的插件名xx即可。
以自定义deno的自动完成为例:

  1. 生成插件内容

    1. deno completions zsh > ~/.oh-my-zsh/custom/plugins/deno.plugin.zsh
  2. 修改.zshrc内容

    1. plugins = (
    2. git
    3. deno
    4. )

    配置zsh

    常用插件安装:

    1. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting // 语法高高
    2. git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions //自动完成

    启用插件:

    1. plugins = (
    2. git
    3. deno
    4. zsh-syntax-highlighting
    5. zsh-autosuggestions
    6. command-not-found
    7. autojump
    8. )

    Jetbrains Toolbox

    设置脚本
    将脚本目录设置为 ~/.local/bin 目录

    mariadb数据库安装

    1. paru -Syyu
    2. paru -S mysql
    3. sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
    4. sudo /usr/bin/mysql_secure_installation

    postgreSQL数据库安装

    1. paru -Syyu
    2. paru -S postgresql
    3. sudo systemctl start postgresql // 启动postgresql服务
    4. sudo systemctl enable postgresql //开机启动postgresql服务(可选)
    5. sudo su - postgres -c "initdb --locale en_US.UTF-8 -E UTF8 -D '/var/lib/postgres/data'" // 初始化设置
    6. sudo su - postgres
    7. [postgres@linux ~]$ createuser --interactive //设置postgreSQL用户

    mycli

    1. paru -S mycli

    配置:~/.myclirc: ``` [main]

Enables context sensitive auto-completion. If this is disabled then all

possible completions will be listed.

smart_completion = True

Multi-line mode allows breaking up the sql statements into multiple lines. If

this is set to True, then the end of the statements must have a semi-colon.

If this is set to False then sql statements can’t be split into multiple

lines. End of line (return) is considered as the end of the statement.

multi_line = False

Destructive warning mode will alert you before executing a sql statement

that may cause harm to the database such as “drop table”, “drop database”

or “shutdown”.

destructive_warning = True

log_file location.

log_file = ~/.mycli.log

Default log level. Possible values: “CRITICAL”, “ERROR”, “WARNING”, “INFO”

and “DEBUG”.

log_level = INFO

Log every query and its results to a file. Enable this by uncommenting the

line below.

audit_log = ~/.mycli-audit.log

Timing of sql statments and table rendering.

timing = True

Table format. Possible values: ascii, double, github,

psql, plain, simple, grid, fancy_grid, pipe, orgtbl, rst, mediawiki, html,

latex, latex_booktabs, textile, moinmoin, jira, vertical, tsv, csv.

Recommended: ascii

table_format = ascii

Syntax Style. Possible values: manni, igor, xcode, vim, autumn, vs, rrt,

native, perldoc, borland, tango, emacs, friendly, monokai, paraiso-dark,

colorful, murphy, bw, pastie, paraiso-light, trac, default, fruity

syntax_style = vim

Keybindings: Possible values: emacs, vi.

Emacs mode: Ctrl-A is home, Ctrl-E is end. All emacs keybindings are available in the REPL.

When Vi mode is enabled you can use modal editing features offered by Vi in the REPL.

key_bindings = vim

Enabling this option will show the suggestions in a wider menu. Thus more items are suggested.

wider_completion_menu = False

MySQL prompt

\t - Product type (Percona, MySQL, Mariadb)

\u - Username

\h - Hostname of the server

\d - Database name

\n - Newline

prompt = ‘\t \u@\h:\d> ‘

Skip intro info on startup and outro info on exit

less_chatty = False

Use alias from —login-path instead of host name in prompt

login_path_as_host = False

Cause result sets to be displayed vertically if they are too wide for the current window,

and using normal tabular format otherwise. (This applies to statements terminated by ; or \G.)

auto_vertical_output = False

keyword casing preference. Possible values “lower”, “upper”, “auto”

keyword_casing = auto

Enable the pager on startup.

enable_pager = True

Custom colors for the completion menu, toolbar, etc.

[colors]

Completion menus.

Token.Menu.Completions.Completion.Current = ‘bg:#00aaaa #000000’ Token.Menu.Completions.Completion = ‘bg:#008888 #ffffff’ Token.Menu.Completions.MultiColumnMeta = ‘bg:#aaffff #000000’ Token.Menu.Completions.ProgressButton = ‘bg:#003333’ Token.Menu.Completions.ProgressBar = ‘bg:#00aaaa’

Selected text.

Token.SelectedText = ‘#ffffff bg:#6666aa’

Search matches. (reverse-i-search)

Token.SearchMatch = ‘#ffffff bg:#4444aa’ Token.SearchMatch.Current = ‘#ffffff bg:#44aa44’

The bottom toolbar.

Token.Toolbar = ‘bg:#222222 #aaaaaa’ Token.Toolbar.Off = ‘bg:#222222 #888888’ Token.Toolbar.On = ‘bg:#222222 #ffffff’

Search/arg/system toolbars.

Token.Toolbar.Search = ‘noinherit bold’ Token.Toolbar.Search.Text = ‘nobold’ Token.Toolbar.System = ‘noinherit bold’ Token.Toolbar.Arg = ‘noinherit bold’ Token.Toolbar.Arg.Text = ‘nobold’

Favorite queries.

[favorite_queries]

Use the -d option to reference a DSN.

[alias_dsn]

example_dsn = mysql://[user[:password]@][host][:port][/dbname]

  1. <a name="OpES3"></a>
  2. ## iredis
  3. iredis是一个好用的redis管理命令行工具。
  4. <a name="WJ1Rw"></a>
  5. ### 安装
  6. ```typescript
  7. paru -S iredis

GoldenDict

goldenDict是linux系统中很好用的一个语言翻译工具。

安装

  1. paru -S goldendict

配置词典

JetBrianRunner

安装

  1. paru -S --needed plasma5-runners-jetbrains-runner

Rime

安装 表型码输入法

先安装 rime 输入法

  1. yay -S fcitx5-im fcitx-rime

配置 .pam_environment 文件:

  1. GTK_IM_MODULE=fcitx5
  2. QT_IM_MODULE=fcitx5
  3. XMODIFIERS="@im=fcitx5"

配置 ~/.xprofile 文件:

  1. export GTK_IM_MODULE=fcitx5
  2. export XMODIFIERS=@im=fcitx5
  3. export QT_IM_MODULE=fcitx5
  4. fcitx5 &

配置 ~/.xinitrc 文件:

  1. export GTK_IM_MODULE=fcitx5
  2. export XMODIFIERS=@im=fcitx5
  3. export QT_IM_MODULE=fcitx5

注意:上述内容需要添加在exec $(get_session)之前

安装完成后,进入到 ~/.local/share/fcitx5/rime 目录中,把设置文件和码表复制到该目录下。文件和码表请到下面下载:

定制

配置UI:
添加 输入法面板 小部件。在 输入法面板 小部件中设置字体和大小。

VimPlus

安装

  1. git clone https://github.com/chxuan/vimplus.git ~/.vimplus
  2. cd ~/.vimplus
  3. ./install.sh

ranger

终端文件管理器
修改默认的文件编辑器:

  1. vim ~/.bashrc
  2. export EDITOR=/usr/bin/vim
  3. export VISUAL=/usr/bin/vim

xclip

功能

将内容输入到剪贴板

安装

  1. yay -S xclip

使用 xclip finename 把文件内容复制到剪贴板中。

Jenkins

切换 java 环境

  1. archlinux-java status
  2. sudo archlinux-java set java-8-openjdk/jre
  3. archlinux-java status // should display java-8-openjdk

安装

  1. paru -S jenkins

启动

  1. sudo systemctl start jenkins

访问

  1. http://localhost:8090

重启/退出/重新加载

重启

要想重启jenkins,我们只要在jenkins的访问地址上添加restart即可。本例中即:http://localhost:8090/restart.

退出

要想重启jenkins,我们只要在jenkins的访问地址上添加exit即可。本例中即:http://localhost:8090/exit.

重新加载

要想重启jenkins,我们只要在jenkins的访问地址上添加reload。本例中即:http://localhost:8090/reload.
查看admin密码

  1. sudo cat /var/lib/jenkins/secrets/initialAdminPassword

VSCode-Insider

源码安装

  1. 下载
  2. 解压 tar -zxvf code-insider-x64-1615971321.tar.gz
  3. 移动到 /opt/ 目录下

    1. sudo mv VSCode-linux-x64 /opt/
  4. 添加执行权限

    1. sudo chomd +x /opt/VSCode-linux-x64/code-insiders
  5. 在桌面上添加图标

    1. sudo cp /opt/VSCode-linux-x64/resources/app/resources/linux/code.png /usr/share/icons/
    2. sudo vim /usr/share/applications/vscode-insider.desktop
    1. [Desktop Entry]
    2. Name=VS-Code-Insider
    3. Comment=Multi-platform code editor for linux
    4. Exec=/opt/VSCode-linux-x64/code-insiders
    5. Icon=/usr/share/icons/code.png
    6. Type=Application
    7. StartupNotify=true
    8. Categories=TextEditor;Development;Utility;
    9. MimeType=text/plain;

    unetbootin

    介绍

    unetbootin是linux下烧录 启动盘的一个工具。

    安装

    1. paru -S unetbootin

    gwenview

    gwenview是KDE桌面上的一个看图软件。

    安装

    1. paru -S gwenview qt5-imageformats kimageformats

    kimageformats和qt5-imageformats都是可选安装的组件。
    kimageformats可以使得 gwenview查看psd格式的图片
    qt5-imageformats可以使得 gwenview查看webp格式的图片

    常用小部件

  • kdeplasma-applets-fokus

    桌面环境

    KDE桌面

    KDE桌面是ArchLinux中自定义最强的一个桌面环境。我们可以把KDE桌面订制成我们想要的样子。可以是Window风格,也可以是MacOS风格,同样也可以是其他风格。
    下面是本人常用的设置:
    全局主题: Sweet
    图标:Kora
    字体:文泉驿微米黑
    光标:SweetFuture cursors
    登录屏幕:Beautiful-splash-SSDM9
    欢迎屏幕:Animated_abstract

    在KDE桌面环境下输入Emoji:

    使用window+.即可,macos的键盘对应的的super+.

    常见问题:

    在我们使用KDE作为桌面环境的时候,难免会遇到这样或那样的问题。为了方便以后遇到同样的问题可以及早解决,把自己或大家遇到的问题在这里列举一下:

    外观问题

  • 在安装完全局主题应用程序风格后,看到不需要的应用程序风格后,找不到删除不需要的应用程序风格的地方

要想删除不需要的应用程序风格,我们只需要在这几个地方把对应的文件删除就可以:

  • /usr/share/kstyle/themes/*.themerc
  • /usr/share/doc/qt/qtwidgets/images/*.png
  • /usr/share/doc/qt/qtdesigner/images/*.png
  • /usr/lib/qt/plugins/styles/*.so

    记得删除的是不需要的对应的文件,不要都删除哦!

常见问题

修改主目录为英文

把HOME目录改为英文

  1. $ sudo pacman -S xdg-user-dirs-gtk
  2. $ export LANG=en_US
  3. $ xdg-user-dirs-gtk-update
  4. $ #然后会有个窗口提示语言更改,更新名称即可
  5. $ export LANG=zh_CN.UTF-8
  6. $ #然后重启电脑如果提示语言更改,保留旧的名称即可

微信输入中文乱码

http://linux-wiki.cn/wiki/Wine%E7%9A%84%E4%B8%AD%E6%96%87%E6%98%BE%E7%A4%BA%E4%B8%8E%E5%AD%97%E4%BD%93%E8%AE%BE%E7%BD%AE

打印机服务不可用,错误的文件描述符

有一个可能的原因是 cups 服务没有启动。

  1. sudo systemctl start cups.service // 启动 cups
  2. sudo systemctl enable cups.service // 设置 cups 为开机启动

ThinkPad E14 AMD 功能键不能使用的bug修复

参考:

discover无法使用

在使用 archlinux的discover安装器的时候,可能会遇到discover当前无法用于安装任何应用程序,这是因为它所需的后端程序均不可用。请将此错误报告给您安装的发行版项目的问题。这是因为我们没有安装必要的安装包packagekit-qt5,只要我们安装上这个包,就可以解决这个问题。然后,重新启动discover即可。

  1. paru -S packagekit-qt5

使用彩色Emoji

要在ArchLinux或Manjaro中使用彩色Emoji,我们需要做三步:

  1. 安装字体;
  2. 添加配置文件;
  3. 添加软链接。

    安装字体

    1. paru -S noto-fonts-emoji

    添加配置文件

    /etc/fonts/conf.avail/中创建75-noto-color-emoji.conf文件 ```xml <?xml version=”1.0” encoding=”UTF-8”?> <!DOCTYPE fontconfig SYSTEM “fonts.dtd”>

    emoji Noto Color Emoji sans Noto Color Emoji serif Noto Color Emoji sans-serif Noto Color Emoji monospace Noto Color Emoji Symbola Apple Color Emoji Noto Color Emoji Segoe UI Emoji Noto Color Emoji Segoe UI Symbol Noto Color Emoji Android Emoji Noto Color Emoji Twitter Color Emoji Noto Color Emoji Twemoji Noto Color Emoji Twemoji Mozilla Noto Color Emoji TwemojiMozilla Noto Color Emoji EmojiTwo Noto Color Emoji Emoji Two Noto Color Emoji EmojiSymbols Noto Color Emoji Symbola Noto Color Emoji

  1. <a name="lyqwG"></a>
  2. ### 添加软链接
  3. ```xml
  4. sudo ln -sf /etc/fonts/conf.avail/75-noto-color-emoji.conf /etc/fonts/conf.d/

通过Virtual Box安装win11

在我们使用Virtual Box安装win11的过程中,我们可能会遇到一个错误类似于您的设备不符合windows11的最低要求的错误。解决这个问题的方法就是修改注册表。如下:

  1. 在界面中按下SHIFT+F10调用控制台。
  2. 在控制台中输入regedit调起注册表窗口。
  3. HKEY_LOCAL_MACHINE->SYSTEM->Setup下新建一下LabConfig的选项。在这个选项下新建四个字段,值的类型都为 DWORD(32 位)位,值都为1。它们是:
  • BypassTPMCheck
  • BypassCPUCheck
  • BypassRAMCheck
  • BypassSecureBootCheck

这样,我们重新安装就可以了。

无线网络不可用

有时候,我们可能会发现无线网络突然不能用了。这个时候,我们可以使用iw命令行工具来查找原因。在我的一次经历中,我使用了iw dev发现,我本地找不到网络设备。但是可以通过lspci -k命令找到无线网卡。这个时候,可能是无线网卡的接莫名其妙的消失了。在这个时候,我们可以使用iw list来找到无线网卡在系统中的“物理命令”,一般会是phy0之类的字样。然后使用下面的命令修复。

  1. iw phy phy0 interface add wlan0 type station

配置lstp/ipsec的VPN连接

在我们使用lstp/ipsec的VPN的连接的时候,有时候会连接不上。如果我们是使用的networkmanager-l2tpstronswan的组合的话。我们就可以使用sudo /usr/lib/NetworkManager/nm-l2tp-service --debug命令来调试。如果我们在调试中发现了no acceptable traffic selectors found这样的错误,那么就可能是IKEv1 Cisco Unity Extension出错了。我们有一个选择就是禁用对IKEv1 Cisco Unity Extension的加载。具体方法如下:

  1. 编辑/etc/strongswan.d/charon.conf文件并取消# cisco_unity = no的注释

    1. # Send Cisco Unity vendor ID payload (IKEv1 only).
    2. cisco_unity = no
  2. 创建或修改/etc/strongswan.d/charon/unity.conf文件,使其包含下面的内容:

    1. unity {
    2. # Whether to load the plugin. Can also be an integer to increase the
    3. # priority of this plugins.
    4. load = no
    5. }