首页 > 代码库 > 无人值守安装RHEL6
无人值守安装RHEL6
环境:Vmware workstation 12
系统:RHEL6
方法:FTP+TFTP+DHCP+Kickstart+PXE
准备两台虚拟机一台为已安装系统的虚拟机(IP:192.168.100.110),另一台为刚创建并未安装系统的虚拟机,上网方式均为仅主机模式
1、 安装vsftpd并开启服务:
[root@kickstart ~]# yum -y install vsftpd [root@kickstart ~]# service vsftpd start Starting vsftpd for vsftpd: [ OK ]
2、 安装TFTP,修改配置并开启服务
[root@kickstart ~]# yum -y install tftp [root@kickstart ~]# yum -y install tftp-server [root@kickstart ~]# vim /etc/xinetd.d/tftp
修改后配置文件内容如下
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 }
启动服务
[root@kickstart ~]# service xinetd start
Starting xinetd: [ OK ]
3、 安装DHCP,修改配置文件并开启服务
[root@kickstart ~]# yum -y install dhcp [root@kickstart ~]# vim /etc/dhcp/dhcpd.conf
修改配置文件内容如下
subnet 192.168.100.0 netmask 255.255.255.0 { option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.100.150 192.168.100.200; default-lease-time 21600; max-lease-time 43200; next-server 192.168.100.110; filename "pxelinux.0"; }
启动DHCP服务
[root@kickstart ~]# service dhcpd start
Starting dhcpd: [ OK ]
4、 挂载光盘到指定的目录
[root@kickstart ~]# mount /dev/cdrom /var/ftp/pub mount: block device /dev/sr0 is write-protected, mounting read-only
5、 安装kickstart软件
[root@kickstart ~]# yum -y install system-config-kickstart.noarch
6、 配置PXE启动所需要的相关文件
[root@kickstart ~]# mkdir /tftpboot [root@kickstart ~]# mkdir /tftpboot/pxelinux.cfg [root@kickstart ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/ [root@kickstart ~]# cp /var/ftp/pub/isolinux/vesamenu.c32 /tftpboot/ [root@kickstart ~]# cp /var/ftp/pub/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default [root@kickstart ~]# cp /var/ftp/pub/images/pxeboot/initrd.img /tftpboot/ [root@kickstart ~]# cp /var/ftp/pub/images/pxeboot/vmlinuz /tftpboot/ [root@kickstart ~]# chmod 644 /tftpboot/pxelinux.cfg/default
[root@kickstart ~]# vim /tftpboot/pxelinux.cfg/default
修改后配置文件如下
default vesamenu.c32 #prompt 1 timeout 600 display boot.msg menu background splash.jpg menu title Welcome to Red Hat Enterprise Linux 6.5! menu color border 0 #ffffffff #00000000 menu color sel 7 #ffffffff #ff000000 menu color title 0 #ffffffff #00000000 menu color tabmsg 0 #ffffffff #00000000 menu color unsel 0 #ffffffff #00000000 menu color hotsel 0 #ff000000 #ffffffff menu color hotkey 7 #ffffffff #ff000000 menu color scrollbar 0 #ffffffff #00000000 label linux menu label ^Install or upgrade an existing system menu default kernel vmlinuz append initrd=initrd.img ks=ftp://192.168.100.110/ks.cfg label vesa menu label Install system with ^basic video driver kernel vmlinuz .......
7、 生成ks.cfg安装配置文件
[root@kickstart ~]# system-config-kickstart
生成的文件内容如下
#platform=x86, AMD64, or Intel EM64T #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use network installation url --url="ftp://192.168.100.110/pub" # Root password rootpw --iscrypted $1$2V2M0UoY$iZIbOYCiKD44lXBUEsOnh1 # System authorization information auth --useshadow --passalgo=sha512 # Use graphical install graphical 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 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=200 part swap --fstype="swap" --size=2048 part / --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 @x11 mtools pax python-dmidecode oddjob wodim sgpio genisoimage device-mapper-persistent-data abrt-gui samba-winbind certmonger pam_krb5 krb5-workstation libXmu perl-DBD-SQLite %end
将ks文件复制到指定目录
[root@kickstart ~]# cp ks.cfg /var/ftp/
8、 开始进行无人值守安装
开启另外一个虚拟机,系统将自动进行安装
无人值守安装RHEL6
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。