diff --git a/deploy.sh b/deploy.sh index b70c4017..0ac985a7 100644 --- a/deploy.sh +++ b/deploy.sh @@ -29,15 +29,25 @@ echo -e "${GREEN}✅ 开始部署...${NC}" # ========== 1. 安装系统依赖 ========== echo -e "${YELLOW}[1/8] 安装系统依赖...${NC}" -apt update -apt upgrade -y +# 移除可能导致问题的 Docker 仓库配置 +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 node --version @@ -48,7 +58,7 @@ echo -e "${GREEN}✅ 系统依赖安装完成${NC}" # ========== 2. 配置 PostgreSQL ========== 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 enable postgresql