设为首页 收藏本站
查看: 1072|回复: 0

[经验分享] 网络安装RedHat Enterprises Linux5.4

[复制链接]

尚未签到

发表于 2018-5-12 11:27:55 | 显示全部楼层 |阅读模式
网络安装RedHat Enterprises Linux5.4

一、PXE介绍
PXE(preboot execute environment)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持来自网络的操作系统的启动过程,其启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file transfer protocol)或MTFTP(multicast trivial file transfer protocol)协议下载一个启动软件包到本机内存中并执行,由这个启动软件包完成终端基本软件设置,从而引导预先安装在服务器中的终端操作系统。

二、KickStart+DHCP+NFS+TFTP+PXE的工作原理
无光软驱服务器通过PXE网卡启动,从DHCP服务器获取IP,通过TFTP下载pxelinux.0文件找到pxelinux.cfg里的配置文件,按配置文件找着vmlinuz引导Linux进入安装界面,之后选择NFS方式安装系统

服务器端配置
第一步:关闭iptables和SElinux
[root@localhost ~]# chkconfig iptables off
[root@localhost ~]# service iptables stop
[root@localhost ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

第二步:挂载镜像,安装TFTP与DHCP服务,并进行配置。
[root@localhost ~]# mount /dev/hdc /mnt
mount: block device /dev/hdc is write-protected, mounting read-only
[root@localhost ~]# cd /mnt/Server/
[root@localhost Server]# rpm -ivh tftp-server-0.42-3.1.i386.rpm
warning: tftp-server-0.42-3.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
        package tftp-server-0.42-3.1.i386 is already installed
[root@localhost Server]# rpm -ivh dhcp-3.0.5-18.el5.i386.rpm
warning: dhcp-3.0.5-18.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:dhcp                   ########################################### [100%]
配置TFTP服务器
[root@localhost Server]# vi /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol. The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -u nobody -s /tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

配置DHCP服务器
[root@localhost Server]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp: overwrite `/etc/dhcpd.conf'? y
[root@localhost Server]# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
authourtative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.55 192.168.1.66;
        option routers 192.168.1.1;
        option subnet-mask 255.255.255.0;
        option domain-name-servers 192.168.1.146;              //服务器IP地址
      option domain-name "koalinfo.com";
        option netbios-name-servers 192.168.1.146;        //服务器IP地址
        option time-offset -18000;
        option broadcast-address 192.168.1.255;
        default-lease-time 6000;
        max-lease-time 11400;
        next-server 192.168.1.146;                                //服务器IP地址
        filename "pxelinux.0";                                      //指示启动文件的位置的一个标签,这里是指/tftpboot/pxelinux.0。
}
第三步:创建目录,存放系统安装文件。
[root@localhost Server]# mkdir /disk
[root@localhost Server]# cp -rf /mnt/* /disk/

第四步:安装并配置NFS服务器
#查看是否已安装NFS服务器,如果没有安装,进入/mnt/Server/进行安装
[root@localhost ~]# rpm -qa | grep "nfs\|portmap"
portmap-4.0-65.2.2.1
nfs-utils-1.0.9-40.el5
nfs-utils-lib-1.0.8-7.2.z2
[root@localhost ~]# vi /etc/exports
/disk   *(ro.sync)
[root@localhost ~]# service nfs restart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [FAILED]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@localhost ~]# exportfs                             //输出NFS配置文件,检查是否生效
/disk           <world>

第五步:启动DHCP、NFS、TFTP服务
[root@localhost disk]# service dhcpd start
Starting dhcpd: [ OK ]
[root@localhost disk]# service portmap start
Starting portmap: [ OK ]
[root@localhost disk]# service nfs start
[root@localhost disk]# service xinetd start
Starting xinetd:           

第六步:将安装配置脚本文件(/root/anaconda-ks.cfg),重命名为ks.cfg,复制到/disk目录下,然后并共享出/disk目录。
[root@localhost disk]# cd /root
[root@localhost ~]# ls
anaconda-ks.cfg Desktop install.log install.log.syslog
[root@localhost ~]# cp anaconda-ks.cfg /disk/ks.cfg
[root@localhost ~]# exportfs -a; service nfs restart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@localhost ~]# vi /disk/ks.cfg
将cdrom修改为:nfs --server=192.168.1.146 --dir=/disk
将network --device eth0 --bootproto dhcp修改为:network --device eth0 --bootproto dhcp
将#clearpart --all --drives=sda修改为:clearpart --all –initlabel

第七步:配置支持PXE,复制启动时所需要文件。
#确保/tftproot目录存在,不存在,手工创建。
[root@localhost ~]# ls -d /tftpboot/ || make /tftpboot/
/tftpboot/
[root@localhost ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
注意:如果找不到syslinux目录与pxelinux.0文件,那么你就必须安装软件包:syslinux-3.11-4.i386.rpm
[root@localhost ~]# mkdir /tftpboot/pxelinux.cfg
[root@localhost ~]# cd /media/
[root@localhost media]# ls
RHEL_5.3 i386 DVD
[root@localhost media]# cp /media/RHEL_5.3\ i386\ DVD/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
[root@localhost media]# cp /media/RHEL_5.3\ i386\ DVD/isolinux/* /tftpboot/
[root@localhost media]# chmod u+w /tftpboot/pxelinux.cfg/default
[root@localhost media]# vi /tftpboot/pxelinux.cfg/default
timeout 60                                                      //将超时时间修改为60秒
append initrd=initrd.img text 修改为:append ks=nfs:192.168.1.146:/disk/ks.cfg initrd=initrd.img

第八步:重启DHCP、NFS、TFTP服务。
[root@localhost ~]# service nfs restart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@localhost ~]# service dhcpd restart
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
[root@localhost ~]# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
Starting xinetd: [ OK ]
  接下来,创建新的linux虚拟机,点击开机按钮, 即可到系统的安装界面。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-459067-1-1.html 上篇帖子: 关于闰秒对redhat的RHEL6,RHEL5以及RHEL4的影响 下篇帖子: 查看Linux版本,centos?redhat?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表