Skip to content

Wiki

Other optional configurations

About 35 min read

Existing English translations were reused. 4 current source blocks remain in Simplified Chinese, without triggering paid translation.

Select and configure the corresponding function according to whether you have a need for it.

1.Switching between KDE's Wayland and X11


# Ubuntu
sudo apt install plasma-workspace-x11 plasma-workspace-wayland

# Fedora,Rocky
sudo dnf install plasma-workspace-x11 plasma-workspace-wayland

Then restart; in the lower-left corner of the KDE login screen, you can choose between X11 and Wayland!

2.Modify DNS

Use NetworkManager (most recommended, suitable for most modern distributions). This is the most flexible method; NetworkManager is the default network management tool in most mainstream distributions such as Ubuntu, Fedora, and CentOS.

  1. Modify the global configuration file (effective for all connections): Create or edit the /etc/NetworkManager/conf.d/dns.conffile:
sudo nano /etc/NetworkManager/conf.d/dns.conf

Add the following content:

[main]dns=none
systemd-resolved=falserc-manager=unmanaged

This tells NetworkManager not to manage DNS settings.

  1. Create static resolv.conf file: Edit /etc/resolv.conffile (create it if it does not exist):
sudo nano /etc/resolv.conf

Add the DNS server you want, for example:

nameserver 223.5.5.5
nameserver 119.29.29.29
options timeout:1 attempts:2
  1. Prevent the file from being overwritten: To prevent other system services from overwriting this file, set it as immutable:
sudo chattr +i /etc/resolv.conf

(If you need to modify this file, first use sudo chattr -i /etc/resolv.confto unlock)

Restart NetworkManager:

sudo systemctl restart NetworkManager
  1. Use resolvectlor systemd-resolveto check whether it succeeded (most recommended)

This is the most direct method to view the system's default DNS configuration.

resolvectl status

or (for older systems)

systemd-resolve --status

3.Screenshot shortcut

KDE's built-in screenshot tool is very useful. This screenshot tool can also record the screen, but OBS is more professional than the screenshot tool, so we generally only use this screenshot tool for taking screenshots.

As of 2025, screenshots of QQ and WeChat still have some minor issues under Wayland, so we chose the screenshot tool bundled with KDE.

Here, to capture a custom shortcut key for a rectangular area, simply enter the shortcut key you want to use.

4.Search tools

KDE's built-in search tool is also very useful, allowing you to quickly open the application you want to open. Just like this, so we will also set a shortcut key to invoke it.

The Meta key is the Win key, and it has a Microsoft logo on it.

5.Disable SELinux

There is no need to enable this thing on a personal computer; it is just asking for trouble. On Android, though, it can be enabled.

Currently, Fedora has this enabled by default (enforcing mode), so it needs to be turned off.

There are two ways to disable it,disabledandpermissivemode; below are the differences between these two modes:

Features Disabled mode Permissive mode
SELinux kernel module status SELinux is completely disabled, and the kernel module does not run137. The SELinux kernel module runs normally, but only logs violations and does not block access126.
Access control policy No policy is enforced, and all access is allowed29. It checks the policy and logs violations, but does not block operations36.
Logging It does not generate SELinux-related audit logs37. All policy violations are logged to /var/log/audit/audit.log26.
Security Lowest; it relies entirely on traditional Linux DAC (Discretionary Access Control)28. Higher than Disabled mode; it provides a debugging environment while retaining log analysis capabilities36.
Switching method The configuration file /etc/selinux/config must be modified and the system restarted34. It can be temporarily switched with the command setenforce 0, without requiring a restart34.
Use cases Used only to completely avoid SELinux compatibility issues (such as with legacy software); not recommended for long-term use19. Used for debugging policies, troubleshooting permission issues, or testing SELinux rules during the development phase367.

由于Disabled模式,SELinux 完全关闭,内核模块未加载。所有进程和文件的访问仅受传统 Linux 用户/组权限控制(如 rwx),所以我们选择Permissive模式,该模式下SELinux 策略正常加载,但仅记录违规行为(如进程尝试访问未授权文件)。

The following is a tutorial for modification mode:

sudo vim /etc/selinux/config


# This file controls the state of SELinux on the system. 

# SELINUX= can take one of these three values: 

#     enforcing - SELinux security policy is enforced. 

#     permissive - SELinux prints warnings instead of enforcing. 

#     disabled - No SELinux policy is loaded. 

# See also: 

# https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-selinux/#getting-started-with-selinux-selinux-states-and-modes 
# 

