您的位置:首页 > 运维架构 > Linux

linux实现kickstart无人值守并自动分配主机名【实验】

2016-08-13 08:51 399 查看
实验一
实验名称:kickstart无人值守安装
实验过程:
步骤1:基本环境
建立在上一个实验环境上
步骤2:安装dns
首先把dns装了,dns可装可不装,实验要求为各主机分配IP和主机名,装上,,

[root@localhost ~]# yum -y install bindbind-chroot caching-nameserver

Installed:
bind.x86_64 30:9.3.6-20.P1.el5_8.5
bind-chroot.x86_64 30:9.3.6-20.P1.el5_8.5
caching-nameserver.x86_64 30:9.3.6-20.P1.el5_8.5

Complete!
修改主配置文件

[root@localhost ~]# cd /var/named/chroot/etc/
[root@localhost etc]# cp -p named.caching-nameserver.conf named.conf

15 listen-on port 53 { 192.168.4.253; };

27 allow-query { any; };
28 allow-query-cache { any; };
29};
37 match-clients { any; };
38 match-destinations { any; };


[root@localhost etc]# vimnamed.rfc1912.zones
zone "tarena.com" IN{
type master;
file "tarena.com.zone";
};
zone "4.168.192.in-addr.arpa" IN{
type master;
file "tarena.com.arpa";
};
检测语法
[root@localhost etc]# named-checkconfnamed.conf
接下来配置数据库文件
[root@localhost etc]# cd /var/named/chroot/var/named/
[root@localhost named]# cp -p named.localtarena.com.zone
[root@localhost named]# vim tarena.com.zone
$TTL 86400
@ IN SOA tarena. root.tarena. (
2014041901 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400) ; Minimum
IN NS dns1.tarena.com.
dns1 IN A 192.168.4.253
$GENERATE 1-20 station$ IN A 192.168.4.$

接着配置反向解析配置文件
[root@localhost named]# cp -p tarena.com.zone tarena.com.arpa
$TTL 86400
@ IN SOA tarena. root.tarena. (
2014041901 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400) ; Minimum
IN NS dns1.tarena.com.
253 IN PTR dns1.tarena.com.
$GENERATE 1-20 $ IN PTR station$.tarena.com.
[root@localhost named]# service namedrestart
停止 named: [确定]
启动 named: [确定]
[root@localhost named]#
Dns配置完成
步骤3:安装kickstart
[root@localhost ~]# yum -y installsystem-config-kickstart

pykickstart.noarch 0:0.43.9-1.el5

Complete!

打开kickstart进行配置
[root@localhost ~]# system-config-kickstart
Loaded plugins: product-id
/usr/lib/python2.4/site-packages/pirut/GroupSelector.py:401:GtkWarning: gtk_tree_view_scroll_to_point: assertion `GTK_WIDGET_REALIZED(tree_view)' failed
gobject.idle_add(lambda x: x.scroll_to_point(0, 0), tree)
我们是在图形环境配置的
见图












































最后两项可以忽略
完成后
生成文件
这样客户机就需要通过一些途径访问到这个文件,我们使用的是http服务器
步骤4:安装http
下面安装http
[root@localhost ~]# yum -y install httpd

Dependency Installed:
apr.x86_64 0:1.2.7-11.el5_6.5 apr-util.x86_64 0:1.2.7-11.el5_5.2
postgresql-libs.x86_64 0:8.1.23-6.el5_8

Complete!
[root@localhost ~]#
将生成的ks.cfg拷贝到httpd默认目录下
[root@localhost ~]# cp /root/ks.cfg/var/www/html/
启动服务
[root@localhost ~]# service httpd restart
停止 httpd: [失败]
启动 httpd: [确定]
[root@localhost ~]#
[root@localhost ~]# chkconfig httpd on
步骤5:ks.cfg相关设置
为ks.cfg文件配置跳过注册步骤
7zerombr
8key --skip
9 #Partition clearing information
修改启动菜单,调用应答文件
[root@localhost ~]# vim/tftpboot/pxelinux.cfg/default
10 label linux
11 kernel vmlinuz
12 append ks=http://192.168.4.253/ks.cfg initrd=initrd.img
存退,重启服务
开启客户机,直接上图



能走到这一步已经成功了,下面就等待安装好

实验结果:这次试验比较综合,总的来说不难,难的是出错怎么解决。



Unable to download the kickstart file
遇到这个错误别着急,要挺住,因为这不是你的配置问题,有可能是VMrare的问题,也有可能是linux系统版本的问题,还有可能是网段的问题,我被卡在这里一段时间,换ftp啦,改权限啦,都没用,百度很多同学遇到这个问题,但是砖家也解释不清楚,没有一个准,还得靠自己,最后新开了一台rh6的裸机终于搞定了,我的服务器没做任何修改。只是改了一下两台虚拟机的网段。
为了进一步验证,我又开了一台rh5的裸机发现没有出错,那么就证明是网段的问题,我将网段改回VMnet1(仅主机模式)它又接着出错。
另外,这种操作用的时候比较多,做到秒杀是最基本的。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux 主机