记录debian12系统安装宝塔后,各种疑难杂症的解决方案命令
重启服务器:systemctl reboot
编辑软件源列表文件 nano /etc/apt/sources.list
注释掉光盘源deb cdrom:[Debian GNU/Linux 12.11.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20250517-09:52]/ bookworm main
# deb cdrom:[Debian GNU/Linux 12.11.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20250517-09:52]/ bookworm main
使用Debian官方全球源(稳定)
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
方案B:使用国内清华镜像源(推荐,速度更快)
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
执行更新apt update
安装您最初需要的 sudo:apt install sudo -y
升级所有可更新的软件包apt upgrade -y
**********************************************************************
安装编译依赖
# 1. 更新软件包列表(我们已经做过了,但确保万无一失)
apt update
# 2. 安装核心编译工具和依赖库
apt install -y build-essential autoconf libtool pkg-config libssl-dev libcurl4-openssl-dev libonig-dev libxml2-dev libzip-dev zlib1g-dev libsqlite3-dev libwebp-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev
**************************************************************************
这一段是解决宝塔面板无法添加端口的问题。
确认 UFW 是否安装dpkg -l | grep ufw
如果确认 UFW 没有安装,你可以通过以下命令来安装:
apt update
apt install ufw -y
***********************************************************