Add files via upload

This commit is contained in:
spiritlhl
2023-06-17 21:05:12 +08:00
committed by GitHub
parent 285e719f12
commit 6ba90db03f
60 changed files with 4358 additions and 0 deletions

3
docs/case/case1.md Normal file
View File

@@ -0,0 +1,3 @@
https://github.com/spiritLHLS/one-click-installation-script
# 说明与用例稍后补充

3
docs/case/case2.md Normal file
View File

@@ -0,0 +1,3 @@
https://github.com/spiritLHLS/ecs
# 说明与用例稍后补充

3
docs/case/case3.md Normal file
View File

@@ -0,0 +1,3 @@
https://github.com/spiritLHLS/ecsspeed
# 说明与用例稍后补充

3
docs/case/case4.md Normal file
View File

@@ -0,0 +1,3 @@
https://github.com/spiritLHLS/Oracle-server-keep-alive-script
# 说明与用例稍后补充

3
docs/case/case5.md Normal file
View File

@@ -0,0 +1,3 @@
https://github.com/spiritLHLS/convoypanel-scripts
# 说明与用例稍后补充

12
docs/case/index.md Normal file
View File

@@ -0,0 +1,12 @@
---
home: true
heroImage: https://raw.githubusercontent.com/spiritlhls/pages/main/logo.jpg
heroText: Linux相关项目
tagline: 与Linux相关的一些项目
actionText: 查看项目 →
actionLink: /case/case1
features:
- title: 注意事项
details: 注意每个项目说明,部分项目有可能对系统造成不可修复的错误,需要重装系统,请仔细查看说明
---
<br />本作品采用 <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a> 进行许可。

View File

@@ -0,0 +1,3 @@
<template>
<span>&#x26A1;</span>
</template>

10
docs/developer/index.md Normal file
View File

@@ -0,0 +1,10 @@
---
home: true
heroImage: https://raw.githubusercontent.com/spiritlhls/pages/main/logo.jpg
heroText: 开发手册
tagline: 欢迎使用一键虚拟化项目开发手册欢迎你提出高质量的Pull Request帮助一键虚拟化项目变得更好
actionText: 开始使用 →
actionLink: /developer/l10n
footer: Copyright © 2023-present oneclickvirt
---
<br />本作品采用 <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a> 进行许可。

10
docs/developer/l10n.md Normal file
View File

@@ -0,0 +1,10 @@
**你可以在开发新功能时遵循以下步骤来支持本地化**
## 介绍
1. 你可以直接使用 `/resource/l10n/zh-CN.toml` 中已有的文本配置来替换新功能中的文本
2. 如果新功能中有新增文本,请参考 `zh-CN.toml` 的配置文本,将新文本拉取到 `zh-CN.toml` 等其他语言的配置文件中,并添加翻译
## 新本地化文本的添加
1.`/resource/l10n/` 中添加新的语言文本配置
2. 在新的语言文本配置中拉取其他语言已有的文本配置
3. 为新的语言文本配置添加翻译

View File

@@ -0,0 +1,10 @@
---
home: true
heroImage: https://raw.githubusercontent.com/spiritlhls/pages/main/logo.jpg
heroText: Development Manual
tagline: Welcome to the Nezha Monitoring Development Manual.
actionText: Start Now →
actionLink: /en_US/developer/l10n
footer: Copyright © 2023-present oneclickvirt
---
<br/>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.

View File

@@ -0,0 +1,10 @@
**You can follow these steps to support localization when developing new features**
## Introduction
1. You can directly use the text configuration already available in `/resource/l10n/en-US.toml` to replace the text in the new feature.
2. If there is new text in the new feature, please refer to the configuration text in `en-US.toml`, pull the new text into the configuration files of other languages such as `en-US.toml`, and add translations.
## Adding a new localized text file
1. Add a new language text configuration in `/resource/l10n/`.
2. Pull existing text configurations from other languages in the new language text configuration.
3. Add translations for the new language text configuration.

View File

