mirror of
https://github.com/oneclickvirt/oneclickvirt.github.io.git
synced 2026-06-02 08:41:49 +08:00
feat: 添加Inucs一键开设QEMU虚拟机的命令
This commit is contained in:
@@ -146,10 +146,11 @@ function getGuideSidebarZhCN() {
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'incus',
|
||||
text: 'Incus',
|
||||
items: [
|
||||
{ text: '系统和硬件配置要求', link: '/guide/incus/incus_precheck.html' },
|
||||
{ text: 'incus主体安装', link: '/guide/incus/incus_install.html' },
|
||||
{ text: 'Incus主体安装', link: '/guide/incus/incus_install.html' },
|
||||
{ text: 'Linux虚拟机(QEMU)', link: '/guide/incus/incus_qemu.html' },
|
||||
{ text: 'Linux容器(LXC)', link: '/guide/incus/incus_lxc.html' },
|
||||
{ text: 'Windows虚拟机(QEMU)', link: '/guide/incus/incus_windows.html' },
|
||||
{ text: '更多配置', link: '/guide/incus/incus_extra_config.html' },
|
||||
@@ -275,10 +276,10 @@ function getGuideSidebarEnUS() {
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'incus',
|
||||
text: 'Incus',
|
||||
items: [
|
||||
{ text: 'Configuration requirements', link: '/en/guide/incus/incus_precheck.html' },
|
||||
{ text: 'incus main installation', link: '/en/guide/incus/incus_install.html' },
|
||||
{ text: 'Incus main installation', link: '/en/guide/incus/incus_install.html' },
|
||||
{ text: 'Linux Container(LXC)', link: '/en/guide/incus/incus_lxc.html' },
|
||||
{ text: 'Windows Virtual Machine(QEMU)', link: '/en/guide/incus/incus_windows.html' },
|
||||
{ text: 'Extra configuration', link: '/en/guide/incus/incus_extra_config.html' },
|
||||
|
||||
@@ -27,9 +27,9 @@ A portion of the available system parameters are shown here for your reference:
|
||||
The version number has ended the long-term maintenance of the general no longer have an official mirror, temporarily did not find the archive address of the historical mirror, if you find welcome to leave a message I will add support!
|
||||
:::
|
||||
|
||||
## Generate only one NAT server
|
||||
## Generate only one NAT container
|
||||
|
||||
- Generate only one NAT server, with customizable restrictions on all content.
|
||||
- Generate only one NAT container, with customizable restrictions on all content.
|
||||
|
||||
### Download script
|
||||
|
||||
@@ -51,7 +51,7 @@ Memory size is calculated in MB, hard disk size is calculated in GB, download sp
|
||||
|
||||
If ```external start port`` and ```external stop port`` are both set to 0, then we don't do interval port mapping, only the basic SSH port is mapped, note that ```can't be null``, and it needs to be set to 0 if it's not to be mapped.
|
||||
|
||||
Support custom server system, do not fill in the leave blank default use debian11, pay attention to the incoming parameters for the system name + version number
|
||||
Support custom container system, do not fill in the leave blank default use debian11, pay attention to the incoming parameters for the system name + version number
|
||||
|
||||
### Example
|
||||
|
||||
@@ -59,7 +59,7 @@ Here is the information about the example chick that is being raised:
|
||||
|
||||
| Attribute | Value |
|
||||
|-----------------------------|-----------------|
|
||||
| server's Name | test |
|
||||
| container's Name | test |
|
||||
| Username for SSH Login | root |
|
||||
| Password for SSH Login | Randomly generated |
|
||||
| Number of CPU Cores | 1 |
|
||||
@@ -108,7 +108,7 @@ Opened Chick Configuration:
|
||||
- Default memory and hard disk size
|
||||
|
||||
:::tip
|
||||
incus if the command is no problem, the execution of the initialization of the opening of the servers, this step is best to put ```screen`` in the background to suspend the execution of the opening of the servers, the length of time with you to open a few and the mother hen configuration-related
|
||||
incus if the command is no problem, the execution of the initialization of the opening of the containers, this step is best to put ```screen`` in the background to suspend the execution of the opening of the containers, the length of time with you to open a few and the mother hen configuration-related
|
||||
:::
|
||||
|
||||
Execute the following command to load the boot script
|
||||
@@ -160,7 +160,7 @@ Sometimes there is a problem with the path where last.sh is run, in this case it
|
||||
- Customizable memory and hard disk sizes
|
||||
- It's also fine if you have manually executed the above batch generation before; the configuration inherits without overwriting
|
||||
|
||||
If you need to batch-generate servers multiple times, you can use the following:
|
||||
If you need to batch-generate containers multiple times, you can use the following:
|
||||
|
||||
Command:
|
||||
|
||||
@@ -175,8 +175,8 @@ Can be run multiple times to batch generate chicks, and inherit the previous par
|
||||
After opening the chicks, the specific information will be generated in the log file in the current directory, with the following format
|
||||
|
||||
```shell
|
||||
Server_1_Name Password SSH_Port Public_Port_Start Public_Port_End
|
||||
Server_2_Name Password SSH_Port Public_Port_Start Public_Port_End
|
||||
container_1_Name Password SSH_Port Public_Port_Start Public_Port_End
|
||||
container_2_Name Password SSH_Port Public_Port_Start Public_Port_End
|
||||
```
|
||||
|
||||
To view it, simply print the log file by executing the following command in the current directory
|
||||
|
||||
@@ -4,9 +4,9 @@ outline: deep
|
||||
|
||||
# LXC virtualization
|
||||
|
||||
## Generate only one NAT server
|
||||
## Generate only one NAT container
|
||||
|
||||
- Generate only one NAT server, with customizable restrictions on all content.
|
||||
- Generate only one NAT container, with customizable restrictions on all content.
|
||||
|
||||
Downloading the boot script is **NOT REQUIRED**, if you have used the command to install LXD with one click, the corresponding boot script will be downloaded automatically, so you don't need to download the script again.
|
||||
|
||||
@@ -26,7 +26,7 @@ Memory size is calculated in MB, hard disk size is calculated in GB, download sp
|
||||
|
||||
If ```external start port`` and ```external stop port`` are both set to 0, then we don't do interval port mapping, only the basic SSH port is mapped, note that ```can't be null``, and it needs to be set to 0 if it's not to be mapped.
|
||||
|
||||
Support for customizing the system of the server, do not fill out the default use of debian12 when left blank, note that the incoming parameters for the system name + version number, such as:
|
||||
Support for customizing the system of the container, do not fill out the default use of debian12 when left blank, note that the incoming parameters for the system name + version number, such as:
|
||||
|
||||
- debian12, debian13
|
||||
- ubuntu22, ubuntu24
|
||||
@@ -46,7 +46,7 @@ Here is the information about the example chick that is being raised:
|
||||
|
||||
| Attribute | Value |
|
||||
|-----------------------------|-----------------|
|
||||
| server's Name | test |
|
||||
| container's Name | test |
|
||||
| Username for SSH Login | root |
|
||||
| Password for SSH Login | Randomly generated |
|
||||
| Number of CPU Cores | 1 |
|
||||
@@ -95,7 +95,7 @@ Opened Chick Configuration:
|
||||
- Default memory and hard disk size
|
||||
|
||||
:::tip
|
||||
lxc if the command is no problem, the execution of the initialization of the opening of the servers, this step is best to put ```screen`` in the background to suspend the execution of the opening of the servers, the length of time with you to open a few and the mother hen configuration-related
|
||||
lxc if the command is no problem, the execution of the initialization of the opening of the containers, this step is best to put ```screen`` in the background to suspend the execution of the opening of the containers, the length of time with you to open a few and the mother hen configuration-related
|
||||
:::
|
||||
|
||||
Execute the following command to load the boot script
|
||||
@@ -147,7 +147,7 @@ Sometimes there is a problem with the path where last.sh is run, in this case it
|
||||
- Customizable memory and hard disk sizes
|
||||
- It's also fine if you have manually executed the above batch generation before; the configuration inherits without overwriting
|
||||
|
||||
If you need to batch-generate servers multiple times, you can use the following:
|
||||
If you need to batch-generate containers multiple times, you can use the following:
|
||||
|
||||
Command:
|
||||
|
||||
@@ -162,8 +162,8 @@ Can be run multiple times to batch generate chicks, and inherit the previous par
|
||||
After opening the chicks, the specific information will be generated in the log file in the current directory, with the following format
|
||||
|
||||
```shell
|
||||
Server_1_Name Password SSH_Port Public_Port_Start Public_Port_End
|
||||
Server_2_Name Password SSH_Port Public_Port_Start Public_Port_End
|
||||
container_1_Name Password SSH_Port Public_Port_Start Public_Port_End
|
||||
container_2_Name Password SSH_Port Public_Port_Start Public_Port_End
|
||||
```
|
||||
|
||||
To view it, simply print the log file by executing the following command in the current directory
|
||||
|
||||
@@ -23,9 +23,9 @@ outline: deep
|
||||
* 目前使用的容器系统有三重筛选,优先级:[自编译](https://github.com/oneclickvirt/incus_images)、[官方](https://images.linuxcontainers.org/)、[opsmaru](https://images.opsmaru.com/)
|
||||
* 自编译镜像完整的支持系统的列表:[x86_64_all_images.txt](https://github.com/oneclickvirt/incus_images/blob/main/x86_64_all_images.txt) 和 [arm64_all_images.txt](https://github.com/oneclickvirt/incus_images/blob/main/arm64_all_images.txt)
|
||||
|
||||
## 单独生成一个NAT服务器
|
||||
## 单独生成一个NAT容器
|
||||
|
||||
- 只生成一个NAT服务器,可自定义限制所有内容
|
||||
- 只生成一个NAT容器,可自定义限制所有内容
|
||||
|
||||
### 下载脚本
|
||||
|
||||
@@ -46,22 +46,22 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
|
||||
### 使用方法
|
||||
|
||||
```
|
||||
./buildct.sh 服务器名称 CPU核数 内存大小 硬盘大小 SSH端口 外网起端口 外网止端口 下载速度 上传速度 是否启用IPV6(Y or N) 系统(留空则为debian11)
|
||||
./buildct.sh 容器名称 CPU核数 内存大小 硬盘大小 SSH端口 外网起端口 外网止端口 下载速度 上传速度 是否启用IPV6(Y or N) 系统(留空则为debian11)
|
||||
```
|
||||
|
||||
CPU核数需要小于或等于宿主机的核数,内存大小以MB计算,硬盘大小以GB计算,下载速度上传速度以Mbit计算,是否启用IPV6不一定要填Y或者N,没有这个参数也行,留空默认不开启IPV6
|
||||
|
||||
如果```外网起端口```和```外网止端口```都设置为0则不做区间外网端口映射了,只映射基础的SSH端口,注意```不能为空```,不进行映射需要设置为0
|
||||
|
||||
支持自定义服务器的系统,不填写留空时默认使用debian11,注意传入参数为系统名字+版本号
|
||||
支持自定义容器的系统,不填写留空时默认使用debian11,注意传入参数为系统名字+版本号
|
||||
|
||||
### 示例
|
||||
|
||||
以下为开设的示例服务器的信息:
|
||||
以下为开设的示例容器的信息:
|
||||
|
||||
| 属性 | 值 |
|
||||
|---------------------------|----------------|
|
||||
| 服务器名字 | test |
|
||||
| 容器名字 | test |
|
||||
| SSH登录的用户名 | root |
|
||||
| SSH登录的密码 | 随机生成 |
|
||||
| CPU核数 | 1 |
|
||||
@@ -88,7 +88,7 @@ incus exec test /bin/bash
|
||||
需要查看信息则执行
|
||||
|
||||
```shell
|
||||
cat 服务器名字
|
||||
cat 容器名字
|
||||
```
|
||||
|
||||
比如查询示例的信息就是
|
||||
@@ -97,9 +97,9 @@ cat 服务器名字
|
||||
cat test
|
||||
```
|
||||
|
||||
如果已通过以上方法生成过服务器,还需要批量生成服务器,可使用自定义批量生成版本的脚本,但注意先删除测试服务器再进行批量生成服务器
|
||||
如果已通过以上方法生成过容器,还需要批量生成容器,可使用自定义批量生成版本的脚本,但注意先删除测试容器再进行批量生成容器
|
||||
|
||||
### 删除测试服务器
|
||||
### 删除测试容器
|
||||
|
||||
```shell
|
||||
incus stop test
|
||||
@@ -111,14 +111,14 @@ ls
|
||||
|
||||
## 普通版本批量生成
|
||||
|
||||
开出的服务器配置:
|
||||
开出的容器配置:
|
||||
|
||||
- 1核256MB内存1GB硬盘限速300Mbit带宽
|
||||
- 带1个SSH端口,24个外网端口
|
||||
- 默认内存和硬盘大小
|
||||
|
||||
:::tip
|
||||
lxc若命令无问题,执行初始化开服务器,这一步最好放```screen```中后台挂起执行,开服务器时长与你开几个和宿主机配置相关
|
||||
lxc若命令无问题,执行初始化开容器,这一步最好放```screen```中后台挂起执行,开容器时长与你开几个和宿主机配置相关
|
||||
:::
|
||||
|
||||
执行下面命令加载开机脚本
|
||||
@@ -135,7 +135,7 @@ curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/init.s
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/init.sh -o init.sh && chmod +x init.sh && dos2unix init.sh
|
||||
```
|
||||
|
||||
下面命令为开服务器名字前缀为**tj**的**10**个服务器
|
||||
下面命令为开容器名字前缀为**tj**的**10**个容器
|
||||
|
||||
```shell
|
||||
./init.sh tj 10
|
||||
@@ -145,14 +145,14 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
|
||||
|
||||
## 纯SSH端口版本批量生成
|
||||
|
||||
开出的服务器配置:
|
||||
开出的容器配置:
|
||||
|
||||
- 1核128MB内存1GB硬盘限速300Mbit带宽
|
||||
- 只有一个SSH端口
|
||||
- 无法挂载warp
|
||||
|
||||
:::tip
|
||||
lxc若命令无问题,执行初始化开服务器,这一步最好放```screen```中后台挂起执行,开服务器时长与你开几个和宿主机配置相关
|
||||
lxc若命令无问题,执行初始化开容器,这一步最好放```screen```中后台挂起执行,开容器时长与你开几个和宿主机配置相关
|
||||
:::
|
||||
|
||||
加载开机脚本
|
||||
@@ -169,7 +169,7 @@ curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/least.
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/least.sh -o least.sh && chmod +x least.sh && dos2unix least.sh
|
||||
```
|
||||
|
||||
下列命令最后一行为开服务器名字前缀为**tj**的**10**个服务器
|
||||
下列命令最后一行为开容器名字前缀为**tj**的**10**个容器
|
||||
|
||||
```shell
|
||||
./least.sh tj 10
|
||||
@@ -182,7 +182,7 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
|
||||
- 可自定义内存和硬盘大小
|
||||
- 有执行过上面的手动批量生成过也没问题,配置是继承的不覆盖
|
||||
|
||||
如果需要多次批量生成服务器,可使用
|
||||
如果需要多次批量生成容器,可使用
|
||||
|
||||
国际
|
||||
|
||||
@@ -196,15 +196,15 @@ curl -L https://github.com/oneclickvirt/incus/raw/main/scripts/add_more.sh -o ad
|
||||
curl -L https://cdn.spiritlhl.net/https://github.com/oneclickvirt/incus/raw/main/scripts/add_more.sh -o add_more.sh && chmod +x add_more.sh && bash add_more.sh
|
||||
```
|
||||
|
||||
可多次运行批量生成服务器,且继承前面已生成的部分在后面添加,可自定义内存和硬盘大小
|
||||
可多次运行批量生成容器,且继承前面已生成的部分在后面添加,可自定义内存和硬盘大小
|
||||
|
||||
## 查看已批量开设的信息
|
||||
|
||||
开完服务器后,具体信息会生成在当前目录下的log文件中,格式如下
|
||||
开完容器后,具体信息会生成在当前目录下的log文件中,格式如下
|
||||
|
||||
```shell
|
||||
1号服务器名称 密码 ssh端口 外网端口起始 外网端口终止
|
||||
2号服务器名称 密码 ssh端口 外网端口起始 外网端口终止
|
||||
1号容器名称 密码 ssh端口 外网端口起始 外网端口终止
|
||||
2号容器名称 密码 ssh端口 外网端口起始 外网端口终止
|
||||
```
|
||||
|
||||
如果想要查看,只需在当前目录执行以下命令打印log文件即可
|
||||
@@ -214,7 +214,7 @@ cat log
|
||||
```
|
||||
|
||||
:::warning
|
||||
不要拿该脚本开出的服务器当生产环境,LXC虚拟化不支持换内核,dd,开启bbr等操作
|
||||
不要拿该脚本开出的容器当生产环境,LXC虚拟化不支持换内核,dd,开启bbr等操作
|
||||
:::
|
||||
|
||||
## 部分常用incus命令
|
||||
@@ -228,31 +228,31 @@ incus list
|
||||
查看个例
|
||||
|
||||
```bash
|
||||
incus info 服务器名字
|
||||
incus info 容器名字
|
||||
```
|
||||
|
||||
启动个例
|
||||
|
||||
```bash
|
||||
incus start 服务器名字
|
||||
incus start 容器名字
|
||||
```
|
||||
|
||||
停止个例
|
||||
|
||||
```bash
|
||||
incus stop 服务器名字
|
||||
incus stop 容器名字
|
||||
```
|
||||
|
||||
删除个例
|
||||
|
||||
```bash
|
||||
incus delete -f 服务器名字
|
||||
incus delete -f 容器名字
|
||||
```
|
||||
|
||||
进入内部
|
||||
|
||||
```bash
|
||||
incus exec 服务器名字 /bin/bash
|
||||
incus exec 容器名字 /bin/bash
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
108
docs/guide/incus/incus_qemu.md
Normal file
108
docs/guide/incus/incus_qemu.md
Normal file
@@ -0,0 +1,108 @@
|
||||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
# 在 Incus 中运行 QEMU 虚拟化的 Linux 虚拟机
|
||||
|
||||
## 开设QEMU虚拟机可使用的镜像
|
||||
|
||||
这里展示一部分可使用的系统参数供你参考:
|
||||
|
||||
- debian10,debian11,debian12, debian13
|
||||
- ubuntu18,ubuntu20,ubuntu22
|
||||
- centos8,centos9 (实际开设出来都是Stream版本)
|
||||
- alpine3.15,alpine3.16,alpine3.17,alpine3.18
|
||||
- openwrt21,openwrt22,fedora37,fedora38,fedora39
|
||||
- rockylinux8,rockylinux9,oralce8,oracle9
|
||||
- oralce7,centos7 (都需要在GRUB中启用CGroupV1否则无法启动,详细介绍见常见问题答疑)
|
||||
- kali,archlinux
|
||||
|
||||
* 注意都是**小写字母+数字**的组合或**仅小写字母**,自行尝试,如果搜索无该系统则会自动退出脚本
|
||||
* 版本号可以带英文小数点,为了适配alpine的版本号已支持
|
||||
* 开不起来的可能是硬盘或内存不够大或者本身就不适配宿主机,自行尝试查看开不起来的报错
|
||||
* 目前使用的虚拟机系统仅使用 [自编译](https://github.com/oneclickvirt/incus_images) 的镜像,非自编译镜像缺少依赖和设置不可使用
|
||||
* 自编译镜像完整的支持系统的列表:[kvm_images](https://github.com/oneclickvirt/incus_images/releases/tag/kvm_images)
|
||||
|
||||
## 单独生成一个NAT服务器
|
||||
|
||||
- 只生成一个NAT服务器,可自定义限制所有内容
|
||||
|
||||
### 下载脚本
|
||||
|
||||
国际
|
||||
|
||||
```shell
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/buildvm.sh -o buildvm.sh && chmod +x buildvm.sh && dos2unix buildvm.sh
|
||||
```
|
||||
|
||||
国内
|
||||
|
||||
```shell
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/buildvm.sh -o buildvm.sh && chmod +x buildvm.sh && dos2unix buildvm.sh
|
||||
```
|
||||
|
||||
### 使用方法
|
||||
|
||||
```
|
||||
./buildvm.sh 服务器名称 CPU核数 内存大小 硬盘大小 SSH端口 外网起端口 外网止端口 下载速度 上传速度 是否启用IPV6(Y or N) 系统(留空则为debian11)
|
||||
```
|
||||
|
||||
CPU核数需要小于或等于宿主机的核数,内存大小以MB计算,硬盘大小以GB计算,下载速度上传速度以Mbit计算,是否启用IPV6不一定要填Y或者N,没有这个参数也行,留空默认不开启IPV6
|
||||
|
||||
如果```外网起端口```和```外网止端口```都设置为0则不做区间外网端口映射了,只映射基础的SSH端口,注意```不能为空```,不进行映射需要设置为0
|
||||
|
||||
支持自定义服务器的系统,不填写留空时默认使用debian13,注意传入参数为系统名字+版本号
|
||||
|
||||
除了alpine系统,其他系统的硬盘大小必须大于6G,否则系统起不来,无法初始化和使用,开设的中途阶段就会崩溃。
|
||||
|
||||
### 示例
|
||||
|
||||
以下为开设的示例服务器的信息:
|
||||
|
||||
| 属性 | 值 |
|
||||
|---------------------------|----------------|
|
||||
| 服务器名字 | test |
|
||||
| SSH登录的用户名 | root |
|
||||
| SSH登录的密码 | 随机生成 |
|
||||
| CPU核数 | 1 |
|
||||
| 内存大小 | 256MB |
|
||||
| 磁盘大小 | 10G |
|
||||
| 内外网映射端口一致的区间 | 20002到20025 |
|
||||
| 上传带宽 | 500Mbit |
|
||||
| 下载带宽 | 500Mbit |
|
||||
| 自动设置外网IPV6地址 | N |
|
||||
| 系统 | debian13 |
|
||||
|
||||
```shell
|
||||
./buildvm.sh test 1 512 10 20001 20002 20025 500 500 N debian13
|
||||
```
|
||||
|
||||
需要进入虚拟机内部则执行
|
||||
|
||||
```shell
|
||||
incus console test
|
||||
```
|
||||
|
||||
退出则先按住```Ctrl```再按```a```,松开后,再按```q```。
|
||||
|
||||
需要查看信息则执行
|
||||
|
||||
```shell
|
||||
cat 服务器名字
|
||||
```
|
||||
|
||||
比如查询示例的信息就是
|
||||
|
||||
```shell
|
||||
cat test
|
||||
```
|
||||
|
||||
### 删除测试服务器
|
||||
|
||||
```shell
|
||||
incus stop -f test
|
||||
incus delete -f test
|
||||
rm -rf test
|
||||
rm -rf test_v6
|
||||
ls
|
||||
```
|
||||
@@ -4,9 +4,9 @@ outline: deep
|
||||
|
||||
# LXC虚拟化
|
||||
|
||||
## 单独生成一个NAT服务器
|
||||
## 单独生成一个NAT容器
|
||||
|
||||
- 只生成一个NAT服务器,可自定义限制所有内容
|
||||
- 只生成一个NAT容器,可自定义限制所有内容
|
||||
|
||||
下载开机脚本是**非必须**的,如果你使用过一键安装LXD的命令,自动已下载对应的开机脚本,不需要重复下载该脚本
|
||||
|
||||
@@ -25,14 +25,14 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
|
||||
### 使用方法
|
||||
|
||||
```
|
||||
./buildone.sh 服务器名称 CPU核数 内存大小 硬盘大小 SSH端口 外网起端口 外网止端口 下载速度 上传速度 是否启用IPV6(Y or N) 系统(留空则为debian11)
|
||||
./buildone.sh 容器名称 CPU核数 内存大小 硬盘大小 SSH端口 外网起端口 外网止端口 下载速度 上传速度 是否启用IPV6(Y or N) 系统(留空则为debian11)
|
||||
```
|
||||
|
||||
CPU核数需要小于或等于宿主机的核数,内存大小以MB计算,硬盘大小以GB计算,下载速度上传速度以Mbit计算,是否启用IPV6不一定要填Y或者N,没有这个参数也行,留空默认不开启IPV6
|
||||
|
||||
如果```外网起端口```和```外网止端口```都设置为0则不做区间外网端口映射了,只映射基础的SSH端口,注意```不能为空```,不进行映射需要设置为0
|
||||
|
||||
支持自定义服务器的系统,不填写留空时默认使用debian12,注意传入参数为系统名字+版本号,如:
|
||||
支持自定义容器的系统,不填写留空时默认使用debian12,注意传入参数为系统名字+版本号,如:
|
||||
|
||||
- debian12,debian13
|
||||
- ubuntu22,ubuntu24
|
||||
@@ -47,11 +47,11 @@ CPU核数需要小于或等于宿主机的核数,内存大小以MB计算,硬
|
||||
|
||||
### 示例
|
||||
|
||||
以下为开设的示例服务器的信息:
|
||||
以下为开设的示例容器的信息:
|
||||
|
||||
| 属性 | 值 |
|
||||
|---------------------------|----------------|
|
||||
| 服务器名字 | test |
|
||||
| 容器名字 | test |
|
||||
| SSH登录的用户名 | root |
|
||||
| SSH登录的密码 | 随机生成 |
|
||||
| CPU核数 | 1 |
|
||||
@@ -79,7 +79,7 @@ lxc exec test /bin/bash
|
||||
需要查看信息则执行
|
||||
|
||||
```shell
|
||||
cat 服务器名字
|
||||
cat 容器名字
|
||||
```
|
||||
|
||||
比如查询示例的信息就是
|
||||
@@ -88,9 +88,9 @@ cat 服务器名字
|
||||
cat test
|
||||
```
|
||||
|
||||
如果已通过以上方法生成过服务器,还需要批量生成服务器,可使用自定义批量生成版本的脚本,但注意先删除测试服务器再进行批量生成服务器
|
||||
如果已通过以上方法生成过容器,还需要批量生成容器,可使用自定义批量生成版本的脚本,但注意先删除测试容器再进行批量生成容器
|
||||
|
||||
### 删除测试服务器
|
||||
### 删除测试容器
|
||||
|
||||
```shell
|
||||
lxc stop test
|
||||
@@ -102,14 +102,14 @@ ls
|
||||
|
||||
## 普通版本批量生成
|
||||
|
||||
开出的服务器配置:
|
||||
开出的容器配置:
|
||||
|
||||
- 1核256MB内存1GB硬盘限速300Mbit带宽
|
||||
- 带1个SSH端口,24个外网端口
|
||||
- 默认内存和硬盘大小
|
||||
|
||||
:::tip
|
||||
lxc若命令无问题,执行初始化开服务器,这一步最好放```screen```中后台挂起执行,开服务器时长与你开几个和宿主机配置相关
|
||||
lxc若命令无问题,执行初始化开容器,这一步最好放```screen```中后台挂起执行,开容器时长与你开几个和宿主机配置相关
|
||||
:::
|
||||
|
||||
执行下面命令加载开机脚本
|
||||
@@ -126,7 +126,7 @@ curl -L https://raw.githubusercontent.com/oneclickvirt/lxd/main/scripts/init.sh
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/lxd/main/scripts/init.sh -o init.sh && chmod +x init.sh && dos2unix init.sh
|
||||
```
|
||||
|
||||
下面命令为开服务器名字前缀为**tj**的**10**个服务器
|
||||
下面命令为开容器名字前缀为**tj**的**10**个容器
|
||||
|
||||
```shell
|
||||
./init.sh tj 10
|
||||
@@ -136,14 +136,14 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
|
||||
|
||||
## 纯SSH端口版本批量生成
|
||||
|
||||
开出的服务器配置:
|
||||
开出的容器配置:
|
||||
|
||||
- 1核128MB内存1GB硬盘限速300Mbit带宽
|
||||
- 只有一个SSH端口
|
||||
- 无法挂载warp
|
||||
|
||||
:::tip
|
||||
lxc若命令无问题,执行初始化开服务器,这一步最好放```screen```中后台挂起执行,开服务器时长与你开几个和宿主机配置相关
|
||||
lxc若命令无问题,执行初始化开容器,这一步最好放```screen```中后台挂起执行,开容器时长与你开几个和宿主机配置相关
|
||||
:::
|
||||
|
||||
加载开机脚本
|
||||
@@ -160,7 +160,7 @@ curl -L https://raw.githubusercontent.com/oneclickvirt/lxd/main/scripts/least.sh
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/lxd/main/scripts/least.sh -o least.sh && chmod +x least.sh && dos2unix least.sh
|
||||
```
|
||||
|
||||
下列命令最后一行为开服务器名字前缀为**tj**的**10**个服务器
|
||||
下列命令最后一行为开容器名字前缀为**tj**的**10**个容器
|
||||
|
||||
```shell
|
||||
./least.sh tj 10
|
||||
@@ -173,7 +173,7 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
|
||||
- 可自定义内存和硬盘大小
|
||||
- 有执行过上面的手动批量生成过也没问题,配置是继承的不覆盖
|
||||
|
||||
如果需要多次批量生成服务器,可使用
|
||||
如果需要多次批量生成容器,可使用
|
||||
|
||||
国际
|
||||
|
||||
@@ -187,15 +187,15 @@ curl -L https://github.com/oneclickvirt/lxd/raw/main/scripts/add_more.sh -o add_
|
||||
curl -L https://cdn.spiritlhl.net/https://github.com/oneclickvirt/lxd/raw/main/scripts/add_more.sh -o add_more.sh && chmod +x add_more.sh && bash add_more.sh
|
||||
```
|
||||
|
||||
可多次运行批量生成服务器,且继承前面已生成的部分在后面添加,可自定义内存和硬盘大小
|
||||
可多次运行批量生成容器,且继承前面已生成的部分在后面添加,可自定义内存和硬盘大小
|
||||
|
||||
## 查看已批量开设的信息
|
||||
|
||||
开完服务器后,具体信息会生成在当前目录下的log文件中,格式如下
|
||||
开完容器后,具体信息会生成在当前目录下的log文件中,格式如下
|
||||
|
||||
```shell
|
||||
1号服务器名称 密码 ssh端口 外网端口起始 外网端口终止
|
||||
2号服务器名称 密码 ssh端口 外网端口起始 外网端口终止
|
||||
1号容器名称 密码 ssh端口 外网端口起始 外网端口终止
|
||||
2号容器名称 密码 ssh端口 外网端口起始 外网端口终止
|
||||
```
|
||||
|
||||
如果想要查看,只需在当前目录执行以下命令打印log文件即可
|
||||
@@ -205,7 +205,7 @@ cat log
|
||||
```
|
||||
|
||||
:::warning
|
||||
不要拿该脚本开出的服务器当生产环境,LXC虚拟化不支持换内核,dd,开启bbr等操作
|
||||
不要拿该脚本开出的容器当生产环境,LXC虚拟化不支持换内核,dd,开启bbr等操作
|
||||
:::
|
||||
|
||||
## 部分常用LXD命令
|
||||
@@ -219,31 +219,31 @@ lxc list
|
||||
查看个例
|
||||
|
||||
```bash
|
||||
lxc info 服务器名字
|
||||
lxc info 容器名字
|
||||
```
|
||||
|
||||
启动个例
|
||||
|
||||
```bash
|
||||
lxc start 服务器名字
|
||||
lxc start 容器名字
|
||||
```
|
||||
|
||||
停止个例
|
||||
|
||||
```bash
|
||||
lxc stop 服务器名字
|
||||
lxc stop 容器名字
|
||||
```
|
||||
|
||||
删除个例
|
||||
|
||||
```bash
|
||||
lxc delete -f 服务器名字
|
||||
lxc delete -f 容器名字
|
||||
```
|
||||
|
||||
进入内部
|
||||
|
||||
```bash
|
||||
lxc exec 服务器名字 /bin/bash
|
||||
lxc exec 容器名字 /bin/bash
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
Reference in New Issue
Block a user