本文参考:http://www.studylinux.net/?p=4515
wget-O/etc/yum.repos.d/CentOS-Base.repo wget-O/etc/yum.repos.d/epel.repohttp://mirrors.aliyun.com/repo/epel-7.repo
3.安装cobbler命令
最好都安装上
yum-yinstallcobblerdhcphttpdxinetdtftp-server
4.启动服务器
[root@localhost~]#systemctlstarthttpd [root@localhost~]#systemctlenablehttpd Createdsymlinkfrom/etc/systemd/system/multi-user.target.wants/httpd.serviceto/usr/lib/systemd/system/httpd.service. [root@localhost~]#systemctlstartcobblerd [root@localhost~]#systemctlenablecobblerd Createdsymlinkfrom/etc/systemd/system/multi-user.target.wants/cobblerd.serviceto/usr/lib/systemd/system/cobblerd.service. [root@localhost~]# 如果出错: [root@localhost~]#rpm-qlcobbler|grepsetting /etc/cobbler/settings 把setting 文件中的server和server_next 修改为本机的IP,默认是127.0.0.1 然后用cobblercheck确定没有问题
5.同步源
mkdir-p/var/www/cobbler/repo_mirror cd/var/www/cobbler/repo_mirror cobblerrepoadd--name=zabbix--mirror=http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/--arch=x86_64--breed=yum cobblerreposync taskstarted:2017-06-04_143254_reposync taskstarted(id=Reposync,time=SunJun414:32:542017) hello,reposync run,reposync,run! creating:/var/www/cobbler/repo_mirror/zabbix/config.repo creating:/var/www/cobbler/repo_mirror/zabbix/.origin/zabbix.repo running:/usr/bin/reposync-l-n-d--config=/var/www/cobbler/repo_mirror/zabbix/.origin/zabbix.repo--repoid=zabbix--download_path=/var/www/cobbler/repo_mirror-ax86_64 3.6kB00:00 4.3kB00:00 3.4kB00:00 3.4kB00:00 951B00:00 170kB00:01 155kB00:01 167kB00:01 epel/x86_64/updateinfoFailed base/7/x86_64/primary_dbFailed 808kB00:08 4.7MB00:46 5.6MB01:19 5.6MB01:00 20kB00:00 230kB00:03 335kB00:07 714kB00:04 621kB00:15 622kB00:16 11kB00:00 240kB00:04 606kB00:08 1.7MB00:20 1.7MB00:16 5.1kB00:00 4.6kB00:00 4.7kB00:00 3.5MB00:48 receivedonstderr: running:createrepo-ccache-ssha/var/www/cobbler/repo_mirror/zabbix receivedonstdout:Spawningworker0with7pkgs Spawningworker1with7pkgs WorkersFinished SavingPrimaryMetadata SavingfilelistsMetadata SavingotherMetadata GeneratingsqliteDBs sqliteDBscomplete receivedonstderr: running:chown-Rroot:apache/var/www/cobbler/repo_mirror/zabbix receivedonstdout: receivedonstderr: running:chmod-R755/var/www/cobbler/repo_mirror/zabbix receivedonstdout: receivedonstderr: ***TASKCOMPLETE*** [root@localhostrepo_mirror]# 检查校验 [root@localhostrepo_mirror]#cd/var/www/cobbler/repo_mirror/zabbix/ [root@localhostzabbix]#ll total10644 drwxr-xr-x2rootapache4096Jun414:35cache -rwxr-xr-x1rootapache111Jun414:32config.repo drwxr-xr-x2rootapache4096Jun414:35repodata -rwxr-xr-x1rootapache343120Apr2503:56zabbix-agent-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x1rootapache235320Apr2503:57zabbix-get-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x1rootapache730860Apr2503:57zabbix-java-gateway-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x1rootapache636756Apr2503:57zabbix-proxy-MysqL-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x1rootapache636252Apr2503:57zabbix-proxy-pgsql-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x1rootapache620776Apr2503:57zabbix-proxy-sqlite3-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x1rootapache11416Feb152016zabbix-release-3.0-1.el7.noarch.rpm -rwxr-xr-x1rootapache246096Apr2503:57zabbix-sender-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x1rootapache1819916Apr2503:57zabbix-server-MysqL-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x1rootapache1818888Apr2503:57zabbix-server-pgsql-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x1rootapache3679892Apr2503:57zabbix-web-3.0.9-1.el7.noarch.rpm -rwxr-xr-x1rootapache5224Apr2503:57zabbix-web-japanese-3.0.9-1.el7.noarch.rpm -rwxr-xr-x1rootapache4756Apr2503:57zabbix-web-MysqL-3.0.9-1.el7.noarch.rpm -rwxr-xr-x1rootapache4768Apr2503:57zabbix-web-pgsql-3.0.9-1.el7.noarch.rpm [root@localhostzabbix]#
apache 映射的地址
http://192.168.56.113/cobbler/repo_mirror/zabbix/
[root@bogon~]#vim/etc/yum.repos.d/zabbix.repo [local-zabbix]#可以自己定义 name=localzabbix baseurl=http://192.168.56.113/cobbler/repo_mirror/zabbix/ enabled=1 gpgcheck=0
下面我就没接着写 参考链接的
[root@aqdl~]#cobblerrepoadd--name=epel--mirror=https://mirrors.aliyun.com/epel/7/x86_64/--arch=x86_64--breed=yum [root@aqdl~]#cobblerrepoadd--name=saltstack--mirror=http://repo.saltstack.com/yum/redhat/latest/x86_64/latest/--arch=x86_64--breed=yum [root@aqdl~]#cobblerrepoadd--name=openstack-mitaka--mirror=https://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-mitaka/--arch=x86_64--breed=yum [root@aqdl~]#cobblerrepoadd--name=updates--mirror=https://mirrors.aliyun.com/centos/7/updates/x86_64/--arch=x86_64--breed=yum [root@aqdl~]#cobblerrepoadd--name=extras--mirror=https://mirrors.aliyun.com/centos/7/extras/x86_64/--arch=x86_64--breed=yum [root@aqdl~]#cobblerrepoadd--name=os--mirror=https://mirrors.aliyun.com/centos/7/os/x86_64/--arch=x86_64--breed=yum [root@aqdl~]#cobblerreposync#在夜深人静的时候同步效果显著!
同步完毕制作一个repo文件放在 /etc/yum.repos.d/
下面就可以了