再次了解下Cobbler的目录结构:
在/var/www/cobbler/ks_mirror目录下存放的是所有的镜像。
存放的是仓库镜像:
在/var/lib/cobbler/kickstarts目录下是存放的所有的kickstarts文件。
再有就是/etc/cobbler这个目录:
[root@vm1 loaders]# cd /etc/cobbler
[root@vm1 cobbler]# ll
total 92
-rw-r--r-- 1 root root 40 Dec 27 2019 auth.conf
-rw-r--r-- 1 root root 75 Dec 27 2019 cheetah_macros
-rw-r--r-- 1 root root 2409 Dec 27 2019 cobbler_bash
-rw-r--r-- 1 root root 11636 Dec 27 2019 completions
-rw-r--r-- 1 root root 3185 Aug 10 18:05 dhcp.template
-rw-r--r-- 1 root root 386 Dec 27 2019 dnsmasq.template
-rw-r--r-- 1 root root 704 Dec 27 2019 genders.template
-rw-r--r-- 1 root root 2014 Dec 27 2019 import_rsync_whitelist
drwxr-xr-x 2 root root 31 Aug 10 16:55 iso
drwxr-xr-x 2 root root 38 Aug 10 16:55 ldap
-rw------- 1 root root 3076 Dec 27 2019 modules.conf
-rw------- 1 root root 43 Dec 27 2019 mongodb.conf
-rw-r--r-- 1 root root 680 Dec 27 2019 named.template
drwxr-xr-x 2 root root 291 Aug 10 16:55 power
drwxr-xr-x 2 root root 4096 Aug 11 18:31 pxe
drwxr-xr-x 2 root root 41 Aug 10 16:55 reporting
-rw-r--r-- 1 root root 368 Dec 27 2019 rsync.exclude
-rw-r--r-- 1 root root 1073 Dec 27 2019 rsync.template
-rw-r--r-- 1 root root 764 Dec 27 2019 secondary.template
-rw-r----- 1 root apache 3077 Aug 10 21:38 settings
-rw-r--r-- 1 root root 740 Dec 27 2019 tftpd.template
-rw-r----- 1 root apache 848 Dec 27 2019 users.conf
-rw-r----- 1 root apache 49 Aug 11 18:13 users.digest
-rw-r--r-- 1 root root 115 Mar 23 2022 version
-rw-r--r-- 1 root root 522 Dec 27 2019 zone.template
drwxr-xr-x 2 root root 6 Mar 23 2022 zone_templates
我们再看下dhcp.template这个文件:
然后我们再看下settings这个文件:
[root@vm1 cobbler]# cat setttings
cat: setttings: No such file or directory
[root@vm1 cobbler]# cat settings
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_manage_ipmi: 0
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$a11e9369$CmvARPtsJvtZ04xqK6sZg/'
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: null}
kernel_options_s390x: {RUNKS: 1, ip: false, ramdisk_size: 40000, ro: null, root: /dev/ram0,vnc: null}
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: 0
manage_forward_zones: []
manage_genders: 0
manage_reverse_zones: []
manage_rsync: 0
manage_tftp: 1
manage_tftpd: 1
mgmt_classes: []
mgmt_parameters: {from_cobbler: 1}
next_server: 192.168.17.3
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: 0
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: 192.168.17.3
sign_puppet_certs_automatically: 0
signature_path: /var/lib/cobbler/distro_signatures.json
signature_url: https://cobbler.github.io/signatures/2.8.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安装的虚拟机下面的文件/etc/yum.repos.d/cobbler-config.repo记录一个yum包的地址。
在源主机下其实有这个文件:
[root@vm1 config]# pwd
/var/www/cobbler/ks_mirror/config
[root@vm1 config]# cat centos7.9-x86_64.repo
[core-0]
name=core-0
baseurl=http://@@http_server@@/cobbler/ks_mirror/centos7.9-x86_64
enabled=1
gpgcheck=0
priority=$yum_distro_priority
添加库:
cobbler repo add --name=CentOS-7-x86_64-epel --mirror=https://mirrors.aliyun.com/epel/7Server/x86_64/ --arch=x86_64 --breed=yum
然后再执行:
cobbler reposync
这部分我执行不成功。我把这个命令记录在这个地方。
然后还需要Kickstart文件。
$yum_config_stanza
%end
5、添加定时任务,定期同步repo。
echo "1 3 * * * /usr/bincobbler reposync --tries=3 --no-fail" >> /var/spool/cron/root
Linux中,一切皆文件。对这句话,我们还要再理解。
例如:
[root@vm1 config]# cat /proc/loadavg
0.01 0.02 0.05 1/150 2662
[root@vm1 config]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 140
Model name: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
Stepping: 1
CPU MHz: 2419.199
BogoMIPS: 4838.39
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 48K
L1i cache: 32K
L2 cache: 1280K
L3 cache: 8192K
NUMA node0 CPU(s): 0,1
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd rsb_ctxsw ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 arat avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq movdiri movdir64b md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities