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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
| cd /etc/yum.repo.d/ vi epel.repo
[epel] name=Extra Packages for Enterprise Linux 6 - $basearch baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[epel-debuginfo] name=Extra Packages for Enterprise Linux 6 - $basearch - Debug baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1
[epel-source] name=Extra Packages for Enterprise Linux 6 - $basearch - Source baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1
sudo rpm --import http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
cd /etc/yum.repos.d/ cp rhel-source.repo rhel-source.repo.bak vi rhel-source.repo
[base] name=CentOS-$releasever-Base baseurl=http://centos.ustc.edu.cn/centos/6/os/x86_64/ gpgcheck=1 gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
[updates] name=CentOS-$releasever-Updates baseurl=http://centos.ustc.edu.cn/centos/6/os/x86_64/ gpgcheck=1 gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
[extras] name=CentOS-$releasever-Extras baseurl=http://centos.ustc.edu.cn/centos/6/os/x86_64/ gpgcheck=1 gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
[centosplus] name=CentOS-$releasever-Plus baseurl=http://centos.ustc.edu.cn/centos/6/os/x86_64/ gpgcheck=1
yum clean all yum makecache yum repolist
yum install cobbler cobbler-web httpd rsync tftp-server xinetd dhcp python-ctypes debmirror pykickstart cman fence-agents dnsmasq
yum install -y yum-plugin-downloadonly yum install --downloadonly --downloaddir=/tmp/cobbler cobbler cobbler-web httpd rsync tftp-server xinetd dhcp python-ctypes debmirror pykickstart cman fence-agents dnsmasq
(1)cobbler (cobbler的核心) (2)httpd (提供cobbler的web界面) (3)dhcpd (为自动安装系统分配IP地址) (4)epel-release (为之提供yum源) (5)rsync (cobbler需要同步信息) (6)cobbler-web (cobbler的一个web插件) (7)xinetd (为rsync和tftp的守护进程) (8)tftp (传送安装的一些文件的类似ftp)
cobbler check
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it. 2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network. 3 : change 'disable' to 'no' in /etc/xinetd.d/tftp 4 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements. 5 : change 'disable' to 'no' in /etc/xinetd.d/rsync 6 : file /etc/xinetd.d/rsync does not exist 7 : debmirror package is not installed, it will be required to manage debian deployments and repositories 8 : ksvalidator was not found, install pykickstart 9 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one 10 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
1.编辑/etc/cobbler/settings文件,找到 server选项,修改为本机IP即可 2.编辑/etc/cobbler/settings文件,找到 next_server选项,修改为本机IP即可 3.SELinux的设置, 如果上面已经关闭了SELinux就不用管了 4.执行 cobbler get-loaders,系统将自动下载loader程序,完成提示4的修复工作。 5.编辑/etc/xinetd.d/tftp文件,将文件中的disable字段的配置由yes改为no 6.编辑/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no 7.在iptables中将69,80,25151端口打开。如果仅仅只是在内部环境中使用,建议直接将防火墙关掉 8.提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略 9.修改cobbler用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中的密码。生成密码命令:openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'其中“random-phrase-here”为任意字符 10.安装cman或者fence-agents
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config setenforce 0 chkconfig iptables off service iptables stop
sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp sed -i -e 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync
sed -i 's/next_server: 127.0.0.1/next_server: 172.28.70.245/g' /etc/cobbler/settings
sed -i 's/server: 127.0.0.1/server: 172.28.70.245/g' /etc/cobbler/settings
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/g' /etc/cobbler/settings
sed -i 's/manage_dns: 0/manage_dns: 1/g' /etc/cobbler/settings
sed -i 's/allow_dynamic_settings: 0/allow_dynamic_settings: 1/g' /etc/cobbler/settings
sed -i -e 's/@dists=/#@dists=/g' /etc/debmirror.conf sed -i -e 's/@arches=/#@arches=/g' /etc/debmirror.conf
vi /etc/dnsmasq.conf
read-ethers addn-hosts = /var/lib/cobbler/cobbler_hosts
dhcp-range=172.28.70.246,172.28.70.250 dhcp-option=3,$next_server dhcp-lease-max=1000 dhcp-authoritative dhcp-boot=pxelinux.0 dhcp-boot=net:normalarch,pxelinux.0 dhcp-boot=net:ia64,$elilo
/etc/init.d/dnsmasq restart
cp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.bak vi /etc/cobbler/dhcp.template
ddns-update-style interim;
allow booting; allow bootp;
ignore client-updates; set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet 172.28.70.0 netmask 255.255.255.0 { option routers 172.28.70.254; option domain-name-servers 172.28.70.254; option subnet-mask 255.255.255.0; range dynamic-bootp 172.28.70.246 172.28.70.250; default-lease-time 21600; max-lease-time 43200; next-server $next_server; class "pxeclients" { match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; if option pxe-system-type = 00:02 { filename "ia64/elilo.efi"; } else if option pxe-system-type = 00:06 { filename "grub/grub-x86.efi"; } else if option pxe-system-type = 00:07 { filename "grub/grub-x86_64.efi"; } else { filename "pxelinux.0"; } }
}
group { host $iface.name { hardware ethernet $mac; fixed-address $iface.ip_address; option host-name "$iface.hostname"; option subnet-mask $iface.netmask; option routers $iface.gateway; if exists user-class and option user-class = "gPXE" { filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner"; } else if exists user-class and option user-class = "iPXE" { filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner"; } else { filename "undionly.kpxe"; } filename "$iface.filename"; next-server $next_server; } }
vi /etc/cobbler/modules.conf
[authentication] module = authn_configfile [dns] module = manage_dnsmasq [dhcp] module = manage_dnsmasq
vi /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1:80
/etc/init.d/httpd restart
PASSWORD="`echo "admin123" | openssl passwd -1 -salt 'root' –stdin`" sed -i s@"^default_password_crypted.*$"@"default_password_crypted: \"$PASSWORD\""@g /etc/cobbler/settings *** default_password_crypted: "$1$cobbler$k/5ITeQUOffuOujzEvhjY." ***
cobbler get-loaders
cobbler@root task started: 2016-04-11_092911_get_loaders task started (id=Download Bootloader Content, time=Mon Apr 11 09:29:11 2016) downloading http://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README downloading http://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo downloading http://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot downloading http://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux downloading http://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi downloading http://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot downloading http://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0 downloading http://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32 downloading http://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi downloading http://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi *** TASK COMPLETE ***
chkconfig cobblerd on chkconfig httpd on chkconfig xinetd on chkconfig dnsmasq on service httpd restart service xinetd restart service dnsmasq restart service cobblerd restart
cobbler@ZJ/etc/cobbler The following are potential configuration items that you may want to fix:
1 : file /etc/xinetd.d/rsync does not exist
Restart cobblerd and then run 'cobbler sync' to apply changes.
cobbler@ZJ/etc/cobbler task started: 2016-04-11_170138_sync task started (id=Sync, time=Mon Apr 11 17:01:38 2016) running pre-sync triggers cleaning trees removing: /var/lib/tftpboot/grub/images copying bootloaders trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0 trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32 trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi copying distros to tftpboot copying images generating PXE configuration files generating PXE menu structure rendering DHCP files rendering DNS files rendering TFTPD files generating /etc/xinetd.d/tftp cleaning link caches rendering Rsync files running post-sync triggers running python triggers from /var/lib/cobbler/triggers/sync/post/* running python trigger cobbler.modules.sync_post_restart_services running: service dnsmasq restart received on stdout: Shutting down dnsmasq: [ OK ] Starting dnsmasq: [ OK ]
received on stderr: running shell triggers from /var/lib/cobbler/triggers/sync/post/* running python triggers from /var/lib/cobbler/triggers/change/* running python trigger cobbler.modules.scm_track running shell triggers from /var/lib/cobbler/triggers/change/* *** TASK COMPLETE ***
cobbler setting report cobbler setting report [--name=option]
allow_duplicate_hostnames : 0 allow_duplicate_ips : 0 allow_duplicate_macs : 0 allow_dynamic_settings : 1 always_write_dhcp_entries : 0 anamon_enabled : 0 auth_token_expiration : 3600 authn_pam_service : login bind_chroot_path : bind_master : 127.0.0.1 build_reporting_email : ['root@localhost'] build_reporting_enabled : 0 build_reporting_ignorelist : [''] build_reporting_sender : build_reporting_smtp_server : localhost build_reporting_subject : build_reporting_to_address : buildisodir : /var/cache/cobbler/buildiso cheetah_import_whitelist : ['random', 're', 'time'] client_use_https : 0 client_use_localhost : 0 cobbler_master : consoles : /var/consoles createrepo_flags : -c cache -s sha default_deployment_method : ssh default_kickstart : /var/lib/cobbler/kickstarts/default.ks default_name_servers : [] default_name_servers_search : [] default_ownership : ['admin'] default_password_crypted : $1$root$JX8M6OcOn.pjk0pHdnG0y0 default_template_type : cheetah default_virt_bridge : xenbr0 default_virt_disk_driver : raw default_virt_file_size : 5 default_virt_ram : 512 default_virt_type : xenpv enable_gpxe : 0 enable_menu : 1 func_auto_setup : 0 func_master : overlord.example.org http_port : 80 isc_set_host_name : 0 iso_template_dir : /etc/cobbler/iso kerberos_realm : EXAMPLE.COM kernel_options : {'ksdevice': 'bootif', 'lang': ' ', 'text': '~'} kernel_options_s390x : {'vnc': '~', 'ip': False, 'RUNKS': 1, 'ramdisk_size': 40000, 'ro': '~', 'root': '/dev/ram0'} ldap_anonymous_bind : 1 ldap_base_dn : DC=example,DC=com ldap_management_default_type : authconfig ldap_port : 389 ldap_search_bind_dn : ldap_search_passwd : ldap_search_prefix : uid= ldap_server : ldap.example.com ldap_tls : 1 ldap_tls_cacertfile : ldap_tls_certfile : ldap_tls_keyfile : manage_dhcp : 1 manage_dns : 1 manage_forward_zones : [] manage_reverse_zones : [] manage_rsync : 1 manage_tftp : 1 manage_tftpd : 1 mgmt_classes : [] mgmt_parameters : {'from_cobbler': 1} next_server : 172.28.70.245 power_management_default_type : ipmitool power_template_dir : /etc/cobbler/power proxy_url_ext : proxy_url_int : puppet_auto_setup : 0 puppet_parameterized_classes : 1 puppet_server : puppet puppet_version : 2 puppetca_path : /usr/bin/puppet pxe_just_once : 1 pxe_template_dir : /etc/cobbler/pxe redhat_management_key : redhat_management_permissive : 0 redhat_management_server : xmlrpc.rhn.redhat.com redhat_management_type : off register_new_installs : 0 remove_old_puppet_certs_automatically : 0 replicate_repo_rsync_options : -avzH replicate_rsync_options : -avzH reposync_flags : -l -n -d restart_dhcp : 1 restart_dns : 1 restart_xinetd : 1 run_install_triggers : 1 scm_track_enabled : 0 scm_track_mode : git serializer_pretty_json : 0 server : 172.28.70.245 sign_puppet_certs_automatically : 0 signature_path : /var/lib/cobbler/distro_signatures.json signature_url : http://cobbler.github.io/signatures/2.6.x/latest.json snippetsdir : /var/lib/cobbler/snippets template_remote_kickstarts : 0 virt_auto_boot : 1 webdir : /var/www/cobbler xmlrpc_port : 25151 yum_distro_priority : 1 yum_post_install_mirror : 1 yumdownloader_flags : --resolve
cobbler setting edit --name=server --value=172.28.0.1
cobbler setting edit --name=pxe_just_once --value=1
cobbler setting edit --name=next_server --value=172.28.0.1
cobbler setting edit --name=manage_rsync --value=1 cobbler setting edit --name=manage_dhcp --value=1 cobbler setting edit --name=manage_dns --value=1
|