作为一个老linuxer(用deb系居多)用户了,面对linux的系统配置的时候又是依然痛不欲生,所以这里归档一下我的Linux配置设置以方便日后使用。

初始配置

更换源

首先换镜像源的是必备的,鉴于Ubuntu还有他的孩子们都有图形化,这里就不用过多赘述。面对没有镜像源图形化切换的发行版,这里给出dabian的修改示例

1
sudo nano /etc/apt/sources.list #修改源文件

我用的是中科大源
1
2
3
4
5
6
7
8
deb https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib

1
sudo apt update

配置显卡驱动

第一种方法:run文件安装

只能说黄狗给的run文件虽然难用但是至少给了(苦笑)
网站链接:(https://www.nvidia.cn/drivers/lookup/),在页面表单上输入具体的型号,然后由网页待到下载界面。搜素奥自己的显卡型号。
安装的时候最好进入root模式。
首先安装一下必要组件

1
apt -y install linux-headers-$(uname -r) build-essential libglvnd-dev pkg-config

禁用内核更新
1
dpkg --get-selections | grep linux-(image|headers)

禁用开源原生驱动
1
2
3
echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
echo "options nouveau modeset=0" >> /etc/modprobe.d/blacklist.conf
update-initramfs -u

将结果里的linux-image和linux-headers固定版本,例如:
1
apt-mark hold linux-image-你的版本号-amd64 linux-headers-你的版本号 linux-headers-你的版本号-common

安装驱动
给它转为可执行文件
1
chmod u+x NVIDIA-Linux-你的版本号.run

执行文件
1
./NVIDIA-Linux-x86_64-470.256.02.run

安装过程紧跟脚步最后重启
1
reboot

或者你可以直接从仓库下载

1
sudo apt install nvidia

第二种方法:仓库安装(ubuntu为例子,反正deb系的软件源各种嫁接大法不少见,ubuntu源用在dabian也不少见(笑))

添加ppa源

1
sudo add-apt-repository ppa:graphics-drivers/ppa

安装依赖
1
sudo apt-get install dkms build-essential

寻找版本
1
ubuntu-drivers devices

按照给出的版本安装
1
sudo ubuntu-drivers autoinstall

重启
1
sudo reboot

linux美化(提一嘴)

我懂我都懂,linux美化是不得不品的一环(linux社区二次元们的莫名的执念)

一般美化

鉴于grub主题等都有现成的网站我就不过多赘述,我这里推荐一个登陆界面美化插件
https://github.com/PRATAP-KUMAR/gse-gdm-extension (超好用)

终端美化

终端个人推荐使用zsh,主题使用powerlevel10k,插件仅需zsh-autosuggestions与zsh-syntax-highlighting即可。 配置可参照:https://www.haoyep.com/posts/zsh-config-oh-my-zsh/

python配置

anaconda死一死,司马慢
建议用venv,pip,真有需要可用minconda。
在这里pip换源可以用清华源

1
2
python -m pip install --upgrade pip
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

然后你就下载自己所需要的轮子吧

这就是我的linux配置了,就这样。