Cobbler体验小记
生活随笔
收集整理的這篇文章主要介紹了
Cobbler体验小记
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
原創作品,允許轉載,轉載時請務必以超鏈接形式標明文章?原始出處?、作者信息和本聲明。否則將追究法律責任。http://navyaijm.blog.51cto.com/4647068/1263115
Cobbler有人稱之為裝系統神奇,當你用了之后你會發現確實如此哈,下記錄一下使用過程:
一、安裝
我系統環境是centos6.4,采用yum安裝:
| 1 | yum -y?install?cobbler? cobbler-web? httpd?rsync?tftp-server xinetd dhcp python-ctypes debmirror pykickstart |
二、配置
1、關閉防火墻和SELinux?后重啟系統:?
| 1 2 3 | /etc/init.d/iptables?stop?????????#關閉防火墻 chkconfig iptables off sed?-i?'/SELINUX=/d'?/etc/selinux/config?&&??echo?"SELINUX=disabled">>?/etc/selinux/config??#關閉SELINUX |
2、修改cobbler配置文件:
?
| 1 2 3 4 5 6 7 8 9 10 11 12 | 'next_server: 127.0.0.1'?替換成?'next_server:172.28.26.188'????#DHCP服務地址 'server: 127.0.0.1'?替換成?'server: 172.28.26.188'???#cobbler服務地址 'manage_dhcp: 0'?替換成?'manage_dhcp: 1'??????#cobbler管理dhcp 'manage_rsync: 0'?替換成?'manage_rsync: 1'?????#cobbler管理rsync功能 'http_port: 80'替換成?'http_port: 9080'?????#更改端口號9080 default_password_crypted:?"$1$1111$vZEjq1D9/uNasiTXwyx4o."??#修改這個默認密碼,因為運行cobbler check時會提示你修改密碼, 用這個命令實現"openssl passwd -1 -salt '任意字母' '你的密碼' " sed?-i?'s/next_server: 127.0.0.1/next_server: 172.28.26.188/g'?/etc/cobbler/settings sed?-i?'s/server: 127.0.0.1/server: 172.28.26.188/g'?/etc/cobbler/settings sed?-i?'s/manage_dhcp: 0/manage_dhcp: 1/g'?/etc/cobbler/settings sed?-i?'s/manage_rsync: 0/manage_rsync: 1/g'?/etc/cobbler/settings sed?-i?'s/http_port: 80/http_port: 9080/g'?/etc/cobbler/settings openssl?passwd?-1 -salt?'1234312'?'navy123456'????#把生成的密碼填到/etc/cobbler/settings配置里default_password_crypted:生成的新密碼 |
3、修改tftp服務和rsync服務配置?:
| 1 2 | sed?-i?'/disable/c disable = no'?/etc/xinetd.d/tftp????#設置 'disable' 為 'no' sed?-i -e?'s/= yes/= no/g'?/etc/xinetd.d/rsync????????#設置 'disable' 為 'no' |
4、修改dhcp模板?:
| 1 2 3 4 5 6 7 8 9 10 11 | vim?/etc/cobbler/dhcp.template subnet 172.28.26.0 netmask 255.255.255.0 {?????#修改為自己需求網段 option routers???????????? 172.28.26.188;?????????????????#修改自己的路由 option domain-name-servers 172.28.26.188;????#域名服務器地址 option subnet-mask???????? 255.255.255.0;?????????#子網掩碼 range dynamic-bootp??????? 172.28.26.191 172.28.26.193;????#分配IP地址段 filename???????????????????"/pxelinux.0"; default-lease-time?????????21600; max-lease-time?????????????43200; next-server??????????????? $next_server; } |
5、修改cobbler-web配置?:
| 1 2 3 4 5 6 7 8 9 10 | sed?-i?'s/Listen 80/Listen 9080/g'?/etc/httpd/conf/httpd.conf??#修改hhtp端口為9080 sed?-i?'s/module = authn_denyall/module = authn_configfile/g'?/etc/cobbler/modules.conf???#修改認證 htdigest??/etc/cobbler/users.digest?"Cobbler"?cobbler??#修改cobbler WEB頁面管理密碼 vim??/etc/httpd/conf.d/ssl.conf?????#修改ssl配置,把下面幾行添加到配置后面即可 <VirtualHost *:9080> <LocationMatch?"^/cobbler_web/*"> RewriteEngine on RewriteRule ^(.*) https://%{SERVER_NAME}/%{REQUEST_URI} [R,L] </LocationMatch> </VirtualHost> |
6、啟動相關的服務:
| 1 2 3 4 5 6 7 8 | /etc/init.d/httpd?start /etc/init.d/xinetd?start /etc/init.d/dhcpd?start /etc/init.d/cobblerd?start chkconfig --level 35 httpd on chkconfig --level 35 xinetd on chkconfig --level 35 dhcpd on chkconfig --level 35 cobblerd on |
7、效驗cobbler安裝條件:
| 1 2 3 | service cobblerd restart cobbler get-loaders???????#修復cobbler check時出現的錯誤信息 cobbler check |
三、導入鏡配置:
| 1 2 3 4 5 6 7 8 | 掛載ISO鏡像到/mnt目錄 mount?-o loop?/data/kisops_centos6.3._vm.iso?/mnt/ 導入ISO,并設置為“x86_64”,并將其命名為Centos6.3。(注:具體可查看/var/www/cobbler/ks_mirror/Centos6.4-x86_64/目錄文件生成情況。) cobbler?import?--path=/mnt/???--name=Centos6.3? --arch=x86_64 查看導入結果 cobbler distro list 完成后同步所有配置 cobbler?sync |
四、需要抓系統的機器從網卡啟動就可以了
PS:附加一下ks.cfg
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | #set $swap= $getVar('$swap', '12000') autostep --autoscreenshot install url --url=$tree # If any cobbler repo definitions were referenced in the kickstart profile, include them here. $yum_repo_stanza text skipx lang en_US.UTF-8 keyboard us network --onboot?yes?--bootproto dhcp --noipv6 --nodns rootpw? --iscrypted \$6\$Qz7FvhTWfC2yTdb1\$qNF1o.fpE44l/F1ROzJ.bXRKeB4OVQ.maYCY3tMZKDS7tDLrHthIAREXZFvW1G08tOqptkLMxfvyW4wA.vPOz1 firewall --disabled firstboot --disabled authconfig --enableshadow --passalgo=sha512 selinux --disabled #timezone --isUtc Asia/Shanghai timezone --utc Asia/Shanghai # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work logging --level=info #bootloader --append="nohz=off" --location=mbr bootloader --location=mbr --driveorder=sda --append="biosdevname=0 nohz=off thash_entries=1048576 rhash_entries=1048576 selinux=0" zerombr?yes # clearpart --all --initlabel --drives=sda clearpart --all --initlabel # ignoredisk --only-use=sda part / --fstype=ext4 --asprimary --size=50000 --maxsize=50000 --label=/ part swap --asprimary --size=$swap --maxsize=$swap --label=swap part?/data?--fstype=xfs --grow --asprimary --size=12000 --label=/data %pre $SNIPPET('pre_install_network_config') # Add Pre-Installation Script here date %end %packages --excludedocs --ignoremissing @base @core @development @server-policy ftp nc telnet cmake compat-gcc-34 compat-gcc-34-c++ sgpio libXtst yum-plugin-priorities koan openssl tengine -lvm2 -acpid -biosdevname -hunspell-en -abrt-cli -man-pages-overrides -blktrace -words -abrt-addon-kerneloops -abrt-addon-ccpp -bridge-utils -nano -mtr -hunspell -abrt-addon-python -man-pages -byacc -indent -diffstat -doxygen -intltool -git -ctags -cscope -iptables -system-config-firewall-base -iptables-ipv6 -system-config-firewall-tui -subversion %end $SNIPPET('services_disable_enable') %post $SNIPPET('post_install_network_config') $SNIPPET('env_init') $SNIPPET('kis_cobbler_api') $SNIPPET('cactirelease') $SNIPPET('kisyum_install') /usr/sbin/eject?-rv?/dev/sr*?# eject P cdrom echo?'v1.3'?> ~root/VERSION %end # finish reboot --eject |
?
本文出自 “屌絲運維男” 博客,請務必保留此出處http://navyaijm.blog.51cto.com/4647068/1263115
總結
以上是生活随笔為你收集整理的Cobbler体验小记的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: http://jingyan.baidu
- 下一篇: linux系统结构与文件管理命令