Update bare_metal_offline.md

Fix format.
This commit is contained in:
Stewart-YU
2017-09-10 18:07:38 +08:00
committed by GitHub
parent 4a55e28166
commit 3e49e008cc
@@ -42,95 +42,81 @@ To setup CentOS PXELINUX environment there is a complete [guide here](http://doc
1. Install packages needed on CentOS 1. Install packages needed on CentOS
```shell sudo yum install tftp-server dhcp syslinux
sudo yum install tftp-server dhcp syslinux
```
2. `vi /etc/xinetd.d/tftp` to enable tftp service and change disable to 'no' 2. `vi /etc/xinetd.d/tftp` to enable tftp service and change disable to 'no'
```conf go get github.com/vmware/photon-controller-cli/photon
disable = no
```
3. Copy over the syslinux images we will need. 3. Copy over the syslinux images we will need.
```shell su -
su - mkdir -p /tftpboot
mkdir -p /tftpboot cd /tftpboot
cd /tftpboot cp /usr/share/syslinux/pxelinux.0 /tftpboot
cp /usr/share/syslinux/pxelinux.0 /tftpboot cp /usr/share/syslinux/menu.c32 /tftpboot
cp /usr/share/syslinux/menu.c32 /tftpboot cp /usr/share/syslinux/memdisk /tftpboot
cp /usr/share/syslinux/memdisk /tftpboot cp /usr/share/syslinux/mboot.c32 /tftpboot
cp /usr/share/syslinux/mboot.c32 /tftpboot cp /usr/share/syslinux/chain.c32 /tftpboot
cp /usr/share/syslinux/chain.c32 /tftpboot
/sbin/service dhcpd start /sbin/service dhcpd start
/sbin/service xinetd start /sbin/service xinetd start
/sbin/chkconfig tftp on /sbin/chkconfig tftp on
```
4. Setup default boot menu 4. Setup default boot menu
```shell mkdir /tftpboot/pxelinux.cfg
mkdir /tftpboot/pxelinux.cfg touch /tftpboot/pxelinux.cfg/default
touch /tftpboot/pxelinux.cfg/default
```
5. Edit the menu `vi /tftpboot/pxelinux.cfg/default` 5. Edit the menu `vi /tftpboot/pxelinux.cfg/default`
```conf default menu.c32
default menu.c32 prompt 0
prompt 0 timeout 15
timeout 15 ONTIMEOUT local
ONTIMEOUT local display boot.msg
display boot.msg
MENU TITLE Main Menu MENU TITLE Main Menu
LABEL local LABEL local
MENU LABEL Boot local hard drive MENU LABEL Boot local hard drive
LOCALBOOT 0 LOCALBOOT 0
```
Now you should have a working PXELINUX setup to image CoreOS nodes. You can verify the services by using VirtualBox locally or with bare metal servers. Now you should have a working PXELINUX setup to image CoreOS nodes. You can verify the services by using VirtualBox locally or with bare metal servers.
## Adding CoreOS to PXE ## Adding CoreOS to PXE
This section describes how to setup the CoreOS images to live alongside a pre-existing PXELINUX environment. This section describes how to setup the CoreOS images to live alongside a pre-existing PXELINUX environment.
1. Find or create the TFTP root directory that everything will be based on. 1. Find or create the TFTP root directory that everything will be based on.
* For this document we will assume `/tftpboot/` is our root directory. - For this document we will assume `/tftpboot/` is our root directory.
2. Once we know and have our tftp root directory we will create a new directory structure for our CoreOS images. 2. Once we know and have our tftp root directory we will create a new directory structure for our CoreOS images.
3. Download the CoreOS PXE files provided by the CoreOS team. 3. Download the CoreOS PXE files provided by the CoreOS team.
```shell MY_TFTPROOT_DIR=/tftpboot
MY_TFTPROOT_DIR=/tftpboot mkdir -p $MY_TFTPROOT_DIR/images/coreos/
mkdir -p $MY_TFTPROOT_DIR/images/coreos/ cd $MY_TFTPROOT_DIR/images/coreos/
cd $MY_TFTPROOT_DIR/images/coreos/ wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz
wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz.sig
wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz.sig wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz
wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz.sig
wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz.sig gpg --verify coreos_production_pxe.vmlinuz.sig
gpg --verify coreos_production_pxe.vmlinuz.sig gpg --verify coreos_production_pxe_image.cpio.gz.sig
gpg --verify coreos_production_pxe_image.cpio.gz.sig
```
4. Edit the menu `vi /tftpboot/pxelinux.cfg/default` again 4. Edit the menu `vi /tftpboot/pxelinux.cfg/default` again
```conf default menu.c32
default menu.c32 prompt 0
prompt 0 timeout 300
timeout 300 ONTIMEOUT local
ONTIMEOUT local display boot.msg
display boot.msg
MENU TITLE Main Menu MENU TITLE Main Menu
LABEL local LABEL local
MENU LABEL Boot local hard drive MENU LABEL Boot local hard drive
LOCALBOOT 0 LOCALBOOT 0
MENU BEGIN CoreOS Menu MENU BEGIN CoreOS Menu
LABEL coreos-master LABEL coreos-master
MENU LABEL CoreOS Master MENU LABEL CoreOS Master
@@ -141,25 +127,20 @@ MENU BEGIN CoreOS Menu
MENU LABEL CoreOS Slave MENU LABEL CoreOS Slave
KERNEL images/coreos/coreos_production_pxe.vmlinuz KERNEL images/coreos/coreos_production_pxe.vmlinuz
APPEND initrd=images/coreos/coreos_production_pxe_image.cpio.gz cloud-config-url=http://<xxx.xxx.xxx.xxx>/pxe-cloud-config-slave.yml APPEND initrd=images/coreos/coreos_production_pxe_image.cpio.gz cloud-config-url=http://<xxx.xxx.xxx.xxx>/pxe-cloud-config-slave.yml
MENU END MENU END
```
This configuration file will now boot from local drive but have the option to PXE image CoreOS. This configuration file will now boot from local drive but have the option to PXE image CoreOS.
## DHCP configuration ## DHCP configuration
This section covers configuring the DHCP server to hand out our new images. In this case we are assuming that there are other servers that will boot alongside other images. This section covers configuring the DHCP server to hand out our new images. In this case we are assuming that there are other servers that will boot alongside other images.
1. Add the `filename` to the _host_ or _subnet_ sections. 1. Add the `filename` to the _host_ or _subnet_ sections.
```conf filename "/tftpboot/pxelinux.0";
filename "/tftpboot/pxelinux.0";
```
2. At this point we want to make pxelinux configuration files that will be the templates for the different CoreOS deployments. 2. At this point we want to make pxelinux configuration files that will be the templates for the different CoreOS deployments.
```conf subnet 10.20.30.0 netmask 255.255.255.0 {
subnet 10.20.30.0 netmask 255.255.255.0 {
next-server 10.20.30.242; next-server 10.20.30.242;
option broadcast-address 10.20.30.255; option broadcast-address 10.20.30.255;
filename "<other default image>"; filename "<other default image>";
@@ -188,8 +169,7 @@ subnet 10.20.30.0 netmask 255.255.255.0 {
filename "/pxelinux.0"; filename "/pxelinux.0";
} }
... ...
} }
```
We will be specifying the node configuration later in the guide. We will be specifying the node configuration later in the guide.