Linux-从0开始安装配置Debian11
Debian 和 Ubuntu 属于同一系列的发行版。Debian 是由 Ian Murdock 在 1993 年创建的最初的发行版。Ubuntu 是 Mark Shuttleworth 在 2004 年基于 Debian 创建的发行版。Ubuntu 源自 Debian。这意味着 Ubuntu 使用与 Debian 相同的 APT 包管理系统,并共享来自 Debian 库中的大量包和库。它建立在 Debian 基础架构上。
Debian 更关注稳定性,这意味着它并不总是使用最新版本的软件。并且安装后的系统不像Ubuntu已经拥有大量的软件可以开箱即用。因此本文介绍了Debian的安装和配置过程。
请注意,不建议Linux新手使用Debian。
准备工作:
使用Upan制作Debian的启动盘,插上电脑,开机,从USB Device启动,进入Debian安装界面
安装:
可以使用图形化安装或者非图形化安装,看得懂英语基本没什么问题。
注意,在硬盘分区时,请确保你的/boot分区是“bootable”的。/boot分区需要在硬盘起始位置,最好不要将/boot分区放在超过2TB的硬盘或Raid中。否则GRUB无法找到系统,将自动进入rescue模式(别试了,救不回来)。
第一次启动:
!!!注意!!!
如果你使用的是Nvidia显卡,在某些情况下将会无法启动,会卡在内核载入截面。需要在GRUB界面选择系统时,编辑启动命令,在linux开头的那一行末尾,加上“nomodeset”,F10即可正常启动。
第一次启动后的Debian非常干净,干净到什么都没有,常用软件需要自己下载。
sudo:
(root) apt install sudo (root) vi /etc/sudoers
username ALL = (ALL:ALL) ALL
添加或删除用户,或删除用户sudo权限:
sudo adduser username
sudo deluser username sudo
软件源:
sudo vim /etc/apt/sources.list
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib deb https://mirrors.aliyun.com/debian-security/ bullseye-security main deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
sudo apt update
内核:
sudo apt update sudo apt install firmware-linux-nonfree sudo apt install linux-headers-$(uname -r)
配置ssh:
sudo apt update sudo apt install openssh-server sudo vim /etc/ssh/sshd.config
安装nvidia驱动:
(注意:如果稍后需要安装CUDA Toolkit,则不需要安装nvidia驱动,因为CUDA Toolkit包含CUDA驱动)
禁用Nouveau驱动,需要通过 /etc/modprobe.d/ 的 blacklist 来禁用:
sudo vim /etc/modprobe.d/blacklist-nouveau.conf blacklist nouveau options nouveau modeset=0
更新内核的 initramfs 文件:
sudo update-initramfs -u
运行下载好的驱动程序:
sudo chmod +777 NVIDIA-Linux-x86_64-515.57.run sudo ./NVIDIA-Linux-x86_64-515.57.run
CUDA:
如果系统缺少add-apt-repository命令,请通过在系统终端中运行以下命令来安装software-properties-common软件包:
sudo apt update sudo apt -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates
安装CUDA,由于前面已经安装好了驱动,因此只需要安装不含驱动版本的cuda即可(因为cuda内嵌有驱动)
wget https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.0-1_all.deb sudo dpkg -i cuda-keyring_1.0-1_all.deb sudo add-apt-repository contrib sudo apt-get update sudo apt-get -y install cuda

浙公网安备 33010602011771号