使用软件和平台
1、基于平台:                  Vmware workstation 8.0
2、基于系统镜像:               rhel-server-5.8-i386-dvd.iso  
3、ISO编辑软件:               UltraISO
4、自定义配置文件:             ks.cfg
5、需要重新编辑的配置文件:      isolinux.cfg
6、其他:                     针对不需要的文件包进行删减


第一步生成ks.cfg文件
我这里使用的远程连接工具是Xmanager Enterprise 4,可以支持在当前系统上打开远程主机的图形软件界面。
1、首先确认kickstart是否安装,没有安装的话使用yum进行安装
1
2
3
4
5
6
7
8
9
10
11
12
#检查 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 do
2、启动Xmanager - Passive服务,然后在终端上输入命令system-config-kickstart &  
如果执行上面的命令弹出错误,请在终端输入以下两条命令
3、再次进行测试,如果还不成功,请查看服务是否开启,上面两条命令执行是否成功

注:这里为了方便大家进行配置,直接在现有系统的基础上进行编辑。
4、在弹出的图形界面点击文件---->打开文件---->root目录下---->anaconda-ks.cfg文件---->确定。
5、开始我们的ks.cfg文件编辑过程(选择语言,键盘类型,时区,设置根口令,安装后是否重启引导系统,在文本模式下进行安装)
6、安装方法的选择(这里我们是对磁盘进行全新封装的,选择执行新安装,安装方法为光盘驱动器)

7、引导装载程序选项,(给内核传递参数rhgb quiet ,其他默认即可)

8、分区信息设置,这里我们新建三个分区(/分区:5G, /boot:200M, swap分区:1G)

9、网络配置(这里选择添加eth0网卡,IP为dhcp自动分配)

10、验证方式默认即可

11、防火墙配置(这里选择禁用)

12、显示配置(这里我们选择安装X界面,色彩深度调整为16,RHEL上默认安装的是gnome)

13、软件包安装选择(按需自定义选择)

14、预安装脚本(按需进行设置)

15、安装后脚本(按需进行设置)

14、保存配置好的文件(可自定义存放路径,这里我们存放到/home目录下)

查看生成的ks.cfg配置文件

1
2
3
4
#验证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文档

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
[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:网上好多关于这个配置文件各不相同,只要能够实验成功就行)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[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 local
localboot 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、只在虚拟机上进行验证

定制属于自己的自动化安装的linux系统镜像的更多相关文章

  1. 安装Ubuntu Linux系统时硬盘分区最合理的方法

    无论是安装Windows还是Linux操作系统,硬盘分区都是整个系统安装过程中最为棘手的环节,网上的一些Ubuntu Linux安装教程一般都是自动分区,给初学者带来很大的不便,下面我就根据多年来在合 ...

  2. 在本机使用虚拟机安装一个linux系统,并搭建ftp服务器

    一.Linux基础使用:linux服务器环境搭建(FTP服务器), 在本机使用虚拟机安装一个linux系统,并搭建ftp服务器,要求能使用ftp服务将本机文件到保存linux虚拟机上 资料: VMwa ...

  3. Cobbler全自动批量安装部署Linux系统

    说明: Cobbler服务器系统:CentOS 5.10 64位 IP地址:192.168.21.128 需要安装部署的Linux系统: eth0(第一块网卡,用于外网)IP地址段:192.168.2 ...

  4. 在新安装的Linux系统中,防火墙默认是被禁掉的,一般也没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件。

    原因:在新安装的Linux系统中,防火墙默认是被禁掉的,一般也没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件. 解决办法: .随便写一条iptables命令配 ...

  5. Redis进阶实践之一VMWare Pro虚拟机安装和Linux系统的安装(转载)(1)

    Redis进阶实践之一VMWare Pro虚拟机安装和Linux系统的安装 一.引言 设计模式写完了,相当于重新学了一遍,每次学习都会有不同的感受,对设计模式的理解又加深了,理解的更加透彻了.还差一篇 ...

  6. 制作U盘启动安装CentOS Linux系统

    制作U盘启动安装CentOS Linux系统 (特为老男孩教育&&51CTO学院在线三期同学而发) 方法一:使用UltraISO,将u盘做成启动盘 文件-->打开-->选择 ...

  7. 在 VirtualBox 虚拟机中安装 Arch Linux 系统指南

    How to install Arch Linux on VirtualBox 在 VirtualBox 虚拟机中安装 Arch Linux 系统指南 本文导航 1.Arch Linux 软件仓库2. ...

  8. Linux-导入已安装的Linux系统

    之前在安装过一个Linux系统,由于重装电脑需要将之前安装的系统重新移动到VMWare中,让Linux系统能够重新运行起来,这样也省去了每次重新安装系统的麻烦. 废话不多说,咱们直接看是如何做? 1) ...

  9. 【docker linux】linux系统镜像转化为docker镜像

    概述 使用docker安装linux的同学都知道,你在docker提供的仓库安装linux系统,你就会体验到最精简的.最纯净的linux系统,当然,他会精简到你连ifconfig命令都需要自己配置,恰 ...

随机推荐

  1. css 控制滚动样式

    ::-webkit-scrollbar{width: 8px; height: 8px;}::-webkit-scrollbar-button:vertical{display:none;}::-we ...

  2. SQLite cans and can'ts

    SQLite 能做的 和 不能做的 1.SQLite_open/SQLite_open_v2

  3. C++异常处理(Exception Handling)

    在C++中引入了三种操作符来处理程序的出错情况,分别是:try  , throw  ,  catch 1.基本的用法如下: try{ //code to be tried throw exceptio ...

  4. BrowserSync:跨浏览器实时同步预览

    BrowserSync:跨浏览器实时同步预览 2016.09.11 官方网站:https://www.browsersync.io/ 项目仓库:https://github.com/Browsersy ...

  5. jQuery—一些常见方法(3)【width(),innerWidth(),outerWidth()】

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. 三种读写XML的方法

    XML文件是一种常用的文件格式,例如WinForm里面的app.config以及Web程序中的web.config文件,还有许多重要的场所都有它的身影.Xml是Internet环境中跨平台的,依赖于内 ...

  7. .NET平台开源项目速览-最快的对象映射组件Tiny Mapper之项目实践

    心情小札:近期换了工作,苦逼于22:00后下班,房间一篇狼藉~ 小翠鄙视到:"你就适合生活在垃圾堆中!!!" 晚上浏览博客园 看到一篇非常实用的博客:.NET平台开源项目速览(14 ...

  8. php导出word(可包含图片)

    为大家介绍一个 php 生成 导出word(可包含图片)的代码,有需要的朋友可以参考下. 之前介绍过php生成word的例子,只是不能包含图片与链接. 今天 为大家介绍一个 php 生成 导出word ...

  9. 免费使用的图表控件XML/SWF Charts 5.08

    免费使用的图表控件XML/SWF Charts 5.08 http://www.pin5i.com/showtopic-26053.html 10个免费的在线统计图表工具 http://paranim ...

  10. python参考手册 Read

    P28 复制 a = [1,2,3,[1,2]] b = a b is a # True c = list[a] # shallow copy c is a # False c[3][0] = 100 ...