一,实验环境
操作系统:RHEL 5.8 32位
IP地址:192.168.1.101
虚拟化平台:Xen半虚拟化
服务:httpd,libvirtd,xend,network,sshd(保持这5个服务开机启动就OK 了,其余的服务全关掉,避免浪费服务器资源,这里仅在实验环境中使用,生产环境按需求开启你需要的服务即可)
二,制作安装源
我们这里使用http安装方式,首先安装Web服务器,这里安装Apache,安装就不说了,直接用yum安装,不用配置。
这里使用RHEL 5.8 32位的DVD镜像文件。挂载到/var/www/html/rhel目录下
启动httpd服务,测试效果
同时在本机配置该yum仓库,在下面的过程需要用到。
三,制作响应文件
自动化部署Linux就离不开kickstart,怎么使用这里不多说,提醒关键的两个地方
第一是,安装号,勾选上,但不要填,最后保存了之后编辑下文件加一行跳过的代码
第二就是软件包的选择,如图选择基本即可
如果这里什么都不选,在开始安装后就会询问你,要你选择安装的软件包,就是我们平时手动安装自定义软件包。否则会影响你的自动化的,就变成交互式安装了,就不是无人值守了。
然后选择你所要安装的项目,保存为/var/www/html/ks.cfg。保存后记得编辑一下:
- #platform=x86, AMD64, or Intel EM64T
- # System authorization information
- auth --useshadow --enablemd5
- # System bootloader configuration
- bootloader --location=mbr
- # Partition clearing information
- clearpart --all --initlabel
- # 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 network installation
- url --url=http://192.168.1.101/rhel5
- # Network information
- network --bootproto=static --device=eth0 --gateway=192.168.1.1 --ip=192.168.1.105 --nameserver=8.8.8.8 --netmask=255.255.255.0 --onboot=on
- # Reboot after installation
- reboot
- #Root password
- rootpw --iscrypted $1$f93gHuxV$pIovaVnrcBQQ22ORhX8ZV.
- # SELinux configuration
- selinux --disabled
- # Do not configure the X Window System
- skipx
- # System timezone
- timezone Asia/Shanghai
- # Install OS instead of upgrade
- install
- # Disk partitioning information
- part /boot --bytes-per-inode=4096 --fstype="ext3" --size=200
- part swap --bytes-per-inode=4096 --fstype="swap" --size=512
- part / --bytes-per-inode=4096 --fstype="ext3" --size=10240
- %packages
- @base
记得加一句:key --skip
另外,根分区分了10个G,不要把全部剩余空间都分给根分区。一般情况,分10到20G装系统就OK 了,其余的可作为数据分区,生产线上就这么用。
6.0以上版本在安装的时候就没有要填写这个序列号的步骤了。
四,开始安装
ssh登陆到该服务器,这里全部都是在命令行模式下安装的。执行安装命令
- virt-install -p -n rhel5 -r 256 -f /var/lib/xen/p_w_picpaths/rhel58.img -s 4 \
- -b xenbr0 -l http://192.168.1.101/rhel -x ks=http://192.168.1.101/ks.cfg
开始安装:
安装过程:
我们看到安装的软件包是数量是371个,整个安装大小为580M的样子,就是开始制作ks.cfg时选择的基本软件包。
安装完毕自动重启,在制作ks.cfg的时候勾选该选项,以便开机
重启后就安装完毕了,我们就可以登陆操作系统了。按Ctrl+】(右方括号)退出控制台。
关于开启自动启动,添加“xm create rhel”到/etc/rc.local中即可,也可以开启xendomains服务,然后做一个软链接:
- ln -s /etc/xen/rhel5 /etc/xen/auto/
安装到这里就结束了,这里只是简单的介绍了下无人值守的安装模式,还有很多详细过程没有列出来,欢迎大家一起探讨。
转载于:https://blog.51cto.com/luxiaok/959379