> ## Content Index
> Fetch the complete content index at: https://alvis.org.cn/llms.txt
> Use this file to discover other available public pages before exploring further.

# 🐸 Debian安装后必备配置
- URL: https://alvis.org.cn/71f62268/
- Published: 2024-10-21T06:16:03.000Z
- Updated: 2026-11-30T07:41:36.000Z
- Description: debina12系统安装后必备的配置操作
- Author: jie.chen
- Tags: 古法编程, Linux, debian

## 1\. 查看系统版本信息

```bash
root@VM-16-16-debian:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

root@VM-16-16-debian:~# cat /etc/debian_version
12.0

root@VM-16-16-debian:~# hostnamectl
 Static hostname: VM-16-16-debian
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: 3217963d28984783b71a0eecc3f3f89d
         Boot ID: 9937def658c5426ba053af84a215a22b
  Virtualization: kvm
Operating System: Debian GNU/Linux 12 (bookworm)  
          Kernel: Linux 6.1.0-13-amd64
    Architecture: x86-64
Firmware Version: seabios-1.9.1-qemu-project.org

root@VM-16-16-debian:~# uname -a
Linux VM-16-16-debian 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64 GNU/Linux

```

![image.png](https://alvis.org.cn/content/images/2026/11/1f87c022636cdf2e38fa73a8.png)

### 1.1 安装vim编辑器

```bash
apt install vim

```

### 1.2 Root用户连接SSH

系统默认是不能使用Root用户去使用SSH连接到VPS的，我们需要修改配置。

```bash
sudo vim /etc/ssh/ssh_config
#修改或增加 PermitRootLogin yes 配置

sudo systemctl restart ssh #重启SSH服务生效

```

安装sudo命令，创建管理员用户，后面都以此用户进行系统管理而不是root用户。

```bash
root@debian:~# useradd -m -s /bin/bash -G sudo test 
root@debian:~# passwd test

```

让我们创建的用户和root有同等的权限

```bash
#1.添加用户，首先用 adduser 命令添加一个普通用户，命令如下：
#2.新增一个test账号
adduser test
#修改密码
passwd test
#3修改 /etc/sudoers 文件，找到 root 一行，在 root 下面添加一行，如下所示：
#Allow root to run any commands anywhere root ALL=(ALL) ALL
test ALL=(ALL) ALL
#修改完毕，现在可以用 yzgxhwj 帐号登录，然后用命令 sudo su—， 即可获得 root 权限进行操作。

```

这样我们就不用去操作root用户了，可以直接操作我们和root用户有同等权限的用户。

### 1.3 为了提高软件下载速度，建立更换为国内镜像源

先备份sources.list，然后拷贝到用户目录，用编辑器进行编辑，最后再拷回去覆盖院配置。

```bash
sudo cp /etc/apt/sources.list /etc/apt/sources.list.back
cp /etc/apt/sources.list /home/scilogyhunter/sources.list
sudo cp /home/scilogyhunter/sources.list /etc/apt/sources.list

```

![image.png](https://alvis.org.cn/content/images/2026/11/ddfbd211d0d761d6882da916.png)

我使用的是腾讯云的

```bash
deb http://mirrors.tencentyun.com/debian bookworm main contrib non-free non-free-firmware
#deb-src http://mirrors.tencentyun.com/debian bookworm main contrib non-free non-free-firmware
deb http://mirrors.tencentyun.com/debian bookworm-updates main contrib non-free non-free-firmware
#deb-src http://mirrors.tencentyun.com/debian bookworm-updates main contrib non-free non-free-firmware
deb http://mirrors.tencentyun.com/debian-security/ bookworm-security main contrib non-free-firmware
#deb-src http://mirrors.tencentyun.com/debian-security/ bookworm-security main contrib non-free-firmware

```