Debian 11 configuration optimization guide

Posted by beemzet on Fri, 04 Mar 2022 09:10:15 +0100

Original address: Debian 11 configuration optimization guide - WindSpiritIT

0x00 introduction

This article applies only to configuring Debian 11 Bullseye

The article includes both Gnome desktop and KDE desktop configurations, most of which are the same, and the differences are listed separately

The update of Gnome desktop related configuration lags behind and may not be updated again

The KDE and Gnome optimized configuration parts should be configured according to your personal preferences

In this article, debianuser is used instead of user name. Please pay attention to replacement when executing commands or copying configurations

For the software package / environment with version number involved in the article, the version number is replaced by xxx. Please install the latest version or the version you need according to the actual situation

The editing time of this article is too long from the practice time, and inaccurate contents may appear in the editing process. If you find any inconsistency with this article in your time process, please leave a message in the comment area as far as possible, and I will confirm the update as soon as possible

0x01 basic configuration

Most operations in this step need to be restarted, so do not judge the configuration of the application according to whether the application can be used normally after the configuration is completed

At the end of this step, all configurations are applied once

Rename the folder in / home directory in English

cd ~
mkdir Desktop Download Templates Public Documents Music Pictures Videos
rm -rf Public template video picture document download music desktop
xdg-user-dirs-update --set DESKTOP ~/Desktop
xdg-user-dirs-update --set DOWNLOAD ~/Download
xdg-user-dirs-update --set TEMPLATES ~/Templates
xdg-user-dirs-update --set PUBLICSHARE ~/Public
xdg-user-dirs-update --set DOCUMENTS ~/Documents
xdg-user-dirs-update --set MUSIC ~/Music
xdg-user-dirs-update --set PICTURES ~/Pictures
xdg-user-dirs-update --set VIDEOS ~/Videos

Add users to sudoers

In this step, you need to switch to root first. There are two schemes

  1. Switch to the new tty

    Ctrl + Alt + F3 switch to the new terminal of the pure command line interface and log in as root for operation

    After that, use exit to exit the terminal and press Ctrl + Alt + F1/F2 to switch back to the user identity graphical interface

  2. Via SSH

    ssh root@localhost

    After that, use exit to exit the terminal

The following commands are executed as root

chmod +w /etc/sudoers
cat >> /etc/sudoers << EOF
debianuser ALL=(ALL:ALL) ALL
chmod -w /etc/sudoers

The above commands are executed as root

Replace software source

sudo tee /etc/apt/sources.list <<-'EOF'
deb bullseye main contrib non-free
# deb-src bullseye main contrib non-free
deb bullseye-updates main contrib non-free
# deb-src bullseye-updates main contrib non-free

deb bullseye-backports main contrib non-free
# deb-src bullseye-backports main contrib non-free

deb bullseye-security main contrib non-free
# deb-src bullseye-security main contrib non-free
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

Configure basic software package

sudo apt install vim wget curl htop git proxychains4 screenfetch tmux bash-completion fcitx5-rime chromium fcitx5-material-color zsh fonts-powerline fzf net-tools openssh-server firewalld bat chromium

Installed packages

Package namepurpose
vimTerminal text editor
wgetTerminal file download tool
curlTerminal URL tool
htopSystem monitoring and process management tools
gitVersion control tool
proxychains4Terminal agent
screenfetchDisplay system information at the terminal
tmuxTerminal Multiplexer
bash-completionbash automatic completion
fcitx5-rimeRim input method based on fcitx5
fcitx5-material-colorfcitx5 theme
chromiumChromium browser
zshTerminal interpreter
fonts-powerlinepowerline font
fzfTerminal fuzzy search tool
net-toolsNetwork configuration tool
openssh-serverOpenSSH server
batMore powerful cat command

Uninstall useless packages

It mainly uninstalls some multilingual support and game packages, which can be skipped


sudo apt remove --purge ibus* xterm goldendict fcitx fcitx-* anthy anthy-* mozc-* mlterm* xiterm+thai mariadb-common
sudo apt autoremove --purge


Note: during execution, please pay attention to whether there are system packages such as gnome in the software package to be uninstalled. If so, please try to uninstall one by one manually