@@ -0,0 +1,35 @@
## 准备工作
需要虚拟化出服务器,你需要:
1. 一台可以连接公网的服务器( VPS 或 Dedicated Server),最好能完美访问 Github 的 RAW 页面,部分项目部分组件可能未使用 CDN 加速
::: tip
如果您位于中国大陆,访问 Github 有困难,请注意配套脚本和项目是否有说明已使用 CDN 加速
:::
2. 本地可以稳定连接SSH如果不能稳定连接请使用```screen```命令创建窗口后,在窗口内执行命令
::: tip
不会用screen命令的自行查找相关教程学习
:::
3. 确保服务器的系统和硬件满足对应项目的要求,详见对应项目说明
**本文档将以VPS作为范例且该VPS纯净无原生环境问题如有必要请重装系统保证初始环境的纯净**
:::warning
PVE项目可能造成宿主机出现问题如果你不会看Bug和修复系统那么不建议你在生产环境中使用使用PVE相关脚本请确保宿主机随时可重装系统
:::
<br/>
<br/>
## 项目仓库
欢迎Star和Fork
### PVE相关的各种一键脚本
[https://github.com/spiritLHLS/pve](https://github.com/spiritLHLS/pve)
### 通过LXD/LXC命令批量或单独开设NAT服务器以及维护
[https://github.com/spiritLHLS/lxc](https://github.com/spiritLHLS/lxc)
### 通过docker批量或单独开设NAT服务器
[https://github.com/spiritLHLS/docker](https://github.com/spiritLHLS/docker)

View File

@@ -0,0 +1,10 @@
Give me a cup of coffee.
https://ko-fi.com/spiritlhl
USDT-TRC20
```bash
TZ7nf8XAL9zQUo63xokazaBdCPeCgPfcwd
```

View File

@@ -0,0 +1,106 @@
## 单独开设
下载脚本
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/onedocker.sh -o onedocker.sh && chmod +x onedocker.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/onedocker.sh -o onedocker.sh && chmod +x onedocker.sh
```
运行
```
./onedocker.sh name cpu memory password sshport startport endport system
```
目前system仅支持选择alpine或debian默认是debian
### 示例
* 以下为开设的示例容器的信息:
`容器名字` - test
`SSH登录的用户名` - root
`SSH登录的密码` - 123456
`CPU核数` - 1
`内存大小` - 512MB
`SSH端口` - 25000
`内外网映射端口一致的区间` - 34975到35000
`系统` - debian
```shell
./onedocker.sh test 1 512 123456 25000 34975 35000 debian
```
删除示例
```shell
docker rm -f test
rm -rf test
ls
```
进入示例
```shell
docker exec -it test /bin/bash
```
要退出容器就执行```exit```退出。
### 查询信息
```shell
cat 容器名字
```
输出格式
```
容器名字 SSH端口 登陆的root密码 核数 内存 外网端口起 外网端口止
```
## 批量开设
- 批量多次运行继承配置生成
- 生成多个时为避免SSH连接中断建议在screen中执行
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/dockers.sh -o dockers.sh && chmod +x dockers.sh && bash dockers.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/onedocker.sh -o onedocker.sh && chmod +x onedocker.sh
```
## 查询批量开设的信息
```shell
cat dclog
```
输出格式
```
容器名字 SSH端口 登陆的root密码 核数 内存 外网端口起 外网端口止
```
一行一个容器对应的信息
## 卸载所有docker容器和镜像
```shell
docker rm -f $(docker ps -aq); docker rmi $(docker images -aq)
rm -rf dclog
ls
```

View File

@@ -0,0 +1,17 @@
## 环境预设
- 检测环境
- 安装docker
- 下载预制脚本
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/pre_build.sh -o pre_build.sh && chmod +x pre_build.sh && bash pre_build.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/pre_build.sh -o pre_build.sh && chmod +x pre_build.sh && bash pre_build.sh
```

View File

@@ -0,0 +1,21 @@
## 项目特点
通过docker批量或单独开设NAT服务器(Bulk or individual NAT server provisioning via docker)
默认使用debian系统每个容器自带1个外网ssh端口25个内外网一致端口
默认创建的是非特权容器且不挂载与宿主机的docker的守护进程之间的通信所以**宿主机创建的docker虚拟化的NAT服务器内无法再嵌套虚拟化docker**
由于只是在宿主机进行了CPU和内存的限制未在容器内使用cgroup驱动所以在容器内使用服务器测试脚本检测容器的可用资源是无效的显示的会是宿主机的资源
由于大部分云服务器xfs文件系统不启用pquota选项所以**默认共享宿主机硬盘,无法限制每个容器的磁盘大小**
## 配置要求
系统可安装docker即可用网络能连接Github的raw界面就能用硬件配置只要不拉跨就行空闲硬盘有3G就行
推荐在开设NAT服务器前先增加部分SWAP虚拟内存避免突发的内存占用导致母鸡卡死 [跳转](https://github.com/spiritLHLS/addswap)
PS: 如果硬件资源只是好了一点需要限制更多东西并需要配置IPV6独立地址和限制硬盘大小可使用LXD批量开LXC虚拟化的容器 [跳转](https://github.com/spiritLHLS/lxc)
PS: 如果硬件非常好资源很多可使用PVE批量开KVM虚拟化的虚拟机 [跳转](https://github.com/spiritLHLS/pve)

View File

View File

View File

@@ -0,0 +1,124 @@
::tip
以下的配置安装会加重母鸡的负担,非必要不要安装
如果是个人使用,可忽略防滥用部分脚本的安装
::
## 自动配置IPV6地址
- (***非必须***,不使用的也没问题)
- **该脚本仅适用于母鸡有给```IPV6```子网且是```/64```的,且母鸡绑定了子网的```第一个IP```做```母鸡的IPV6地址或IPV6的gateway```**
- 自动为LXD创建的LXC容器配置```IPV6```地址
- 已集成到```buildone.sh```中可使用变量控制且无需事先下载,该脚本可不手动使用,在使用```buildone.sh```时配置Y开启即可
下载脚本
国际
```bash
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/build_ipv6_network.sh -o build_ipv6_network.sh && chmod +x build_ipv6_network.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/build_ipv6_network.sh -o build_ipv6_network.sh && chmod +x build_ipv6_network.sh
```
自动为容器配置IPV6映射地址
```bash
bash build_ipv6_network.sh 容器名称
```
映射完毕会打印信息
示例(给test容器自动配置IPV6地址配置完成会写入一个test_v6的文件信息)
```bash
bash build_ipv6_network.sh test
```
删除所有IPV6已映射的规则
```bash
ip6tables -t nat -F PREROUTING
ip6tables-legacy -t nat -F PREROUTING
ip6tables-save > /etc/iptables/rules.v6
netfilter-persistent save
netfilter-persistent reload
service netfilter-persistent restart
```
卸载IPV6地址绑定的守护进程和对应的文件
```shell
systemctl stop add-ipv6.service
systemctl disable add-ipv6.service
rm /etc/systemd/system/add-ipv6.service
systemctl daemon-reload
rm /usr/local/bin/add-ipv6.sh
```
## 屏蔽容易被滥用的端口的出入流量以屏蔽端口和屏蔽滥用工具包
- (***非必须***,该脚本仅仅是为了防止容器滥用方便,不装的也没问题)
- 事前预防
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/rules.sh -o rules.sh && chmod +x rules.sh && bash rules.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/rules.sh -o rules.sh && chmod +x rules.sh && bash rules.sh
```
##### 使用screen配置监控屏蔽某些进程的执行遇到某些进程的出现直接关闭容器
- 如需停止监控可使用```screen```命令停止```lxc_moniter```这个名字的窗口并删除
- (***非必须***,该脚本仅仅是为了防止容器滥用方便,不装的也没问题)
- 事后停机
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/build_monitor.sh -o build_monitor.sh && chmod +x build_monitor.sh && bash build_monitor.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/build_monitor.sh -o build_monitor.sh && chmod +x build_monitor.sh && bash build_monitor.sh
```
##### 一键安装开lxd母鸡所需要的带vnstat环境的常用预配置环境
- (***非必须***,该脚本仅仅是为了站点对接监控方便,不装的也没问题)
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/backend.sh -o backend.sh && chmod +x backend.sh && bash backend.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/backend.sh -o backend.sh && chmod +x backend.sh && bash backend.sh
```
##### 一键安装母鸡可视化操作的面板
- (***非必须***,该面板只是为了方便可视化操作,没有也没问题)
- 原作者仓库:[跳转](https://github.com/turtle0x1/LxdMosaic)
```shell
lxc config set core.https_address [::]
lxc config set core.trust_password some-secret-string
snap install lxdmosaic
```
安装完毕后打开母鸡IP地址按照提示设置admin的密码其他一路默认就能使用面板了

View File

@@ -0,0 +1,104 @@
## 手动安装
新手推荐避免有bug不知道怎么修当然如果只是图方便又是老手懂排查BUG用后面的一键安装也行
### 关闭防火墙
```bash
apt update
apt install curl wget sudo dos2unix ufw jq -y
ufw disable
```
### 开设虚拟内存SWAP
内存看你开多少小鸡这里如果要开8个换算需要2G内存实际内存如果是512MB内存还需要开1.5G保守点开2G虚拟内存即可
执行下面命令输入1再输入2048代表开2G虚拟内存
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/swap.sh -o swap.sh && chmod +x swap.sh && bash swap.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/swap.sh -o swap.sh && chmod +x swap.sh && bash swap.sh
```
### 安装LXD
实际swap开的虚拟内存应该是实际内存的2倍也就是开1G是合理的上面我描述的情况属于超开了
```
apt install snapd -y
snap install lxd
/snap/bin/lxd init
```
如果上面的命令中出现下面的错误
(snap "lxd" assumes unsupported features: snapd2.39 (try to update snapd and refresh the core snap))
使用命令修补后再进行lxd的安装
```
snap install core
```
如果无异常,上面三行命令执行结果如下
![图片](https://user-images.githubusercontent.com/103393591/233270028-5a43d0f7-45f5-4175-969e-d4d182cb877a.png)
一般的选项回车默认即可
选择配置物理盘大小(提示默认最小1GB那个选项)一般我填空闲磁盘大小减去内存大小后乘以0.95并向下取整这里我填了10GB
提示带auto的更新image的选项记得选no避免更新占用系统
测试lxc有没有软连接上
```
lxc -h
```
如果报错则执行以下命令软连接lxc命令
```bash
! lxc -h >/dev/null 2>&1 && echo 'alias lxc="/snap/bin/lxc"' >> /root/.bashrc && source /root/.bashrc
export PATH=$PATH:/snap/bin
```
连接后再测试lxc命令是否有报错找不到
## 一键安装
::tip
如果是全新的服务器务必保证apt update和apt install curl都无问题再执行本脚本
且自开机起最好等待5分钟后再执行以下命令避免系统默认设置中就执行了本脚本导致apt源卡死
::
- 环境要求Ubuntu 18+(推荐)Debian 8+(仅限x86_64架构)
**如果是Debian系的宿主机务必在screen中执行本脚本避免长期运行时SSH中断导致ZFS编译安装失败**
这里的虚拟内存是说要开的SWAP大小存储池则是你所有要开的小鸡占的盘的大小的总和
环境安装过程中可能需要重启服务器再次执行以加载含zfs的内核一切以运行后命令行的提示为准
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/lxdinstall.sh -o lxdinstall.sh && chmod +x lxdinstall.sh && bash lxdinstall.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/lxdinstall.sh -o lxdinstall.sh && chmod +x lxdinstall.sh && bash lxdinstall.sh
```
例子:
如果系统盘除去已占用空间还有18G硬盘空余想开2G虚拟内存(2048MB的SWAP)15G的存储池按照命令行的提示则依次输入```2048```和```15```

218
docs/en_US/guide/lxd_lxc.md Normal file
View File

@@ -0,0 +1,218 @@
## 普通的批量版本
开出的小鸡配置:
- 1核256MB内存1GB硬盘限速250Mbps带宽
- 带1个SSH端口25个外网端口
- 默认内存和硬盘大小
::tip
lxc若命令无问题执行初始化开小鸡这一步最好放```screen```中后台挂起执行,开小鸡时长与你开几个和母鸡配置相关
::
执行下面命令加载开机脚本
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/init.sh -o init.sh && chmod +x init.sh && dos2unix init.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/init.sh -o init.sh && chmod +x init.sh && dos2unix init.sh
```
下面命令为开小鸡名字前缀为**tj**的**10**个小鸡
```shell
./init.sh tj 10
```
有时候init.sh的运行路径有问题此时建议前面加上sudo强制根目录执行
### 只有一个SSH端口的版本
开出的小鸡配置:
- 1核128MB内存300MB硬盘限速200Mbps带宽
- 只有一个SSH端口
- 无法挂载warp
::tip
lxc若命令无问题执行初始化开小鸡这一步最好放```screen```中后台挂起执行,开小鸡时长与你开几个和母鸡配置相关
::
加载开机脚本
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/least.sh -o least.sh && chmod +x least.sh && dos2unix least.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/least.sh -o least.sh && chmod +x least.sh && dos2unix least.sh
```
下列命令最后一行为开小鸡名字前缀为**tj**的**10**个小鸡
```shell
./least.sh tj 10
```
有时候least.sh的运行路径有问题此时建议前面加上sudo强制根目录执行
## 查看已批量开设的信息
开完小鸡后具体信息会生成在当前目录下的log文件中格式如下
```shell
1号服务器名称 密码 ssh端口 外网端口起始 外网端口终止
2号服务器名称 密码 ssh端口 外网端口起始 外网端口终止
```
如果想要查看只需在当前目录执行以下命令打印log文件即可
```shell
cat log
```
::warning
不要拿该脚本开出的小鸡当生产环境LXC虚拟化不支持换内核dd开启bbr等操作
::
## 部分常用LXD命令
查看所有
```bash
lxc list
```
查看个例
```bash
lxc info 服务器名字
```
启动个例
```bash
lxc start 服务器名字
```
停止个例
```bash
lxc stop 服务器名字
```
删除个例
```bash
lxc delete -f 服务器名字
```
进入内部
```bash
lxc exec 服务器名字 /bin/bash
```
退出则输入```exit```回车即可
删除所有LXC容器
```bash
lxc list | awk '{print $2}' | grep -v "^$" | xargs -I {} lxc delete -f {}
```
在容器内执行删除无用日志
```bash
sudo apt-get autoremove
sudo apt-get clean
sudo find /var/log -type f -delete
sudo find /var/tmp -type f -delete
sudo find /tmp -type f -delete
sudo find /var/cache/apt/archives -type f -delete
```
## 一键脚本老手推荐方便快捷
- 只生成一个NAT服务器可自定义限制所有内容
### 只开一个NAT服务器
#### 下载开机脚本
- (***非必须***如果你使用过一键安装LXD的命令自动已下载对应的开机脚本不用下载该脚本)
国际
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/buildone.sh -o buildone.sh && chmod +x buildone.sh && dos2unix buildone.sh
```
国内
```shell
curl -L https://ghproxy.com/https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/buildone.sh -o buildone.sh && chmod +x buildone.sh && dos2unix buildone.sh
```
##### 开NAT服务器
内存大小以MB计算硬盘大小以GB计算下载速度上传速度以Mbit计算是否启用IPV6不一定要填Y或者N没有这个参数也行
如果```外网起端口```和```外网止端口```都设置为0则不做区间外网端口映射了只映射基础的SSH端口注意```不能为空```不进行映射需要设置为0
支持自定义小鸡的系统,注意传入参数为系统名字+版本号debian11、ubuntu20centos8注意都是小写字母+数字的组合
```
./buildone.sh 小鸡名称 内存大小 硬盘大小 SSH端口 外网起端口 外网止端口 下载速度 上传速度 是否启用IPV6(Y or N) 系统(留空则为debian11)
```
示例
```
./buildone.sh test 256 2 20001 20002 20025 300 300 N
```
* 以下为开设的示例小鸡的信息:
`小鸡名字` - test
`SSH登录的用户名` - root
`SSH登录的密码` - 随机生成
`CPU核数` - 1
`内存大小` - 256MB
`磁盘大小` - 2G
`内外网映射端口一致的区间` - 20002到20025
`上传带宽` - 300Mbit
`下载带宽` - 300Mbit
`自动设置外网IPV6地址` - N
`系统` - debian11
需要查看信息则执行
```shell
cat 小鸡名字
```
比如查询示例的信息就是
```shell
cat test
```
如果已通过以上方法生成过小鸡,还需要批量生成小鸡,可使用手动安装部分的脚本,但注意先删除测试小鸡再进行批量生成小鸡
删除测试小鸡
```shell
lxc delete -f test
rm -rf test
ls
```

View File

@@ -0,0 +1,40 @@
## 配置要求
硬件要求:
- 系统Debian 8+, Ubuntu 18+(推荐),系统越新越好
- 虚拟化推荐KVM、VMWARE虚拟化
- 内存内存至少512MB
- 硬盘:硬盘(系统盘)至少10G
- 网络独立的IPV4地址IPV6可有可无带宽能下载脚本就行网络能连接Github的raw页面就行
PS: 如果硬件非常好资源很多可使用PVE批量开KVM虚拟化的虚拟机 [跳转](https://github.com/spiritLHLS/pve)
PS: 如果硬件资源更烂虚拟化不支持可使用docker版本的适配面更广 [跳转](https://github.com/spiritLHLS/docker)
## 项目特点
- 本套脚本开发使用的Ubuntu20Ubuntu别的长期维护版本应该也没问题Debian无法使用zfs时自动切换别的存储类型
- 已设置同时进行TCP和UDP转发除了SSH端口其他的映射内网外网端口一致
- 已设置支持开出的LXC容器进行docker嵌套虚拟默认普通版本和纯探针版本使用debian11系统
- 已屏蔽容器内可能用于滥用的工具包和IPV4网络的TCP/UDP协议的端口( 3389 8888 54321 65432 ),以防止容器被用于扫描和爆破,且可外置进程检查有问题自动停机
- 已支持一键为LXC容器配置IPV6地址(前提是母鸡有IPV6子网无IPV6地址则不配置)
- 一定要在 ```/root``` 的路径下运行本仓库脚本,且使用```一键脚本```的**不要删除**路径下的```ssh.sh```和```config.sh```文件
- 保证你要开的盘为默认的系统盘(sda或者sda1)而不是挂载的盘(sdb之类的),不确定的使用```fdisk -l```和```df```查看
- 挂载其他盘的详看 [其他说明](https://github.com/spiritLHLS/lxc/blob/main/README_other.md)
- 一键脚本支持自定义限制所有内容,普通版本支持多次运行批量生成不覆盖先前生成的配置
## 检测环境
**使用后续脚本的务必执行本命令检测母鸡是否符合要求**
```
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/pre_check.sh)
```

View File

@@ -0,0 +1,7 @@
## 目前已验证可开带独立IPV6地址容器的VPS商家
[kuroit](https://my.kuroit.com/aff.php?aff=5) 中的 美国凤凰城 regular
[datalix](https://t.me/vps_reviews/338) 中的 德国AMD 促销款
[luxvps](https://billing.luxvps.xyz/aff.php?aff=36) 中的 德国AMD 促销款

View File

@@ -0,0 +1,19 @@
## 致谢
https://github.com/lxc/lxd
https://lxdware.com/
https://discuss.linuxcontainers.org/
https://discuss.linuxcontainers.org/t/how-to-run-docker-inside-lxc-container/13017/4
https://discuss.linuxcontainers.org/t/error-seccomp-notify-not-supported-on-container-start/15038/3
https://discuss.linuxcontainers.org/t/how-do-i-assign-a-public-ipv6-address-to-a-lxc-container/6028
https://github.com/turtle0x1/LxdMosaic
https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/index.html
感谢 [@Ella-Alinda](https://github.com/Ella-Alinda) [@fscarmen](https://github.com/fscarmen) 提供的指导

View File

@@ -0,0 +1,74 @@
## 一键安装PVE
- 安装的是当下apt源最新的PVE
- 比如debian10则是pve6.4debian11则是pve7.xdebian12则是pve8.x
::tip
建议debian11而不是debian12因为后者是beta版本debian11安装的才是稳定版
::
- /etc/hosts文件修改(修正商家hostname设置错误以及新增PVE所需的内容)
- 已设置```/etc/hosts```为只读模式,避免重启后文件被覆写,如需修改请使用```chattr -i /etc/hosts```取消只读锁定,修改完毕请执行```chattr +i /etc/hosts```只读锁定
- 检测```/etc/cloud/cloud.cfg```如果发现```preserve_hostname```是```false```,则改为```true```同上也用chattr命令进行了文件锁定避免重启覆盖设置
- 检测是否为中国IP如果为中国IP使用清华镜像源否则使用官方源
- 安装PVE开虚拟机需要的必备工具包
- 替换apt源中的企业订阅为社区源
- 打印查询Linux系统内核和PVE内核是否已安装
- 检测```/etc/resolv.conf```是否为空,为空则设置检测```8.8.8.8```的开机自启添加DNS的systemd服务
- 新增PVE的APT源链接后下载PVE并打印输出登陆信息
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/install_pve.sh -o install_pve.sh && chmod +x install_pve.sh && bash install_pve.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/install_pve.sh -o install_pve.sh && chmod +x install_pve.sh && bash install_pve.sh
```
## 预配置环境
- 创建资源池mypool
- 移除订阅弹窗
- 尝试开启硬件直通
- 检测AppArmor模块并试图安装
- 重启系统前推荐挂上[nezha探针](https://github.com/naiba/nezha)方便在后台不通过SSH使用命令行避免SSH可能因为商家奇葩的预设导致重启后root密码丢失
- **执行完毕建议等待几分钟后再重启服务器**,执行```reboot```前需要等待后台任务执行完毕一些宿主机的系统apt命令执行很慢得等一会才能执行完毕
国际
```shell
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/build_backend.sh)
```
国内
```shell
bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/build_backend.sh)
```
### 自动配置宿主机的网关
::warning
使用前请保证重启过服务器且此时PVE能正常使用WEB端再执行重启机器后不要立即执行此命令待WEB端启动成功后至少等5分钟再执行本命令
这一步是最容易造成SSH断开的原因是未等待PVE内核启动就修改网络会造成设置冲突所以至少等几分钟待内核启动也就是WEB端启动成功后再执行
::
- 创建vmbr0母鸡允许addr和gateway为内网IP或外网IP已自动识别
- vmbr0创建支持纯IPV4或双栈服务器自动识别IPV4地址和IPV6地址自动识别对应的IP区间
- 创建vmbr1(NAT网关)
- 开NAT虚拟机时网关IPV4使用```172.16.1.1```IPV4/CIDR使用```172.16.1.x/24```这里的x不能是1当然如果后续使用本套脚本无需关注这点细枝末节的东西
- 想查看完整设置可以执行```cat /etc/network/interfaces```查看
- 加载iptables并设置回源且允许NAT端口转发
国际
```shell
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/build_nat_network.sh)
```
国内
```shell
bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/build_nat_network.sh)
```

196
docs/en_US/guide/pve_kvm.md Normal file
View File

@@ -0,0 +1,196 @@
## 部分注意事项
**执行本项目的第一个检测环境的命令**,展示如下
<br/>
![coode](/images/pve_kvm/pve_kvm_1.png)
<br/>
查询如上的只需使用下面的一键脚本自动创建虚拟机即可无需手动再修改WEB端设置
<br/>
![coode](/images/pve_kvm/pve_kvm_2.png)
<br/>
查询如上的在使用后续脚本创建了虚拟机后,**可能**需要手动修改WEB端设置需要关闭对应每个虚拟机的硬件嵌套虚拟化如下图
<br/>
![coode](/images/pve_kvm/pve_kvm_3.png)
<br/>
先停止虚拟机再修改修改完后再开机才能使用NOVNC不关闭**可能**导致这个虚拟机有BUG无法使用
如果强行安装PVE开KVM启动不了的也可以关闭这个选项试试能不能启动虚拟机
### 单独开设KVM虚拟化的VM
- 自动开设NAT服务器默认使用Debian10镜像因为该镜像占用最小
- 可在命令中自定义需要使用的镜像这里有给出配置好的镜像镜像自带空间设置是2~10G硬盘日常使用**至少10G以上**即可,除非某些镜像开不起来再增加硬盘大小
- 可在命令中指定存储盘位置默认不指定时为local盘即系统盘可指定为PVE中显示的挂载盘
- 自定义内存大小推荐512MB内存
::tip
需要注意的是宿主机内存记得开点swap免得机器炸了[开SWAP点我跳转](https://github.com/spiritLHLS/addswap)
::
- 自动进行内外网端口映射含2280443端口以及其他25个内外网端口号一样的端口
- 生成后需要等待一段时间虚拟机内部的cloud-init配置好网络以及登陆信息大概需要5分钟
- 虚拟机的相关信息将会存储到WEB端对应VM的NOTES中可在WEB端查看
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildvm.sh -o buildvm.sh && chmod +x buildvm.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildvm.sh -o buildvm.sh && chmod +x buildvm.sh
```
#### 使用方法
- 系统支持:详见 [跳转](https://github.com/spiritLHLS/Images/releases/tag/v1.0) 中列出的系统,使用时只需写文件名字,不需要.qcow2尾缀
::tip
注意这里的用户名不能是纯数字会造成cloudinit出问题最好是纯英文或英文开头
::
```shell
./buildvm.sh VMID 用户名 密码 CPU核数 内存 硬盘 SSH端口 80端口 443端口 外网端口起 外网端口止 系统 存储盘
```
#### 测试示例
* 以下为开设的示例VM的信息
`VMID` - 102
`SSH登录的用户名` - test1
`SSH登录的密码` - 1234567
`CPU核数` - 1
`内存大小` - 512MB
`磁盘大小` - 10G
`SSH端口` - 40001
`80端口` - 40002
`443端口` - 40003
`内外网映射端口一致的区间` - 50000到50025
`系统` - ubuntu20
`宿主机的存储盘` - local
```shell
./buildvm.sh 102 test1 1234567 1 512 10 40001 40002 40003 50000 50025 ubuntu20 local
```
开设完毕可执行```cat vm102```查看信息或到WEB端对应VM的NOTES中查看
#### 删除示例
- 停止VM
- 删除VM
- 删除端口映射
- 重启网络
- 删除log文件
```shell
qm stop 102
qm destroy 102
iptables -t nat -F
iptables -t filter -F
service networking restart
systemctl restart networking.service
rm -rf vm102
```
#### 相关qcow2镜像
- 已预安装开启cloudinit开启SSH登陆预设值SSH监听V4和V6的22端口开启允许密码验证登陆开启允许ROOT登陆
目前使用的镜像列表为
[https://github.com/spiritLHLS/Images/releases/tag/v1.0](https://github.com/spiritLHLS/Images/releases/tag/v1.0)
### 批量开设NAT的KVM虚拟化的VM
::warning
初次使用前需要保证当前PVE纯净且宿主机未进行过任何端口映射否则设置冲突可能出现BUG
开设前请使用screen挂起执行避免批量开设时间过长SSH不稳定导致中间执行中断
::
- 可多次运行批量生成VM
- 自动开设NAT服务器选项留空默认使用debian11镜像可自定义使用镜像名字支持的系统名字详见上文支持的镜像列表
- 自动进行内外网端口映射含2280443端口以及其他25个内外网端口号一样的端口
- 生成后需要等待一段时间虚拟机内部的cloudinit配置好网络以及登陆信息大概需要5分钟每个虚拟机创建之间有间隔等待60秒避免突发性能不足
- 默认批量开设的虚拟机网络配置为2280443端口及一个25个端口区间的内外网映射
- 可自定义批量开设的核心数,内存大小,硬盘大小,使用宿主机哪个存储盘,记得自己计算好空闲资源开设
- 虚拟机的相关信息将会存储到WEB端对应VM的NOTES中可在WEB端查看
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/create_vm.sh -o create_vm.sh && chmod +x create_vm.sh && bash create_vm.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/create_vm.sh -o create_vm.sh && chmod +x create_vm.sh && bash create_vm.sh
```
开设完毕可执行```cat vmlog```查看信息或到WEB端对应VM的NOTES中查看
#### 删除所有VM
- 删除所有VM
- 删除所有nat的端口映射
- 重启网络
- 删除log文件
```shell
for vmid in $(qm list | awk '{if(NR>1) print $1}'); do qm stop $vmid; qm destroy $vmid; rm -rf /var/lib/vz/images/$vmid*; done
iptables -t nat -F
iptables -t filter -F
service networking restart
systemctl restart networking.service
rm -rf vmlog
```
::tip
PVE修改VM配置前都得停机先再修改配置修改完再启动免得出现配置重载错误
::
### 开设独立IPV4地址的VM
::warning
使用前需要保证当前宿主机的IP段带了至少2个IP且有空余的IP未配置该空余的IP未绑定宿主机
开设前请使用screen挂起执行避免开设时间过长SSH不稳定导致中间执行中断
::
- 自动检测可用的IP区间通过ping检测空余可使用的IP选取其中之一绑定到虚拟机上
- 系统的相关信息将会存储到对应的虚拟机的NOTE中可在WEB端查看
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildvm_extraip.sh -o buildvm_extraip.sh && chmod +x buildvm_extraip.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildvm_extraip.sh -o buildvm_extraip.sh && chmod +x buildvm_extraip.sh
```
#### 创建示例
```shell
./buildvm_extraip.sh VMID 用户名 密码 CPU核数 内存大小以MB计算 硬盘大小以GB计算 系统 存储盘
```
```shell
./buildvm_extraip.sh 152 test1 1234567 1 1024 10 ubuntu20 local
```
上述命令意义为开设一个带独立IPV4地址的虚拟机VMID是152用户名是test1密码是1234567CPU是1核内存是1024MB硬盘是10G系统是Ubuntu20存储盘是local盘也就是系统盘
### 删除示例
```shell
qm stop 152
qm destroy 152
rm -rf vm152
```

120
docs/en_US/guide/pve_lxc.md Normal file
View File

@@ -0,0 +1,120 @@
## 单独开设LXC虚拟化的CT
::warning
初次使用前需要保证当前PVE纯净且宿主机未进行过任何端口映射否则设置冲突可能出现BUG
开设前请使用screen挂起执行避免批量开设时间过长SSH不稳定导致中间执行中断
::
- 自动开设NAT服务器默认使用Debian11镜像也可自定义系统
- 自动进行内外网端口映射含2280443端口以及其他25个内外网端口号一样的端口
- 生成后需要等待一段时间虚拟机内部配置好网络以及登陆信息大概需要3分钟
- 默认开设的网络配置为2280443端口及一个25个端口区间的内外网映射
- 可自定义开设的核心数,内存大小,硬盘大小,使用宿主机哪个存储盘,记得自己计算好空闲资源开设
- 可在命令中指定存储盘位置默认不指定时为local盘即系统盘可指定为PVE中显示的挂载盘
- 开设的CT默认已启用SSH且允许root登陆且已设置支持使用docker的嵌套虚拟化
- 容器的相关信息将会存储到对应的容器的NOTE中可在WEB端查看
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildct.sh -o buildct.sh && chmod +x buildct.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildct.sh -o buildct.sh && chmod +x buildct.sh
```
#### 使用方法
- 系统支持debian10debian11ubuntu18ubuntu20ubuntu22centos8almalinux9等
- 系统参数一律是小写的系统名字拼接版本号,具体可执行```pveam available --section system```查看可用的系统名字和版本号(注意脚本使用的参数只有小写的英文系统名字拼接版本号)
- 其他系统可能支持可能不支持,自行测试
- 默认用户名是root
```shell
./buildct.sh CTID 密码 CPU核数 内存 硬盘 SSH端口 80端口 443端口 外网端口起 外网端口止 系统 存储盘
```
#### 测试示例
* 以下为开设的示例CT的信息
`VMID` - 102
`SSH登录的用户名` - root
`SSH登录的密码` - 1234567
`CPU核数` - 1
`内存大小` - 512MB
`磁盘大小` - 5G
`SSH端口` - 20001
`80端口` - 20002
`443端口` - 20003
`内外网映射端口一致的区间` - 30000到30025
`系统` - debian11
`宿主机的存储盘` - local
```shell
./buildct.sh 102 1234567 1 512 5 20001 20002 20003 30000 30025 debian11 local
```
开设完毕可执行```cat ct102```查看信息或在web端的NOTES查看
#### 删除示例
- 停止CT
- 删除CT
- 删除端口映射
- 重启网络
- 删除log文件
```shell
pct stop 102
pct destroy 102
rm -rf ct102
iptables -t nat -F
iptables -t filter -F
service networking restart
systemctl restart networking.service
```
## 批量开设NAT的LXC虚拟化的CT
::warning
初次使用前需要保证当前PVE纯净且宿主机未进行过任何端口映射否则设置冲突可能出现BUG
开设前请使用screen挂起执行避免批量开设时间过长SSH不稳定导致中间执行中断
::
- 可多次运行批量生成CT容器但需要注意的是母鸡内存记得开点swap免得机器炸了[开SWAP点我跳转](https://github.com/spiritLHLS/addswap)
- 每个容器创建之间有间隔等待60秒避免突发性能不足
- 可自定义批量开设的核心数,内存大小,硬盘大小,使用宿主机哪个存储盘,记得自己计算好空闲资源开设
- 开设的CT默认已启用SSH且允许root登陆且已设置支持使用docker的嵌套虚拟化
- 容器的相关信息将会存储到对应的容器的NOTE中可在WEB端查看
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/create_ct.sh -o create_ct.sh && chmod +x create_ct.sh && bash create_ct.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/create_ct.sh -o create_ct.sh && chmod +x create_ct.sh && bash create_ct.sh
```
开设完毕可执行```cat ctlog```查看信息或在web端的NOTES查看
#### 删除所有CT
- 删除所有CT
- 删除所有nat的端口映射
- 重启网络
- 删除log文件
```shell
pct list | awk 'NR>1{print $1}' | xargs -I {} sh -c 'pct stop {}; pct destroy {}'
rm -rf ct*
iptables -t nat -F
iptables -t filter -F
service networking restart
systemctl restart networking.service
```

View File

@@ -0,0 +1,42 @@
# 系统要求与配置
## 各种要求
建议debian在使用前尽量使用最新的稳定版本的系统
非debian11可使用 [debian一键升级](https://github.com/spiritLHLS/one-click-installation-script#%E4%B8%80%E9%94%AE%E5%8D%87%E7%BA%A7%E4%BD%8E%E7%89%88%E6%9C%ACdebian%E4%B8%BAdebian11) 来升级系统
本项目只适配Debian系统(非Debian无法通过APT源安装官方只给了Debian的镜像其他系统只能使用ISO安装)
- 系统要求Debian 8+
::tip
建议debian11而不是debian12因为后者是beta版本debian11安装的才是稳定版
::
- 硬件要求2核2G内存x86_64架构服务器硬盘至少20G
::warning
内存开点swap免得机器炸了[开SWAP点我跳转](https://github.com/spiritLHLS/addswap)
::
- 可开KVM的硬件要求VM-X或AMD-V支持 (部分VPS和全部独服支持)
- 如果硬件或系统需求不满足可使用LXD批量开LXC容器[跳转](https://github.com/spiritLHLS/lxc)
**遇到选项不会选的可无脑回车安装本项目所有脚本内置国内外IP自动判断使用的是不同的安装源与配置文件有使用CDN加速镜像下载**
## 检测环境
- 本项目相关脚本执行前务必执行本脚本检测环境如果不符合安装PVE的要求则无法使用后续的脚本
- 检测硬件配置是否满足最低要求
- 检测硬件环境是否可嵌套虚拟化KVM类型的服务器
- 检测系统环境是否可嵌套虚拟化KVM类型的服务器
- 不可嵌套虚拟化KVM类型的服务器也可以开LXC虚拟化的服务器但不推荐安装PVE不如使用[LXD](https://github.com/spiritLHLS/lxc)
国际
```
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/check_kernal.sh)
```
国内
```
bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/check_kernal.sh)
```

View File

@@ -0,0 +1,23 @@
## 目前已验证的VPS商家
### 可开设KVM虚拟化的NAT的商家
[nocix](https://www.nocix.net/) 中的特价最低配15美元独服 (IPV6不自带需要找客服要)
[amhost](http://amhost.net/vps/?cid=29317) 中的测试款
[digitalocean](https://m.do.co/c/e9712622ee89) 中的 Perminu Intel 和 Regular 4核款
[skrime](https://hosting.skrime.eu/a/server) 中的 AMD Ryzen KVM Server 最低配款
[webdock](https://webdock.io/en?maff=wdaff--150) 中的 AMD KVM Server
[4vps](https://clck.ru/33VQmc) 中的 俄罗斯和希腊 测试款
[hostaris](https://deploy.hostaris.com/) 中的 德国款 (商家的系统模板有问题IPV6已失效和Github的连通稳定性很差)
### 只可开设LXC虚拟化的NAT的商家
[腾讯云](https://curl.qcloud.com/tPrMnfZm) 中的无忧款和特惠款(学生机)
[spectraip](https://my.spectraip.net/aff.php?aff=35) 中的KVM服务器

View File

@@ -0,0 +1,17 @@
## 致谢
https://blog.ilolicon.com/archives/615
https://github.com/Ella-Alinda/somescripts/blob/main/nat.sh
https://pve.proxmox.com/pve-docs/qm.1.html
https://down.idc.wiki/Image/realServer-Template/
https://mirrors.tuna.tsinghua.edu.cn/proxmox/
https://github.com/roacn/pve/blob/main/pve.sh
https://github.com/spiritLHLS/lxc
感谢 [@Ella-Alinda](https://github.com/Ella-Alinda) 提供的PVE指导

22
docs/en_US/index.md Normal file
View File

@@ -0,0 +1,22 @@
---
home: true
heroImage: https://raw.githubusercontent.com/spiritlhls/pages/main/logo.jpg
heroText: One Click Virtualization Project
tagline: Open source, easy to use server virtualization project
actionText: Learn More →
actionLink: /en_US/guide/dashboard
features:
- title: One-Click Installation
details: Support one-click script installation, easy to use; based on Debian, Ubuntu long-term maintenance version development, try to ensure that the host system and development environment consistent
- title: Comes with internal and external port forwarding
details: Support automatic intranet port forwarding, including TCP and UDP protocols
- title: Batch Virtualization
details: Support for KVM, LXC, Docker virtualization batch opening of virtual machines (containers)
- title: Self-limiting abuse
details: Partially virtualized containers/VMs have been masked and loaded with restrictions to avoid being used for abuse
footer: Copyright © 2022-present Nezhahq
---
Documentation has not been translated yet, waiting for translation.
<br/>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.

35
docs/guide/dashboard.md Normal file
View File

@@ -0,0 +1,35 @@
## 准备工作
需要虚拟化出服务器,你需要:
1. 一台可以连接公网的服务器( VPS 或 Dedicated Server),最好能完美访问 Github 的 RAW 页面,部分项目部分组件可能未使用 CDN 加速
::: tip
如果您位于中国大陆,访问 Github 有困难,请注意配套脚本和项目是否有说明已使用 CDN 加速
:::
2. 本地可以稳定连接SSH如果不能稳定连接请使用```screen```命令创建窗口后,在窗口内执行命令
::: tip
不会用screen命令的自行查找相关教程学习
:::
3. 确保服务器的系统和硬件满足对应项目的要求,详见对应项目说明
**本文档将以VPS作为范例且该VPS纯净无原生环境问题如有必要请重装系统保证初始环境的纯净**
:::warning
PVE项目可能造成宿主机出现问题如果你不会看Bug和修复系统那么不建议你在生产环境中使用使用PVE相关脚本请确保宿主机随时可重装系统
:::
<br/>
<br/>
## 项目仓库
欢迎Star和Fork
### PVE相关的各种一键脚本
[https://github.com/spiritLHLS/pve](https://github.com/spiritLHLS/pve)
### 通过LXD/LXC命令批量或单独开设NAT服务器以及维护
[https://github.com/spiritLHLS/lxc](https://github.com/spiritLHLS/lxc)
### 通过docker批量或单独开设NAT服务器
[https://github.com/spiritLHLS/docker](https://github.com/spiritLHLS/docker)

10
docs/guide/dashboardq.md Normal file
View File

@@ -0,0 +1,10 @@
Give me a cup of coffee.
https://ko-fi.com/spiritlhl
USDT-TRC20
```bash
TZ7nf8XAL9zQUo63xokazaBdCPeCgPfcwd
```

106
docs/guide/docker_build.md Normal file
View File

@@ -0,0 +1,106 @@
## 单独开设
下载脚本
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/onedocker.sh -o onedocker.sh && chmod +x onedocker.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/onedocker.sh -o onedocker.sh && chmod +x onedocker.sh
```
运行
```
./onedocker.sh name cpu memory password sshport startport endport system
```
目前system仅支持选择alpine或debian默认是debian
### 示例
* 以下为开设的示例容器的信息:
`容器名字` - test
`SSH登录的用户名` - root
`SSH登录的密码` - 123456
`CPU核数` - 1
`内存大小` - 512MB
`SSH端口` - 25000
`内外网映射端口一致的区间` - 34975到35000
`系统` - debian
```shell
./onedocker.sh test 1 512 123456 25000 34975 35000 debian
```
删除示例
```shell
docker rm -f test
rm -rf test
ls
```
进入示例
```shell
docker exec -it test /bin/bash
```
要退出容器就执行```exit```退出。
### 查询信息
```shell
cat 容器名字
```
输出格式
```
容器名字 SSH端口 登陆的root密码 核数 内存 外网端口起 外网端口止
```
## 批量开设
- 批量多次运行继承配置生成
- 生成多个时为避免SSH连接中断建议在screen中执行
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/dockers.sh -o dockers.sh && chmod +x dockers.sh && bash dockers.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/onedocker.sh -o onedocker.sh && chmod +x onedocker.sh
```
## 查询批量开设的信息
```shell
cat dclog
```
输出格式
```
容器名字 SSH端口 登陆的root密码 核数 内存 外网端口起 外网端口止
```
一行一个容器对应的信息
## 卸载所有docker容器和镜像
```shell
docker rm -f $(docker ps -aq); docker rmi $(docker images -aq)
rm -rf dclog
ls
```

View File

@@ -0,0 +1,17 @@
## 环境预设
- 检测环境
- 安装docker
- 下载预制脚本
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/pre_build.sh -o pre_build.sh && chmod +x pre_build.sh && bash pre_build.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/docker/main/scripts/pre_build.sh -o pre_build.sh && chmod +x pre_build.sh && bash pre_build.sh
```

View File

@@ -0,0 +1,21 @@
## 项目特点
通过docker批量或单独开设NAT服务器(Bulk or individual NAT server provisioning via docker)
默认使用debian系统每个容器自带1个外网ssh端口25个内外网一致端口
默认创建的是非特权容器且不挂载与宿主机的docker的守护进程之间的通信所以**宿主机创建的docker虚拟化的NAT服务器内无法再嵌套虚拟化docker**
由于只是在宿主机进行了CPU和内存的限制未在容器内使用cgroup驱动所以在容器内使用服务器测试脚本检测容器的可用资源是无效的显示的会是宿主机的资源
由于大部分云服务器xfs文件系统不启用pquota选项所以**默认共享宿主机硬盘,无法限制每个容器的磁盘大小**
## 配置要求
系统可安装docker即可用网络能连接Github的raw界面就能用硬件配置只要不拉跨就行空闲硬盘有3G就行
推荐在开设NAT服务器前先增加部分SWAP虚拟内存避免突发的内存占用导致母鸡卡死 [跳转](https://github.com/spiritLHLS/addswap)
PS: 如果硬件资源只是好了一点需要限制更多东西并需要配置IPV6独立地址和限制硬盘大小可使用LXD批量开LXC虚拟化的容器 [跳转](https://github.com/spiritLHLS/lxc)
PS: 如果硬件非常好资源很多可使用PVE批量开KVM虚拟化的虚拟机 [跳转](https://github.com/spiritLHLS/pve)

0
docs/guide/docker_qa.md Normal file
View File

View File

View File

@@ -0,0 +1,124 @@
::tip
以下的配置安装会加重母鸡的负担,非必要不要安装
如果是个人使用,可忽略防滥用部分脚本的安装
::
## 自动配置IPV6地址
- (***非必须***,不使用的也没问题)
- **该脚本仅适用于母鸡有给```IPV6```子网且是```/64```的,且母鸡绑定了子网的```第一个IP```做```母鸡的IPV6地址或IPV6的gateway```**
- 自动为LXD创建的LXC容器配置```IPV6```地址
- 已集成到```buildone.sh```中可使用变量控制且无需事先下载,该脚本可不手动使用,在使用```buildone.sh```时配置Y开启即可
下载脚本
国际
```bash
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/build_ipv6_network.sh -o build_ipv6_network.sh && chmod +x build_ipv6_network.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/build_ipv6_network.sh -o build_ipv6_network.sh && chmod +x build_ipv6_network.sh
```
自动为容器配置IPV6映射地址
```bash
bash build_ipv6_network.sh 容器名称
```
映射完毕会打印信息
示例(给test容器自动配置IPV6地址配置完成会写入一个test_v6的文件信息)
```bash
bash build_ipv6_network.sh test
```
删除所有IPV6已映射的规则
```bash
ip6tables -t nat -F PREROUTING
ip6tables-legacy -t nat -F PREROUTING
ip6tables-save > /etc/iptables/rules.v6
netfilter-persistent save
netfilter-persistent reload
service netfilter-persistent restart
```
卸载IPV6地址绑定的守护进程和对应的文件
```shell
systemctl stop add-ipv6.service
systemctl disable add-ipv6.service
rm /etc/systemd/system/add-ipv6.service
systemctl daemon-reload
rm /usr/local/bin/add-ipv6.sh
```
## 屏蔽容易被滥用的端口的出入流量以屏蔽端口和屏蔽滥用工具包
- (***非必须***,该脚本仅仅是为了防止容器滥用方便,不装的也没问题)
- 事前预防
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/rules.sh -o rules.sh && chmod +x rules.sh && bash rules.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/rules.sh -o rules.sh && chmod +x rules.sh && bash rules.sh
```
##### 使用screen配置监控屏蔽某些进程的执行遇到某些进程的出现直接关闭容器
- 如需停止监控可使用```screen```命令停止```lxc_moniter```这个名字的窗口并删除
- (***非必须***,该脚本仅仅是为了防止容器滥用方便,不装的也没问题)
- 事后停机
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/build_monitor.sh -o build_monitor.sh && chmod +x build_monitor.sh && bash build_monitor.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/build_monitor.sh -o build_monitor.sh && chmod +x build_monitor.sh && bash build_monitor.sh
```
##### 一键安装开lxd母鸡所需要的带vnstat环境的常用预配置环境
- (***非必须***,该脚本仅仅是为了站点对接监控方便,不装的也没问题)
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/backend.sh -o backend.sh && chmod +x backend.sh && bash backend.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/backend.sh -o backend.sh && chmod +x backend.sh && bash backend.sh
```
##### 一键安装母鸡可视化操作的面板
- (***非必须***,该面板只是为了方便可视化操作,没有也没问题)
- 原作者仓库:[跳转](https://github.com/turtle0x1/LxdMosaic)
```shell
lxc config set core.https_address [::]
lxc config set core.trust_password some-secret-string
snap install lxdmosaic
```
安装完毕后打开母鸡IP地址按照提示设置admin的密码其他一路默认就能使用面板了

104
docs/guide/lxd_install.md Normal file
View File

@@ -0,0 +1,104 @@
## 手动安装
新手推荐避免有bug不知道怎么修当然如果只是图方便又是老手懂排查BUG用后面的一键安装也行
### 关闭防火墙
```bash
apt update
apt install curl wget sudo dos2unix ufw jq -y
ufw disable
```
### 开设虚拟内存SWAP
内存看你开多少小鸡这里如果要开8个换算需要2G内存实际内存如果是512MB内存还需要开1.5G保守点开2G虚拟内存即可
执行下面命令输入1再输入2048代表开2G虚拟内存
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/swap.sh -o swap.sh && chmod +x swap.sh && bash swap.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/swap.sh -o swap.sh && chmod +x swap.sh && bash swap.sh
```
### 安装LXD
实际swap开的虚拟内存应该是实际内存的2倍也就是开1G是合理的上面我描述的情况属于超开了
```
apt install snapd -y
snap install lxd
/snap/bin/lxd init
```
如果上面的命令中出现下面的错误
(snap "lxd" assumes unsupported features: snapd2.39 (try to update snapd and refresh the core snap))
使用命令修补后再进行lxd的安装
```
snap install core
```
如果无异常,上面三行命令执行结果如下
![图片](https://user-images.githubusercontent.com/103393591/233270028-5a43d0f7-45f5-4175-969e-d4d182cb877a.png)
一般的选项回车默认即可
选择配置物理盘大小(提示默认最小1GB那个选项)一般我填空闲磁盘大小减去内存大小后乘以0.95并向下取整这里我填了10GB
提示带auto的更新image的选项记得选no避免更新占用系统
测试lxc有没有软连接上
```
lxc -h
```
如果报错则执行以下命令软连接lxc命令
```bash
! lxc -h >/dev/null 2>&1 && echo 'alias lxc="/snap/bin/lxc"' >> /root/.bashrc && source /root/.bashrc
export PATH=$PATH:/snap/bin
```
连接后再测试lxc命令是否有报错找不到
## 一键安装
::tip
如果是全新的服务器务必保证apt update和apt install curl都无问题再执行本脚本
且自开机起最好等待5分钟后再执行以下命令避免系统默认设置中就执行了本脚本导致apt源卡死
::
- 环境要求Ubuntu 18+(推荐)Debian 8+(仅限x86_64架构)
**如果是Debian系的宿主机务必在screen中执行本脚本避免长期运行时SSH中断导致ZFS编译安装失败**
这里的虚拟内存是说要开的SWAP大小存储池则是你所有要开的小鸡占的盘的大小的总和
环境安装过程中可能需要重启服务器再次执行以加载含zfs的内核一切以运行后命令行的提示为准
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/lxdinstall.sh -o lxdinstall.sh && chmod +x lxdinstall.sh && bash lxdinstall.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/lxdinstall.sh -o lxdinstall.sh && chmod +x lxdinstall.sh && bash lxdinstall.sh
```
例子:
如果系统盘除去已占用空间还有18G硬盘空余想开2G虚拟内存(2048MB的SWAP)15G的存储池按照命令行的提示则依次输入```2048```和```15```

218
docs/guide/lxd_lxc.md Normal file
View File

@@ -0,0 +1,218 @@
## 普通的批量版本
开出的小鸡配置:
- 1核256MB内存1GB硬盘限速250Mbps带宽
- 带1个SSH端口25个外网端口
- 默认内存和硬盘大小
::tip
lxc若命令无问题执行初始化开小鸡这一步最好放```screen```中后台挂起执行,开小鸡时长与你开几个和母鸡配置相关
::
执行下面命令加载开机脚本
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/init.sh -o init.sh && chmod +x init.sh && dos2unix init.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/init.sh -o init.sh && chmod +x init.sh && dos2unix init.sh
```
下面命令为开小鸡名字前缀为**tj**的**10**个小鸡
```shell
./init.sh tj 10
```
有时候init.sh的运行路径有问题此时建议前面加上sudo强制根目录执行
### 只有一个SSH端口的版本
开出的小鸡配置:
- 1核128MB内存300MB硬盘限速200Mbps带宽
- 只有一个SSH端口
- 无法挂载warp
::tip
lxc若命令无问题执行初始化开小鸡这一步最好放```screen```中后台挂起执行,开小鸡时长与你开几个和母鸡配置相关
::
加载开机脚本
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/least.sh -o least.sh && chmod +x least.sh && dos2unix least.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/least.sh -o least.sh && chmod +x least.sh && dos2unix least.sh
```
下列命令最后一行为开小鸡名字前缀为**tj**的**10**个小鸡
```shell
./least.sh tj 10
```
有时候least.sh的运行路径有问题此时建议前面加上sudo强制根目录执行
## 查看已批量开设的信息
开完小鸡后具体信息会生成在当前目录下的log文件中格式如下
```shell
1号服务器名称 密码 ssh端口 外网端口起始 外网端口终止
2号服务器名称 密码 ssh端口 外网端口起始 外网端口终止
```
如果想要查看只需在当前目录执行以下命令打印log文件即可
```shell
cat log
```
::warning
不要拿该脚本开出的小鸡当生产环境LXC虚拟化不支持换内核dd开启bbr等操作
::
## 部分常用LXD命令
查看所有
```bash
lxc list
```
查看个例
```bash
lxc info 服务器名字
```
启动个例
```bash
lxc start 服务器名字
```
停止个例
```bash
lxc stop 服务器名字
```
删除个例
```bash
lxc delete -f 服务器名字
```
进入内部
```bash
lxc exec 服务器名字 /bin/bash
```
退出则输入```exit```回车即可
删除所有LXC容器
```bash
lxc list | awk '{print $2}' | grep -v "^$" | xargs -I {} lxc delete -f {}
```
在容器内执行删除无用日志
```bash
sudo apt-get autoremove
sudo apt-get clean
sudo find /var/log -type f -delete
sudo find /var/tmp -type f -delete
sudo find /tmp -type f -delete
sudo find /var/cache/apt/archives -type f -delete
```
## 一键脚本老手推荐方便快捷
- 只生成一个NAT服务器可自定义限制所有内容
### 只开一个NAT服务器
#### 下载开机脚本
- (***非必须***如果你使用过一键安装LXD的命令自动已下载对应的开机脚本不用下载该脚本)
国际
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/buildone.sh -o buildone.sh && chmod +x buildone.sh && dos2unix buildone.sh
```
国内
```shell
curl -L https://ghproxy.com/https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/buildone.sh -o buildone.sh && chmod +x buildone.sh && dos2unix buildone.sh
```
##### 开NAT服务器
内存大小以MB计算硬盘大小以GB计算下载速度上传速度以Mbit计算是否启用IPV6不一定要填Y或者N没有这个参数也行
如果```外网起端口```和```外网止端口```都设置为0则不做区间外网端口映射了只映射基础的SSH端口注意```不能为空```不进行映射需要设置为0
支持自定义小鸡的系统,注意传入参数为系统名字+版本号debian11、ubuntu20centos8注意都是小写字母+数字的组合
```
./buildone.sh 小鸡名称 内存大小 硬盘大小 SSH端口 外网起端口 外网止端口 下载速度 上传速度 是否启用IPV6(Y or N) 系统(留空则为debian11)
```
示例
```
./buildone.sh test 256 2 20001 20002 20025 300 300 N
```
* 以下为开设的示例小鸡的信息:
`小鸡名字` - test
`SSH登录的用户名` - root
`SSH登录的密码` - 随机生成
`CPU核数` - 1
`内存大小` - 256MB
`磁盘大小` - 2G
`内外网映射端口一致的区间` - 20002到20025
`上传带宽` - 300Mbit
`下载带宽` - 300Mbit
`自动设置外网IPV6地址` - N
`系统` - debian11
需要查看信息则执行
```shell
cat 小鸡名字
```
比如查询示例的信息就是
```shell
cat test
```
如果已通过以上方法生成过小鸡,还需要批量生成小鸡,可使用手动安装部分的脚本,但注意先删除测试小鸡再进行批量生成小鸡
删除测试小鸡
```shell
lxc delete -f test
rm -rf test
ls
```

View File

@@ -0,0 +1,40 @@
## 配置要求
硬件要求:
- 系统Debian 8+, Ubuntu 18+(推荐),系统越新越好
- 虚拟化推荐KVM、VMWARE虚拟化
- 内存内存至少512MB
- 硬盘:硬盘(系统盘)至少10G
- 网络独立的IPV4地址IPV6可有可无带宽能下载脚本就行网络能连接Github的raw页面就行
PS: 如果硬件非常好资源很多可使用PVE批量开KVM虚拟化的虚拟机 [跳转](https://github.com/spiritLHLS/pve)
PS: 如果硬件资源更烂虚拟化不支持可使用docker版本的适配面更广 [跳转](https://github.com/spiritLHLS/docker)
## 项目特点
- 本套脚本开发使用的Ubuntu20Ubuntu别的长期维护版本应该也没问题Debian无法使用zfs时自动切换别的存储类型
- 已设置同时进行TCP和UDP转发除了SSH端口其他的映射内网外网端口一致
- 已设置支持开出的LXC容器进行docker嵌套虚拟默认普通版本和纯探针版本使用debian11系统
- 已屏蔽容器内可能用于滥用的工具包和IPV4网络的TCP/UDP协议的端口( 3389 8888 54321 65432 ),以防止容器被用于扫描和爆破,且可外置进程检查有问题自动停机
- 已支持一键为LXC容器配置IPV6地址(前提是母鸡有IPV6子网无IPV6地址则不配置)
- 一定要在 ```/root``` 的路径下运行本仓库脚本,且使用```一键脚本```的**不要删除**路径下的```ssh.sh```和```config.sh```文件
- 保证你要开的盘为默认的系统盘(sda或者sda1)而不是挂载的盘(sdb之类的),不确定的使用```fdisk -l```和```df```查看
- 挂载其他盘的详看 [其他说明](https://github.com/spiritLHLS/lxc/blob/main/README_other.md)
- 一键脚本支持自定义限制所有内容,普通版本支持多次运行批量生成不覆盖先前生成的配置
## 检测环境
**使用后续脚本的务必执行本命令检测母鸡是否符合要求**
```
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/lxc/main/scripts/pre_check.sh)
```

7
docs/guide/lxd_qa.md Normal file
View File

@@ -0,0 +1,7 @@
## 目前已验证可开带独立IPV6地址容器的VPS商家
[kuroit](https://my.kuroit.com/aff.php?aff=5) 中的 美国凤凰城 regular
[datalix](https://t.me/vps_reviews/338) 中的 德国AMD 促销款
[luxvps](https://billing.luxvps.xyz/aff.php?aff=36) 中的 德国AMD 促销款

19
docs/guide/lxd_thanks.md Normal file
View File

@@ -0,0 +1,19 @@
## 致谢
https://github.com/lxc/lxd
https://lxdware.com/
https://discuss.linuxcontainers.org/
https://discuss.linuxcontainers.org/t/how-to-run-docker-inside-lxc-container/13017/4
https://discuss.linuxcontainers.org/t/error-seccomp-notify-not-supported-on-container-start/15038/3
https://discuss.linuxcontainers.org/t/how-do-i-assign-a-public-ipv6-address-to-a-lxc-container/6028
https://github.com/turtle0x1/LxdMosaic
https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/index.html
感谢 [@Ella-Alinda](https://github.com/Ella-Alinda) [@fscarmen](https://github.com/fscarmen) 提供的指导

74
docs/guide/pve_install.md Normal file
View File

@@ -0,0 +1,74 @@
## 一键安装PVE
- 安装的是当下apt源最新的PVE
- 比如debian10则是pve6.4debian11则是pve7.xdebian12则是pve8.x
::tip
建议debian11而不是debian12因为后者是beta版本debian11安装的才是稳定版
::
- /etc/hosts文件修改(修正商家hostname设置错误以及新增PVE所需的内容)
- 已设置```/etc/hosts```为只读模式,避免重启后文件被覆写,如需修改请使用```chattr -i /etc/hosts```取消只读锁定,修改完毕请执行```chattr +i /etc/hosts```只读锁定
- 检测```/etc/cloud/cloud.cfg```如果发现```preserve_hostname```是```false```,则改为```true```同上也用chattr命令进行了文件锁定避免重启覆盖设置
- 检测是否为中国IP如果为中国IP使用清华镜像源否则使用官方源
- 安装PVE开虚拟机需要的必备工具包
- 替换apt源中的企业订阅为社区源
- 打印查询Linux系统内核和PVE内核是否已安装
- 检测```/etc/resolv.conf```是否为空,为空则设置检测```8.8.8.8```的开机自启添加DNS的systemd服务
- 新增PVE的APT源链接后下载PVE并打印输出登陆信息
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/install_pve.sh -o install_pve.sh && chmod +x install_pve.sh && bash install_pve.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/install_pve.sh -o install_pve.sh && chmod +x install_pve.sh && bash install_pve.sh
```
## 预配置环境
- 创建资源池mypool
- 移除订阅弹窗
- 尝试开启硬件直通
- 检测AppArmor模块并试图安装
- 重启系统前推荐挂上[nezha探针](https://github.com/naiba/nezha)方便在后台不通过SSH使用命令行避免SSH可能因为商家奇葩的预设导致重启后root密码丢失
- **执行完毕建议等待几分钟后再重启服务器**,执行```reboot```前需要等待后台任务执行完毕一些宿主机的系统apt命令执行很慢得等一会才能执行完毕
国际
```shell
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/build_backend.sh)
```
国内
```shell
bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/build_backend.sh)
```
### 自动配置宿主机的网关
::warning
使用前请保证重启过服务器且此时PVE能正常使用WEB端再执行重启机器后不要立即执行此命令待WEB端启动成功后至少等5分钟再执行本命令
这一步是最容易造成SSH断开的原因是未等待PVE内核启动就修改网络会造成设置冲突所以至少等几分钟待内核启动也就是WEB端启动成功后再执行
::
- 创建vmbr0母鸡允许addr和gateway为内网IP或外网IP已自动识别
- vmbr0创建支持纯IPV4或双栈服务器自动识别IPV4地址和IPV6地址自动识别对应的IP区间
- 创建vmbr1(NAT网关)
- 开NAT虚拟机时网关IPV4使用```172.16.1.1```IPV4/CIDR使用```172.16.1.x/24```这里的x不能是1当然如果后续使用本套脚本无需关注这点细枝末节的东西
- 想查看完整设置可以执行```cat /etc/network/interfaces```查看
- 加载iptables并设置回源且允许NAT端口转发
国际
```shell
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/build_nat_network.sh)
```
国内
```shell
bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/build_nat_network.sh)
```

196
docs/guide/pve_kvm.md Normal file
View File

@@ -0,0 +1,196 @@
## 部分注意事项
**执行本项目的第一个检测环境的命令**,展示如下
<br/>
![coode](/images/pve_kvm/pve_kvm_1.png)
<br/>
查询如上的只需使用下面的一键脚本自动创建虚拟机即可无需手动再修改WEB端设置
<br/>
![coode](/images/pve_kvm/pve_kvm_2.png)
<br/>
查询如上的在使用后续脚本创建了虚拟机后,**可能**需要手动修改WEB端设置需要关闭对应每个虚拟机的硬件嵌套虚拟化如下图
<br/>
![coode](/images/pve_kvm/pve_kvm_3.png)
<br/>
先停止虚拟机再修改修改完后再开机才能使用NOVNC不关闭**可能**导致这个虚拟机有BUG无法使用
如果强行安装PVE开KVM启动不了的也可以关闭这个选项试试能不能启动虚拟机
### 单独开设KVM虚拟化的VM
- 自动开设NAT服务器默认使用Debian10镜像因为该镜像占用最小
- 可在命令中自定义需要使用的镜像这里有给出配置好的镜像镜像自带空间设置是2~10G硬盘日常使用**至少10G以上**即可,除非某些镜像开不起来再增加硬盘大小
- 可在命令中指定存储盘位置默认不指定时为local盘即系统盘可指定为PVE中显示的挂载盘
- 自定义内存大小推荐512MB内存
::tip
需要注意的是宿主机内存记得开点swap免得机器炸了[开SWAP点我跳转](https://github.com/spiritLHLS/addswap)
::
- 自动进行内外网端口映射含2280443端口以及其他25个内外网端口号一样的端口
- 生成后需要等待一段时间虚拟机内部的cloud-init配置好网络以及登陆信息大概需要5分钟
- 虚拟机的相关信息将会存储到WEB端对应VM的NOTES中可在WEB端查看
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildvm.sh -o buildvm.sh && chmod +x buildvm.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildvm.sh -o buildvm.sh && chmod +x buildvm.sh
```
#### 使用方法
- 系统支持:详见 [跳转](https://github.com/spiritLHLS/Images/releases/tag/v1.0) 中列出的系统,使用时只需写文件名字,不需要.qcow2尾缀
::tip
注意这里的用户名不能是纯数字会造成cloudinit出问题最好是纯英文或英文开头
::
```shell
./buildvm.sh VMID 用户名 密码 CPU核数 内存 硬盘 SSH端口 80端口 443端口 外网端口起 外网端口止 系统 存储盘
```
#### 测试示例
* 以下为开设的示例VM的信息
`VMID` - 102
`SSH登录的用户名` - test1
`SSH登录的密码` - 1234567
`CPU核数` - 1
`内存大小` - 512MB
`磁盘大小` - 10G
`SSH端口` - 40001
`80端口` - 40002
`443端口` - 40003
`内外网映射端口一致的区间` - 50000到50025
`系统` - ubuntu20
`宿主机的存储盘` - local
```shell
./buildvm.sh 102 test1 1234567 1 512 10 40001 40002 40003 50000 50025 ubuntu20 local
```
开设完毕可执行```cat vm102```查看信息或到WEB端对应VM的NOTES中查看
#### 删除示例
- 停止VM
- 删除VM
- 删除端口映射
- 重启网络
- 删除log文件
```shell
qm stop 102
qm destroy 102
iptables -t nat -F
iptables -t filter -F
service networking restart
systemctl restart networking.service
rm -rf vm102
```
#### 相关qcow2镜像
- 已预安装开启cloudinit开启SSH登陆预设值SSH监听V4和V6的22端口开启允许密码验证登陆开启允许ROOT登陆
目前使用的镜像列表为
[https://github.com/spiritLHLS/Images/releases/tag/v1.0](https://github.com/spiritLHLS/Images/releases/tag/v1.0)
### 批量开设NAT的KVM虚拟化的VM
::warning
初次使用前需要保证当前PVE纯净且宿主机未进行过任何端口映射否则设置冲突可能出现BUG
开设前请使用screen挂起执行避免批量开设时间过长SSH不稳定导致中间执行中断
::
- 可多次运行批量生成VM
- 自动开设NAT服务器选项留空默认使用debian11镜像可自定义使用镜像名字支持的系统名字详见上文支持的镜像列表
- 自动进行内外网端口映射含2280443端口以及其他25个内外网端口号一样的端口
- 生成后需要等待一段时间虚拟机内部的cloudinit配置好网络以及登陆信息大概需要5分钟每个虚拟机创建之间有间隔等待60秒避免突发性能不足
- 默认批量开设的虚拟机网络配置为2280443端口及一个25个端口区间的内外网映射
- 可自定义批量开设的核心数,内存大小,硬盘大小,使用宿主机哪个存储盘,记得自己计算好空闲资源开设
- 虚拟机的相关信息将会存储到WEB端对应VM的NOTES中可在WEB端查看
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/create_vm.sh -o create_vm.sh && chmod +x create_vm.sh && bash create_vm.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/create_vm.sh -o create_vm.sh && chmod +x create_vm.sh && bash create_vm.sh
```
开设完毕可执行```cat vmlog```查看信息或到WEB端对应VM的NOTES中查看
#### 删除所有VM
- 删除所有VM
- 删除所有nat的端口映射
- 重启网络
- 删除log文件
```shell
for vmid in $(qm list | awk '{if(NR>1) print $1}'); do qm stop $vmid; qm destroy $vmid; rm -rf /var/lib/vz/images/$vmid*; done
iptables -t nat -F
iptables -t filter -F
service networking restart
systemctl restart networking.service
rm -rf vmlog
```
::tip
PVE修改VM配置前都得停机先再修改配置修改完再启动免得出现配置重载错误
::
### 开设独立IPV4地址的VM
::warning
使用前需要保证当前宿主机的IP段带了至少2个IP且有空余的IP未配置该空余的IP未绑定宿主机
开设前请使用screen挂起执行避免开设时间过长SSH不稳定导致中间执行中断
::
- 自动检测可用的IP区间通过ping检测空余可使用的IP选取其中之一绑定到虚拟机上
- 系统的相关信息将会存储到对应的虚拟机的NOTE中可在WEB端查看
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildvm_extraip.sh -o buildvm_extraip.sh && chmod +x buildvm_extraip.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildvm_extraip.sh -o buildvm_extraip.sh && chmod +x buildvm_extraip.sh
```
#### 创建示例
```shell
./buildvm_extraip.sh VMID 用户名 密码 CPU核数 内存大小以MB计算 硬盘大小以GB计算 系统 存储盘
```
```shell
./buildvm_extraip.sh 152 test1 1234567 1 1024 10 ubuntu20 local
```
上述命令意义为开设一个带独立IPV4地址的虚拟机VMID是152用户名是test1密码是1234567CPU是1核内存是1024MB硬盘是10G系统是Ubuntu20存储盘是local盘也就是系统盘
### 删除示例
```shell
qm stop 152
qm destroy 152
rm -rf vm152
```

120
docs/guide/pve_lxc.md Normal file
View File

@@ -0,0 +1,120 @@
## 单独开设LXC虚拟化的CT
::warning
初次使用前需要保证当前PVE纯净且宿主机未进行过任何端口映射否则设置冲突可能出现BUG
开设前请使用screen挂起执行避免批量开设时间过长SSH不稳定导致中间执行中断
::
- 自动开设NAT服务器默认使用Debian11镜像也可自定义系统
- 自动进行内外网端口映射含2280443端口以及其他25个内外网端口号一样的端口
- 生成后需要等待一段时间虚拟机内部配置好网络以及登陆信息大概需要3分钟
- 默认开设的网络配置为2280443端口及一个25个端口区间的内外网映射
- 可自定义开设的核心数,内存大小,硬盘大小,使用宿主机哪个存储盘,记得自己计算好空闲资源开设
- 可在命令中指定存储盘位置默认不指定时为local盘即系统盘可指定为PVE中显示的挂载盘
- 开设的CT默认已启用SSH且允许root登陆且已设置支持使用docker的嵌套虚拟化
- 容器的相关信息将会存储到对应的容器的NOTE中可在WEB端查看
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildct.sh -o buildct.sh && chmod +x buildct.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildct.sh -o buildct.sh && chmod +x buildct.sh
```
#### 使用方法
- 系统支持debian10debian11ubuntu18ubuntu20ubuntu22centos8almalinux9等
- 系统参数一律是小写的系统名字拼接版本号,具体可执行```pveam available --section system```查看可用的系统名字和版本号(注意脚本使用的参数只有小写的英文系统名字拼接版本号)
- 其他系统可能支持可能不支持,自行测试
- 默认用户名是root
```shell
./buildct.sh CTID 密码 CPU核数 内存 硬盘 SSH端口 80端口 443端口 外网端口起 外网端口止 系统 存储盘
```
#### 测试示例
* 以下为开设的示例CT的信息
`VMID` - 102
`SSH登录的用户名` - root
`SSH登录的密码` - 1234567
`CPU核数` - 1
`内存大小` - 512MB
`磁盘大小` - 5G
`SSH端口` - 20001
`80端口` - 20002
`443端口` - 20003
`内外网映射端口一致的区间` - 30000到30025
`系统` - debian11
`宿主机的存储盘` - local
```shell
./buildct.sh 102 1234567 1 512 5 20001 20002 20003 30000 30025 debian11 local
```
开设完毕可执行```cat ct102```查看信息或在web端的NOTES查看
#### 删除示例
- 停止CT
- 删除CT
- 删除端口映射
- 重启网络
- 删除log文件
```shell
pct stop 102
pct destroy 102
rm -rf ct102
iptables -t nat -F
iptables -t filter -F
service networking restart
systemctl restart networking.service
```
## 批量开设NAT的LXC虚拟化的CT
::warning
初次使用前需要保证当前PVE纯净且宿主机未进行过任何端口映射否则设置冲突可能出现BUG
开设前请使用screen挂起执行避免批量开设时间过长SSH不稳定导致中间执行中断
::
- 可多次运行批量生成CT容器但需要注意的是母鸡内存记得开点swap免得机器炸了[开SWAP点我跳转](https://github.com/spiritLHLS/addswap)
- 每个容器创建之间有间隔等待60秒避免突发性能不足
- 可自定义批量开设的核心数,内存大小,硬盘大小,使用宿主机哪个存储盘,记得自己计算好空闲资源开设
- 开设的CT默认已启用SSH且允许root登陆且已设置支持使用docker的嵌套虚拟化
- 容器的相关信息将会存储到对应的容器的NOTE中可在WEB端查看
国际
```shell
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/create_ct.sh -o create_ct.sh && chmod +x create_ct.sh && bash create_ct.sh
```
国内
```shell
curl -L https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/create_ct.sh -o create_ct.sh && chmod +x create_ct.sh && bash create_ct.sh
```
开设完毕可执行```cat ctlog```查看信息或在web端的NOTES查看
#### 删除所有CT
- 删除所有CT
- 删除所有nat的端口映射
- 重启网络
- 删除log文件
```shell
pct list | awk 'NR>1{print $1}' | xargs -I {} sh -c 'pct stop {}; pct destroy {}'
rm -rf ct*
iptables -t nat -F
iptables -t filter -F
service networking restart
systemctl restart networking.service
```

View File

@@ -0,0 +1,42 @@
# 系统要求与配置
## 各种要求
建议debian在使用前尽量使用最新的稳定版本的系统
非debian11可使用 [debian一键升级](https://github.com/spiritLHLS/one-click-installation-script#%E4%B8%80%E9%94%AE%E5%8D%87%E7%BA%A7%E4%BD%8E%E7%89%88%E6%9C%ACdebian%E4%B8%BAdebian11) 来升级系统
本项目只适配Debian系统(非Debian无法通过APT源安装官方只给了Debian的镜像其他系统只能使用ISO安装)
- 系统要求Debian 8+
::tip
建议debian11而不是debian12因为后者是beta版本debian11安装的才是稳定版
::
- 硬件要求2核2G内存x86_64架构服务器硬盘至少20G
::warning
内存开点swap免得机器炸了[开SWAP点我跳转](https://github.com/spiritLHLS/addswap)
::
- 可开KVM的硬件要求VM-X或AMD-V支持 (部分VPS和全部独服支持)
- 如果硬件或系统需求不满足可使用LXD批量开LXC容器[跳转](https://github.com/spiritLHLS/lxc)
**遇到选项不会选的可无脑回车安装本项目所有脚本内置国内外IP自动判断使用的是不同的安装源与配置文件有使用CDN加速镜像下载**
## 检测环境
- 本项目相关脚本执行前务必执行本脚本检测环境如果不符合安装PVE的要求则无法使用后续的脚本
- 检测硬件配置是否满足最低要求
- 检测硬件环境是否可嵌套虚拟化KVM类型的服务器
- 检测系统环境是否可嵌套虚拟化KVM类型的服务器
- 不可嵌套虚拟化KVM类型的服务器也可以开LXC虚拟化的服务器但不推荐安装PVE不如使用[LXD](https://github.com/spiritLHLS/lxc)
国际
```
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/check_kernal.sh)
```
国内
```
bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/check_kernal.sh)
```

23
docs/guide/pve_qa.md Normal file
View File

@@ -0,0 +1,23 @@
## 目前已验证的VPS商家
### 可开设KVM虚拟化的NAT的商家
[nocix](https://www.nocix.net/) 中的特价最低配15美元独服 (IPV6不自带需要找客服要)
[amhost](http://amhost.net/vps/?cid=29317) 中的测试款
[digitalocean](https://m.do.co/c/e9712622ee89) 中的 Perminu Intel 和 Regular 4核款
[skrime](https://hosting.skrime.eu/a/server) 中的 AMD Ryzen KVM Server 最低配款
[webdock](https://webdock.io/en?maff=wdaff--150) 中的 AMD KVM Server
[4vps](https://clck.ru/33VQmc) 中的 俄罗斯和希腊 测试款
[hostaris](https://deploy.hostaris.com/) 中的 德国款 (商家的系统模板有问题IPV6已失效和Github的连通稳定性很差)
### 只可开设LXC虚拟化的NAT的商家
[腾讯云](https://curl.qcloud.com/tPrMnfZm) 中的无忧款和特惠款(学生机)
[spectraip](https://my.spectraip.net/aff.php?aff=35) 中的KVM服务器

17
docs/guide/pve_thanks.md Normal file
View File

@@ -0,0 +1,17 @@
## 致谢
https://blog.ilolicon.com/archives/615
https://github.com/Ella-Alinda/somescripts/blob/main/nat.sh
https://pve.proxmox.com/pve-docs/qm.1.html
https://down.idc.wiki/Image/realServer-Template/
https://mirrors.tuna.tsinghua.edu.cn/proxmox/
https://github.com/roacn/pve/blob/main/pve.sh
https://github.com/spiritLHLS/lxc
感谢 [@Ella-Alinda](https://github.com/Ella-Alinda) 提供的PVE指导

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

19
docs/index.md Normal file
View File

@@ -0,0 +1,19 @@
---
home: true
heroImage: https://raw.githubusercontent.com/spiritlhls/pages/main/logo.jpg
heroText: 一键虚拟化项目
tagline: 开源、易于使用的服务器虚拟化项目
actionText: 开始使用 →
actionLink: /guide/dashboard
features:
- title: 一键安装
details: 支持一键脚本安装,轻松使用;基于 Debian、Ubuntu 的长期维护版本开发,尽量保证宿主机系统与开发环境一致
- title: 自带内外网端口转发
details: 支持自动的内网端口转发含TCP、UDP协议
- title: 批量虚拟化
details: 支持 KVM、LXC、Docker 虚拟化批量开设虚拟机(容器)
- title: 自限制滥用
details: 部分虚拟化开设的容器/虚拟机已屏蔽和装载限制,避免被用于滥用
footer: Copyright © 2023-present oneclickvirt
---
<br />本项目采用 <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a> 进行许可。

4
docs/package.json Normal file
View File

@@ -0,0 +1,4 @@
{
"private": true,
"name": "vitepress-docs"
}

3
docs/public/_headers Normal file
View File

@@ -0,0 +1,3 @@
/assets/*
cache-control: max-age=31536000
cache-control: immutable

View File

@@ -0,0 +1,7 @@
// #region snippet
function foo() {
// ..
}
// #endregion snippet
export default foo

3
docs/snippets/snippet.js Normal file
View File

@@ -0,0 +1,3 @@
export default function () {
// ..
}

1858
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

26
package.json Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "nezhahq.github.io",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"doc": "docs"
},
"scripts": {
"dev": "vitepress dev docs",
"build": "vitepress build docs"
},
"repository": {
"type": "git",
"url": "git+https://github.com/oneclickvirt/oneclickvirt.github.io.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/oneclickvirt/oneclickvirt.github.io/issues"
},
"homepage": "https://github.com/oneclickvirt/oneclickvirt.github.io#readme",
"devDependencies": {
"vitepress": "^0.22.4"
}
}