安装 Debian12 后默认情况下使用较为繁琐,通过以下步骤可以提高 Debian12 的使用体验,阅读以下内容时,需要按照文章步骤依次执行
换国内源
使用清华镜像源
cd /etc/apt/ # 切换到源地址配置目录
su # 切换root用户
mv sources.list sources.list.back # 备份原本的源文件
nano sources.list # 编辑源文件
将以下内容复制到 source.list 文件中,复制完成后 crtl+s
保存, ctrl+x
退出
注意以下内容只适用于 Debian12 版本
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
然后更新,显示的内容中有 tuna 即设置成功
su
apt-get update
显示包含以下内容即为成功
Hit:1 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm InRelease
Hit:2 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-updates InRelease
Hit:3 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-backports InRelease
....
将用户添加到sudo组中
su
apt-get install sudo
/usr/sbin/usermod -a -G sudo $(echo $USER)
关闭终端,重新启动一个终端
命令缺失和终端美化
debian12 安装完成后有一部分常用命令没有,这是因为环境变量中没有 /usr/sbin
路径,所以需要手动添加环境变量
sudo nano /etc/profile
# 在最后一行加入
export PATH=$PATH:/usr/sbin
# ctrl+s 保存,ctrl+x退出后,执行以下命令
source /etc/profile
终端美化
Debian 终端使用 grep 没有高亮显示,对于查看较为不便,需要修改 ~/.bashrc
文件,将其中注释掉的地方打开
nano ~/.bashrc
将以下注释掉的内容打开即可(去掉 alias 前面的 # 号)
去掉后使用 source ~/.bashrc
即可
github 配置与安装
git安装与配置
首先安装git
sudo apt-get install git
配置git
# 配置用户名和邮箱
git config --global user.name "yourName"
git config --global user.email "youEmail@xxx.com"
# 显示配置的信息
git config --list
ssh配置
在本地生成密钥
ssh-keygen -t ed25519 -C "your_email@example.com"
#然后一直回车即可
# 查看生成的公钥内容
cat ~/.ssh/id_ed25519.pub
github配置
首先注册一个账号
然后点击右上角的头像,选择 Settings ,进入新页面点击 SSH and GPG keys ,点击左边的 New SSH key
-
Title随便填
-
Key type 选择 Authentication Key
-
Key 将上面公钥的内容复制进去即可
中文支持和输入法
中文支持
sudo dpkg-reconfigure locales
一直按下到最后, 空格
选择, tab
切换选项,空格选择完这几个后,一直选择 ok 回车即可
安装中文输入法
推荐 rime
sudo apt-get install ibus-rime
安装完成后重启!!!
配置rime输入法
在 Settings > Keyboard 中的 InputSources 中添加输入源, 选择 Chinese > Chinese(Rime) 即可
打开Tweaks > Keyboard & Mouse > Show Extended Input Sources
推荐 雾凇拼音
安装方式推荐 rime-auto-deploy
安装步骤
# 安装依赖环境
sudo apt install ruby
# 克隆仓库
git clone --depth=1 https://github.com/Mark24Code/rime-auto-deploy.git --branch latest
cd rime-auto-deploy
# 执行安装脚本
./installer.rb
脚本运行后直接选择 1 运行即可
更详细的内容请查看 rime-auto-deploy github 仓库说明
横排配置
- ibus 配置 运行
ibus-setup
的初始程序(需要使用当前用户, 非root用户,不需要加su或者sudo)
ibus-setup
General > Font and Style > Candidates orientation 选择 Horizontal
Input Method > Add > Chinese > Rime
2. 修改 ~/.config/ibus/build/ibus_rime.yaml
添加(只需要在style下添加该属性即可,注意 yaml 的缩进格式)
style:
horizontal: true
# horizontal 添加的位置和 style 下其他属性位置一致即可
然后点击右上角输入法,选择部署等待即可
修改rm命令防止误删[可选]
首先安装 trash-cli
,回收站的命令模式
apt install trash-cli
修改 rm
命令
# 将rm命令重命名为 rrm
sudo mv /usr/bin/rm /usr/bin/rrm
# 软链接 trash 到 rm
sudo ln -s /usr/bin/trash /usr/bin/rm
trash命令
trash # 将文件或文件夹移动到回收站
trash-list # 显示已删除的文件
trash-restore # 恢复删除的文件
trash-empty # 清空回收站
trash-rm # 删除回收站中的某个文件
注意: 每个用户的回收站都是单独的,比如使用 sudo trash
删除的文件需要使用 sudo trash-list
查看
常用插件安装
在线安装插件方式
使用火狐浏览器,进入 插件下载 网站,根据提示安装浏览器插件
安装成功后,直接在 https://extensions.gnome.org/ 中搜索需要的插件即可
-
AppIndicator and KStatusNorifierItem Support
系统托盘,必须安装,否则一些运行在后台的软件无法查看 -
AATWS alt+tab
窗口切换优化,可以调节预览窗口大小 -
blur my shell
高斯模糊,美化插件 -
Screenshot Tool
托盘有个截屏的图标 -
Clipboard Indicator
粘贴板管理工具,安装后在状态栏有个小图标,查看历史粘贴记录 -
Proxy Switcher
在快速设置中添加一个网络代理的选择开关 -
TopHat
资源监控图标,在状态栏查看网速,cpu占用等信息 -
Removable Drive Menu
硬盘挂载托盘图标 -
quick settings audio devices hider
在快速设置中选择声音输出设备,如果有使用耳机的场景建议使用 -
任务栏优化插件,二者选一个即可
- dash to panel 将任务栏和状态栏合并在一起
- dash to dock 优化任务栏
-
Gnome Fuzzy App Search
gnome搜索框模糊搜索
常用软件安装
aptitude
# 一个用来代替 apt-get 的软件,可以自动处理依赖,搜索软件包
sudo apt-get install aptitude
# 常用命令 大部分命令与 apt-get 相同
aptitude serach xxx # 查询当前源中的软件
htop
终端系统资源监控
sudo apt-get install htop
/
通过进程名搜索
F9
kill 某个进程
q
退出
gdebi
deb安装软件,可以自动处理依赖
sudo apt-get install gdebi
# 使用方式
sudo gdebi xxx.deb
markdown编辑软件
-
可以使用 faltpak 安装
sudo flatpak install io.typora.Typora
-
开源免费,同样也可以使用 flatpak 安装
flatpak install com.github.marktext.marktext
gitui
比较方便的 git 终端界面 软件地址
更快的搜索工具
- riggrep 用来代替 grep
# 搜索某个文件的内容
rg '正则表达式' README.md
# 搜索当前目录下文件的内容
rg '正则表达式'
# 搜索被.gitignore 文件忽略的内容
rg '正则表达式' -u
# 搜索被.gitignore 文件忽略的内容和隐藏的文件和目录
rg '正则表达式' -uu
# 搜索被.gitignore 文件忽略的内容和隐藏的文件和目录以及二进制文件
rg '正则表达式' -uuu
# 搜索被.gitignore 文件忽略的内容和隐藏的文件和目录 并且只搜索 .txt文件的内容
rg '正则表达式' -g '*.txt' -uu
# 搜索被.gitignore 文件忽略的内容和隐藏的文件和目录 并且忽略 .txt文件的内容
rg '正则表达式' -g '!*.txt' -uu
# 搜索被.gitignore 文件忽略的内容和隐藏的文件和目录 并且只搜索 .txt 和 .t 文件的内容
rg '正则表达式' -g '*.txt' -g '.t' -uu
- fd 用来替代 find 命令
# 搜索 InputDis*.cpp 包含.gitignore 和隐藏文件夹
fdfind -g 'InputDis*.cpp' -HI
# 搜索以 *.txt 结尾的文件 包含.gitignore 和隐藏文件夹 并且忽略 .hidden 目录
fdfind -g '*.txt' -HI -E .hidden/
# -g global 模式 -HI 包含.gitgnore 和 隐藏文件夹 -E 忽略的目录
flatpak
软件管理软件
sudo aptitude install flatpak
# 使用 Gnome 软件应用程序安装 Flatpak 可以使用给定的命令为其添加 Flatpak 插件支持:
# sudo apt install gnome-software-plugin-flatpak
# 将 Flathub 仓库添加到系统
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# flatpak 添加国内源
flatpak remote-add --if-not-exists flathub https://mirror.sjtu.edu.cn/flathub/flathub.flatpakrepo
flatpak remote-modify flathub --url=https://mirror.sjtu.edu.cn/flathub
# 查看国内源是否设置成功
flatpak remotes -d
# 设置完成后需要重启
systemctl reboot
安装软件步骤
sudo flatpak search typora
# 以下为命令输出内容
Name Description Application ID Version Branch Remotes
Typora A minimal Markdown reading & writing app io.typora.Typora 1.7.5 stable flathub
#安装命令
sudo flatpak install io.typora.Typora # install + Application ID
flatpak权限管理软件
# 安装flatpak权限管理软件[图形界面]
sudo flatpak install com.github.tchx84.Flatseal
截图录屏软件
xrog环境录屏 ,截屏
sudo aptitude install kazam # 录屏软件
sudo aptitude install flameshot # 截屏软件
wayland 环境录屏
sudo flatpak install io.github.seadve.Kooha
洛雪音乐助手
在 release 选择 deb 下载安装
迅雷
sudo flatpak install com.xunlei.Thunder
使用 Flatseal 开启权限
- Device 中开启 All device (e.g. webcam)
- Allow 中全部开启
- Filessystem 中也是全部开启
微信
在优麒麟商店下载微信的 deb 包安装即可