自动化安装的linux系统镜像

本文发布时间: 2019-Mar-22
第一步生成ks.cfg文件我这里使用的远程连接工具是Xmanager Enterprise 4,可以支持在当前系统上打开远程主机的图形软件界面。1、首先确认kickstart是否安装,没有安装的话使用yum进行安装#检查 kickstart是否安装 [root@lovelace ~]# rpm -qa | grep kickstart system-config-kickstart-2.6.19.9-2.el5 pykickstart-0.43.9-1.el5 #使用yum安装 kickstart [root@lovelace ~]# yum install system-config-kickstart -y Loaded plugins: katello, security Repository rhel-debuginfo is listed more than once in the configuration Unable to read consumer identity Setting up Install Process Package system-config-kickstart-2.6.19.9-2.el5.noarch already installed and latest version Nothing to do2、启动Xmanager - Passive服务,然后在终端上输入命令system-config-kickstart & 如果执行上面的命令弹出错误,请在终端输入以下两条命令3、再次进行测试,如果还不成功,请查看服务是否开启,上面两条命令执行是否成功注:这里为了方便大家进行配置,直接在现有系统的基础上进行编辑。4、在弹出的图形界面点击文件---->打开文件---->root目录下---->anaconda-ks.cfg文件---->确定。5、开始我们的ks.cfg文件编辑过程(选择语言,键盘类型,时区,设置根口令,安装后是否重启引导系统,在文本模式下进行安装)6、安装方法的选择(这里我们是对磁盘进行全新封装的,选择执行新安装,安装方法为光盘驱动器)7、引导装载程序选项,(给内核传递参数rhgbquiet,其他默认即可)8、分区信息设置,这里我们新建三个分区(/分区:5G,/boot:200M,swap分区:1G)9、网络配置(这里选择添加eth0网卡,IP为dhcp自动分配)10、验证方式默认即可11、防火墙配置(这里选择禁用)12、显示配置(这里我们选择安装X界面,色彩深度调整为16,RHEL上默认安装的是gnome)13、软件包安装选择(按需自定义选择)14、预安装脚本(按需进行设置)15、安装后脚本(按需进行设置)14、保存配置好的文件(可自定义存放路径,这里我们存放到/home目录下)查看生成的ks.cfg配置文件#验证ks.cfg文件是否存在 [root@lovelace home]# pwd;ll ks.cfg /home-rw-r--r-- 1 root root 1649 05-27 04:20 ks.cfg查看ks.cfg文件具体参数请查看kickstart文档[root@lovelace home]# cat ks.cfg #platform=x86, AMD64, 或 Intel EM64T # System authorization information auth --useshadow --enablemd5 # System bootloader configuration bootloader --append="rhgb quiet" --location=mbr --driveorder=sda # Partition clearing information clearpart --none # Use text mode install text # Firewall configuration firewall --disabled # Run the Setup Agent on first boot firstboot --disable key --skip # System keyboard keyboard us # System language lang en_US # Installation logging level logging --level=info # Use CDROM installation media cdrom # Network information network --bootproto=dhcp --device=eth0 --onboot=on # Reboot after installation reboot #Root password rootpw --iscrypted $1$/3RmiuX/$ZqpoSJEqBLYu93wL6a60R1 # SELinux configuration selinux --enforcing # System timezone timezone --isUtc Asia/Shanghai# Install OS instead of upgrade install# X Window System configuration information xconfig --defaultdesktop=GNOME --depth=8 --resolution=640x480 # Disk partitioning information part / --bytes-per-inode=4096 --fstype="ext3" --size=6000 part /boot --bytes-per-inode=4096 --fstype="ext3" --size=200 part swap --bytes-per-inode=4096 --fstype="swap" --size=1024 %packages @base @development-libs @core @development-tools @sound-and-video @x-software-development @gnome-desktop @base-x @printing @gnome-software-development @admin-tools @legacy-software-support @editors @text-internet @dialup @graphics @office @java @graphical-internet @games kexec-tools iscsi-initiator-utils fipscheck device-mapper-multipath sgpio python-dmidecode imake emacs libsane-hpaio mesa-libGLU-devel xorg-x11-utils xorg-x11-server-Xnest xorg-x11-server-Xvfb第二步:修改isolinux.cfg配置文件(有多种方向进行选择,这里不再演示)修改后内容为(Note:网上好多关于这个配置文件各不相同,只要能够实验成功就行)[root@lovelace home]# cat isolinux.cfg default ks prompt 1 timeout 60 display boot.msg F1 boot.msg F2 options.msg F3 general.msg F4 param.msg F5 rescue.msg label linux kernel vmlinuz append initrd=initrd.img label text kernel vmlinuz append initrd=initrd.img text label ks kernel vmlinuz append ks=cdrom:/ks.cfg initrd=initrd.img label locallocalboot 1 label memtest86 kernel memtest append -第三步:重新封装iso镜像文件(win下操作)1、打开原版iso镜像文件(删除自动的isolinux.cfg文件,然后把我们重新编辑过的文件添加进去)2、添加我们制作的ks.cfg文件到光盘根目录下,然后进行iso文件生成即可第四步:测试安装(这里截两张图验证下)后记:其实做这个也没有多大意义,因为生产环境中都是批量部署的,这里希望大家能够了解下关于ks.cfg文件的编辑方法,如果你很熟悉的话,也可以脱离图形编辑,直接命令行进行设置…..存在的bug:1、安装后swap分区没有被自动挂载2、没有对系统包和组件进行裁剪,只是添加了ks.cfg文件和对isolinux.cfg文件进行了添加和修改3、进入系统后没有主机名为.不知道是啥情况4、只在虚拟机上进行验证那位有经验的大牛告知一下……….


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:10pm
栏目列表