2016-06-20 15:33:42 +02:00
|
|
|
pxe
|
|
|
|
===
|
|
|
|
|
|
|
|
The Preboot Execution Environment (PXE) is an environment to bootstrap
|
|
|
|
computers using a network card (i.e Ethernet, Token-Ring) independently of
|
|
|
|
available data storage devices (like hard disks) or installed operating
|
|
|
|
systems.
|
|
|
|
|
|
|
|
## docker-compose.yml
|
2016-06-20 16:42:27 +02:00
|
|
|
|
2016-06-20 15:33:42 +02:00
|
|
|
```yaml
|
|
|
|
pxe:
|
|
|
|
image: vimagick/dnsmasq
|
2016-06-20 16:42:27 +02:00
|
|
|
net: host
|
2016-06-20 15:33:42 +02:00
|
|
|
volumes:
|
|
|
|
- ./dnsmasq.conf:/etc/dnsmasq.d/dnsmasq.conf
|
|
|
|
- ./tftpboot:/tftpboot
|
|
|
|
restart: always
|
2016-06-20 16:42:27 +02:00
|
|
|
|
|
|
|
web:
|
|
|
|
image: nginx:alpine
|
|
|
|
ports:
|
|
|
|
- "80:80"
|
|
|
|
volumes:
|
|
|
|
- ./nginx.conf:/etc/nginx/nginx.conf
|
|
|
|
- ./html:/var/lib/nginx/html
|
|
|
|
restsart: always
|
2016-06-20 15:33:42 +02:00
|
|
|
```
|
|
|
|
|
2016-06-21 03:23:08 +02:00
|
|
|
> :warning: The local mirror doesn't work!
|
|
|
|
|
2016-06-20 15:33:42 +02:00
|
|
|
## dnsmasq.conf
|
|
|
|
|
|
|
|
```
|
|
|
|
interface=eth0
|
|
|
|
port=0
|
|
|
|
no-hosts
|
|
|
|
no-resolv
|
|
|
|
server=8.8.8.8
|
2016-08-07 02:51:52 +02:00
|
|
|
dhcp-range=192.168.1.10,192.168.1.20,1h,proxy
|
2016-06-20 15:33:42 +02:00
|
|
|
dhcp-option=3,192.168.1.1
|
|
|
|
dhcp-option=6,192.168.1.1
|
|
|
|
dhcp-boot=pxelinux.0
|
|
|
|
enable-tftp
|
|
|
|
tftp-root=/tftpboot
|
|
|
|
```
|
|
|
|
|
|
|
|
> You can get all `dhcp-option` codes via `dnsmasq --help dhcp`.
|
|
|
|
|
2016-06-20 16:42:27 +02:00
|
|
|
## nginx.conf
|
|
|
|
|
|
|
|
```
|
|
|
|
worker_processes 1;
|
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
|
|
|
include mime.types;
|
|
|
|
default_type application/octet-stream;
|
|
|
|
sendfile on;
|
|
|
|
keepalive_timeout 65;
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name localhost;
|
|
|
|
location / {
|
|
|
|
root html;
|
|
|
|
index index.html index.htm;
|
|
|
|
autoindex on;
|
|
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
|
location = /50x.html {
|
|
|
|
root html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-06-20 15:33:42 +02:00
|
|
|
## up and running
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd ~/fig/pxe/
|
|
|
|
|
|
|
|
mkdir tftpboot
|
|
|
|
wget http://ftp.nl.debian.org/debian/dists/jessie/main/installer-amd64/current/images/netboot/netboot.tar.gz
|
|
|
|
tar xzf netboot.tar.gz -C tftpboot
|
|
|
|
|
2016-06-20 16:42:27 +02:00
|
|
|
mkdir html
|
|
|
|
wget http://cdimage.debian.org/debian-cd/8.5.0/amd64/iso-cd/debian-8.5.0-amd64-CD-1.iso
|
|
|
|
mount debian-8.5.0-amd64-CD-1.iso html
|
|
|
|
|
2016-06-20 15:33:42 +02:00
|
|
|
docker-compose up -d
|
|
|
|
docker-compose logs -f
|
|
|
|
```
|
|
|
|
|
2016-06-21 03:23:08 +02:00
|
|
|
> You should stop DHCP service on local network before starting PXE.
|
|
|
|
> Also take a look at `preseed.cfg` for unattended installation.
|