fix: 修复部署脚本处理Docker仓库访问失败的问题

This commit is contained in:
Sens 2026-02-20 22:59:10 +08:00
parent 656cefa668
commit de57318632
1 changed files with 17 additions and 7 deletions

View File

@ -29,15 +29,25 @@ echo -e "${GREEN}✅ 开始部署...${NC}"
# ========== 1. 安装系统依赖 ========== # ========== 1. 安装系统依赖 ==========
echo -e "${YELLOW}[1/8] 安装系统依赖...${NC}" echo -e "${YELLOW}[1/8] 安装系统依赖...${NC}"
apt update # 移除可能导致问题的 Docker 仓库配置
apt upgrade -y rm -f /etc/apt/sources.list.d/docker*.list 2>/dev/null || true
apt install -y curl wget git nginx software-properties-common # 更新包列表,允许不安全的仓库
apt-get update --allow-insecure-repositories || apt-get update
apt install -y python3.9 python3-pip python3-venv python3-dev libpq-dev # 升级包,跳过不可用的包
apt-get upgrade -y --allow-downgrades --remove-essentialallow- --allow-change-held-packages || \
apt-get upgrade -y --fix-missing || true
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - # 安装基础工具
apt install -y nodejs apt-get install -y --no-install-recommends curl wget git nginx software-properties-common || true
# 安装 Python
apt-get install -y --no-install-recommends python3.9 python3-pip python3-venv python3-dev libpq-dev || true
# 安装 Node.js
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - || true
apt-get install -y --no-install-recommends nodejs || true
python3 --version python3 --version
node --version node --version
@ -48,7 +58,7 @@ echo -e "${GREEN}✅ 系统依赖安装完成${NC}"
# ========== 2. 配置 PostgreSQL ========== # ========== 2. 配置 PostgreSQL ==========
echo -e "${YELLOW}[2/8] 配置 PostgreSQL 数据库...${NC}" echo -e "${YELLOW}[2/8] 配置 PostgreSQL 数据库...${NC}"
apt install -y postgresql postgresql-contrib apt-get install -y --no-install-recommends postgresql postgresql-contrib || true
systemctl start postgresql systemctl start postgresql
systemctl enable postgresql systemctl enable postgresql