# NOTE: In earlier Fedora kernel builds, SELINUX=disabled would also 

# fully disable SELinux during boot. If you need a system with SELinux 

# fully disabled instead of SELinux running with no policy loaded, you 

# need to pass selinux=0 to the kernel command line. You can use grubby 

# to persistently set the bootloader to boot with selinux=0: 
# 

#    grubby --update-kernel ALL --args selinux=0 
# 

# To revert back to SELinux enabled: 
# 

#    grubby --update-kernel ALL --remove-args selinux 
# 
SELINUX=permissive 

# SELINUXTYPE= can take one of these three values: 

#     targeted - Targeted processes are protected, 

#     minimum - Modification of targeted policy. Only selected processes are protected. 

#     mls - Multi Level Security protection. 
SELINUXTYPE=targeted

SELINUXTYPE是修改selinux的策略,targeted 策略是 SELinux 的 默认策略,主要对 高风险的网络服务(如 Apache、MySQL、SSH)进行强制访问控制,其他非关键进程沿用传统的 Linux 用户/组权限(DAC)。这种设计在安全性和易用性之间取得了平衡,所以无需修改。

Restart to take effect

sudo reboot

6.UEFI boot interface rEFInd

https://www.bilibili.com/video/BV1qh411Q7d4

6.1.Install rEFInd


# Ubuntu
sudo apt update
sudo apt install refind

# Fedora
sudo dnf makecache
sudo dnf install rEFInd

Note: If three systems are installed, try to install rEFInd on the first system on the Linux disk.

6.2.Confirm whether refind is installed successfully

As shown in the figure, in the /boot/efi/EFI folder, there is a refind.

If you do not have this refind file, you need to install it manually.

Manual installation method 1:

Find/usr/share/rEFInd/the folder and see if there is refind-install inside, then simply run the command below.

cd /usr/share/rEFInd/
sudo ./refind-install
sudo reboot

Manual installation method 2:

cd /usr/share/rEFInd/
sudo cp -r /usr/share/rEFInd/refind /boot/efi/EFI/
sudo reboot

After installation is complete, you can check the /boot/efi/EFI folder to see whether refind is present.

6.3.Configure refind.conf

cd /boot/efi/EFI/refind
sudo vim ./refind.conf

