1 安装包和配置服务
2 修改cobbler 配置文件 1 2 vim /etc/ cobbler/settings server: cobblerIP 384
““` next_server: cobblerIP 272
1 ![](https:// s1.51 cto.com/images/ blog/201904/ 19 /290dc61ee65de2a2697d5d040478a78f.png?x-oss-process=image/ watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
default_password_crypted: “$1$VBqc7U0W$F2qhI5oZwR8chJBU.mAly1” 101
1 ![](https:// s1.51 cto.com/images/ blog/201904/ 19 /90833ca45103ddd0246c9b3e7521dbda.png?x-oss-process=image/ watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
manage_dhcp: 1 242 #可自动配置dhcp
1 ![](https:// s1.51 cto.com/images/ blog/201904/ 19 /28a8f123de629a645fa9668e9f0c6c06.png?x-oss-process=image/ watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
root:# cobbler get-loaders task started: 2019-04-19_074328_get_loaders task started (id=Download Bootloader Content, time=Fri Apr 19 07:43:28 2019) downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0 downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32 downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi *** TASK COMPLETE *** root:# cobbler sync task started: 2019-04-19_074450_sync
!!! TASK FAILED !!!
root:~# vim /etc/cobbler/dhcp.template subnet 192.168.64.0 netmask 255.255.255.0 { option routers 192.168.64.254; option domain-name-servers 1.1.1.1; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.64.100 192.168.64.254
root:~# cobbler sync task started: 2019-04-19_075613_sync task started (id=Sync, time=Fri Apr 19 07:56:13 2019) running pre-sync triggers ……………………………. running shell triggers from /var/lib/cobbler/triggers/change/* *** TASK COMPLETE *** ““
4导入安装源文件 将光盘挂载好
root:~# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root 52403200 2066756 50336444 4% / devtmpfs 919432 0 919432 0% /dev tmpfs 931612 0 931612 0% /dev/shm tmpfs 931612 9744 921868 2% /run tmpfs 931612 0 931612 0% /sys/fs/cgroup /dev/sda1 1038336 149004 889332 15% /boot /dev/mapper/centos-home 154057220 33100 154024120 1% /home tmpfs 186324 0 186324 0% /run/user/0 /dev/sr0 10491772 10491772 0 100% /mnt/7 /dev/sr1 3897932 3897932 0 100% /mnt/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 root:~# cobbler import --path=/mnt/ 6 --name=Centos-6.10 --arch=x86_64 task started: 2019 -04 -19 _080352_importtask started (id=Media import , time=Fri Apr 19 08 :03 :52 2019 )Found a candidate signature: breed=redhat, version=rhel6 Found a matching signature: breed=redhat, version=rhel6 Adding distros from path /var/ www/cobbler/ ks_mirror/Centos-6.10 -x86_64: creating new distro: Centos-6.10 -x86_64 trying symlink: /var/ www/cobbler/ ks_mirror/Centos-6.10-x86_64 -> / var/www/ cobbler/links/ Centos-6.10 -x86_64 creating new profile: Centos-6.10 -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-6.10 -x86_64 for Centos-6.10 -x86_64 processing repo at : /var/ www/cobbler/ ks_mirror/Centos-6.10 -x86_64 need to process repo/comps: / var/www/ cobbler/ks_mirror/ Centos-6.10 -x86_64 looking for /var/ www/cobbler/ ks_mirror/Centos-6.10-x86_64/ repodata
查看现有安装选项 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 root:~# cobbler profile list Centos-6.10 -x86_64 [root@localhost ~]# cobbler distro list #安装原文件名称 [root@localhost ~]# cat /var/ lib/tftpboot/ pxelinux.cfg/default DEFAULT menuPROMPT 0 MENU TITLE Cobbler | http: TIMEOUT 200 TOTALTIMEOUT 6000 ONTIMEOUT local LABEL local MENU LABEL (local) MENU DEFAULT LOCALBOOT -1 LABEL Centos-6.10 -x86_64 kernel /images/ Centos-6.10 -x86_64/vmlinuz MENU LABEL Centos-6.10 -x86_64 append initrd=/images/ Centos-6.10 -x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http:/ /192.168.64.131/ cblr/svc/ op/ks/ profile/Centos-6.10 -x86_64 ipappend 2 MENU end cobbler profile remove --name=NAME cobbler distro remove --name=NAME
现在已经可以自动化安装了,不过cobbler默认配置文件为最小化安装,想要自定义的花要修改配置文件 Centos 7.0下使用system-config-kickstart 1 2 3 4 5 6 修改CentOS-Base.repo [base] 修改 ---------->[development] name=CentOS-$releasever - Base root:~# yum install -y system -config-kickstart.noarch root:~ # env LANG=zh_CN.UTF-8 system -config-kickstart #生成自定义配置文件
将ks文件和系统关联,生成启动菜单 1 cobbler profile add --name =Centos6_mini --distro =Centos-6.10-x86_64 --kickstart =/var/lib/cobbler/kickstarts/ks6mini.cfg
将所有选项选完即可左上角保存 centos6ks文件 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 firewall --disabledinstall url --url =$tree rootpw --iscrypted $1 $RR1QsW0t $qYYwsKO5LloO6y3WaTkdj0 auth --useshadow --passalgo =sha512 text keyboard us lang en_US selinux --disabled skipx logging --level =inforeboot timezone Asia/Shanghai network --bootproto =dhcp --device =eth0 --onboot =onbootloader --location =mbr --md5pass ="$1 $EmYezDTP $mBxhDFd /BRDIn6ZBAOtL00" zerombr clearpart --all --initlabel part /boot --fstype ="ext4" --size =1024 part / --fstype ="ext4" --grow --size =1 %post mkdir /root/.ssh chmod 700 /root/.ssh cat > /root/.ssh/authorized_keys <<EOF ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtSEz3OSOAI6UMkRjIVk3cXwVf/tYa9YsBOVd4vamGtrAuPN5+zgOj9T9p+QI0nJHva6LR4Wz5es46zXoSrLoKY4rTpqnmuPNYuG3B/cybOv99+hriq7Vs9/OqMIgsLbtk4R99Rg75wL9jXpcyxgKtCyVYG4sjdlfyQXQXuauzai6u9oqKo7MmDyWiC9QJSqfilrQKhUB+OfVo4/vkYxKLsRy8N6k2BoRTk2VIp7XKB4gr3sutgutXk35A3O08ukGBSA+378G2csDmf9nctGv4kSw/gR6Mdy2LnhcxcnPA5IP39Buvkdp2eqXOnY1zWxTiUdLtfAb81rFpwMudtaK1w == rsa 2048-041619 EOF chmod 600 /root/.ssh/authorized_keys systemctl stop firewalld systemctl disable firewalld.service systemctl stop NetworkManager systemctl disable NetworkManager %end %packages @base @debugging @network-tools %end
centos7ks文件 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 install keyboard 'us' rootpw --iscrypted $1 $F4q00dyi $IQ1 /CLubGYHtDw6EvSiln0 lang en_US auth --useshadow --passalgo=sha512 url --url=$tree text selinux --disabled skipx firewall --disabled network --bootproto=dhcp --device=ens33 halt timezone Asia/Shanghai bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda clearpart --all --initlabel reboot part /boot --fstype="xfs" --size=1024 part / --fstype="xfs" --grow --size=1 %post mkdir /root/ .ssh chmod 700 /root/ .ssh cat > /root/ .ssh/authorized_keys <<EOF ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtSEz3OSOAI6UMkRjIVk3cXwVf/tYa9YsBOVd4vamGtrAuPN5+zgOj9T9p+QI0nJHva6LR4Wz5es46zXoSrLoKY4rTpqnmuPNYuG3B/ cybOv99+hriq7Vs9/OqMIgsLbtk4R99Rg75wL9jXpcyxgKtCyVYG4sjdlfyQXQXuauzai6u9oqKo7MmDyWiC9QJSqfilrQKhUB+OfVo4/ vkYxKLsRy8N6k2BoRTk2VIp7XKB4gr3sutgutXk35A3O08ukGBSA+378 G2csDmf9nctGv4kSw/gR6Mdy2LnhcxcnPA5IP39Buvkdp2eqXOnY1zWxTiUdLtfAb81rFpwMudtaK1w== rsa 2048 -041619 EOF chmod 600 /root/ .ssh/authorized_keys systemctl stop firewalld systemctl disable firewalld.service systemctl stop NetworkManager systemctl disable NetworkManager sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/ selinux/config mkdir /etc/yum .repo.d/bak mv /etc/yum .repos.d/*.repo / etc/yum.repos.d/ bak/ cat > /etc/yum .repos.d/Centos-Base.repo <<EOF [development] name=CentOS-$releasever - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mi rrors.aliyun.com/centos/ $releasever /os/ $basearch / http://mi rrors.aliyuncs.com/centos/ $releasever /os/ $basearch / http://mi rrors.cloud.aliyuncs.com/centos/ $releasever /os/ $basearch / gpgcheck=1 gpgkey=http://mi rrors.aliyun.com/centos/ RPM-GPG-KEY-CentOS-7 [updates] name=CentOS-$releasever - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mi rrors.aliyun.com/centos/ $releasever /updates/ $basearch / http://mi rrors.aliyuncs.com/centos/ $releasever /updates/ $basearch / http://mi rrors.cloud.aliyuncs.com/centos/ $releasever /updates/ $basearch / gpgcheck=1 gpgkey=http://mi rrors.aliyun.com/centos/ RPM-GPG-KEY-CentOS-7 [extras] name=CentOS-$releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mi rrors.aliyun.com/centos/ $releasever /extras/ $basearch / http://mi rrors.aliyuncs.com/centos/ $releasever /extras/ $basearch / http://mi rrors.cloud.aliyuncs.com/centos/ $releasever /extras/ $basearch / gpgcheck=1 gpgkey=http://mi rrors.aliyun.com/centos/ RPM-GPG-KEY-CentOS-7 [centosplus] name=CentOS-$releasever - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mi rrors.aliyun.com/centos/ $releasever /centosplus/ $basearch / http://mi rrors.aliyuncs.com/centos/ $releasever /centosplus/ $basearch / http://mi rrors.cloud.aliyuncs.com/centos/ $releasever /centosplus/ $basearch / gpgcheck=1 enabled=0 gpgkey=http://mi rrors.aliyun.com/centos/ RPM-GPG-KEY-CentOS-7 [contrib] name=CentOS-$releasever - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mi rrors.aliyun.com/centos/ $releasever /contrib/ $basearch / http://mi rrors.aliyuncs.com/centos/ $releasever /contrib/ $basearch / http://mi rrors.cloud.aliyuncs.com/centos/ $releasever /contrib/ $basearch / gpgcheck=1 enabled=0 gpgkey=http://mi rrors.aliyun.com/centos/ RPM-GPG-KEY-CentOS-7 EOF cat > /etc/yum .repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 7 - $basearch baseurl=http://mi rrors.aliyun.com/epel/ 7 /$basearch failovermethod=priority enabled=1 gpgcheck=0 gpgkey=file:// /etc/ pki/rpm-gpg/ RPM-GPG-KEY-EPEL-7 [epel-debuginfo] name=Extra Packages for Enterprise Linux 7 - $basearch - Debug baseurl=http://mi rrors.aliyun.com/epel/ 7 /$basearch/ debug failovermethod=priority enabled=0 gpgkey=file:// /etc/ pki/rpm-gpg/ RPM-GPG-KEY-EPEL-7 gpgcheck=0 [epel-source] name=Extra Packages for Enterprise Linux 7 - $basearch - Source baseurl=http://mi rrors.aliyun.com/epel/ 7 /SRPMS failovermethod=priority enabled=0 gpgkey=file:// /etc/ pki/rpm-gpg/ RPM-GPG-KEY-EPEL-7 gpgcheck=0 EOF %end %packages @base @network-tools %end
web管理 阿里云太新会出错,用搜狐 1 2 3 4 5 6 7 8 9 10 vi /etc/yum .repos.d/epel.repo [epel] name=Extra Packages for Enterprise Linux 7 - $basearch baseurl=http://mi rrors.sohu.com/fedora-epel/ 7 /x86_64/ enabled=1 gpgcheck=0 [root@localhost ~] [root@localhost network-scripts] [root@localhost network-scripts] [root@localhost network-scripts]