跳到主要内容

Debian做服务器的相关设置

创建时间:2025年02月22日

下载镜像

https://www.debian.org/distrib/ 。不要下载小型镜像,应下载完整安装镜像(3GB以上),安装时勾选SSH Server

配置清华源

备份初始源

mv /etc/apt/sources.list /etc/apt/sources.list.old

替换清华源

cat > /etc/apt/sources.list << EOF
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free
EOF

更新软件包列表

sudo apt update

安装curl

sudo apt install curl

安装1panel

curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && bash quick_start.sh

开启root用户ssh登录

/etc/ssh/sshd_config中的PermitRootLogin prohibit-password改为PermitRootLogin yes,同时设置允许密码登录PasswordAuthentication yes

重启ssh服务systemctl restart ssh

手动设置ipv4地址

修改/etc/network/interfaces

iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 1.1.1.1

重启网络systemctl restart networking