-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Jerry edited this page Dec 26, 2022
·
1 revision
Welcome to the DBC-CloudCyberCafe wiki!
Cloud Cyber Cafe -- iPXE + iSCSI 无盘启动方案
可以使用 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 使用的无人值守配置文件。
支持 iPXE 的网络配置,甚至为机器绑定固定的IP地址。如果已经存在 DHCP 服务,推荐使用 dnsmasq 做 DHCP 代理,如果没有 DHCP 服务,推荐直接使用 isc-dhcp-server 配置自己的子网。
sudo apt install dnsmasq
sudo apt install isc-dhcp-server
sudo apt install tftpd-hpa
启动TFTP服务,并在服务指定的目录中放入undionly.kpxe
和ipxe.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