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
| [root@cobbler ~]# useradd cblrtest [root@cobbler ~]# echo "centos" | passwd --stdin cblrtest [root@cobbler ~]# cat /etc/shadow|grep cblrtest [root@cobbler ~]# vim /etc/cobbler/settings --- allow_duplicate_hostnames: 0 allow_duplicate_ips: 0 allow_duplicate_macs: 0 allow_dynamic_settings: 0 anamon_enabled: 0 authn_pam_service: "login" auth_token_expiration: 3600 build_reporting_enabled: 0 build_reporting_sender: "" build_reporting_email: [ 'root@localhost' ] build_reporting_smtp_server: "localhost" build_reporting_subject: "" build_reporting_ignorelist: [ "" ] cheetah_import_whitelist: - "random" - "re" - "time" createrepo_flags: "-c cache -s sha" default_kickstart: /var/lib/cobbler/kickstarts/default.ks default_name_servers: [] default_ownership: - "admin" default_password_crypted: "6$5CswA7bf$4o4nzSBWsCEU3IzWcpAloQ07P9SXp4fhHRJTkI9yxbPK9g49wsrINHMPeUjVp4JUzaiPUQfkpDW4COCJpRW0E." # 设置新装系统的默认root密码,这是现在的root用户的密码 default_template_type: "cheetah" default_virt_bridge: xenbr0 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 kernel_options: ksdevice: bootif lang: ' ' text: ~ kernel_options_s390x: RUNKS: 1 ramdisk_size: 40000 root: /dev/ram0 ro: ~ ip: off vnc: ~ ldap_server: "ldap.example.com" ldap_base_dn: "DC=example,DC=com" ldap_port: 389 ldap_tls: 1 ldap_anonymous_bind: 1 ldap_search_bind_dn: '' ldap_search_passwd: '' ldap_search_prefix: 'uid=' ldap_tls_cacertfile: '' ldap_tls_keyfile: '' ldap_tls_certfile: '' mgmt_classes: [] mgmt_parameters: from_cobbler: 1 puppet_auto_setup: 0 sign_puppet_certs_automatically: 0 puppetca_path: "/usr/bin/puppet" remove_old_puppet_certs_automatically: 0 manage_dhcp: 0 # 用Cobbler管理DHCP就改为1,但重启后不知什么原因dhcpd.conf文件与之前配置的不同,所以这里使用默认的0。 manage_dns: 0 bind_chroot_path: "" bind_master: 127.0.0.1 manage_tftpd: 1 manage_rsync: 0 manage_forward_zones: [] manage_reverse_zones: [] next_server: 172.16.99.100 # 这是提供PXE对外的地址的。如果用Cobbler管理DHCP,修改本项 power_management_default_type: 'ipmitool' power_template_dir: "/etc/cobbler/power" pxe_just_once: 1 pxe_template_dir: "/etc/cobbler/pxe" consoles: "/var/consoles" redhat_management_type: "off" redhat_management_server: "xmlrpc.rhn.redhat.com" redhat_management_key: "" redhat_management_permissive: 0 register_new_installs: 0 reposync_flags: "-l -n -d" restart_dns: 1 restart_dhcp: 1 run_install_triggers: 1 scm_track_enabled: 0 scm_track_mode: "git" server: 172.16.99.100 # 设置cobbler对外联系的地址 client_use_localhost: 0 client_use_https: 0 snippetsdir: /var/lib/cobbler/snippets template_remote_kickstarts: 0 virt_auto_boot: 1 webdir: /var/www/cobbler xmlrpc_port: 25151 yum_post_install_mirror: 1 yum_distro_priority: 1 yumdownloader_flags: "--resolve" serializer_pretty_json: 0 replicate_rsync_options: "-avzH" replicate_repo_rsync_options: "-avzH" always_write_dhcp_entries: 0 proxy_url_ext: "" proxy_url_int: "" [root@cobbler ~]# systemctl start cobblerd [root@cobbler ~]# systemctl enable cobblerd [root@cobbler ~]# cobbler check The following are potential configuration items that you may want to fix:
1 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment: https://github.com/cobbler/cobbler/wiki/Selinux 2 : change 'disable' to 'no' in /etc/xinetd.d/tftp 3 : 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. 4 : enable and start rsyncd.service with systemctl 5 : debmirror package is not installed, it will be required to manage debian deployments and repositories 6 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes. # 如果有“httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:”的提示,那么就重启一下http服务器。 # 这是检查的结果,1是没有关SElinux,实际已经关了;2是需要将/etc/xinetd.d/tftp中的disable改为no。3是没有loader文件,可以运行提示的命令下载,没有必要;4是没有启动rsync服务,实际启动了,监听在873端口;5是与debian相关的,没有用;6是与fence设备相关,不需要 [root@cobbler ~]# vim /etc/xinetd.d/tftp service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot disable = no # 此项之前是yes per_source = 11 cps = 100 2 flags = IPv4 }
[root@cobbler ~]# systemctl restart tftp.socket [root@cobbler ~]# cobbler check The following are potential configuration items that you may want to fix:
1 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment: https://github.com/cobbler/cobbler/wiki/Selinux 2 : 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. 3 : enable and start rsyncd.service with systemctl 4 : debmirror package is not installed, it will be required to manage debian deployments and repositories 5 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes. # 再次检查就没有上面第二项提示了,但要求重启cobblerd并执行命令。 [root@cobbler ~]# systemctl restart cobblerd [root@cobbler ~]# cobbler sync # 同步所有配置 task started: 2019-05-07_200411_sync task started (id=Sync, time=Tue May 7 20:04:11 2019) running pre-sync triggers cleaning trees removing: /var/lib/tftpboot/grub/images copying bootloaders copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0 copying: /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32 copying: /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk copying distros to tftpboot copying images generating PXE configuration files generating PXE menu structure rendering TFTPD files generating /etc/xinetd.d/tftp cleaning link caches running post-sync triggers running python triggers from /var/lib/cobbler/triggers/sync/post/* running python trigger cobbler.modules.sync_post_restart_services running shell triggers from /var/lib/cobbler/triggers/sync/post/* running python triggers from /var/lib/cobbler/triggers/change/* running python trigger cobbler.modules.manage_genders running python trigger cobbler.modules.scm_track running shell triggers from /var/lib/cobbler/triggers/change/* *** TASK COMPLETE *** 上传镜像到服务器 [root@cobbler ~]# mount -o loop /root/CentOS-7-x86_64-DVD-1611.iso /media/ # 将系统中的镜像挂载到media/目录 [root@cobbler ~]# cobbler import --name="CentOS-7_x86_64-1503" --path=/media task started: 2019-05-07_201016_import task started (id=Media import, time=Tue May 7 20:10:16 2019) Found a candidate signature: breed=redhat, version=rhel6 Found a candidate signature: breed=redhat, version=rhel7 Found a matching signature: breed=redhat, version=rhel7 Adding distros from path /var/www/cobbler/ks_mirror/CentOS-7_x86_64-1503: creating new distro: CentOS-7-1503-x86_64 trying symlink: /var/www/cobbler/ks_mirror/CentOS-7_x86_64-1503 -> /var/www/cobbler/links/CentOS-7-1503-x86_64 creating new profile: CentOS-7-1503-x86_64 associating repos checking for rsync repo(s) checking for rhn repo(s) checking for yum repo(s) starting descent into /var/www/cobbler/ks_mirror/CentOS-7_x86_64-1503 for CentOS-7-1503-x86_64 processing repo at : /var/www/cobbler/ks_mirror/CentOS-7_x86_64-1503 need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS-7_x86_64-1503 looking for /var/www/cobbler/ks_mirror/CentOS-7_x86_64-1503/repodata/*comps*.xml Keeping repodata as-is :/var/www/cobbler/ks_mirror/CentOS-7_x86_64-1503/repodata *** TASK COMPLETE *** # 导入镜像,生成distro,生成的镜像存在/var/www/cobbler/ks_mirror下。所以/var/www/cobbler要有足够的空间。 # --path 镜像路径 # --name 为安装源定义一个名字 # --arch 指定安装源是32位、64位、ia64, 目前支持的选项有: x86│x86_64│ia64 # 安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是:CentOS-7_x86_64-1503,如果重复,系统会提示导入失败。 [root@cobbler ~]# cobbler distro list CentOS-7-1503-x86_64 [root@cobbler ~]# cobbler profile list CentOS-7-1503-x86_64 # 这时查看都应该有一个刚才创建的文件名 # 镜像存放目录,cobbler会将镜像中的所有安装文件拷贝到本地一份,放在/var/www/cobbler/ks_mirror下的CentOS-7_x86_64-1503目录下。因此/var/www/cobbler目录必须具有足够容纳安装文件的空间。 [root@cobbler ~]# cobbler sync # 同步数据。这个命令是为了将数据同步到/var/lib/tftpboot/pxelinux.cfg/default文件,也就是安装时的菜单 # cobbler check 核对当前设置是否有问题 # cobbler list 列出所有的cobbler元素 # cobbler report 列出元素的详细信息 # cobbler sync 同步配置到数据目录,更改配置最好都要执行下 # cobbler reposync 同步yum仓库 # cobbler distro 查看导入的发行版系统信息 # cobbler system 查看添加的系统信息 # cobbler profile 查看配置信息
|