sudo apt remove --purge ibus ibus-* xterm goldendict aisleriot evolution gnome-todo gnome-klotski gnome-tetravex gnome-chess gnome-maps gnome-mines gnome-taquin gnome-sudoku gnome-robots gnome-nibbles gnome-music gnome-mahjongg gnome-2048 hitori transmission-* quadrapassel lightsoff four-in-a-row tali swell-foop five-or-more iagno fcitx fcitx-* anthy anthy-* mozc-* mlterm mlterm-* xiterm+thai
sudo apt autoremove --purge

Wireless network card driver

If your computer has a wireless network card and you find that the wireless network card cannot be used after installing the operating system, please try the following steps

sudo apt install firmware-iwlwifi
sudo modprobe -r iwlwifi
sudo modprobe iwlwifi

Nvidia graphics card driver

If you have a Nvidia video card on your computer and find that the video card cannot be used after installing the operating system, please try the following steps

sudo apt install nvidia-detect
sudo nvidia-detect

This step will detect which drivers should be installed according to the hardware. Please install the corresponding drivers according to the output, for example, prompt NVIDIA driver

sudo apt install nvidia-driver

tmux shortcut key

sudo tee /etc/tmux.conf <<-'EOF'
set -g prefix C-a
unbind C-b
bind C-a send-prefix

Install Clash for Windows

from GitHub - Fndroid/clash_for_windows_pkg Download, grab.CFW for. Windows-x.xx. x-x64-linux. tar. gz

Unzip it to / usr/local/cfw

tar zxvf Clash.for.Windows-0.19.5-x64-linux.tar.gz -C cfw --strip-components 1

Create ~ / local/share/applications/cfw.desktop is used to display desktop icons

touch ~/.local/share/applications/cfw.desktop
tee ~/.local/share/applications/cfw.desktop <<-'EOF'
[Desktop Entry]
Name=Clash For Windows
GenericName=Clash For Windows
Comment=Clash For Windows for Linux

Configuring Advanced Copy

The warehouse is located in GitHub - jarun/advcpmv , no manual download required

tar Jxvf coreutils-9.0.tar.xz
cd coreutils-9.0/
patch -p1 -i advcpmv-0.9-9.0.patch
sudo chmod +x ./src/cp ./src/mv
sudo chown root. ./src/cp ./src/mv
sudo mv ./src/cp /usr/local/bin/cpg
sudo mv ./src/mv /usr/local/bin/mvg

Configure ZSH

Switch to zsh

chsh -s /bin/zsh
sudo ln -s ~/.zshrc /root

After completing the above steps, switch to root and the user will automatically configure zsh, zinit and Plug ins configured in zshrc


sudo reboot

0x02 install application

download Google Chrome

download Microsoft Visual Studio Code

download JetBrains Toolbox App

download Go for Linux

download Nodejs LTS

sudo apt install ./google-chrome-stable_current_amd64.deb
sudo apt install ./code_xxx_amd64.deb
sudo apt remove --purge 'firefox-esr*'

JetBrains Toolbox

IDE for managing JetBrains

It is recommended to configure the IDE installation path as / usr/local/JetBrains

tar zxvf jetbrains-toolbox-xxx.tar.gz

download GitHub - ja-netfilter/ja-netfilter , unzip to / usr / local / JetBrains / JA Netfilter

Modify the configuration in config as follows


Yes Write in vmoptions


use Authentication server to grant authorization

Go & NodeJS & Java

It is recommended to install go and nodejs under / usr/local/go and / usr/local/nodejs respectively

Create / usr/local/java directory for java, and unzip all versions of jdk to this directory for management

sudo mkdir /usr/local/go
sudo mkdir /usr/local/nodejs
sudo chown debianuser. -R /usr/local/go
sudo chown debianuser. -R /usr/local/nodejs
tar zxvf Downloads/goxxxlinux-amd64.tar.gz -C /usr/local/go/ --strip-components=1
tar Jxvf Downloads/node-v14.17.3-linux-x64.tar.xz -C /usr/local/nodejs/ --strip-components=1
sudo tee /etc/zsh/zprofile <<-'EOF'

export NODE_HOME='/usr/local/nodejs'

