[心得] UEFI PXE Server架設 (RHEL6)

看板Linux作者 (Sand)時間14年前 (2011/08/13 08:52), 編輯推噓3(301)
留言4則, 4人參與, 最新討論串1/1
最近研究完UEFI PXE Server架設 這邊與各位分享 以下是用Shell Script寫法 附上說明 #!/bin/bash # 這個Shell Script適用在RHEL6來架設UEFI PXE Server # 網路IP請先設定好 這邊使用的是192.168.100.100當範例 # 請將RHEL6的DVD資料cp到/var/ftp/RHEL6 # 1. Install all service # 請確認你的yum server有先架設起來 # 參考src.repo檔案寫法 # [src] # name=src # baseurl=file:///var/ftp/RHEL6/ yum -y install tftp-server dhcp vsftpd # 2. Config all service # (1) tftp server # tftp部份 只要將原始檔的disable=yes改成no即可 echo "service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot disable = no per_source = 11 CPUS = 100 2 flags = IPv4 }" > /etc/xinetd.d/tftp chkconfig tftp on service xinetd restart # (2) vsftp server # 這邊看個人需求 具有匿名下載的基本功能即可 chkconfig vsftpd on service vsftpd restart # (3) dhcp server # 這邊做的是將efiboot.img掛載起來 然後複製必要檔案到tftp server mkdir /efiboot mount -o loop /var/ftp/RHEL6/images/efiboot.img /efiboot cp -R /efiboot/EFI/BOOT/* /var/lib/tftpboot/ # 這邊是dhcpd的config # 指定的區段是.50到.250 echo "ddns-update-style none; ignore client-updates; allow booting; allow bootp; subnet 192.168.100.0 netmask 255.255.255.0 { range 192.168.100.50 192.168.100.250; option routers 192.168.100.254; option subnet-mask 255.255.255.0; next-server 192.168.100.100; # next-server是重點 代表指引Client的目標Server IP filename \"BOOTX64.efi\"; # 這邊與Legacy BIOS的檔案不同 UEFI使用的是efi檔案做開機 # 也就是剛剛掛載的image複製出來的檔案之一 }" > /etc/dhcp/dhcpd.conf umount /efiboot rmdir /efiboot chkconfig dhcpd on service dhcpd start # (4) make boot menu echo "default=0 timeout 10 splashimage=(nd)/splash.xpm.gz # nd代表network device 指定從網路介面去讀取splash.xpm.gz # 成功的話 Client連結到時 menu會在螢幕正中間 而不是左上角 title RHEL6 root (nd) # nd是重點 splashimage /splash.xpm.gz kernel /vmlinuz keymap=us lang=en_US method=ftp://192.168.100.100/RHEL6 ip=dhcp noipv6 # 這邊指定的是Server的RHEL6光碟檔案放置處 採用dhcp的方式 initrd /initrd.img title Kickstart root (nd) kernel /vmlinuz ks=ftp://192.168.100.100/ks.cfg initrd /initrd.img" > /var/lib/tftpboot/efidefault # 這個選單有兩種模式 預設是使用者自己手動安裝 # 第二種是kickstart來自動安裝 # (5) copy vmlinux cp /var/ftp/RHEL6/images/pxeboot/* /var/lib/tftpboot/ echo "Now you can test UEFI-PXE" # Kickstart file automatically generated by anaconda. # (6) ks.cfg 這個kickstart會清掉所有分割區 要套用前記得修改成自己要的 echo "#version=RHEL6 install url --url=ftp://192.168.100.100/RHEL6 # url指定的是Server的光碟檔案位置 lang en_US.UTF-8 keyboard us network --device eth0 --bootproto dhcp rootpw --iscrypted $6$e57ki/NcsLdO1lSv$UzC2Uv5aUbGt8o.vU9e6HNqyammGXj7WTL6WYEFXBn1YytM.1eA6jWhay8dLUw2me6gji9Irki8wx6cecGJS3/ # 密碼是設定成Aa123456 # 你也可以去掉這行 或是換成明碼 firewall --service=ssh authconfig --enableshadow --passalgo=sha512 --enablefingerprint selinux --enforcing timezone Asia/Taipei bootloader --location=partition --driveorder=sda --append="crashkernel=auto rhgb quiet" # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work clearpart --all --drives=sda part /boot/efi --fstype=efi --grow --maxsize=200 --size=20 part /boot --fstype=ext4 --size=500 part pv.oR0bde-SgcE-eiHl-Khvt-BRx9-NpmK-otQ5HU --grow --size=1 volgroup vg_urhel6 --pesize=4096 pv.oR0bde-SgcE-eiHl-Khvt-BRx9-NpmK-otQ5HU logvol / --fstype=ext4 --name=lv_root --vgname=vg_urhel6 --size=570596 logvol swap --name=lv_swap --vgname=vg_urhel6 --size=1024 repo --name="Red Hat Enterprise Linux" --baseurl=ftp://192.168.100.100/RHEL6/ --cost=100 %packages @additional-devel @base @compat-libraries @console-internet @core @debugging @basic-desktop @desktop-debugging @desktop-platform @desktop-platform-devel @development @directory-client @eclipse @fonts @general-desktop @graphical-admin-tools @hardware-monitoring @input-methods @java-platform @kde-desktop @large-systems @legacy-x @network-file-system-client @performance @perl-runtime @remote-desktop-clients @server-platform @server-platform-devel @server-policy @x11 httpd-devel pcre-devel libcap-devel libXinerama-devel openmotif-devel net-snmp-devel libgudev1-devel kdelibs-apidocs xz-devel libtopology-devel kdegraphics-devel libibverbs-devel libuuid-devel kdepimlibs-devel libblkid-devel papi-devel libXmu-devel unique-devel xorg-x11-proto-devel gmp-devel kdepim-devel sane-backends-devel perl-Test-Pod kdemultimedia-devel startup-notification-devel libudev-devel cups-devel gstreamer-plugins-base-devel unixODBC-devel tcl-devel numactl-devel libgnomeui-devel libbonobo-devel perl-Test-Pod-Coverage libtiff-devel junit SDL-devel libXau-devel tcp_wrappers-devel PyQt4-devel kdenetwork-devel kdelibs-devel libgcrypt-devel popt-devel libusb-devel hunspell-devel iptables-devel libdrm-devel libXrandr-devel libxslt-devel kdebase-devel tk-devel libnl-devel libXpm-devel expat-devel e2fsprogs-devel kdebase-workspace-devel libglade2-devel libaio-devel gnutls-devel kdesdk-devel fuse-devel libXaw-devel libhugetlbfs-devel mtools pax python-dmidecode oddjob squashfs-tools sgpio genisoimage wodim sabayon-apply control-center-extra xguest tigervnc-server oprofile-gui abrt-gui xrestop systemtap-grapher bltk qt-mysql qt3-ODBC qt-odbc qt-postgresql qt3-PostgreSQL qt3-MySQL kdesdk gnome-common qt-doc gtk2-devel-docs glade3 desktop-file-utils gnome-devel-docs systemtap-sdt-devel mod_dav_svn ElectricFence ant libstdc++-docs gcc-gnat expect dejagnu perltidy cmake imake babel rpmdevtools compat-gcc-34 systemtap-server gcc-java compat-gcc-34-g77 jpackage-utils bzr mercurial chrpath gcc-objc rpmlint gcc-objc++ compat-gcc-34-c++ python-docs nasm certmonger pam_krb5 krb5-workstation nscd pam_ldap nss-pam-ldapd eclipse-mylyn-cdt eclipse-pde eclipse-mylyn-pde eclipse-mylyn-wikitext eclipse-mylyn-trac eclipse-subclipse-graph eclipse-mylyn-webtasks cjkuni-fonts-ghostscript bitmap-fixed-fonts bitmap-lucida-typewriter-fonts krb5-auth-dialog gnome-pilot-conduits gconf-editor dvgrab alacarte seahorse-plugins rhythmbox-upnp gnome-games gedit-plugins gnome-pilot totem-upnp vim-X11 sabayon system-config-lvm audit-viewer setroubleshoot firstaidkit-gui system-config-kickstart policycoreutils-gui kdebase-workspace-akonadi kdebase-workspace-python-applet xorg-x11-twm openmotif xorg-x11-fonts-ISO8859-1-75dpi xterm xorg-x11-fonts-cyrillic xorg-x11-xdm xorg-x11-fonts-ISO8859-9-100dpi xorg-x11-fonts-ISO8859-14-100dpi xorg-x11-fonts-75dpi xorg-x11-fonts-ISO8859-9-75dpi libXmu xorg-x11-fonts-ISO8859-15-75dpi libXp openmotif22 xorg-x11-fonts-ISO8859-14-75dpi xorg-x11-fonts-ISO8859-2-75dpi xorg-x11-fonts-ethiopic xorg-x11-fonts-ISO8859-2-100dpi papi perl-DBD-SQLite spice-xpi tsclient rdesktop vinagre tigervnc spice-client wacomcpl %end " > /var/ftp/ks.cfg chmod 777 /var/ftp/ks.cfg # 要注意權限問題 免得Client無法下載ks.cfg -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.116.209.95 ※ 編輯: h5210h 來自: 122.116.209.95 (08/13 09:01)

08/13 10:02, , 1F
好文
08/13 10:02, 1F

08/13 16:00, , 2F
先收下,謝謝
08/13 16:00, 2F

08/18 13:35, , 3F
好文
08/18 13:35, 3F

01/18 09:51, , 4F
補充一下:目前已知RHEL6.1做UEFI Pxe會kernel panic
01/18 09:51, 4F
文章代碼(AID): #1EHShNL9 (Linux)