Skip to content

当你有一台 VPS

Published: at 00:00

前言

软件安装

1. 基础环境配置

zsh & oh my zsh

  1. 安装 zsh 并设置为默认 shell
sudo apt update
sudo apt install zsh
  1. 安装 curl 和 git
apt install curl -y
apt install git -y
  1. 安装 Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  1. 配置 ~/.zshrc 文件
# 配置文件位于 ~/.zshrc,可通过修改此文件来设置主题和插件
# 常用配置:
# 设置主题
ZSH_THEME="agnoster"
# 设置插件
plugins=(git docker)

2. 服务器代理

x-ui

  1. 执行一键安装脚本
bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)
  1. 访问管理面板 通过浏览器访问:http://服务器IP:端口号 示例:http://192.168.1.1:10000

  2. 更新 V2Ray 到最新版本 更新完成后系统将自动重启

  3. 配置 vmess 节点

  4. 安装 V2Ray 客户端 推荐使用 V2rayN,支持扫码连接或导入配置文件

3. 容器环境

docker & docker-compose

安全提示:

  1. 安装必要的依赖
apt install apt-transport-https ca-certificates curl software-properties-common -y
  1. 添加 Docker 官方仓库
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  1. 更新软件包索引
apt update
  1. 安装 Docker CE
apt install docker-ce -y
  1. 验证 Docker 安装
docker --version
  1. 安装 docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  1. 设置 docker-compose 执行权限
chmod +x /usr/local/bin/docker-compose
  1. 验证 docker-compose 安装
docker-compose --version

4. 服务器管理

1Panel

  1. 执行一键安装脚本
curl -sSL https://resource.1panel.hk/quick_start.sh -o quick_start.sh && bash quick_start.sh
  1. 安装过程中需要设置以下信息:

安装成功之后,会有这样一段日志输出

[1Panel Log]:
======================= Starting Installation =======================
Set 1Panel installation directory (default is /opt):
[1Panel Log]: The installation path you selected is /opt

The port you set is:  30840
Set 1Panel secure entrance (default is xxxxxxx):
Set 1Panel panel user (default is xxxxxx):
Set 1Panel panel password,xxxxxxx

可通过以下地址访问面板:

http://服务器IP:30840

注意事项:

5. 网站统计

Umami

前置条件:

  1. 创建项目目录
mkdir umami
cd umami
  1. 创建 docker-compose.yml 文件
version: "3"
services:
  umami:
    image: ghcr.io/umami-software/umami:postgresql-latest
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgresql://umami:umami@db:5432/umami
      DATABASE_TYPE: postgresql
      APP_SECRET: replace-me-with-a-random-string
      NEXTAUTH_URL: https://your-domain.com # 替换为你的域名
    depends_on:
      db:
        condition: service_healthy
    init: true
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "curl http://localhost:3000/api/heartbeat"]
      interval: 5s
      timeout: 5s
      retries: 5
  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: umami
    volumes:
      - umami-db-data:/var/lib/postgresql/data
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 5s
      timeout: 5s
      retries: 5
volumes:
  umami-db-data:
  1. 启动服务
docker-compose up -d
  1. 访问配置

重要配置说明:

使用说明:

参考资料

关注公众号 技术后花园 获取更多信息

image.png