export GOROOT='/usr/local/go'
export GOPATH="$HOME/.go"
export GOENV="$HOME/.config/go/env"
export GOCACHE="$HOME/.cache/go-build"

export JAVA_HOME='/usr/local/java/jdk-xxx'

export PATH="$PATH:$NODE_HOME/bin"
export PATH="$PATH:$GOROOT/bin"
export PATH="$PATH:$JAVA_HOME/bin"
source /etc/zsh/zprofile

Configure Go Modules, Go agents and switch npm sources

go env -w GO111MODULE=on
go env -w GOPROXY=,,direct
npm config set registry

Install MySQL Server and MySQL Workbench

visit MySQL Community Downloads Download APT warehouse management package

Since MySQL Workbench relies on a higher Python version, MySQL has disabled this package in the Debian source

visit MySQL Product Archives Download the 8.0.22 installation package for Ubuntu 18.04

sudo apt install ./Downloads/mysql-apt-config_xxx_all.deb
sudo apt update
sudo apt upgrade
sudo apt install mysql-server
sudo systemctl start mysql
sudo systemctl enable mysql
sudo apt install ./Downloads/mysql-workbench-community_8.0.23-1ubuntu18.04_amd64.deb

Install VSCode extension

The following are only recommended extensions. Please choose according to your own technology stack and personal preferences

  • Chinese (Simplified) Language Pack for Visual Studio Code
  • Markdown All in One
  • Markdown Preview Enhanced
  • markdownlint
  • Remote Development
  • Todo Tree
  • ESLint
  • Python
  • C/C++

0x03 KDE Desktop Optimization

System settings

  • appearance
    • Global theme
      • Get a new global theme: Nordic darker KDE
    • Plasma style: Nordic darker
    • Application style
      • Window decoration: Nordic
    • Color: Breeze dark
    • Icon
      • Get new icon theme: Nordic Folders icon pack Mod
  • work area
    • Workspace behavior
      • Routine behavior
        • Click behavior: double click to open files and folders
      • Lock screen
        • Auto lock screen: if idle for 30 minutes
        • How long does it take to unlock the screen with a password: 0 seconds
    • Powering on
      • Login screen (SDDM)
        • Get new login screen: Chili login theme for KDE Plasma
      • Welcome screen: Nordic darker
    • search
      • KRunner
        • Position on screen: Center
        • Turn off keep previous searches
  • network
    • Network settings
      • agent
        • Select a proxy server that is configured manually
        • HTTP proxy: port: 7890
        • Open all protocols using the same proxy server
  • Hardware
    • Power management
      • energy conservation
        • Screen energy saving: wait 30 minutes before turning off

Panel configuration

  • Panel height: 46
  • Add margins on both sides of the task manager
  • More options
    • Open the maximize panel
  • Icon Task Manager
    • appearance
      • Highlight window when hovering task is opened
    • behavior
      • Grouping: no grouping
      • Show only tasks: open from the current screen
  • Digital clock
    • appearance
      • Turn on display for seconds
      • Time display: 24-hour system

Konsol configuration

  • routine
    • Close remember window size
  • Configuration scheme
    • routine
      • Initial terminal size: 140 columns and 30 rows
    • appearance
      • Color scheme and font
        • Get new: Nordic konsol
      • Font: Sarasa Term SC 10pt
    • roll
      • Rollback: Unlimited

0x04 Gnome desktop optimization

Install Gnome extensions

visit GNOME Shell Extensions Enable extension

  • Alternatetab
  • AppIndicator and KStatusNotifierItem Support
  • Dash to panel
  • User themes

Install theme GitHub - PapirusDevelopmentTeam/papirus-icon-theme

sudo sh -c "echo 'deb focal main' > /etc/apt/sources.list.d/papirus-ppa.list"
sudo apt install dirmngr
sudo apt-key adv --recv-keys --keyserver E58A9D36647CAE7F
sudo apt update
sudo apt install papirus-icon-theme

Gnome system settings

  • network
    • Network agent
      • Manual
        • HTTP proxy: 7890
        • HTTPS proxy: 7890
        • Socks host: 7890
  • Power Supply
    • Rest screen: 15 minutes
    • Auto suspend
      • Delay when using battery: 30 minutes
      • Plugged in delay: 60 minutes
      • Power button behavior: sleep
  • Keyboard shortcuts
    • add to
      • Name: Terminal
      • Command: Gnome terminal
      • Shortcut keys: Ctrl + Alt + T
  • Mouse and touchpad: open tap to click

