快速入门:如何执行无提示的kickstart Linux安装。
您很清楚,在安装Linux操作系统时,需要输入很多输入,例如IP地址,主机名,分区详细信息,root密码等。 以及何时需要按主机数量执行此操作。 对于Linux安装,当然有一个VMWare映像选项。 但是您也可以执行自动Kickstart Linux安装。 本文将教您如何以最低的要求执行无提示的Kickstart Linux安装。
请注意:我们不使用任何DHCP服务器进行IP分配,而是从VMware使用它。 在此演示中,我们使用了以下内容:
- 8 VMware Workstation
- Kickstart文件
- FTP服务器(我们通过FTP共享kickstart文件)进行网络安装。
因此,让我们直接进入自动Linux kickstart安装。
第1步: FTP服务器
我们在带有FTP的VMware内部运行了IP地址为“ 192.168.216.134”的RHEL服务器。
步骤2:Kickstart文件
每当您安装任何RHEL服务器时,都会生成默认文件“ /root/anaconda-ks.cfg”:
[[email protected] ~]# ll /root/anaconda-ks.cfg -rw-------. 1 root root 1394 Dec 27 12:05 /root/anaconda-ks.cfg [[email protected] ~]#
您需要根据需要进行更改。 但是,此kickstart文件效果很好。 您可以使用相同的命令自动安装Linux kickstart。 创建一个文件“ /var/ftp/pub/anaconda-ks.cfg”,然后复制以下内容。
# Kickstart file automatically generated by anaconda. #version=DEVEL install cdrom lang ru_RU.UTF-8 keyboard ru #Network card Definition with hostname and all network --onboot yes --device eth0 --bootproto dhcp --noipv6 --hostname localhost.localdomain # grab the hash from an account in /etc/shadow that has the password you want to use this is hash of password "root987" rootpw --iscrypted $6$.Z9thd3gOdXvddLD$66rjO2syNkQ/8qRo3wjZI/9pg2W9U4PWXYzVr/3yra47k1TZfK2/ufwsWnXu.FA4I8pVj9RrlAjQk3lQld/ZQ/ firewall --service=ssh authconfig --enableshadow --passalgo=sha512 selinux --enforcing timezone --utc Europe/Moscow bootloader --location=mbr --driveorder=sda --append=" rhgb crashkernel=auto quiet crashkernel=auto quiet rhgb" # 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 --linux --drives=sda --all --initlabel ignoredisk --only-use=sda #part pv.008002 --grow --size=1 ### part /boot --fstype=ext4 --size=500 part /home --fstype=ext4 --size=10240 part swap --size=1024 part / --fstype=ext4 --grow --size=200 repo --name="Red Hat Enterprise Linux" --baseurl=file:///mnt/source --cost=100 %packages @Base @Core @base @client-mgmt-tools @console-internet @core @debugging @directory-client @hardware-monitoring @java-platform @large-systems @network-file-system-client @performance @perl-runtime @server-platform @server-policy certmonger krb5-workstation oddjob pam_krb5 pax perl-DBD-SQLite python-dmidecode sgpio %end
您可以参考上面一些参数的简短说明,以获取更多信息。 在上面的文件中,root密码的哈希值为“ root123”。 成功安装后,必须使用相同的root登录名。 您可以通过简单地从/ etc / shadow复制哈希值,将其更改为您喜欢的另一个强密码。
您可以使用以下命令检查以上文件中是否有错误。 空出口意味着一切都很好。
[[email protected] ~]# ksvalidator /var/ftp/pub/anaconda-ks.cfg [[email protected] ~]#
如果尚未安装ksvalidator,请使用以下命令进行安装。
[[email protected] ~]# yum install pykickstart
步骤3:在/var/ftp/pub/anaconda-ks.cfg中检查FTP。
现在,尝试从浏览器访问链接“ ftp://192.168.216.134/pub/anaconda-ks.cfg~~pobj”,以确保可以通过网络进行安装。 请注意,192.168.216.134是FTP服务器的IP地址。 您应该在浏览器中获得以下输出。
这就是您对服务器配置所做的。
步骤4:在VMWare Workstation中创建Guest VM。
现在,很容易在VMWare Workstation中创建一个具有RHEL 6 ISO虚拟机作为配置CD的示例。
步骤6:启动VM。
打开虚拟机。 安装后,使用向上或向下箭头键出现以下安装屏幕。
现在,在第一个选项(即“安装或更新现有系统”)上选择光标,然后按Tab键,以便我们可以更改该选项。 在命令行上发出以下命令。
vmlinuz initrd=initrd.img ks=ftp://192.168.216.134/pub/anaconda-ks.cfg
然后按Enter。
现在,除了最后一步中的重新启动消息外,您无需执行其他任何操作即可重新启动。 喝杯咖啡,享受自动Linux kickstart安装。 成功安装后,kickstart Linux将要求重新启动。