ããã§ã¯ããããã¯ãŒã¯ãä»ããŠèµ·åããFirefoxãã©ãŠã¶ãèªåçã«èµ·åã§ããæ°ããArch Linuxã·ã¹ãã ãäœæããŸãããã®éã«ãããŒããµãŒããŒã®å¿ èŠãªæ©èœãåŠçããŸãã 次ã«ããµãŒããŒèªäœãæ§æããããããèµ·åããããšããŸãã GoogleããPXEãã®ãªã¯ãšã¹ãã§èŠã€ããç»åãšãŸã£ããåãããã«ãã¹ãŠãèµ·ãããŸãã
Linuxãå床ã€ã³ã¹ããŒã«ããŸã
Archlinuxã¯æ¢è£œã®ãã£ã¹ããªãã¥ãŒã·ã§ã³ãšæ¯èŒããŠãäœæ¥ãã·ã³ããã®æ°ããã·ã¹ãã ã®ã€ã³ã¹ããŒã«ãã€ã³ã¹ããŒã«ã€ã¡ãŒãžã䜿çšãããšããšåãæ¹æ³ã§å®è¡ãããã©ã¡ãã®å ŽåãçŸåšã®ã·ã¹ãã ã®ææ°ããŒãžã§ã³ãååŸããç¹ã§æå©ã§ãã å°ããªã€ã³ã¹ããŒã«ã¹ã¯ãªããã®ã¿ãå¿ èŠã§ãã
pacman -S arch-install-scripts
å®å šã«äºæž¬å¯èœãªå§ãŸãïŒ
export root=/srv/nfs/diskless mkdir -p $root
ãããã£ãŠãåºæ¬ããã±ãŒãžã®ã¿ãã€ã³ã¹ããŒã«ããŠãã ããã
pacstrap -d -c -i $root base
泚ïŒ
ããããã¯ãŒã¯ããã©ãŒãã³ã¹ã¯ãæãé
ãããŒããã©ã€ãã®ããã©ãŒãã³ã¹ãããã¯ããã«äœããããã€ã³ã¹ããŒã«ãããã·ã¹ãã ã®ããªã¥ãŒã ãæå°éã«æããããåªããŠããŸãïŒããã®æç¹ã§æžããŠããã¹ãã§ããããç¹å®ã®ããã±ãŒãžãéžæãããšãããªã¥ãŒã ãããã«æžããããšãã§ããããšãç¥ã£ãŠããŸãåºæ¬ããã±ãŒãžã°ã«ãŒãã èªåã§ããããšãææ¡ããŸãã
次ã«ã åã®èšäºã«åŸã£ãŠããŒãããŒããŒãã€ã³ã¹ããŒã«ãããŸã§ããã¹ãŠã®æé ãç¹°ãè¿ããŸãã ãã§ãã¯ãªã¹ãã¯æ¬¡ã®ãšããã§ãã
- ãã·ã¢åïŒåœéåïŒãå®æœããã
- ã¿ã€ã ãŸãŒã³ãæå®ããNTPãµãŒãã¹ã®èªååçãæ§æããŸãã
- ãŠãŒã¶ãŒåãè¿œå ãããã¹ã¯ãŒãã®å€æŽããããã¯ããŸãã
ãã£ã¹ã¯ããŒããšãããã¯ãŒã¯ããŒããæ¯èŒãã
ååã®èšäºã§ã¯ãå éšã¹ãã¬ãŒãžã®èŠ³ç¹ããLinuxã®ããŒãããã»ã¹ãæ€èšããŸããã 次ã«ããããã¯ãŒã¯ã«ãŒãã®ç®ãéããŠäœãèµ·ãã£ãŠããããæ³åããŸãã ããããŒã®å³ã¯ãã€ãã³ãããã瀺ããŠããŸããããã®å Žåããã¹ãŠã®ãµãŒããŒã1å°ã®ã³ã³ãã¥ãŒã¿ãŒã§åäœããŸãã
ã³ã³ãã¥ãŒã¿ãŒã®é»æºããªã³ã«ããçŽåŸã«ããããã¯ãŒã¯ã«ãŒãã®ROMã«çŽæ¥é 眮ãããŠããPXEã³ãŒããããªã¬ãŒãããŸãïŒPreboot eXecution Environmentãpixyãšçºé³-wikiã®ãããïŒã ãã®ã¿ã¹ã¯ã¯ãããŒãããŒããŒãèŠã€ããŠå¶åŸ¡ã転éããããšã§ãã
泚ïŒ
以äžã§ã¯ã販売ãããŠããã»ãŒãã¹ãŠã®ãã¶ãŒããŒãã«çµã¿èŸŒãŸããŠãããããã¯ãŒã¯ã«ãŒãã®æ©èœãæ€èšããŸãïŒSocket 775ãæèŒãããã¶ãŒããŒãã®äžã«ã¯åŒ±ãã³ããŒããã£ããã®ããããŸãïŒã 察å¿ããPXEã¢ã€ãã ãèµ·åå¯èœãªBIOSããã€ã¹ã®ãªã¹ãã«ãªãå Žåã¯ããããã¯ãŒã¯ã«ãŒãèšå®ã®çµ±åããã€ã¹ã»ã¯ã·ã§ã³ã§æå¹ã«ããŠã¿ãŠãã ããã ä»ã®ãã¹ãŠã倱æããå Žåã¯ããã¶ãŒããŒãã®æ瀺ãèªãã§ãããããããªãå®éšã«é©ããŠããããšã確èªããŠãã ããã
ãããã¯ãŒã¯ã¢ããã¿ãŒã¯ãçŸåšã©ã®ãããã¯ãŒã¯ã«ããã®ãããããªããããã¢ãã¬ã¹0.0.0.0ãå²ãåœãŠãDHCPDISCOVERã¡ãã»ãŒãžãéä¿¡ããŸãã
- ARCHãªãã·ã§ã³93-PXEã¯ã©ã€ã¢ã³ãã¢ãŒããã¯ã㣠ïŒUEFIãBIOSïŒã
- Vendor-Class Option 60ã¯ããã¹ãŠã®PXEã¯ã©ã€ã¢ã³ãã«å¯ŸããŠãPXEClientïŒArchïŒxxxxxïŒUNDIïŒyyyzzzãã®ãããªèå¥åã§ããããã§ãçªå·xxxxxã¯ã¯ã©ã€ã¢ã³ãã¢ãŒããã¯ãã£ãyyyzzzã¯UNDIãã©ã€ããŒã®ã¡ãžã£ãŒããŒãžã§ã³ãšãã€ããŒããŒãžã§ã³ïŒãŠãããŒãµã«ãããã¯ãŒã¯ãã©ã€ããŒã€ã³ã¿ãŒãã§ã€ã¹ïŒã§ãã
ã¢ããã¿ãŒã¯ãBOOTPãããã³ã«ïŒ Bootstrap Protocol ïŒãä»ããŠDHCPãµãŒããŒããå¿çãåä¿¡ããããšãæ³å®ããŠããŸã ãããã§ã¯ãç®çã®IPã¢ãã¬ã¹ããµãããããã¹ã¯ãããã³ã²ãŒããŠã§ã€ã¢ãã¬ã¹ã«å ããŠã TFTPãµãŒããŒã¢ãã¬ã¹ãšããããååŸããããŒãããŒããŒãã¡ã€ã«ã®ååã«é¢ããæ å ±ããããŸãã 次ã«ãTFTPãµãŒããŒã¯ãèŠæ±ãããã¡ã€ã«ãå¿ èŠãšãããã¹ãŠã®ãŠãŒã¶ãŒã«åçŽã«æäŸããŸãã
å¿çãåä¿¡ãããããã¯ãŒã¯èšå®ãé©çšããåŸãããã«ããŠã³ããŒãå¶åŸ¡ãåä¿¡ãã¡ã€ã«ã«è»¢éãããŸãããµã€ãºã¯32 kBãè¶ ããããšã¯ã§ããªãããã2段éã®ããŠã³ããŒãã䜿çšãããŸãã 次ã«ãç»é¢ã«ããŒãã¡ãã¥ãŒã衚瀺ããããã«å¿ èŠãªãã®ã¯ãã¹ãŠãåãTFTPãããã³ã«ã䜿çšããŠããŠã³ããŒããããŸãã ãããã¯ãŒã¯ããŒãã¬ã€ãã®å€§éšåã¯pxelinuxããŒãããŒããŒã䜿çšããŸãããGRUBã¯åãããšãå®è¡ã§ããŸããããã«ãUEUBãªã©ãã¢ãŒããã¯ãã£ããšã«ç°ãªãããŒãããŒããŒããããŸãã
次ã«ãããŒãã¡ãã¥ãŒã衚瀺ãããŠããéãããŠã³ããŒããäžæåæ¢ããããã®åŸãåãTFTPãããã³ã«ã䜿çšããŠãéžæãããvmlinuzããã³initramfsãã¡ã€ã«ãããŠã³ããŒããããããã«ããŠã³ããŒãã®å¶åŸ¡ãããã«è»¢éãããŸãã ãã®æ®µéã§ã¯ããããã¯ãŒã¯çµç±ãŸãã¯å éšãã©ã€ãããã®èªã¿èŸŒã¿ã®ã¡ã«ããºã ã«éãã¯ãããŸããã
GRUBã䜿çšãããããã¯ãŒã¯ããŒãã®æ§æ
GRUBã¯ãã§ã«ãµãŒããŒäžã«ååšããããããã®æ¹æ³ã§ãããã¯ãŒã¯ã¯ã©ã€ã¢ã³ãã®ãã©ã«ããŒæ§é ãäœæããããã«äœ¿çšããŸãã
grub-mknetdir --net-directory=$root/boot --subdir=grub
grubãã©ã«ããŒãšä»ã®ããã€ãã®ãã©ã«ããŒã$ root / bootãã©ã«ããŒã«è¡šç€ºãããŸãã TFTPãµãŒããŒã䜿çšããŠããã®ãã¡ã€ã«æ§é ãå®å šã«ãæŸæ£ãããŸãã 32ãããã·ã¹ãã ã«/ grub / x86_64-efi /ãã©ã«ããŒããªãããã64ãããArchLinuxã䜿çšããŸããããã¯UEFIã·ã¹ãã ãããŒãããããã«å¿ èŠã§ãã ãã®ãã©ã«ããŒã64ããããµãŒããŒããååŸãã32ããããµãŒããŒã«å€æŽããã«è»¢éãããšãUEFIãµããŒãã衚瀺ãããŸãã
次ã®å 容ã®ããŒãããŒããŒæ§æãã¡ã€ã«ãäœæããŸãã
cat $ root / boot / grub / grub.cfg
function load_video { if [ x$feature_all_video_module = xy ]; then insmod all_video else insmod efi_gop insmod efi_uga insmod ieee1275_fb insmod vbe insmod vga insmod video_bochs insmod video_cirrus fi } if [ x$feature_default_font_path = xy ] ; then font=unicode else font="fonts/unicode.pf2" fi if loadfont $font ; then set gfxmode=auto load_video insmod gfxterm set locale_dir=locale set lang=ru_RU insmod gettext fi terminal_input console terminal_output gfxterm set timeout=5 set default=0 menuentry " Firefox" { load_video set gfxpayload=keep insmod gzio echo " ..." linux /vmlinuz-linux \ add_efi_memmap \ ip="$net_default_ip":"$net_default_server":192.168.1.1:255.255.255.0::eth0:none \ nfsroot=${net_default_server}:/diskless echo " ..." initrd /initramfs-linux.img }
ãµãŒããŒããgrub.cfgãã¡ã€ã«ãååŸããGRUBããŒãã¡ãã¥ãŒã®è¡šç€ºã«é¢ä¿ããªãããŸãã¯äœããã®åœ¢ã§ãã£ã¹ã¯ã«é¢é£ãããã®ããã¹ãŠåé€ããŸããã
ã«ãŒãã«ãã©ã¡ãŒã¿ã«é¢ããããªãã¿ã®æååã«æ³šæããŠãã ããã
linux /vmlinuz-linux add_efi_memmap ip="$net_default_ip":"$net_default_server":192.168.1.1:255.255.255.0::eth0:none nfsroot=${net_default_server}:/diskless
ååãšåæ§ã«ãå€ãå€æ°ãipãã«å²ãåœãŠãŸãã ããã¯ãããŒããµãŒããŒã§ãããã¯ãŒã¯ã«ãŒããæ§æããããã«æ¡çšããããããããã³ãã©ãŒã§äœ¿çšãããããšãæãåºãããŠãã ããã ããã§ããeth0ãããã¯ãŒã¯ã«ãŒãã®éçIPã¢ãã¬ã¹ãšå®æ°åã瀺ãããŠããŸãã $ net_default_ipãš$ net_default_serverã®å€ã¯ãæåã®DHCPèŠæ±ããåä¿¡ããããŒã¿ã«åºã¥ããŠGRUBã«ãã£ãŠåå¥ã«çœ®ãæããããŸãã $ net_default_ipã¯ãã·ã³ã«å²ãåœãŠãããIPã¢ãã¬ã¹ã§ããã$ net_default_serverã¯ããŒããµãŒããŒã®IPã¢ãã¬ã¹ã§ãã
ïŒã€ã³ã¿ãŒãããã®ãªãŒãã³ã¹ããŒã¹ã«ããïŒãããã¯ãŒã¯ããŒãã®ã¬ã€ãã®ã»ãšãã©ã¯ããip = :::::: eth0ïŒdhcpãã®ãããªå€æ°ãèšå®ããããšãæšå¥šããŸããããã«ãããããããã³ãã©ãŒã¯æ°ããDHCPDISCOVERèŠæ±ãéä¿¡ããŠãããã¯ãŒã¯èšå®ãååŸããŸãã
DHCPãµãŒããŒãããäžåºŠãã¹ãã ãããå¿çãããŸã§åŸ æ©ãã客芳çãªçç±ã¯ãããŸããããã®ãããéçå€æ°ãå床䜿çšããDNSãµãŒããŒãæå®ããããšãå¿ããªãã§ãã ããã ãã®åé¡ã¯ãã§ã«è§£æ±ºæžã¿ãªã®ã§ãå¿ èŠãªãã¡ã€ã«ãã³ããŒããŠããµãŒãã¹ãã¹ã¿ãŒãã¢ããã«è¿œå ããã ãã§ãã
cp {,$root}/etc/systemd/system/update_dns@.service && cp {,$root}/etc/default/dns@eth0 && arch-chroot $root systemctl enable update_dns@eth0
ã«ãŒãã«ãã©ã¡ãŒã¿ãå«ãè¡ã«æ»ããŸãã ãŸã 銎æã¿ã®ãªãadd_efi_memmapïŒEFIã¡ã¢ãªãããïŒã³ãã³ãã¯ã䜿çšå¯èœãªRAMã«EFIã¡ã¢ãªããããè¿œå ããŸã ã ååã¯ãUEFIããµããŒãããããã®ã¡ãã£ã¢ã®äºåçãªããŒã¯ã¢ãããæ¯èŒçè€éã ã£ããããæå³çã«ãããèŠéããŸããã ããŒããµãŒããŒäžã®ãã¡ã€ã«ã·ã¹ãã ã¯æ¢ã«ååšããå€æŽãããã«äœ¿çšããããããããã§äœãããŒã¯ããå¿ èŠã¯ãããŸããã
ã«ãŒãã«å€æ°-nfsrootã¯ãã«ãŒããã¡ã€ã«ã·ã¹ãã ãæ¢ãå¿ èŠããããããã¯ãŒã¯å ã®æ£ç¢ºãªå Žæã瀺ããŸãã ããŒããµãŒããŒã®ã«ãŒãå€æ°ãšåãæ©èœãå®è¡ããŸãã ãã®å Žåã NFSãµãŒããŒã®ã¢ãã¬ã¹ã瀺ãããŸããããã¯ãTFTPãµãŒããŒãšäžèŽããŠããŸãããããã¯å®å šã«ãªãã·ã§ã³ã§ãã
initramfsã®æºå
ããããã³ãã©ãŒã¯ãNFSãä»ããŠã«ãŒããã¡ã€ã«ã·ã¹ãã ã«æ¥ç¶ããŸãã ååããã®æ©èœãåé€ããŸããããä»ã§ã¯å°ãå€æŽãã圢ã§å¿ èŠã«ãªã£ãŠããŸãã å®éã®ãšãããããããã³ãã©ãŒã¯ãNFSããŒãžã§ã³3ãããã³ã«ã䜿çšããæ¥ç¶ã®ã¿ããµããŒãããŸããã幞ããªããšã«ãããŒãžã§ã³4ã®ãµããŒãã¯éââåžžã«ç°¡åã«è¿œå ã§ããŸãã
ãŸããå¿ èŠãªããããã³ãã©ãŒãå«ãããã±ãŒãžãšãNFSãæäœããããã®ãŠãŒãã£ãªãã£ããã±ãŒãžïŒnfsv4ã¢ãžã¥ãŒã«ãšmount.nfs4ããã°ã©ã ïŒãã€ã³ã¹ããŒã«ããŸãã
pacman --root $root --dbpath $root/var/lib/pacman -S mkinitcpio-nfs-utils nfs-utils
ããã¯ãã©ã«ããŒããããããã³ãã©ãŒãä¿®æ£ããŸãïŒnfsmountãããŠã³ãããã³ãã³ãã®ä»£ããã«ãmount.nfs4ã䜿çšããŸãïŒã
sed s/nfsmount/mount.nfs4/ "$root/usr/lib/initcpio/hooks/net" > "$root/etc/initcpio/hooks/net_nfs4"
ã€ã³ã¹ããŒã«ãã©ã«ããŒãããã³ãã©ãŒã€ã³ã¹ããŒã©ãŒã䜿çšããŠãinifsã«nfsv4ã¢ãžã¥ãŒã«ãšmount.nfsv4ããã°ã©ã ãè¿œå ããŸãã ãŸããã¯ãŒã¯ããŒã¹ãã³ããŒããŠååãå€æŽããŸãã
cp $root/usr/lib/initcpio/install/net $root/etc/initcpio/install/net_nfs4
ããã§ã1ã€ã®buildïŒïŒé¢æ°ã®ã¿ãä¿®æ£ããæ®ãã¯å€æŽããŸããã
nano $root/etc/initcpio/install/net_nfs4 build() { add_checked_modules '/drivers/net/' add_module nfsv4? add_binary "/usr/lib/initcpio/ipconfig" "/bin/ipconfig" add_binary "/usr/bin/mount.nfs4" "/bin/mount.nfs4" add_runscript }
mkinitcpio.confãã¡ã€ã«ã®è¡ãä¿®æ£ããŠããã³ãã©ãŒãinitramfsã«è¿œå ããŸãã
nano $root/etc/mkinitcpio.conf HOOKS="base udev net_nfs4"
äœã觊ããªãå Žåãéåžžãé«égzipã¢ãŒã«ã€ãã䜿çšããŠinitramfsãã¡ã€ã«ãå§çž®ããŸãã å§çž®ãå¿ èŠãªã»ã©æ¥ãã§ããªãã®ã§ãxzã䜿çšããŸãã mkinitcpio.confãã¡ã€ã«ã®æ¬¡ã®è¡ããã³ã¡ã³ããåé€ããŸãã
COMPRESSION="xz"
xzã®ã¢ãŒã«ã€ãã«ã¯ããªãæéãããããŸãããinitramfsãã¡ã€ã«ã¯å°ãªããšã2ã3åçž®å°ãããŸãããã®ãããTFTPãµãŒããŒã¯ãããã¯ãŒã¯äžã§ã¯ããã«é«éã«è»¢éãããŸãã ãµãŒããŒããããªã»ãããã³ããŒããŠãæäœäžã«1ã€ã®initramfsãã¡ã€ã«ã®ã¿ãçæãããããã«ããmkinitcpioãå®è¡ããŸãã
cp /etc/mkinitcpio.d/habr.preset $root/etc/mkinitcpio.d/habr.preset && arch-chroot $root mkinitcpio -p habr
æåŸã«ãfstabãç·šéããŸãã ããã§ã¯ãäœæ¥ãæé©åããããã«ã«ãŒããã¡ã€ã«ã·ã¹ãã ãããŠã³ããããªãã·ã§ã³ãéžæã§ããŸãããäœãå€æŽããŸããã
echo "192.168.1.100:/diskless / nfs defaults 0 0" >> $root/etc/fstab
ããã§ãã¯ã©ã€ã¢ã³ãã·ã¹ãã ã®åºæ¬çãªã€ã³ã¹ããŒã«ãå®äºããŸããã ãã ããã°ã©ãã£ã«ã«ç°å¢ãšFirefoxã®èªåèµ·åãè¿œå ããããšèããŠããŸãã
Firefoxãèµ·åããŸã
ã·ã¹ãã ãå æããã¡ã¢ãªã®éãæžããããã«ã ã¹ã¯ãªãŒã³ãããŒãžã£ã®äœ¿çšãæŸæ£ããæãåçŽãªãŠã£ã³ããŠãããŒãžã£ ïŒããšãã°ãèªåãŠãŒã¶ãŒèªèšŒãŠãŒã¶ãŒåãæã€openboxïŒã«çŠç¹ãåœãŠãŸãã ã軜éãã³ã³ããŒãã³ãã䜿çšãããšãã·ã¹ãã ãèããåäœããæãå€ãããŒããŠã§ã¢ã§ãåäœããŸãã
VirtualBoxããµãŒããŒXãçŽ æµãªTTFãã©ã³ããopenboxãfirefoxããµããŒãããã¢ãžã¥ãŒã«ãã€ã³ã¹ããŒã«ããŸãïŒä»ã®ãã¹ãŠã®ã¢ãžã¥ãŒã«ã¯äŸåé¢ä¿ãšããŠã€ã³ã¹ããŒã«ãããŸãïŒïŒ
pacman --root $root --dbpath $root/var/lib/pacman -S virtualbox-guest-modules virtualbox-guest-utils xorg-xinit ttf-dejavu openbox firefox
virtualboxãµãŒãã¹ã®èµ·åãæå¹ã«ããŸãã
arch-chroot $root systemctl enable vboxservice
ãã¹ã¯ãŒããå ¥åããã«ãŠãŒã¶ãŒåã®èªåãã°ã€ã³ãè¿œå ããŸãããããè¡ãã«ã¯ãagettyèµ·åè¡ãå€æŽããŸãã
mkdir $root/etc/systemd/system/getty@tty1.service.d && \ echo -e "[Service]\nExecStart=\nExecStart=-/usr/bin/agetty --autologin username --noclear %I 38400 linux Type=simple %I" > $root/etc/systemd/system/getty@tty1.service.d/autologin.conf
ãŠãŒã¶ãŒã®æ¿èªåŸããã«ãã/ .bash_profileãã¡ã€ã«ããŠãŒã¶ãŒã®ããŒã ãã©ã«ããŒããå®è¡ãããã°ã©ãã£ãã¯ãµãŒããŒã®èªåèµ·åãè¿œå ãããŸãã
echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx &> /dev/null' >> $root/home/username/.bash_profile
XãµãŒããŒã®èµ·åæã«ãopenboxãèµ·åããŸãã
cp $root/etc/X11/xinit/xinitrc $root/home/username/.xinitrc && echo 'exec openbox-session' >> $root/home/username/.xinitrc
ãã¡ã€ã«ã®æåŸã«ãã次ã®è¡ãã³ã¡ã³ãã¢ãŠãããŸãïŒtwmè¡ããopenboxã«è¿œå ããè¡ãŸã§ã§ããããããå«ã¿ãŸããïŒïŒ
cat $root/home/username/.xinitrc # twm & # xclock -geometry 50x50-1+1 & # xterm -geometry 80x50+494+51 & # xterm -geometry 80x20+494-0 & # exec xterm -geometry 80x66+0+0 -name login exec openbox-session
Openboxæ§æãã¡ã€ã«ãã³ããŒãã
mkdir -p $root/home/username/.config/openbox && cp -R $root/etc/xdg/openbox/* $root/home/username/.config/openbox
Fireboxãè¿œå ããŠãopenboxç°å¢ã§èªåããŒãããŸãã
echo -e 'exec firefox habrahabr.ru/post/253573/' >> $root/home/username/.config/openbox/autostart
ã¹ãŒããŒãŠãŒã¶ãŒã«ä»£ãã£ãŠãŠãŒã¶ãŒã®ããŒã ãã©ã«ããŒã§ãŠãŒã¶ãŒåããã¹ãããããã圌ã®ãã©ã«ããŒã«ãããã¹ãŠã®ãã¡ã€ã«ã«å¯Ÿããæš©éãè¿ãå¿ èŠããããŸãã
chown -R username $root/home/username
ãããã¯ãŒã¯çµç±ã§èµ·åããããã®ã·ã¹ãã ã®æºåã¯å®äºããŸãããããŒããµãŒããŒã®ã»ããã¢ããã«ç§»ããŸãããã ããŠã³ããŒãã«å¿ èŠãªãã®ã¯æ¬¡ã®ãšããã§ãã
- ãããã¯ãŒã¯ã«ãŒãæ§æçšã®BOOTPãããã³ã«ãµããŒããåããDHCPãµãŒããŒã
- $ root / boot / grubãã©ã«ããŒã«ããããŒãããŒããŒãšvmlinuzããã³initramfsãã¡ã€ã«ã転éããããã®TFTPãµãŒããŒã
- ã«ãŒããã¡ã€ã«ã·ã¹ãã ããã¹ãããNFSãµãŒããŒãããã¯ã$ã«ãŒããã©ã«ããŒã«ãããŸãã
ããŒããµãŒããŒãæ§æãã
ãã€ããŒãªå€æŽã䌎ããããªãã¹ãããã¯ãwikiãããã®èšäºãç¹°ãè¿ããŸãã®ã§ãç§ã®åŽã§ã®ã³ã¡ã³ãã¯æå°éã«ããŸãã
DHCPãµãŒããŒãã€ã³ã¹ããŒã«ãã
ããã±ãŒãžãããŠã³ããŒãããŸãã
pacman -S dhcp
æ§æãã¡ã€ã«/etc/dhcpd.confã®å 容ã次ã®åœ¢åŒã«ããŸãã
mv /etc/dhcpd.conf /etc/dhcpd.conf.old
nano /etc/dhcpd.conf
# BOOTP allow booting; allow bootp; # , ( , BOOTP , PXE ) authoritative; # ( ) option architecture code 93 = unsigned integer 16; # ( ) subnet 192.168.1.0 netmask 255.255.255.0 { # , class "pxe_client" { match if exists architecture; } pool { # : if option architecture = 7 { filename "/grub/x86_64-efi/core.efi"; } else { filename "/grub/i386-pc/core.0"; } # TFTP , , , , DHCP next-server 192.168.1.100; # , ( ) default-lease-time 600; max-lease-time 7200; option domain-name-servers 192.168.1.1; option routers 192.168.1.1; range 192.168.1.128 192.168.1.192; # , allow members of "pxe_client"; } }
ã芧ã®ãšãããDHCPãµãŒããŒã¯PXEã¯ã©ã€ã¢ã³ãããã®DHCPDISCOVERèŠæ±ã«ã®ã¿å¿çããæ®ãã¯åã«ç¡èŠãããŸãã
DHCPãµãŒããŒãèµ·åããŸãã
systemctl start dhcpd4
TFTPãµãŒããŒãã€ã³ã¹ããŒã«ãã
å¿ èŠãªããã±ãŒãžãããŠã³ããŒãããŠã€ã³ã¹ããŒã«ããŸãã
pacman -S tftp-hpa
$ root / bootãã©ã«ããŒã«é 眮ããããŒãããŒããŒãã¡ã€ã«ãžã®ã¢ã¯ã»ã¹ãæäŸããã«ã¯ãTFTPãµãŒããŒãå¿ èŠã§ãã ãããè¡ãã«ã¯ãå®èšŒæžã¿ã®æ¹æ³ã§ãµãŒãã¹ã®éå§ãå€æŽããŸãã
mkdir -p /etc/systemd/system/tftpd.service.d && echo -e '[Service]\nExecStart=\nExecStart=/usr/bin/in.tftpd -s /srv/nfs/diskless/boot' > /etc/systemd/system/tftpd.service.d/directory.conf
æåã®è¡ "ExecStart ="ã¯ãå ã®ãã¡ã€ã«$ root / usr / lib / systemd / system / tftpd.serviceã§æå®ãããã³ãã³ãã®å®è¡ããã£ã³ã»ã«ãã代ããã« "/usr/bin/in.tftpd -s / srv / nfs / disklessãå®è¡ããŸã/ããŒã "ã ãµãŒãã¹ã1åéå§ãããå Žåã®ã¿ïŒType = oneshotïŒãExecStart =ã®è€æ°ã®è¡ã䜿çšããŠãã³ãã³ãã次ã ã«å®è¡ã§ããŸãã ããã§ã¯ãªãããã1ã€ã®ã³ãã³ãããã£ã³ã»ã«ããŠå¥ã®ã³ãã³ããå®è¡ããŸãã
TFTPãµãŒããŒãéå§ããŸãã
systemctl start tftpd.socket tftpd.service
NFSãµãŒããŒãã€ã³ã¹ããŒã«ãã
ããã±ãŒãžãããŠã³ããŒãããŸãã
pacman -S nfs-utils
ã·ã¹ãã ãã€ã³ã¹ããŒã«ãããã©ã«ããŒãããšã¯ã¹ããŒãããããªã¹ãã«è¿œå ããŸãã
echo -e "/srv/nfs 192.168.1.0/24(rw,fsid=root,no_subtree_check,no_root_squash)\n$root 192.168.1.0/24(rw,no_subtree_check,no_root_squash)" >> /etc/exports
NFS v.4æ§æã䜿çšããããšãå¿ããªãã§ãã ãããããã¯ãfsid = rootïŒä»ã®ãã¹ãŠã®ãšã¯ã¹ããŒãããããã©ã«ããŒã«é¢é£ããã«ãŒããäœãæ©èœããªãïŒãæã€ãã©ã«ããŒã«çžå¯Ÿçãªãã¹ã瀺ããŸãã
NFSãµãŒããŒã®æäœãæäŸãããµãŒãã¹ãéå§ããŸãã
systemctl start rpcbind nfs-server
ããã§ãããŒããµãŒããŒã䜿çšããæºåãæŽããŸããã
ãããã¯ãŒã¯çµç±ã§ããŒãããããšããŸã
tcpdumpããã°ã©ã ã䜿çšããŠãµãŒããŒããããŠã³ããŒãããããã»ã¹ã«åŸããŸã
pacman -S tcpdump tcpdump -v '( \ src host 0.0.0.0 and udp[247:4] = 0x63350101) or ( \ dst host HabraBoot and dst port tftp) or ( \ dst host HabraBoot and tcp[tcpflags] == tcp-syn)'
æåã®è¡ã¯ãPXEã¯ã©ã€ã¢ã³ãããã®DHCPDISCOVERèŠæ±ãããã£ãããããŸãã 2è¡ç®ã§ãã£ã«ã¿ãªã³ã°ãããåºåã«ã¯ãTFTPã«ãã£ãŠèŠæ±ããããã¹ãŠã®ãã¡ã€ã«ã®ååããªã¹ããããŸãã 3è¡ç®ã¯ãNFSæ¥ç¶ã®æåã«éä¿¡ããã2ã€ã®tcp-synèŠæ±ã瀺ããŠããŸãïŒæåã®æ¥ç¶ã¯ããããã³ãã©ãŒã«ãã£ãŠè¡ããã2çªç®ã®åæ¥ç¶ã¯fstabãã¡ã€ã«ã®åŠçäžã«çºçããŸãïŒã
æ°ããä»®æ³ãã·ã³ãäœæããŸããç°¡æœã«ããããããã¯ã©ã€ã¢ã³ãããšåŒã³ãŸãã ãããã¯ãŒã¯èšå®ã§ãæ¥ç¶ã®çš®é¡ããããã¯ãŒã¯ããªããžããå床æå®ãããã·ã³ã®é»æºãå ¥ããŸãã ããã«ããŒããŒãã®F12ããŒãæŒããŠèµ·åããã€ã¹ãéžæãã次ã«lããŒãæŒããŠãããã¯ãŒã¯çµç±ã§èµ·åããŸãã
ããŠã³ããŒããå®äºãããŸã§åŸ ã¡ãŸãã ãã¹ãŠãæ£åžžã§ããå ŽåããµãŒããŒäžã§äœ¿çšãããµãŒãã¹ãèªåããŒãã«è¿œå ããŸãã
systemctl enable tftpd.socket tftpd.service dhcpd4 rpcbind nfs-server
åãããŒããµãŒããŒã§èµ·åãããã¹ãŠã®DHCPãTFTPãããã³NFSãµãŒããŒã ããã¯ãªãã·ã§ã³ã§ãã ããšãã°ãMikrotikã«ãŒã¿ãŒã¯BootpããµããŒãããŠãããTFTPãšããŠäœ¿çšã§ããŸããå¿ èŠãªãã¡ã€ã«ããã¹ãŠã¢ããããŒããããããã¯ãŒã¯èšå®ã確èªããã ãã§ãã
ããŒããŠã§ã¢ãããªã«ãŒãçšã®ãã©ã€ããŒãã€ã³ã¹ããŒã«ããªãã£ããããã°ã©ãã£ã«ã«ç°å¢ã¯VirtualBoxã§ã®ã¿æ©èœããŸãã 次ã®èšäºã§é©åãªãã©ã€ããŒãèªåçã«éžæããåé¡ã解決ããŸã ã åæã«ãã·ã¹ãã ã®èªã¿èŸŒã¿ãé«éåãããã©ã€ãã€ã¡ãŒãžãã«ããŸãã