Skip to content
Jerry edited this page Dec 26, 2022 · 1 revision

Welcome to the DBC-CloudCyberCafe wiki!

无盘服务器的部署

Cloud Cyber Cafe -- iPXE + iSCSI 无盘启动方案

HTTP

可以使用 apache 或者 nginx 搭建 HTTP 服务器,下面以 nginx 为例:

    server {
        listen    8080;
        root      /var/www/file;
        location / {
            autoindex on;# 显示目录
            autoindex_exact_size on;# 显示文件大小
            autoindex_localtime on;# 显示文件时间
        }
    }

/var/www/file目录结构如下:

├── ipxe
│   ├── boot.ipxe
│   ├── boot.ipxe.cfg
│   ├── cfg
│   │   ├── 404.html
│   │   └── mac-000c29c63944.ipxe.cfg
│   └── wimboot
└── winpe
    ├── amd64
    │   ├── ......
    └── x86
        ├── ......
├── netboot
├── ubuntu
│   └── preseed.cfg
  • ipxe文件夹下存放的是iPXE的启动脚本,其中mac-000c29c63944.ipxe.cfg以MAC地址去除冒号全小写格式命名,每个被引导的机器都需要有一个对应的配置文件。
  • wimboot文件从https://github.com/ipxe/wimboot/releases下载。
  • winpe下面存放安装Windows系统所用的PE文件。
  • netboot是网络安装 ubuntu 所用的文件,可以从阿里云或者清华源下面。
  • ubuntu/preseed.cfg是网络安装 ubuntu 使用的无人值守配置文件。

DHCP

支持 iPXE 的网络配置,甚至为机器绑定固定的IP地址。如果已经存在 DHCP 服务,推荐使用 dnsmasq 做 DHCP 代理,如果没有 DHCP 服务,推荐直接使用 isc-dhcp-server 配置自己的子网。

sudo apt install dnsmasq
sudo apt install isc-dhcp-server

TFTP

sudo apt install tftpd-hpa

启动TFTP服务,并在服务指定的目录中放入undionly.kpxeipxe.efi,这两个文件可以使用ipxe官网提供的文件,我们推荐使用自定义脚本script.ipxe自行编译文件。脚本内容如下:

#!ipxe
dhcp
chain --autofree http://192.168.119.2:8080/ipxe/boot.ipxe

http://192.168.119.2:8080/ipxe/boot.ipxe此 url 根据 HTTP 服务上的文件指定,ip:port 仅供参考。

编译 iPXE 启动文件

make bin-x86_64-pcbios/undionly.kpxe EMBED=script.ipxe
make bin-x86_64-efi/ipxe.efi EMBED=script.ipxe

启动控制台

sudo apt install targetcli-fb open-iscsi python3-pip thrift-compiler
sudo pip3 install dash pandas thrift diskcache

将仓库克隆到本地,运行命令:

jerry@jerry:~/Code/DBC-CloudCyberCafe$ cd preset/
jerry@jerry:~/Code/DBC-CloudCyberCafe/preset$ thrift --gen py preset.thrift 
jerry@jerry:~/Code/DBC-CloudCyberCafe/preset$ cd ../plotly/
jerry@jerry:~/Code/DBC-CloudCyberCafe/plotly$ sudo python3 home.py
Clone this wiki locally