RHEL5.5cobbler的配置

先言:人們對於安裝操作系統往往的理解是在電腦光驅裏安一張光驅 然後狂按下一步 直到提示電腦重啓安裝完成,或是通過高級一點的U盤安裝,但是有沒有想過在一個教室 或者是當一個公司開業購買電腦,光驅安裝和U盤這種普通的安裝方式已經不再適合,管理員們耗不起這時間,這時就需要一種批量安裝操作系統的方式來解放管理員的時間,批量部署操作系統的好處在於省時省力,可以多臺機器同時安裝操作系統

環境:RHEL5.5 vmware9.0

安裝前準備:關閉SElinux 配置IP地址 配置yum源

實驗注意事項:網卡必須支持PXE啓動(vmware默認支持)服務器能上網 從網上下載cobbler等軟件

實驗拓撲圖:

image

 

IP地址配置

image

在這裏我用了兩塊網卡 eth0用於從網上下載安裝軟件爲NAT模式

eth1用於部署操作系統 爲單獨的局域網VMnet2

1 #wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm

#rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm

///////#64位:

///#wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

/////#rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

mount /dev/cdrom /mnt/

2 yum install cobbler httpd rsync tftp-server xinetd dhcp

手動開啓wsgi模塊

vim /etc/httpd/conf.d/wsgi.conf

#LoadModule wsgi_module modules/mod_wsgi.so 前面#去掉即可

service cobblerd restart

service httpd restart

cobbler import --path=/mnt/ --name=RedHat-5-i386

 

cobbler list

image

4 xinet.d配置文件修改

#vi /etc/xinetd.d/rsync

disable = yes 改成no

#vi /etc/xinetd.d/tftp

disable = yes 改成no

vi /etc/cobbler/settings

next_server: '127.0.0.1' //改成本機IP:192.168.1.1

server: '127.0.0.1' //改成本機IP:192.168.1.1

manage_dhcp: 0 // 改成1 //開啓管理DHCP服務

5 dhcp的配置

#vi /etc/cobbler/dhcp.template

ddns-update-style interim;

allow booting;

allow bootp;

ignore client-updates;

set vendorclass = option vendor-class-identifier;

subnet 192.168.1.0 netmask 255.255.255.0 {

#option routers 192.168.1.1;

#option domain-name-server 192.168.0.100;

option subnet-mask 255.255.255.0;

range dynamic-bootp 192.168.1.2 192.168.1.200;

filename "/pxelinux.0";

default-lease-time 21600;

max-lease-time 43200;

next-server $next_server;

6 編輯ks文件  模板文件位置位於/var/lib/cobbler/kickstarts/目錄下

vi /etc/cobbler/default.ks

#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

# System keyboard

keyboard us

# System language

lang en_US

# Use network installation

url --url=$tree

# If any cobbler repo definitions were referenced in the kickstart profile, include them here.

$yum_repo_stanza

# Network information

network --bootproto=dhcp --device=eth0 --onboot=on

# Reboot after installation

reboot

#Root password

rootpw 123456

# SELinux configuration

selinux –disabled

#disabled serverces

services --disabled acpid,anacron,apmd,atd,auditd,autofs,avahi-daemon,bluetooth,cups,firstboot,hidd,ip6tables,lvm2-monitor,mcstrans,mdmonitor,microcode_ctl,netfs,nfslock,pcscd,portmap,rawdevices,readahead_early,restorecond,rpcgssd,rpcidmapd,sendmail,setroubleshoot,xfs,xinetd,yum-updatesd

#enabled services

services --enabled cpuspeed,crond,gpm,haldaemon,irqbalance,kudzu,messagebus,network,smartd,sshd,syslog

# Do not configure the X Window System

skipx

# System timezone

timezone --utc Asia/Shanghai

# Install OS instead of upgrade

install

# Clear the Master Boot Record

zerombr

# Magically figure out how to partition this thing

%include /tmp/partinfo

%pre

# Determine how many drives we have

set \$(list-harddrives)

#let numd=\$#/2

#d1=\$1

#d2=\$3

cat << EOF >> /tmp/partinfo

clearpart --all --drives=sda --initlabel

part / --fstype ext3 --size=20000

part /usr/local --fstype ext3 --size=50000

part swap --size=1024

part /home --fstype ext3 --size=1000 --grow

#EOF

##

%packages

@admin-tools

@base

@development-libs

@development-tools

@editors

@emacs

@system-tools

%post

$yum_config_stanza

$kickstart_done

6 同步cobbler配置使之生效

service cobblerd restart

service httpd restart

service xinetd restart

cobbler sync

service dhcpd restart

7 至此服務器的配置工作完成 客戶端開機

image

開機選擇第二項

image

到這一步就是選擇紅帽的key了 由於在ks文件裏面沒有設置好需要選擇跳過才能一路安裝

image

可以看到安裝進度 OK 實驗成功!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章