Configure ArchLinux system environment
Article directory
Configure AUR
China source
As mentioned in the previous article, installing AUR
the Chinese source is ArchLinuxCN
the source, but there may be situations where it cannot be used.
The reason is that pacman
the upstream has updated the format of the key ring, which makes the local master key unable to sign other keys.
Therefore, it is recommended to install a haveged
system entropy generation daemon that speeds up critical operations of encryption software.
The specific steps are as follows:
-
① Use the software package management tool (
pacman
) to installhaveged
the system entropy generation daemon . The specific operations are as follows:$ sudo pacman -Syu haveged
-
② Use
systemd
the system daemon management tool to starthaveged
and make it start automatically at boot. The specific operations are as follows:$ sudo systemctl start haveged $ sudo systemctl enable haveged
-
③ Delete the generated key file and generate the key file again. The specific operations are as follows:
$ sudo rm -rf /etc/pacman.d/gnupg $ sudo pacman-key --init $ sudo pacman-key --populate archlinux $ sudo pacman-key --populate archlinuxcn
-
④ Use the software package management tool (
pacman
) to synchronize the local package database with the remote warehouse. The specific operations are as follows:$ sudo pacman -Sy
-
⑤ Install third-party software package management tools for management
AUR
. ManageableAUR
third-party software package management tools include, but are not limited to,yay
,paru
.yaourt
Just choose one of them. You can use the official software package management tool (pacman
) to install third-party software package management tools. The specific operations are as follows:$ sudo pacman -S yay # 使用官方的软件包管理工具安装第三方软件包管理工具yay $ sudo pacman -S paru # 使用软件包管理工具管理器安装第三方软件包管理工具paru $ sudo pacman -S yaourt #软件包管理工具方的软件包管理工具安装第三方软件包管理工具yaourt
Desktop environment installation
Use the system package management tool pacman
to install the desktop environment.
Linux
There are many desktop environments, and there are also many optional desktop environments. For example, you can choose lightweight XFCE
desktop environments, slightly lightweight MATE
desktop environments or KDE
desktop environments, desktop environments with many functions, GNOME
etc., as well as window managers i3wm
, dwm
, openbox
, fluxbox
etc.
For example, to install XFCE
the desktop environment, the command is as follows:
$ sudo pacman -S xfce4
hint:
If you install
XFCE4
desktop plug-ins, you can directly installXFCE4
the desktop plug-in package, that isxfce4-goodies
, you can install allXFCE4
desktop plug-ins. The installation command is as follows:$ sudo pacman -S xfce4-goodies
For another example, to install KDE
the desktop environment, the command is as follows:
$ sudo pacman -S plasma
...and so on
Login Manager Installation
Use the system package management tool pacman
to install the desktop environment. Linux
There are many login managers, including but not limited to LightDM
, GDM
, LXDM
, SDDM
, XDM
. Here is LightDM
an example. Use the following command to install the login manager:
$ sudo pacman -S lightdm
hint:
LightDM
It is not possible to just install , you also need to install oneGreeter
to configureLightDM
,Greeter
including but not limited tolightdm-gtk-greeter
,lightdm-deepin-greeter
,lightdm-pantheon-greeter
,lightdm-slick-greeter
,lightdm-webkit2-greeter
.lightdm-webkit-theme-litarvan
Taking an example here
lightdm-pantheon-greeter
, the installation command is as follows:$ sudo pacman -S lightdm-pantheon-greeter
After installation, you need to set
LightDM
theGreeter
to the installed oneGreeter
, that is, delete the one/etc/lightdm/lightdm.conf
in thegreeter-session=
front#
and fill in the installedGreeter
name after it. The example is as follows:[Seat:*] ... greeter-session=lightdm-<yourgreeter>-greeter ...
Among them,
lightdm-pantheon-greeter
are special cases, examples of which are as follows:[Seat:*] ... greeter-session=io.elementary.greeter.confer ...
Use the following command to start the login manager at boot:
# systemctl enable <登录管理器名称>
hint:
Start the login manager after booting, as
LightDM
an example:# systemctl enable lightdm
Fonts and other add-ons installation
Use the system package management tool pacman
to install fonts and other add-ons:
$ sudo pacman -S ntfs-3g adobe-source-han-serif-cn-fonts ttf-dejavu wqy-zenhei wqy-microhei noto-fonts-cjk noto-fonts-emoji noto-fonts-extra file-roller gwenview packagekit-qt5 packagekit appstream-qt appstream man neofetch net-tools openssh gvfs
These include commonly used fonts, decompression software, network tools, etc.
If you want to use the downloaded font file, you can also use software to install the font or install the font manually. The command is as follows:
-
Software Installation:
-
① Use the system package management tool to install the font manager. The command is as follows:
$ sudo pacman -S font-manager
Or use the following command to install Deepin Font Manager:
$ sudo pacman -S deepin-font-manager
-
② Import the downloaded fonts into the installed font manager to complete the font installation.
-
-
Manual installation:
-
① Copy or transfer the downloaded fonts to the font folder. If there is no font folder, create the folder.
The command to create a font folder is as follows:
$ mkdir ~/.local/share/fonts
Copy or transfer fonts to the fonts folder:
$ cp -r <下载的字体文件或字体文件夹名称> ~/.local/share/fonts/ # 复制 $ mv <下载的字体文件或字体文件夹名称> ~/.local/share/fonts/ # 剪切
-
② Use the following command to scan the font directory and generate a font information cache:
$ fc-cache -fv
-
Driver Installation
1. Use the following command to install xorg
the driver:
$ sudo pacman -S xorg xorg-xint xorg-server xorg-server-common xorg-server-devel xorg-apps xorg-xset xorg-xsetroot xorg-xinput
2. Use the following command to install the graphics card driver :
$ sudo pacman -S xf86-video-vesa # 通用
$ sudo pacman -S xf86-video-nv # 英伟达
$ sudo pacman -S xf86-video-ati # ATI
3. Use the following command to install the notebook touchpad driver:
$ sudo pacman -S xf86-input-synaptics
4. Use the following command to install the sound card driver:
$ sudo pacman -S alsa-utils
$ sudo pacman -Sy alsa-lib alsa-utils
$ sudo systemctl --user enable pulseaudio
Xorg
Installed drivers will be automatically searched for:
- If the driver listed in the table below cannot be found for the device, it will first check whether it is installed
fbdev
(xf86-video-fbdev
). - If it is still not found, it will search for
vesa
(xf86-video-vesa
), which is a universal driver that supports most graphics cards and does not provide any2D
and3D
acceleration functions. - If not found
vesa
,Xorg
it will fall back toKMS
the accelerationKMS
included in the driverGLAMOR
.
To get the most out of your graphics card, install the driver according to the table below. It is recommended to use open source drivers first, as these drivers are less likely to cause problems.
Manufacturer | type | drive | OpenGL | OpenGL (multilib) | document |
---|---|---|---|---|---|
AMD/ATI | Open source | xf86-video-amdgpu | mesa | lib32-table | AMDGPU |
AMD/ATI | Open source | xf86-video-and | mesa | lib32-table | WE HAD |
Intel | Open source | xf86-video-intel | mesa | lib32-table | Intel graphics |
NVIDIA | Open source | xf86-video-new | mesa | lib32-table | Nouveau |
NVIDIA | Proprietary | nvidia | nvidia-utils | lib32-nvidia-utils | NVIDIA |
NVIDIA | Proprietary | nvidia-390xxAUR | nvidia-390xx-utilsAUR | lib32-nvidia-390xx-utilsAUR | NVIDIA |
Notice:
NVIDIA Optimus
For notebooks using both integrated graphics and discrete graphics , please refer toNVIDIA Optimus
.For 4th generation and newer
Intel
graphics cards, readIntel_graphics#Installation
for available drivers.
Other drivers are also located xorg-drivers
in the package group.
Xorg
It should work fine without closed source drivers .
If you don’t know the graphics card type, you can use the following command to install all open source graphics card drivers:
$ sudo pacman -S xorg-drivers
A typical use for closed source drivers is for certain advanced graphics features, such as rendering acceleration for games 3D
.
Some exceptions are that some of the latest GPU
(especially ) are not supported by open source drivers NVIDIA
.GPU
Chinese input method installation:
Linux
Chinese input method engines include, but are not limited to ibus
, , fcitx
, , and are recommended fcitx
, but others are also available.
fcitx
Engines include fcitx-sunpinyin
, fcitx-libpinyin
, fcitx-rime
, , fcitx-googlepinyin
etc. You can select one or more of them.
You can use the software package management tool pacman
to install the Chinese input method. The command is as follows:
$ sudo pacman -S fcitx-im #默认全部安装
$ sudo pacman -S fcitx-configtool
$ sudo pacman -S fcitx-<输入法名称>
After the installation is complete, configure the input method and use a text editor to edit .xprofile
the file or files. The editing content is as follows..xinit
export LC_ALL=zh_CN.UTF-8
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=“@im=fcitx”
Make the environment variables take effect after logging in again.
Notice:
If
fcitx
it does not start automatically, pleasefcitx &
add it~/.xinitrc
.If
fcitx &
it does not start, add a delay at the endsleep 2
.
Please do not
.bashrc
set these environment variables in .
bashrc
Applies only to initialization of interactive sessions, and does not apply to initialization ofbash
non-interactive scripts or sessions.X
If there is any problem
Qt
usingfcitx
, please executeqtconfig
( ) and set to " "qtconfig-qt4
in the input method configuration .fcitx
Default Input Method
Optimization
TRM
Disk optimization
If the root ( /
) directory is installed on a solid-state drive, it is recommended to enter the following command to TRM
help clean up SSD
the blocks and extend SSD
the service life:
$ sudo systemctl enable fstrim.timer
tlp
Power management
Use the following command to install tlp
the power management software:
$ sudo pacman -S tlp tlp-rdw
Use the following command to start tlp
the service
sudo tlp start
Use the following command to check tlp
the working status:
sudo tlp-stat -s
Note :
If the output content is at the end
Notice
, it is as follows:Notice: systemd-rfkill.service is not masked -- invoke "systemctl mask systemd-rfkill.service" to correct this! Notice: systemd-rfkill.socket is not masked -- invoke "systemctl mask systemd-rfkill.socket" to correct this!
Then
notice
run the command as prompted, as shown below:$ sudo systemctl mask systemd-rfkill.service $ sudo systemctl mask systemd-rfkill.socket
Use the following command to check whether the add-on needs to be installed:
$ sudo tlp-stat -b
Note :
If the last two lines have the following prompts to install additional components:
+++ Recommendations * Install acpi_call kernel module for ThinkPad battery recalibration
Then use the following command to install the add-on:
Note :
Select the appropriate
linux
kernel version when installing.$ yay -S acpi_call
Avoid shutting down for too long
Use a text editor to edit the system configuration file:
$ sudo gedit /etc/systemd/system.conf
In the file opened with a text editor system.conf
, find the two items #DefaultTimeoutStartSec
and #DefaultTimeoutStopSec
and modify 2
the content. The example is as follows:
DefaultTimeoutStartSec=5s
DefaultTimeoutStopSec=5s
Notice:
The above modification is to set the maximum response time for opening and closing processes. There is no limit by default. It is now modified to 5 seconds.
Changing this parameter to 5 seconds only applies to personal computers, not servers, please remember!
System firewall
Linux
There are many firewall software options available, including but not limited to FireWall
, Gufw
. This article will Gufw
use an example to illustrate.
Install Gufw
system firewall
Use the package manager to install Gufw
the system firewall. The specific steps are as follows:
$ sudo pacman -S gufw
Configure Gufw
system firewall
-
① Use the following command to query
ufw
the system firewall status:$ sudo ufw status
hint:
Generally, the default state is idle (
inactive
), that is, the output state is as follows:Status: inactive
-
② Use the following command to start
UFW
the service
$ sudo ufw enable
- ③ Use the following command to set the default to block all
$ sudo ufw default deny
- ④ Use the following command to allow all port connections.
$ sudo ufw allow ssh
- ⑤ Use the following command to allow
3389
the port connection of this machine (i.e.xrdp
)
$ sudo ufw allow from 127.0.0.1 to any port 3389
- ⑥ Status query, successfully started and custom rules added
$ sudo ufw status
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
3389 ALLOW 127.0.0.1
hint:
The output content of successful startup is
Status: active
.Other output content is custom rules.
Generate system log
You can use software such as metalog
, syslog-ng
etc. to record the system and software operation status in log files to facilitate analysis of problems encountered during system use and further management.
This article takes metalog
an example, and the specific steps are as follows:
-
① Use the software package management tool to install the system usage log generation tool. The specific steps are as follows:
$ sudo pacman -S metalog
-
② Use
systemd
the system daemon management tool to startmetalog
and make it start automatically at boot. The specific operations are as follows:$ sudo systemctl start metalog $ sudo systemctl enable metalog
hint:
After
metalog
the installation and startup are completed, the system usage log will be generated in/var/log
the folder.If you
metalog
have more configuration requirements, you can/etc/metalog.conf
further customize the configuration file ( ).If you want to know
metalog
more about it, you can learn more about it on its official website or its Github platform , or you can download the latest stable version on its sourceforge homepage .
Third-party package management tools
If you want to further obtain more application software, you can choose to use third-party software package management tools. The specific third-party software package management tools are as follows:
Flatpak
Package management tools
" Flatpak
A Linux
system for building, distributing, and sandboxing desktop programs."
Flatpak
Is a tool used to manage applications and the runtime used by the application.
Flatpak
In this model, applications are built and distributed independently of their host system, and run to a certain extent independent of the host system ('sandboxed').
Flatpak
Use OSTree
to distribute and deploy data.
Flatpak
The repository used is OSTree
a repository and can ostree
be operated with tools.
Flatpak
Installed runtimes and applications have been OSTree
checked out.
-
Install
Flatpak
To install
Flatpak
, run the following command in the terminal:$ sudo pacman -S flatpak
-
Manage warehouse
Notice:
By default, each
flatpak
command is available globally; specifically, the package is installed to all users of the current machine and requires the user to provideroot
a password.If you install a software package or operate a warehouse for a single user, you can add
--user
parameters to each command. In this case, you do not need to provide super permissions.For example, adding a warehouse visible only to you should be executed
$ flatpak remote-add --user *name* *location*
. Install a software visible only to you and execute it$ flatpak install --user *package-name*
.-
Add a repository
To add a remote
flatpak
repository, execute:$ flatpak remote-add *name* *location*
hint:
name
is the name of the new remote warehouselocation
Is the path or warehouseURL
.For example, add an official repository
Flathub repository
:$ flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
The download speed of the official warehouse in China is extremely slow. It is recommended to use
Flatpak
domestic mirror sources to speed up the download speed. The specific operations are as follows:$ flatpak remote-modify flathub --url=https://mirror.sjtu.edu.cn/flathub
If you get an error try:
$ wget https://mirror.sjtu.edu.cn/flathub/flathub.gpg $ sudo flatpak remote-modify --gpg-import=flathub.gpg flathub
Flathub
Due to redistribution authorization issues, some of the software needs to be downloaded from the official server and cannot be accelerated by mirror sites. For example,NVIDIA
drivers,JetBrains
series software, etc.If an installation is interrupted, files may not be found when downloading again. You can use
flatpak repair
to solve related problems. -
Delete a repository
To delete a remote
flatpak
repository, execute:$ flatpak remote-delete *name*
hint:
where
name
is the name of the remote repository to be deleted. -
Warehouse list
To list all added repositories, execute:
$ flatpak remotes
-
-
Management application
-
Search remote warehouse applications
Before searching for applications in the newly added remote warehouse, you need to obtain the data of the software application flow:
$ flatpak update Looking for updates... Updating appstream data for remote *name*
flatpak search *packagename*
You can then search using the commandflathub
Search for software packages in the configured remote repositorylibreoffice
:$ flatpak search libreoffice Application ID Version Branch Remotes Description org.libreoffice.LibreOffice stable flathub The LibreOffice productivity suite
-
Install app
To use
Flatpak
the installation application, execute the command as follows:$ flatpak install *remote* *name*
hint:
where
remote
is the name of the remote repository andname
is the name of the application to be installed.Partial identifiers can be used
flatpak install *partial-name*
(for example
flatpak install libreoffice
). -
Upgrade application
To upgrade an
name
application called$ flatpak update *name*
-
Uninstall app
To uninstall an
name
application named:$ flatpak uninstall *name*
hint:
Can uninstall dependencies that are no longer used
flatpak
(i.e. orphaned packages with no application/runtime dependencies)Execute
flatpak uninstall --unused
. -
List all installed apps
To list all installed apps, execute:
$ flatpak list
-
Homebrew
Package management tools
Homebrew
It is a software package management tool under Mac OS
a Linux
platform, with many practical functions such as installation, uninstallation, update, viewing, and search.
Homebrew
You can use a simple command to implement software package management without having to worry about various dependencies and file paths. It is very convenient and fast.
If you install a software package management tool, you need to ensure that , and application software Homebrew
are installed in the system .bash
git
curl
- Use the following command to install
Homebrew
:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
hint:
The download speed of the official warehouse in China is extremely slow. It is recommended to use
Homebrew
domestic mirror sources to speed up the download speed. The specific operations are as follows:
- ① Enter the following lines of commands in the terminal to set environment variables:
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
② Run the following command in the terminal to install
Homebrew
/Linuxbrew
:# 从本镜像下载安装脚本并安装 Homebrew / Linuxbrew git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install /bin/bash brew-install/install.sh rm -rf brew-install # 也可从 GitHub 获取官方安装脚本安装 Homebrew / Linuxbrew /bin/bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/master/install.sh)"
Mirrors can also be used during installation.
For more information, please refer to the official Homebrew installation documentation .
After successful installation, you need to
brew
add the relevant path of the program to the environment variable. The specific operations are as follows:test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)" test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile test -r ~/.profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile test -r ~/.zprofile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.zprofile
Reference Homebrew on Linux — Homebrew Documentation .
-
Install app
Use to
Homebrew
install software that is not pre-installed but is required . The installation software execution command is as follows:$ brew install <software_name>
-
Uninstall app
To uninstall application software, execute the command as follows:
$ brew uninstall <software_name>
-
Query available packages
Find the required application software and execute the command as follows:
$ brew search <software_name>
hint:
If you need to query the list of installed software, you can execute the following command:
$ brew list
-
renew
Homebrew
If you need to update
Homebrew
, you can use the following command to update:$ brew update
-
View brew version
If you need to check the current Homebrew version, you can use the following command to query:
$ brew -v
-
View
Homebrew
helpIf you need to know
Homebrew
more commands, you can use the following command to viewHomebrew
the help content:$ brew help
-
uninstall
Homebrew
If you need to uninstall
Homebrew
, you can use the following command to completely uninstallHomebrew
and useHomebrew
all installed software:$ cd `brew --prefix` $ rm -rf Cellar $ brew prune $ rm `git ls-files` $ rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions $ rm -rf ~/Library/Caches/Homebrew
zap
Package management tools
Linux
Medium AppImage
application software management tools.
-
Install
zap
package management tools:The installer requires
curl
,grep
,jq
andwget
.Please make sure that the above software has been installed. If it has been installed, you can use the following command to install
zap
the package management tool:curl https://raw.githubusercontent.com/srevinsaju/zap/main/install.sh | sudo bash -s
Notice:
If you install
zap
a software package management tool for the entire system, you need to usesudo
or other privilege escalation software to perform privilege escalation operations.sudo
Be sure to check the script before running itbash
.The
bash
script can be checked at willinstall.sh
. -
zap
Install software using a package management tool:All installations from and
AppImage Catalog
can be installed using their registered names.AppImage catalog v2
AppImage
zap
$ zap install <software_name>
Tips :
During installation, you will be asked for the software version you want to install/download and integrate into the system.
For example, create desktop files, etc.
You can also use the following command
GitHub
to installAppImages
application software in:$ zap install --github --from <UserName>/<AppName>
Tips :
When installing the AppImage application software in Github, some options will also be provided to choose the best version for the system.
Also use the following
URL
command to installAppImage
the application software from:$ zap install --from https://<URL> <AppName>
You can also use the following command to integrate locally downloaded
AppImage
application software:$ zap install libresprite <software_path>/<AppName>.AppImage
-
Update individual downloaded
AppImages
applications:appimage
You can choose to usezapd
automatic updates, or you can do it manually. The specific operations are as follows:$ zap update <AppName>
This operation takes advantage of
appimage
the update information embedded in and, if present, downloads only the changed parts for a "delta-update" latest version. -
Update
zap
package management tools and corresponding software:Zap
It also supportsappimage-update
updating all applications. The specific operations are as follows:$ zap upgrade
-
Configure
zap
package management tools:It can be configured interactively
zap
. The specific operations are as follows:$ zap init
-
zap
Daemon:zapd
It is aZap AppImage
daemon process whose role is to check for updates regularly.This operation will install
systemd
the service at the local (user) level.AppImages
An automatically updatedzap
daemon will be spawned.The specific operations are as follows:
$ zap daemon --install
If you need to run the daemon process (synchronization), please perform the following operations:
$ zap daemon
Not original, please do not reprint