Debian series system routine initialization steps compilation
本文最后更新于 268 天前,其中的信息可能已经有所发展或是发生改变,如有失效可到评论区留言。
Article Abstract
Addressing the initialization needs of Debian systems, this article compiles a complete workflow solution from basic configuration to development environment deployment. By installing Vim, an SSH server, and configuring the timezone and network parameters (IP/DNS), it resolves the issues of missing software and tedious configuration during new system deployment. Combined with APT source optimization (applicable to domestic users in China) and Docker environment setup, it meets the requirements for server deployment and development environment construction. Practice shows that following these steps can systematically improve the usability and management efficiency of Debian systems, making it especially suitable for scenarios requiring frequent initialization of virtual machines or cloud hosts. Some operations, such as installing network tools and configuring SSH keys, can serve as subsequent expansion directions.
Qwen3-14B · 2026-06-18

Preface

This article is mainly for record-keeping purposes, to save myself from installing various software here and there every time I install a new Debian virtual machine. Why specifically mention Debian virtual machines? Because as soon as a Debian LXC is newly created, most of the basic software is already installed. The following assumes that the console is logged in as the root user, so I won't type sudo to save a few characters.

Note 1: Steps 1 and 2 below can only be performed in the console.

Note 2: Since I am installing locally using the mini image provided by the official Debian website, almost no software is installed by default, so I need to install them manually. If it is another deployment environment, such as a cloud host, the default image provided by the provider may already have some of these software integrated, so you may not need to install them separately.

Note 3: Determine whether you need to perform some of the operations in this article or install certain tools based on your actual needs, as this article is recorded according to my own requirements.

Install vim

This is the top priority, and the command is as follows:

apt install vim

Install and configure SSH server

Install openssh-server:

apt install openssh-server

Allow root account to log in via SSH:

vim /etc/ssh/sshd_config

Remove thePermitRootLoginThe preceding #, and modify it toto yes

Allow regular users to log in via SSH using username and password:

Remove thePasswordAuthentication yesThe preceding #

After modification, simply restart the SSH service:

systemctl restart ssh

Or you can restart it using the service command:

service ssh restart

Actually, I highly recommend logging in directly with a public key, which is more secure. However, because I need to connect from many terminals and find it annoying to configure each one, I just use username and password login. If you usually only use 1 or 2 management terminals, I suggest using public key login directly. For the detailed configuration process of public key login, please refer to another article:Debian Series: Configuring SSH Public Key Login。

For the subsequent operations, you can use an SSH client and directly copy and paste, without having to use the clunky console. :)

Configure timezone

If this step was already configured during the installation process, you can skip it:

timedatectl list-timezones \\列出时区
timedatectl set-timezone your_time_zone \\改时区,这里一般是Asia/Shanghai

Modify hostname

timedatectl set-timezone your_time_zone \\Change timezone, usually Asia/Shanghai here
UseThis step is also optional, depending on your needs. There are 3 ways:hostnamectl

hostnamectl set-hostname your-hostname

hostnamectl set-hostname your-hostname

vim /etc/hostname

vim /etc/hostname
Use the hostname command: hostname your-hostname

Modify IP address

Takes effect immediately, but becomes invalid after reboot.

vim /etc/network/interfaces

vim /etc/network/interfaces

auto lo auto eth0  #设置开机自动连接网络
iface lo inet loopback allow-hotplug
eth0 iface eth0 inet static   #static表示使用固定IP地址上网,dhcp表示使用动态ip address 192.168.9.100    #设置静态ip地址,注意只是address,没有ip
netmask 255.255.255.0   #子网掩码 gateway 192.168.9.254    #网关

auto lo auto eth0 #Set to automatically connect to the network on boot

iface lo inet loopback allow-hotplug

eth0 iface eth0 inet static #static means using a static IP address to access the internet, dhcp means using dynamic ip address 192.168.9.100 #Set static IP address, note it is just address, no ip

apt install network-manager

If modifying a static IP address, just change the address after "address"; if using DHCP, change "static" to "dhcp", and comment out the two lines for "address" and "netmask".Modification method for Debian 12:A pure command-line network configuration tool, and the other isnmtui's terminal graphical configuration tool.

The configuration file path for NetworkManager:/etc/NetworkManager/NetworkManager.conf, you need to modify the configuration inside: changemanaged=falsein the red box tomanaged=true

Modify DNS address

Temporary modification:

vim  /etc/resolv.conf

vim /etc/network/interfaces

nameserver 119.29.29.29   #设置首选dns,国外尽量选1.1.1.1或者8.8.8.8
nameserver 8.8.8.8   #设置备用dns

Modify as needed.

Permanent modification:

vim /etc/systemd/resolved.conf

Then add a line, modifying the DNS address as needed:

DNS=8.8.8.8 114.114.114.114

After configuring steps 5 and 6, you need to restart the network service for it to take effect:

service networking restart

Install common network tools

The command is as follows:

apt install net-tools

Running the above command will install a set of classic network tools, including ifconfig, netstat, route, arp, hostname, and mii-tool. These tools are commonly used for tasks such as network interface configuration, routing table viewing, ARP cache management, and network troubleshooting.

Install DNS troubleshooting tools

apt install dnsutils

Running the above command will install a set of DNS query tools, including dig, nslookup, and host. These tools are used to perform DNS queries, resolution, and diagnostics, helping to troubleshoot domain name resolution issues.

Configure APT sources (only required if the host is in China)

The default repository source is configured in /etc/apt/sources.list, while the sources for individual software are in/etc/apt/sources.list.d/directory.

Assuming we use the USTC mirror for Debian 12, use the cat command to add it directly:

cat > /etc/apt/sources.list << EOF
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
EOF

Of course, you can also use vim, whichever you prefer.

After changing the sources, remember to use theapt updatecommand to update. (The principle of apt is: a list of package information is saved locally, such as package size, version number, dependencies, etc. The apt update command updates this information list, rather than updating the source (updating the source is done on the server side). If this list is not updated, you might install older versions of packages when installing software.)

Note that the sources for different versions are different, for example, Debian 12 corresponds to bookworm, and Debian 11 corresponds to bullseye.

Deploy Docker environment

First, install some necessary packages:

apt update
apt upgrade -y
apt install curl wget gnupg dpkg apt-transport-https lsb-release ca-certificates

Then add Docker's GPG public key and apt source, the command (for Debian system) is as follows:

curl -sSL https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-ce.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://download.docker.com/linux/debian $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list

Finally, update and install:

apt update &&  apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

That's all for now, I will add more as I encounter them in the future.

View Related Categories · 3 Matches
📌 Content Structure Prompt:
This content is part of the following knowledge map, where you can view the complete content path: Blog Knowledge Map。
📎 Related Articles
Share this article
The blog content is original, please indicate the source when reposting! The RSS address of the blog is:https://blog.tangwudi.com/feed, welcome to subscribe; if needed, you can join theTelegram Groupto discuss questions together.
No Comments

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗ
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
Kaomoji
Emoji
Little Dinosaur
Flower!
Previous
Next
       

👋 Welcome to “Wudi's Personal Blog”

Here, long-term exploration is mainly carried out around the following directions:

🧱 Personal Digital Infrastructure and Blog System Construction
☁️ Cloudflare and Network Architecture Practice
🧠 AI and Knowledge System Exploration
🛡️ Network Security and Access Optimization
🎵 Music and Sound Cognition
👁️ Cognitive Perspectives and Worldviews