- 论坛徽章:
- 7
|
本帖最后由 milujite 于 2012-07-05 17:57 编辑
一项目利旧了几台2950,没DVD,想装RHEL5.动手照着教程弄了个自动安装,在虚拟机上测试了下,可行
Linux平台- 1、配置本地源并安装软件包将安装介质复制到/var/www/html目录,新建rhel-local.repo文件创建一个本地repo
- [root@PXEBoot ~]#vi /etc/yum.repo.d/rhel-local.repo
- [rhel-Server]
- name=Red Hat Enterprise Linux $releasever - Server
- baseurl=file:///var/www/html/Server
- enabled=1
- gpgcheck=0
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
- [rhel-VT]
- name=Red Hat Enterprise Linux $releasever - VT
- baseurl=file:///var/www/html/VT
- enabled=1
- gpgcheck=0
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
- [rhel-Cluster]
- name=Red Hat Enterprise Linux $releasever - Cluster
- baseurl=file:///var/www/html/Cluster
- enabled=1
- gpgcheck=0
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
- [rhel-ClusterStorage]
- name=Red Hat Enterprise Linux $releasever - ClusterStorage
- baseurl=file:///var/www/html/ClusterStorage
- enabled=1
- gpgcheck=0
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
- 2、安装软件包
- [root@PXEBoot ~]#yum install httpd
- [root@PXEBoot ~]#yum install dhcp
- 如果想用图形界面来写kickstart规则和配置网络启动,可以安装以下两个工具
- [root@PXEBoot ~]#yum install system-config-kickstart
- [root@PXEBoot ~]#yum install system-config-netboot
- 3、配置启动dhcp服务器,这里我的安装网络是172.16.100.0,tftp服务器是本机172.16.100.254,bootloader是pxelinux.0
- [root@PXEBoot ~]#vi /etc/dhcpd.conf
- ddns-update-style interim;
- subnet 172.16.100.0 netmask 255.255.255.0 {
- # --- default gateway
- option routers 172.16.100.1;
- option subnet-mask 255.255.255.0;
- option time-offset -18000; # Eastern Standard Time
-
- # option ntp-servers 192.168.1.1;
- # option netbios-name-servers 192.168.1.1;
- # --- Selects point-to-point node (default is hybrid). Don't change this unless
- # -- you understand Netbios very well
- # option netbios-node-type 2;
- next-server 172.16.100.254;
- filename "pxelinux.0";
- range dynamic-bootp 172.16.100.10 172.16.100.250;
- default-lease-time 21600;
- max-lease-time 43200;
- # we want the nameserver to appear at a fixed address
- #host ns {
- # next-server marvin.redhat.com;
- # hardware ethernet 12:34:56:78:AB:CD;
- # fixed-address 207.175.42.254;
- #}
- }
- [root@PXEBoot ~]# /etc/init.d/dhcpd restart
- 4、配置tftp服务器
- [root@PXEBoot ~]# 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 = -s /tftpboot
- disable = no
- per_source = 11
- cps = 100 2
- flags = IPv4
- }
- [root@PXEBoot ~]#/etc/init.d/xinetd restart
- 5、配置httpd服务器,注释welcome.conf配置
- [root@PXEBoot ~]# vi /etc/httpd/conf.d/welcome.conf
- #<LocationMatch "^/+$">
- # Options -Indexes
- # ErrorDocument 403 /error/noindex.html
- #</LocationMatch>
- [root@PXEBoot ~]# /etc/init.d/httpd restart
- 6、在/tftpboot目录下建立以下目录结构,从/var/www/html/isolinux目录复制boot.msg,general.msg,param.msg,rescue.msg到pxelinux.cfg目录下,并且复制isolinux.cfg文件为default文件;复制initrd.img,vmlinuz到rhel5.7目录下;从/usr/lib/syslinux目录复制pxelinux.0到/tftpboot目录。
- /tftpboot/
- |-- pxelinux.0
- |-- pxelinux.cfg
- | |-- boot.msg
- | |-- general.msg
- | |-- options.msg
- | |-- param.msg
- | |-- rescue.msg
- | `-- default
- `-- rhel5.7
- |-- initrd.img
- `-- vmlinuz
- 7、修改default配置文件
- [root@PXEBoot ~]# vi /tftpboot/pxelinux.cfg/default
- default web
- prompt 1
- timeout 100
- display boot.msg
- F1 boot.msg
- F2 options.msg
- F3 general.msg
- F4 param.msg
- F5 rescue.msg
- label web
- kernel rhel5.7/vmlinuz
- append initrd=rhel5.7/initrd.img ks=http://172.16.100.254/ks/web.cfg
- label db
- kernel rhel5.7/vmlinuz
- append initrd=rhel5.7/initrd.img ks=http://172.16.100.254/ks/db.cfg
- label text
- kernel rhel5.7/vmlinuz
- append initrd=rhel5.7/initrd.img text
- label ks
- kernel rhel5.7/vmlinuz
- append ks initrd=rhel5.7/initrd.img
- label local
- localboot 1
- label memtest86
- kernel rhel5.7/memtest
- append -
- 8、生成kickstart配置文件
- kickstart可以从已经安装的系统anaconda-ks.cfg文件复制而来,也可以使用system-config-kickstart程序来生成,建议使用后者生成,再进行修改。由于需要kickstart文件能被http访问到,因此讲kickstart文件放在/var/www/html/ks目录下,内容大致如下,配置中的分区信息等可以根据需要进行修改:
- [root@PXEBoot ~]# vi /var/www/html/ks/web.cfg
- #platform=x86, AMD64, or Intel EM64T
- #skip input subscribe number
- key --skip
- # System authorization information
- auth --useshadow --enablemd5
- # System bootloader configuration
- bootloader --append="rhgb quiet" --location=mbr --driveorder=sda
- # Clear the Master Boot Record
- zerombr
- # Partition clearing information
- clearpart --all --initlabel
- # Use graphical install
- graphical
- # Firewall configuration
- firewall --disabled
- # Run the Setup Agent on first boot
- firstboot --disable
- # System keyboard
- keyboard us
- # System language
- lang en_US
- # Installation logging level
- logging --level=info
- # Use network installation
- url --url=http://172.16.100.254/
- # Network information
- network --bootproto=dhcp --device=eth0 --onboot=on
- # Reboot after installation
- reboot
- #Root password
- rootpw --iscrypted xxxxxxxxxxxxxxxxxxxxxxxxxxx
- # SELinux configuration
- selinux --disabled
- # System timezone
- timezone Asia/Shanghai
- # Install OS instead of upgrade
- install
- # X Window System configuration information
- # Disk partitioning information
- part /boot --asprimary --bytes-per-inode=4096 --fstype="ext3" --size=200
- part / --asprimary --bytes-per-inode=4096 --fstype="ext3" --size=4096
- part swap --asprimary --bytes-per-inode=4096 --fstype="swap" --size=512
- part pv.0 --size=100 --grow --asprimary
- volgroup redhatvg --pesize=32768 pv.0
- logvol /var --fstype ext3 --name=varlv --vgname=redhatvg --size=1024
- logvol /home --fstype ext3 --name=homelv --vgname=redhatvg --size=1024
- %packages
- @base
- @core
- @development-tools
- @base-x
- @x-software-development
- @gnome-desktop
- @admin-tools
- @gnome-software-development
- @development-libs
- @legacy-software-development
- @legacy-software-support
- @system-tools
- @editors
- @java-development
- @java
- @text-internet
- @graphical-internet
- kexec-tools
- iscsi-initiator-utils
- fipscheck
- device-mapper-multipath
- sgpio
- python-dmidecode
- imake
- emacs
- audit
- mesa-libGLU-devel
- xorg-x11-utils
- xorg-x11-server-Xnest
- xorg-x11-server-Xvfb
- -nspluginwrapper
- 9、这样一个完整的自动PXE网络安装RHEL环境就完成了,在同个局域网中从网络启动一个虚拟机
- 超时时间过后,或者手动输入需要安装的设置,如web/db等,系统将进入系统安装界面。
复制代码 windows平台
没Linux的童鞋可以使用windows的tftpd32软件配合filezilla server搞一个,tftpd32的配置手册很详细,只需要修改几个参数,修改kickstart配置文件的url,default配置文件的ks文件位置url就可以了。tftpd32的配置就看下图了。
|
|