Gnome terminal settings

  • Profile preferences
    • General shortcut key: enable close
    • Unnamed
      • text
        • Terminal starting size 140 columns and 30 rows
      • colour
        • palette
          • Built in solution: GNOME
          • Turns on bold text in bright colors
      • Scrolling: turn off rollback restrictions

Gnome optimized configuration

  • General: close the laptop and hang when the cover is closed
  • appearance
    • Application: adwaita dark
    • Icon: Papirus
  • typeface
    • Fine tuning: complete
    • Antialiasing: subpixels
  • extend
    • Dash to Panel
      • position
        • Panel screen position: Top
        • Panel thickness: 40 px
        • Close Desktop button
      • style
        • Application icon edge blank: 4 px 6 px
        • Running indicator position: Top
        • Run indicator style options
          • Turn on indicator color - override theme
            • Set all to white
          • Open and use different schemes for programs that do not get focus
            • Set all to gray
        • Open overlay panel theme background opacity
          • Panel background opacity 60
      • behavior
        • Open quarantine workspace
        • Turn on the isolation display
        • Open ungroup application
  • Window title bar
    • Turn on maximize
    • Open minimize
  • Keyboard and mouse: close the middle click Paste
  • Top bar
    • Percentage of battery on
    • Opening date
    • Open seconds

0x05 ZSH configuration reference



# apt install fonts-powerline
# Download
# Extract the files and copy all font files to user font folder like ~/.local/share/fonts
# fc-cache -f -v

### Added by Zinit's installer
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
    print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})...%f"
    command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
    command git clone "$HOME/.local/share/zinit/zinit.git" && \
        print -P "%F{33} %F{34}Installation successful.%f%b" || \
        print -P "%F{160} The clone has failed.%f%b"

source '/etc/zsh/zprofile'
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
### End of Zinit's installer chunk

setopt BANG_HIST                 # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY          # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY        # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY             # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST    # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS          # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS      # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS         # Do not display a line previously found.
setopt HIST_IGNORE_SPACE         # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS         # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS        # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY               # Don't execute immediately upon history expansion.
setopt HIST_BEEP                 # Beep when accessing nonexistent history.

# apt install fzf
zinit ice depth='1' lucid wait='0' atload='_zsh_autosuggest_start'
zinit light zsh-users/zsh-autosuggestions
zinit ice depth='1' lucid wait='0'
zinit light zsh-users/zsh-syntax-highlighting
zinit ice depth='1'
zinit light zsh-users/zsh-completions
zinit ice depth='1'
zinit light romkatv/powerlevel10k
zinit ice lucid wait='0'
zinit snippet OMZ::plugins/jsontools/jsontools.plugin.zsh
zinit ice lucid wait='0'
zinit snippet OMZ::plugins/fzf/fzf.plugin.zsh
zinit ice lucid wait='0'
zinit snippet OMZ::lib/completion.zsh

autoload -U compinit && compinit

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
if [ ${DISPLAY} ]; then
   [[ ! -f ~/.p10k.gui.zsh ]] || source ~/.p10k.gui.zsh
   [[ ! -f ~/.p10k.terminal.zsh ]] || source ~/.p10k.terminal.zsh
   if [ ${CHANGE_LANG_NOGUI} ]; then
       export LC_ALL="en_US.UTF-8"

alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias ll='ls -lh'
alias la='ls -A'
alias l='ls -CF'
alias cp='/usr/local/bin/cpg -g'
alias mv='/usr/local/bin/mvg -g'
alias cat='batcat --paging=never -p'

Powerlevel10k configuration

Powerlevel 10K is the theme of zsh In zshrc, we declare that different p10k configurations are used in desktop environment and terminal environment, that is, more and more friendly terminal theme configurations are used in desktop environment, while more conservative terminal theme configurations are used in terminal environment to ensure compatibility. The following is the complete content link of the two configuration files

p10k Config for GUI

p10k Config for Terminal

Topics: Linux debian