Configure ArchLinux system

Configure ArchLinux system environment

Configure AURChina source

As mentioned in the previous article, installing AURthe Chinese source is ArchLinuxCNthe source, but there may be situations where it cannot be used.

The reason is that pacmanthe 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 havegedsystem 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 install havegedthe system entropy generation daemon . The specific operations are as follows:

    $ sudo pacman -Syu haveged
    
  • ② Use systemdthe system daemon management tool to start havegedand 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. Manageable AURthird-party software package management tools include, but are not limited to, yay, paru. yaourtJust 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 pacmanto install the desktop environment.

LinuxThere are many desktop environments, and there are also many optional desktop environments. For example, you can choose lightweight XFCEdesktop environments, slightly lightweight MATEdesktop environments or KDEdesktop environments, desktop environments with many functions, GNOMEetc., as well as window managers i3wm, dwm, openbox, fluxboxetc.

For example, to install XFCEthe desktop environment, the command is as follows:

$ sudo pacman -S xfce4

hint:

If you install XFCE4desktop plug-ins, you can directly install XFCE4the desktop plug-in package, that is xfce4-goodies, you can install all XFCE4desktop plug-ins. The installation command is as follows:

$ sudo pacman -S xfce4-goodies 

For another example, to install KDEthe desktop environment, the command is as follows:

$ sudo pacman -S plasma 

...and so on

Login Manager Installation

Use the system package management tool pacmanto install the desktop environment. LinuxThere are many login managers, including but not limited to LightDM, GDM, LXDM, SDDM, XDM. Here is LightDMan example. Use the following command to install the login manager:

$ sudo pacman -S lightdm

hint:

LightDMIt is not possible to just install , you also need to install one Greeterto configure LightDM, Greeterincluding but not limited to lightdm-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 LightDMthe Greeterto the installed one Greeter, that is, delete the one /etc/lightdm/lightdm.confin the greeter-session=front #and fill in the installed Greetername after it. The example is as follows:

[Seat:*]
...
greeter-session=lightdm-<yourgreeter>-greeter
...

Among them, lightdm-pantheon-greeterare 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 LightDMan example:

# systemctl enable lightdm

Fonts and other add-ons installation

Use the system package management tool pacmanto 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 xorgthe 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

XorgInstalled 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 any 2Dand 3Dacceleration functions.
  • If not found vesa, Xorgit will fall back to KMSthe acceleration KMSincluded in the driver GLAMOR.

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 OptimusFor notebooks using both integrated graphics and discrete graphics , please refer to NVIDIA Optimus.

  • For 4th generation and newer Intelgraphics cards, read Intel_graphics#Installationfor available drivers.

Other drivers are also located xorg-driversin the package group.

XorgIt 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:

LinuxChinese input method engines include, but are not limited to ibus, , fcitx, , and are recommended fcitx, but others are also available.

fcitxEngines include fcitx-sunpinyin, fcitx-libpinyin, fcitx-rime, , fcitx-googlepinyinetc. You can select one or more of them.

You can use the software package management tool pacmanto 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 .xprofilethe 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 fcitxit does not start automatically, please fcitx &add it ~/.xinitrc.

If fcitx &it does not start, add a delay at the end sleep 2.

  • Please do not .bashrcset these environment variables in .

    • bashrcApplies only to initialization of interactive sessions, and does not apply to initialization of bashnon-interactive scripts or sessions.X
  • If there is any problem Qtusing fcitx, please execute qtconfig( ) and set to " " qtconfig-qt4in the input method configuration .fcitxDefault Input Method

Optimization

TRMDisk optimization

If the root ( /) directory is installed on a solid-state drive, it is recommended to enter the following command to TRMhelp clean up SSDthe blocks and extend SSDthe service life:

$ sudo systemctl enable fstrim.timer

tlpPower management

Use the following command to install tlpthe power management software:

$ sudo pacman -S tlp tlp-rdw

Use the following command to start tlpthe service

sudo tlp start

Use the following command to check tlpthe 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 noticerun 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 linuxkernel 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 #DefaultTimeoutStartSecand #DefaultTimeoutStopSecand modify 2the 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

LinuxThere are many firewall software options available, including but not limited to FireWall, Gufw. This article will Gufwuse an example to illustrate.

Install Gufwsystem firewall

Use the package manager to install Gufwthe system firewall. The specific steps are as follows:

$ sudo pacman -S gufw

Configure Gufwsystem firewall

  • ① Use the following command to query ufwthe 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 UFWthe 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 3389the 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-ngetc. 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 metalogan 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 systemdthe system daemon management tool to start metalogand make it start automatically at boot. The specific operations are as follows:

    $ sudo systemctl start metalog
    $ sudo systemctl enable metalog
    

