2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CoreOS(471.1.0)をPXE bootする方法 (root=tmpfs版)

Last updated at Posted at 2014-10-16

Overview

手元にUbuntu/DebianなPCとDHCPサーバが立っている環境があれば、ダウンロードの時間を含めても20分くらいで起動できます

rootがtmpfsです。dockerは使えません。etcdやfleetを試す環境としてどうぞ

NOTE:
CoreOSの情報は刻一刻と変わっています。かならずオフィシャルドキュメントを見るようにしてください

PXE server on Ubuntu/Debian

TFTPd "tftpd-hpa" install

$ sudo apt-get install tftpd-hpa
$ sudo sed -i -e "s/^\(start on runlevel.*\)$/#\1/" /etc/init/tftpd-hpa.conf

/etc/init/tftpd-hpa.confのstart onをコメントアウトしているのは、OS起動時にTFTPdが起動しないようにするため

ProxyDHCP "pxe-pdhcp" install

pxe-pdhcpは、すでに稼働中のDHCPを中継して、PXE bootに必要な情報を送ってくれる、素敵なfrsyukiプロダクトです

$ cd /tmp
$ git clone https://github.com/frsyuki/pxe-pdhcp.git
$ cd pxe-pdhcp
$ make
$ sudo install -o root -g root -m 755 pxe-pdhcp /usr/local/sbin/

Setup for PXE env.

$ sudo apt-get install syslinux
$ cd /var/lib/tftpboot
$ sudo -s
# for urlp in .vmlinuz _image.cpio.gz ; do wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe${urlp} ; done
# cp /usr/lib/syslinux/pxelinux.0 ./
# mkdir pxelinux.cfg
# cat << EOT >> pxelinux.cfg/default
# default

default coreos
prompt 1
timeout 15

display boot.msg

label coreos
  menu default
  kernel coreos_production_pxe.vmlinuz
  append initrd=coreos_production_pxe_image.cpio.gz root=tmpfs sshkey="SSH-KEY"

EOT
# SSH_KEY="`cat ~/.ssh/id_rsa.pub`"
# sed -e "s#SSH-KEY#$SSH_KEY#" pxelinux.cfg/default
# exit

※ssh鍵として~/.ssh/id_rsa.pubを指定しています。このへんは上手くやってください

Setup VirtualBox VM on VBox PC (e.g. Mac OS X)

CoreOSを実際に動かすVBoxマシンでVMを作ります

$ VBoxManage createvm --name coreos01 --ostype Linux_64 --register
$ VBoxManage modifyvm coreos01 --memory 512 --chipset ich9 --boot1 disk --boot2 net --boot3 none --boot4 none --nic1 bridged --bridgeadapter "en1: Wi-Fi (AirPort)" --macaddress1 auto

bridgeadapterは各々の環境に合わせてください。指定する文字列はVBoxManage list bridgeifsName:を見ればわかります。Nameに表示された文字列すべて記載しないとVM起動に失敗します

boot

on Ubuntu/Debian:

## NOTE: If running LXC on your PC then conflict with dnsmasq.
$ sudo initctl start tftpd-hpa
$ cd /var/lib/tftpboot
$ sudo /usr/local/sbin/pxe-pdhcp -d -l 0.0.0.0 -b 255.255.255.255 -t TFTPD_ADDR pxelinux.0

on VBox PC:

$ VBoxManage startvm coreos01

起動が完了したらsshログインできます

$ ssh core@COREOS_ADDR

IPアドレスは、CoreOSのログインプロンプトに表示されます。されていなければ、Enterを押せば表示されます

NOTE

起動直後のメモリ使用量は240MB程度。etcdやfleetを使うだけなら、VMに512MBを割り当てれば十分です

pxelinux.cfg/defaultのappend行には、様々なオプションが指定できます
シリアルコンソールに直接出すこともできるようですね

リファレンス

あとがき

CoreOSいいよ、CoreOS

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?