cobbler服务器准备工作:挂载centos5.5的镜像。(本机环境IP:192.168.0.220+64位)
上次ISO文件至服务器:
[root@dbops1 www]# ll /data/ISO/
total 4294960
-rw-r--r-- 1 root root 4393730048 Mar 21 2011 CentOS_5.5_Final_x64.iso
挂载ISO文件
/bin/mount -o loop /data/ISO/CentOS_5.5_Final_x64.iso /data/yum/iso_files/
由于centos5.5默认安装没有rpmforge,所以需要下载rpm包。
安装所需包:
yum install cobbler tftp-server dhcp httpd xinetd
cobbler check
修改 /var/lib/cobbler/settings //把两处127.0.0.1的ip改为虚拟机提供dhcp和tftp的ip 第17行的manage_dhcp 0改为1
vi /var/lib/cobbler/settings | --- bootloaders: ia64: /var/lib/cobbler/elilo-3.6-ia64.efi standard: /usr/lib/syslinux/pxelinux.0 default_kickstart: /etc/cobbler/default.ks dhcpd_bin: /usr/sbin/dhcpd dhcpd_conf: /etc/dhcpd.conf dnsmasq_bin: /usr/sbin/dnsmasq dnsmasq_conf: /etc/dnsmasq.conf httpd_bin: /usr/sbin/httpd kernel_options: ksdevice: eth0 lang: ' ' syslog: '192.168.0.220:25150' text: ~ koan_path: '' manage_dhcp: 1 manage_dhcp_mode: isc minimize_syncs: 1 next_server: '192.168.0.220' server: '192.168.0.220' syslog_port: 25150 tftpboot: /tftpboot tftpd_bin: /usr/sbin/in.tftpd tftpd_conf: /etc/xinetd.d/tftp webdir: /var/www/cobbler xmlrpc_port: 25151 yum_core_mirror_from_server: 0 |
修改 /etc/xinetd.d/tftp //把第14行的= yes 改为= no
vi /etc/xinetd.d/tftp | 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 } |
yum install system-config-kickstart
//图形化界面执行,生成kickstart的配置文件
保存在/etc/cobbler目录文件内容如下
vim /etc/cobbler/default.ks | #platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# 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
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# 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 NFS installation media
nfs --server=192.168.0.220 --dir=/
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
#Root password
rootpw --iscrypted $1$zlwzVSO6$.mAx831sa.sEeK2Mjzkyh/
# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=16 --resolution=1024x768
# Disk partitioning information
part swap --bytes-per-inode=4096 --fstype="swap" --size=1024 |
cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
vi /etc/dhcpd.conf
备注: 本机IP:192.168.0.220, 子网掩码:255.255.0.0 网关:192.168.1.1 | ddns-update-style interim; ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway option routers 192.168.1.1; option subnet-mask 255.255.0.0;
option nis-domain "domain.org"; option domain-name "domain.org"; option domain-name-servers 192.168.1.1;
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;
range dynamic-bootp 192.168.0.200 192.168.0.254; 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 192.168.1.1; } } |
vim /etc/cobbler/dhcp.template | ddns-update-style interim;
allow booting; allow bootp;
ignore client-updates; set vendorclass = option vendor-class-identifier;
subnet 192.168.0.0 netmask 255.255.255.0 { option routers 192.168.1.1; option subnet-mask 255.255.0.0; range dynamic-bootp 192.168.0.200 192.168.0.254;//dhcp范围 filename "/pxelinux.0"; default-lease-time 21600; max-lease-time 43200; next-server $next_server; }
$insert_cobbler_system_definitions |
导入镜像名称:
cobbler import --mirror=/data/yum/iso_files/ --name=Centos5.5
cobbler list //检查列表
正常返回
生成并同步所有配置:
cobbler sync
启动相关服务:
service httpd start
service xinetd start
service dhcpd start
service cobblerd start
注:关闭防火墙,检查Http是否是80端口。
服务端到此配置完毕
客户端
Workstation新建一台虚拟机
选择网络启动
启动后会停留在boot:
此时手工输入menu回车
然后选择第二项即可正常安装。
输入menu
选择第二个即可!!
转载于:https://blog.51cto.com/400053/888137