关于debian:debian11系统初始化

30次阅读

共计 2374 个字符,预计需要花费 6 分钟才能阅读完成。

本文形容下 debian11 的初始化工作。

首先,咱们应用普通用户登录到 debian,而后应用 su - 命令来切到 root 用户。留神: 肯定要是su -,而不是su

$ su -

设置 IP 地址

应用 root 登录后,批改 /etc/network/interfaces 文件:

# The primary network interface
# 正文掉这行,并记录这个相似于 ens192 的关键字
# allow-hotplug ens192 
# 正文点这行同时
#iface ens192 inet dhcp
# 退出以下行,留神 ens192 是咱们从下面复制下来的,不同的电脑不一样
auto ens192
iface ens192 inet static
# 以下请依据本人的理论状况设置
address 192.168.1.17
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1

编辑后退出,而后执行:systemctl restart networking.service使配置失效.

装置 sudo

默认 debian11 并没有装置 sudo,装置过程如下:

更新源

如果操作系统是以 CD 形式装置的,那么 CD 会默认成为软件源(这在离线的网络环境中是必要的),而以后咱们的服务器有网络环境,同时装置完操作系统后,CD 曾经弹出,所以此时须要勾销掉软件源:

$ nano /etc/apt/sources.list

# 正文掉以 cd rom 开始的源
# deb cdrom:[Debian GNU/Linux 11.4.0 _Bullseye_ - Official amd64 DVD Binary-1 2>

# deb cdrom:[Debian GNU/Linux 11.4.0 _Bullseye_ - Official amd64 DVD Binary-1 2>

而后增加一些国内的官网源的中的华为镜像,最终文件如下:

# deb cdrom:[Debian GNU/Linux 11.4.0 _Bullseye_ - Official amd64 DVD Binary-1 20
220709-10:33]/ bullseye contrib main

# deb cdrom:[Debian GNU/Linux 11.4.0 _Bullseye_ - Official amd64 DVD Binary-1 20
220709-10:33]/ bullseye contrib main

# huawei
deb https://mirrors.huaweicloud.com/debian/ bullseye main contrib non-free
deb-src https://mirrors.huaweicloud.com/debian/ bullseye main contrib non-free
deb https://mirrors.huaweicloud.com/debian/ bullseye-updates main contrib non-fr
ee
deb-src https://mirrors.huaweicloud.com/debian/ bullseye-updates main contrib no
n-free
deb https://mirrors.huaweicloud.com/debian/ bullseye-backports main contrib non-
free
deb-src https://mirrors.huaweicloud.com/debian/ bullseye-backports main contrib 
non-free
deb https://mirrors.huaweicloud.com/debian-security bullseye-security main contr
ib non-free
deb-src https://mirrors.huaweicloud.com/debian-security bullseye-security main c
ontrib non-free

#deb http://security.debian.org/debian-security bullseye-security main contrib
#deb-src http://security.debian.org/debian-security bullseye-security main contr
ib

# bullseye-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_
and_backports
# A network mirror was not selected during install.  The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
# deb http://deb.debian.org/debian/ bullseye-updates main contrib
# deb-src http://deb.debian.org/debian/ bullseye-updates main contrib

除此以外,你还能够将上述镜像中的 mirrors.huaweicloud.com 替换为以下地址的任意关键字:

更新源

$ apt update

装置 sudo

debian11 默认未装置 sodu, 执行:apt install sudo进行装置.

退出 sudoers

$ usermod -aG sudo yourusername

而后,咱们登记以后的 shell,再从新登录一个。此时,便能够应用 sudo 命令了。

正文完
 0