之前 《RHEL在VLAN Trunk模式下的IP地址配置》这篇博客中,讲述了如何设置这种变态的网络配置,原本是打算直接在这台服务器上面安装KICKSTART相关组件进行网络安装的,2笼刀片,16片刀,一台一台的安装着实非常累人,再加上操作的环境并不是在客户那边进行的,网络延迟非常严重,以至于安装一个系统需要2个小时的时间,而且有可能安装到最后报错了。
最终,跟客户那边的工程师进行了相关沟通,将网络配置成比较“舒服”的环境,本人对网络不是很懂,一般而言我在客户那边部署产品应用,很简单,给我IP地址或者IP地址段,我在RHEL操作系统上面直接对eth*进行配置就可以使用,所以这次同样提出这样的要求,毕竟大家都是搞技术的,要求人家完全同意了。今天就把这个变更做完了,简单测试了一下,ifconfig eth0 xx.xx.xx.x netmask xx.xx.xx.x ,然后就很顺利的通了。
虽然标题为RHEL网络安装刀片服务器,其实说白了,不就是RHEL通过kickstart无人值守安装普通的机器而已,刀片服务器,PC机对我们而言不都一样嘛。因为之前一直没有将kickstart的配置方法整理到自己博客上面来,很多时候,还是在网络上面现找现用,以致效率有点低。
言归正传,下面开始对Kickstart无人值守安装相关步骤进行简要说明并记录如下:
1. 配置yum源,安装如下服务
[root@blog01 ~]# mount -o loop /var/www/html/isos/rhel-server-6.3-x86_64-dvd.iso /media/ [root@blog01 ~]#cat /etc/yum.repos.d/core.repo [core] name=rhel6u3_core baseurl=file:///media/ enabled=1 gpgcheck=0 [root@blog01 ~]# yum install dhcp vsftpd tftp tftp-server -y [root@blog01 ~]#chkconfig dhcpd on ; chkconfig vsftpd on ; chkconfig xinetd on
2. 相关服务配置文件修改
1) tftp 相关修改
[root@blog01 ~]# cat /etc/xinetd.d/tftp # default: off # description: The tftp server serves files using the trivial file transfer \ # protocol. The tftp protocol is often used to boot diskless \ # workstations, download configuration files to network-aware printers, \ # and to start the installation process for some operating systems. service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /tftpboot disable = no per_source = 11 cps = 100 2 flags = IPv4 }
修改16行 server_args 的目录为/tftpboot
修改17行 disable 设置为no,表明tftp允许被托管
[root@blog01 ~]# service xinetd restart //重启xinetd进程
2) dhcp相关修改
[root@blog01 ~]# cat /etc/dhcp/dhcpd.conf ddns-update-style interim; ignore client-updates; subnet 10.196.28.0 netmask 255.255.255.0 { option routers 10.196.28.254; option subnet-mask 255.255.255.0; filename "pxelinux.0"; next-server 10.196.28.43; option domain-name-servers 8.8.8.8; range dynamic-bootp 10.196.28.33 10.196.28.100; default-lease-time 21600; max-lease-time 43200; } host blog05 { hardware ethernet 38:EA:A7:A1:FC:7C; fixed-address 10.196.28.47; } host blog06 { hardware ethernet 38:EA:A7:A1:FA:A8; fixed-address 10.196.28.48; } host blog07 { hardware ethernet 38:EA:A7:A1:F6:DC; fixed-address 10.196.28.49; } host blog08 { hardware ethernet 38:EA:A7:A1:FC:58; fixed-address 10.196.28.50; } host blog09 { hardware ethernet 38:EA:A7:A1:FE:3E; fixed-address 10.196.28.78; }
启动dhcp服务
[root@blog01 ~]# service dhcpd start Starting dhcpd: [ OK ]
3)vsftpd 相关配置
安装好,无需任何配置,启动服务,直接使用
[root@blog01 ~]# service vsftpd start
3. 配置kickstart,准备相关文件
[root@blog01 ~]# yum install system-config-kickstart -y [root@blog01 ~]# mkdir /tftpboot [root@blog01 ~]# mkdir /tftpboot/pxelinux.cfg [root@blog01 ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/ [root@blog01 ~]# cp /media/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default [root@blog01 ~]# cp /media/isolinux/* /tftpboot/ [root@blog01 ~]# chmod 644 /tftpboot/pxelinux.cfg/default [root@blog01 ~]#cat /tftpboot/pxelinux.cfg/default //查看如下信息,添加ks.cfg位置 label linux menu label ^Install or upgrade an existing system menu default kernel vmlinuz append initrd=initrd.img ks=ftp://10.196.28.43/pub/ks.cfg
4.生成ks.cfg文件
[root@blog01 ~]
#
system-config-kickstart
具体步骤在此不具体说明,贴出最终ks.cfg文件,如下
[root@SJC42KVM01 ~]# cat /var/ftp/pub/ks.cfg #platform=x86, AMD64, or Intel EM64T #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use network installation url --url="ftp://10.196.28.43/pub" # Root password rootpw --iscrypted $1$eTN.ZnVf$Kprjai3Hzn.qEbSnepP5R/ # System authorization information auth --useshadow --passalgo=sha512 # Use text mode install text firstboot --disable # System keyboard keyboard us # System language lang en_US # SELinux configuration selinux --disabled # Installation logging level logging --level=info # Reboot after installation reboot # System timezone timezone --isUtc Asia/Shanghai # Network information network --bootproto=dhcp --device=eth0 --onboot=on # System bootloader configuration bootloader --location=mbr # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel # Disk partitioning information part /boot --fstype="ext4" --size=400 part swap --fstype="swap" --size=12000 part / --asprimary --fstype="ext4" --grow --size=1 %packages @base @client-mgmt-tools @core @debugging @basic-desktop @desktop-debugging @desktop-platform @directory-client @fonts @general-desktop @graphical-admin-tools @input-methods @internet-browser @java-platform @legacy-x @network-file-system-client @perl-runtime @print-client @remote-desktop-clients @server-platform @server-policy @virtualization @virtualization-client @virtualization-platform @virtualization-tools @x11 pax python-dmidecode oddjob wodim sgpio genisoimage mtools abrt-gui certmonger pam_krb5 krb5-workstation libXmu perl-DBD-SQLite qemu-kvm-tools qemu-guest-agent libvirt-snmp fence-virtd-serial fence-virtd-multicast libvirt-java libvirt-cim fence-virtd-libvirt libvirt-qmf perl-Sys-Virt libguestfs-java virt-v2v libguestfs-tools %end
拷贝kc.cfg至/var/ftp/pub目录中
[root@blog01 ~ ]# cp ks.cfg /var/ftp/pub/ks.cfg [root@blog01 ~ ]# rsync -avP /media/ /var/ftp/pub/
5.清空防火墙规则,关闭selinux
[root@blog01 ~ ]# iptables -F;iptables -X; iptables -Z [root@blog01 ~ ]# service iptables save; service iptables restart [root@blog01 ~ ]# setenforce 0 [root@blog01 ~ ]# sed -i 's/enforcing/disabled/g' /etc/selinux/config
6.设置刀片第一次从PXE启动
然后通过ILO控制刀片启动即可,等待安装!
普通PC设置更加简单,你会的!