hint:

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:

FlatpakPackage management tools

" FlatpakA Linuxsystem for building, distributing, and sandboxing desktop programs."

FlatpakIs a tool used to manage applications and the runtime used by the application.

FlatpakIn this model, applications are built and distributed independently of their host system, and run to a certain extent independent of the host system ('sandboxed').

FlatpakUse OSTreeto distribute and deploy data.

FlatpakThe repository used is OSTreea repository and can ostreebe operated with tools.

FlatpakInstalled runtimes and applications have been OSTreechecked out.

  • InstallFlatpak

    To install Flatpak, run the following command in the terminal:

    $ sudo pacman -S flatpak
    
  • Manage warehouse

    Notice:

    By default, each flatpakcommand is available globally; specifically, the package is installed to all users of the current machine and requires the user to provide roota password.

    If you install a software package or operate a warehouse for a single user, you can add --userparameters 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 flatpakrepository, execute:

      $ flatpak remote-add *name* *location*
      

      hint:

      nameis the name of the new remote warehouse

      locationIs the path or warehouse URL.

      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 Flatpakdomestic 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
      

      FlathubDue 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, NVIDIAdrivers, JetBrainsseries software, etc.

      If an installation is interrupted, files may not be found when downloading again. You can use flatpak repairto solve related problems.

    • Delete a repository

      To delete a remote flatpakrepository, execute:

      $ flatpak remote-delete *name*
      

      hint:

      where nameis 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 command

      flathubSearch for software packages in the configured remote repository libreoffice:

      $ flatpak search libreoffice
      
      Application ID Version Branch Remotes Description  
      org.libreoffice.LibreOffice stable flathub The LibreOffice productivity suite
      
    • Install app

      To use Flatpakthe installation application, execute the command as follows:

      $ flatpak install *remote* *name*
      

      hint:

      where remoteis the name of the remote repository and nameis the name of the application to be installed.

      Partial identifiers can be usedflatpak install *partial-name*

      (for example flatpak install libreoffice).

    • Upgrade application

      To upgrade an nameapplication called

      $ flatpak update *name*
      
    • Uninstall app

      To uninstall an nameapplication 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
      

HomebrewPackage management tools

HomebrewIt is a software package management tool under Mac OSa Linuxplatform, with many practical functions such as installation, uninstallation, update, viewing, and search.

HomebrewYou 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 Homebreware installed in the system .bashgitcurl

  • 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 Homebrewdomestic 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 brewadd 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 Homebrewinstall 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
    
  • renewHomebrew

    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 Homebrewhelp

    If you need to know Homebrewmore commands, you can use the following command to view Homebrewthe help content:

    $ brew help
    
  • uninstallHomebrew

    If you need to uninstall Homebrew, you can use the following command to completely uninstall Homebrewand use Homebrewall 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
    

zapPackage management tools

LinuxMedium AppImageapplication software management tools.

  • Install zappackage management tools:

    The installer requires curl, grep, jqand wget.

    Please make sure that the above software has been installed. If it has been installed, you can use the following command to install zapthe package management tool:

    curl https://raw.githubusercontent.com/srevinsaju/zap/main/install.sh | sudo bash -s
    

    Notice:

    If you install zapa software package management tool for the entire system, you need to use sudoor other privilege escalation software to perform privilege escalation operations.

    sudoBe sure to check the script before running it bash.

    The bashscript can be checked at will install.sh.

  • zapInstall software using a package management tool:

    All installations from and AppImage Catalogcan be installed using their registered names.AppImage catalog v2AppImagezap

    $ 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 GitHubto install AppImagesapplication 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 URLcommand to install AppImagethe application software from:

    $ zap install --from https://<URL> <AppName>
    

    You can also use the following command to integrate locally downloaded AppImageapplication software:

    $ zap install libresprite <software_path>/<AppName>.AppImage
    
  • Update individual downloaded AppImagesapplications:

    appimageYou can choose to use zapdautomatic updates, or you can do it manually. The specific operations are as follows:

    $ zap update <AppName>
    

    This operation takes advantage of appimagethe update information embedded in and, if present, downloads only the changed parts for a "delta-update" latest version.

  • Update zappackage management tools and corresponding software:

    ZapIt also supports appimage-updateupdating all applications. The specific operations are as follows:

    $ zap upgrade
    
  • Configure zappackage management tools:

    It can be configured interactively zap. The specific operations are as follows:

    $ zap init
    
  • zapDaemon:

    zapdIt is a Zap AppImagedaemon process whose role is to check for updates regularly.

    This operation will install systemdthe service at the local (user) level.

    AppImagesAn automatically updated zapdaemon 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

Guess you like

Origin blog.csdn.net/GaaraZ/article/details/127223954
Recommended