Add at the last line (if you don't know how to use the vim editor, search it yourself on Baidu)

dont_scan_dirs ESP:/EFI/boot,EFI/ubuntu,EFI/boot,EFI/deepin_os,EFI/UOS,EFI/fedora

sduo reboot
#如果使用refind-install安装的refind,默认自动将rEFInd启动项作为第一项,如果没有进BIOS手动配置

Complete!!!

6.4.Beautify

rEFInd-glassy主题:https://pan.baidu.com/s/1HgfXG3m4j57VIk4k6inI-g

Extraction code: zimo

Remember to extract it.

cd /boot/efi/EFI/refind
mkdir -p ./themes

# 你把美化包解压到哪里了,就cd到哪里
cd ~/Downloads
sudo cp -r ./rEFInd-glassy /boot/efi/EFI/refind/themes

Then

cd /boot/efi/EFI/refind
sudo vim ./refind.conf

Add at the last line (if you don't know how to use the vim editor, search it yourself on Baidu)

include themes/rEFInd-glassy/theme.conf

# 重新启动电脑
sudo reboot

7.KDE theme

First download a desired theme from the KDE Store, then extract it.

https://store.kde.org/


# cd进主题的文件夹
cd ~/Downloads

# 把主题文件复制到KDE的主题
sudo cp -r ./Apple.BigSur.Dark.P6 /usr/share/plasma/look-and-feel

You can see it after entering the settings. If you can't see it, just restart your computer.

8.Startup Applications and Scripts

Scripts and applications can be added in the upper right corner. Before adding a script, first confirm whether the script has executable permissions. You can also choose to run scripts at startup and run scripts at shutdown.

Example: take the command docker_x11xhost +local:dockeras an example.

First, find a folder to store the scripts; you can just create one yourself in the home partition.

touch docker_x11.bash
sudo chmod a+x ./docker_x11.bash
sudo vim ./docker_x11.bash

Enter in the vim editor:

#!/bin/bash
# 等待 X Server 就绪(最多等 10 秒)
for i in {1..10}; do
    if [ -n "$DISPLAY" ] && xset q >/dev/null 2>&1; then
        /usr/bin/xhost +local:docker
        exit 0
    fi
    sleep 1
done

In the vim editor, first press ESC, then :wqsave and exit.

In KDE 6 settings, find Autostart, then add a login script, not a logout script.

🟢 Login Script

  • When is it executed? It is executed automatically when a user logs into the system (e.g., via terminal, TTY, or SSH).

🔴 Logout Script

  • When is it executed? It is executed automatically when the user exits the shell or logs out of the login session.

Just find the script file and add it.

Restart to take effect

9.Switching from Bash to Zsh

9.1.What is a shell?

Simply put, the shell is the medium through which you interact with applications. Typically, you enter the application you want to use and its arguments into the shell; the shell searches for the application you wish to invoke in PATH, parses the arguments, and passes them in. Finally, it returns the result to you.

If you are using the bash shell, then you are most likely using some Linux distribution. Currently, mostlinuxdistributions still use the default shellbash。 WindowsBy default,Powershellis used. Starting fromCatalina,MacOShas switched the default shell frombashtozsh。

9.2.What advantages does zsh have?

Compared tobash,zshthere is a vast plugin community and a mature plugin management framework such asoh my zsh,which makeszsh's functionality expansion extremely easy; you can manage zsh plugins just like managing Vim plugins.

9.3.Zsh Installation and Configuration

First, check what shell you are currently using? (Usually bash)

echo $SHELL  # 应该会显示/usr/bin/bash

# 或
echo $0      # 应该显示 "-bash"

Now let's install zsh.


# Debian系
sudo apt install zsh

#红帽系
sudo dnf install zsh

Check whether you have installed it successfully.


# 查看shell版本
bash --version
zsh --version

How do I configure zsh?

andbashAlmost the same.

zshThe global configuration file is located at/etc/zsh.zshc; the single-user configuration file is located at~/.zshrc.

However, it is not recommended that you modify any file now, because we have a more elegant configuration method:

9.4.oh my zsh!

Project address:

https://github.com/ohmyzsh/ohmyzsh

oh my zshis currently the most popularzshplugin management tool, equivalent to vim-plug or vundle in vim.

Install oh my zsh


# 方式一(可能需要科学上网)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# 方式二
sh -c "$(curl -fsSL https://install.ohmyz.sh/)"

The figure below allows you to optionally set zsh as the default now.

If the above image is displayed, the installation is successful.

9.5.Configure oh my zsh

Now look at the .zshrc file, and you'll find that oh my zsh has almost configured it for you.

If you want to use a plugin, you can find plugins and add it there.

Here is my .zshrc for your reference.

9.6.Customize a unique zsh

Remember what I mentioned earlier about not recommending modifying .zshrc? This is because after we use the Oh My Zsh framework, Oh My Zsh creates a ~/oh-my-zsh directory for storing related files. Within it there is a folder named custom, where we can place our configuration scripts, and Oh My Zsh will automatically load the vim scripts in this directory.

Basically supports bash configuration commands. Taking the blogger as an example, the bashrc script was migrated to zsh without any changes.

I created a script named myshrc.zsh to store the configuration; the file is as follows for your reference.

cd /home/用户名/.oh-my-zsh/custom
touch ./myshrc.zsh
vim ./myshrc.zsh

Simply copy all the custom settings you added to your ~/.bashrc into this file.

For example, mine:


# 配置CUDA
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

# 配置ROS-DISTRO
export ROSDISTRO_INDEX_URL=https://mirrors.bfsu.edu.cn/rosdistro/index-v4.yaml

# 配置ROS1 Noetic

# source /opt/ros/noetic/setup.zsh

# export ROS_MASTER_URI=http://localhost:11311

# export ROS_HOSTNAME=localhost

# export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/home/tungchiahui/UserFloder/MySource/ROS_WS/gazebo_models:/home/tungchiahui/UserFloder/MySource/ROS_WS/ign_models

# 配置ROS2 Humble
source /opt/ros/humble/setup.zsh
export ROS_DOMAIN_ID=6
export IGN_GAZEBO_RESOURCE_PATH=$IGN_GAZEBO_RESOURCE_PATH:/home/tungchiahui/UserFloder/MySource/ROS_WS/gazebo_models:/home/tungchiahui/UserFloder/MySource/ROS_WS/ign_models

Then the current terminal environment can be refreshed.


# 刷新环境
source ~/.zshrc

# 检查自己的配置是否生效
echo $LD_LIBRARY_PATH 

Corresponding to my configuration above, echoing and printing the following indicates success.

/usr/local/cuda/lib64:/usr/local/cuda/lib64: 

9.7.Switch the default shell

If you select yes in the figure below, you do not need to set it again.

chsh -s $(which zsh)
echo $SHELL  # 应输出 "/usr/bin/zsh"
echo $0      # 若显示 "-zsh",表示已生效

Done!

If it is found here that it cannot be set as the default, as shown in the following figure:

Then use the following command to force the modification:


# 强制修改
sudo usermod -s /usr/bin/zsh tungchiahui(用户名)

# 验证
grep tungchiahui(用户名) /etc/passwd  # 检查是否显示 "/usr/bin/zsh"

# 重启
sudo reboot

Verify after restart

echo $SHELL  # 应输出 "/usr/bin/zsh"
echo $0      # 若显示 "-zsh",表示已生效

Done again!

9.8.Add Plugin Tutorial

9.8.1.powerlevel10k

This plugin beautifies zsh, and its advantage is that it barely affects terminal performance and is relatively fast.

https://github.com/romkatv/powerlevel10k

Install powerlevel10k


# 国外用户
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc

# 国内用户
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc

Download Font

Choose one of the following


# 刷新当前环境变量
source ~/.zshrc

Here you need to check whether the icons all display correctly. If they do not display correctly, it proves there is a problem with the font. Close the terminal and open it again to see whether the font still has a problem?

If there is no problem, keep going y.

It is recommended to refer to the configuration in this tutorial.

https://www.bilibili.com/video/BV1dX4y127JL

Here is what it looks like after configuration:

If you want to reconfigure, enter:

p10k configure

If the icons in VSCode are not fully displayed, the following operation will suffice.

  1. Search Terminal › Integrated: Font Family

Enter the name of a font that supports Nerd Font, for example:

MesloLGS NF

(Note: MesloLGS NF must be placed first)

  1. Enable basic ligature support

Search Terminal › Integrated: Font Ligatures

Check Enabled(allow font rendering of special ligature characters)

  1. Ensure GPU acceleration is enabled
  • Search Terminal › Integrated: Gpu Acceleration

  • Set to on(improve rendering performance)

If GPU acceleration causes issues

  • Try setting it to off and then restart the terminal

  • Check whether Fallback Ligatures take effect

Then simply reopen the terminal (GPU settings require restarting the terminal).

10.Add color to the terminal

If the text in your terminal has no color at all, add this. Some distributions, such as Rocky Linux, have no color by default, while out-of-the-box distributions like Fedora and Ubuntu generally have color by default.

vim ~/.bashrc

Place the following content at the very bottom of the file and save it.

# =========================================================
# Fedora / Ubuntu style colored bash prompt
# =========================================================

# Enable color support
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# Git branch function
parse_git_branch() {
    git branch 2>/dev/null | sed -n '/^\*/s/^\* //p'
}

if [ "$color_prompt" = yes ]; then
    if [ "$EUID" -eq 0 ]; then
        # root prompt (red)
        PS1='\[\e[1;31m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[1;33m\]$(parse_git_branch)\[\e[0m\]\$ '
    else
        # normal user prompt (green)
        PS1='\[\e[1;32m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[1;33m\]$(parse_git_branch)\[\e[0m\]\$ '
    fi
else
    PS1='\u@\h:\w\$ '
fi

# Enable colored commands
alias ls='ls --color=auto'
alias ll='ls -lh --color=auto'
alias la='ls -A --color=auto'

alias grep='grep --color=auto'
alias diff='diff --color=auto'
alias ip='ip -color=auto'

export CLICOLOR=1
source ~/.bashrc

11.Flatpak software management tool

Flatpak is similar to package management tools such as apt and dnf, and can install software, but what it installs is not the most basic software; it is software like QQ and QQ Music.

When your apt or dnf does not have a certain piece of software, you can check Flathub to see whether it is available.

11.1.Flatpak installation

https://flatpak.org/

  1. Ubuntu

# 安装flatpak
sudo apt update && sudo apt install flatpak

# 先添加官方国外源
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

# 再修改为中科大镜像源
sudo flatpak remote-modify flathub --url=https://mirrors.ustc.edu.cn/flathub

# 查看仓库详情
flatpak remotes --show-details

  1. Fedora

Fedora already includes it.


# 先添加官方国外源
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

# 再修改为中科大镜像源
sudo flatpak remote-modify flathub --url=https://mirrors.ustc.edu.cn/flathub

# 查看仓库详情
flatpak remotes --show-details

11.2.Font issue resolved

Because Flatpak is a sandbox, fonts are easily missing, so install fonts first.

#Ubuntu
sudo apt install google-noto-sans-cjk-fonts google-noto-serif-cjk-fonts

# Fedora
sudo dnf install google-noto-sans-cjk-fonts google-noto-serif-cjk-fonts

Actually, this font family is called: Noto Sans CJK / Noto Serif CJK It simultaneously includes: Chinese (Simplified + Traditional) Japanese (JP) Korean (KR)

Then set Flatpak font access permissions (override) so that all Flatpak applications can "see" these fonts:

sudo flatpak override --filesystem=/usr/share/fonts
sudo flatpak override --filesystem=~/.local/share/fonts

If you have previously installed Flatpak software, the above operations will not take effect on the already installed software. Take QQ Music as an example; we need to make it take effect.

Enter the Flatpak sandbox environment. This command lets you enter the sandboxed terminal of QQ Music, just like "entering a container." The paths inside are isolated from the host system.

flatpak run --command=bash com.qq.QQmusic

Delete the old fontconfig cache; Flatpak caches the font index inside its own sandbox. After deleting the old cache, new fonts can only be recognized again.

rm -rvf ~/.var/app/com.qq.QQmusic/cache/fontconfig/

Rebuild font cache. This step forces a rescan of font paths (including /usr/share/fonts and user font paths), generates a new cache file, and fixes display issues.

fc-cache -f -v

11.3.Install software

https://flathub.org/

Go to the official website above to search for the software and download it.

flatpak install flathub com.obsproject.Studio

11.4.Run software

Method 1 (Official)

flatpak install flathub com.obsproject.Studio

Method 2 (just run it directly as ordinary software)

12.Appimage

For example, QQ Music only provides deb and AppImage, and does not provide RPM format installation packages (this was the case for version 1.1.7; it is expected that RPM will be provided in the future. The developers are purely asking for it—they do not even provide RPM.) Therefore, if I want to install QQ Music on Fedora, I either have to use AppImage or choose to use Flatpak. (Here AppImage is used.)

First, download the AppImage.

https://y.qq.com/download/download.html

Then go to Google and download a QQ Music icon (because Google allows downloading transparent icons).

Place them in/home/用户名in a certain folder (you decide, for example I use the/home/tungchiahui/UserFloder/Applications/qqmusic/folder)

First grant execution permission to QQ Music

cd ~/UserFloder/Applications/qqmusic
sudo chmod +x ./qqmusic-1.1.7.AppImage

给QQ音乐配置 快捷方式 :

cd ~/.local/share/applications/
touch ./qqmusic.desktop
vim ./qqmusic.desktop
sudo chmod +x ./qqmusic.desktop

The content is as follows

[Desktop Entry]
Name=QQ音乐
Exec=/home/tungchiahui/UserFloder/Applications/qqmusic/qqmusic-1.1.7.AppImage
Icon=/home/tungchiahui/UserFloder/Applications/qqmusic/QQ_Music2023.svg
Type=Application
Categories=Audio;Music;Player;
Comment=QQ Music Client for Linux

At this point, the software should be found and can be opened. If it cannot be found, please restart; on some less advanced distributions, the icon list does not refresh very quickly.

If QQ Music crashes, this is just a problem with the QQ Music software itself; do as shown in the figure below.

If you are not using KDE, you can also directly modifyqqmuic.desktop:add at the end of exec--no-sandbox

[Desktop Entry]
Name=QQ音乐
Exec=/home/tungchiahui/UserFloder/Applications/qqmusic/qqmusic-1.1.7.AppImage --no-sandbox
Icon=/home/tungchiahui/UserFloder/Applications/qqmusic/QQ_Music2023.svg
Type=Application
Categories=Audio;Music;Player;
Comment=QQ Music Client for Linux

If QQ Music is missing fonts, then please install the font (this font is a unified font for multiple languages)

sudo dnf install google-noto-sans-cjk-fonts google-noto-serif-cjk-fonts

13.Modify HOSTNAME

For example, I want to change it to Dell-G15-5511

sudo hostnamectl set-hostname "Dell-G15-5511"

hostnamectl | grep "Static hostname"      # 验证静态主机名

sudo systemctl restart systemd-hostnamed  # 重启主机名服务
sudo systemctl restart NetworkManager      # 重启网络服务
sudo reboot

echo $HOSTNAME           # 验证主机名

14.Delete application configuration

Some applications have configuration issues; you can delete their cache.

Cached under the~/.configfolder.

For example, if there is a problem with VSCode:

This deletes him and it's over.

And the following one~/.vscodeis an extension.