本篇文章为大家展示了怎么制作内网yum源,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
本文参考:http://www.studylinux.net/?p=4515
-
操作系统centos7(selinux firewalld关闭 )
-
安装cobbler命令修改为阿里的yum源 163的也可以
wget -O /etc/yum.repos.d/CentOS-Base.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
3.安装cobbler命令
最好都安装上
yum -y install cobbler dhcp httpd xinetd tftp-server
4.启动服务器
[root@localhost ~]# systemctl start httpd [root@localhost ~]# systemctl enable httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. [root@localhost ~]# systemctl start cobblerd [root@localhost ~]# systemctl enable cobblerd Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service. [root@localhost ~]# 如果出错: [root@localhost ~]# rpm -ql cobbler|grep setting /etc/cobbler/settings 把 setting 文件中的server和server_next 修改为本机的IP,默认是127.0.0.1 然后用cobbler check确定没有问题
5.同步源
mkdir -p /var/www/cobbler/repo_mirror cd /var/www/cobbler/repo_mirror cobbler repo add --name=zabbix --mirror=http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/ --arch=x86_64 --breed=yum cobbler reposync task started: 2017-06-04_143254_reposync task started (id=Reposync, time=Sun Jun 4 14:32:54 2017) 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 -a x86_64 3.6 kB 00:00 4.3 kB 00:00 3.4 kB 00:00 3.4 kB 00:00 951 B 00:00 170 kB 00:01 155 kB 00:01 167 kB 00:01 epel/x86_64/updateinfo FAILED base/7/x86_64/primary_db FAILED 808 kB 00:08 4.7 MB 00:46 5.6 MB 01:19 5.6 MB 01:00 20 kB 00:00 230 kB 00:03 335 kB 00:07 714 kB 00:04 621 kB 00:15 622 kB 00:16 11 kB 00:00 240 kB 00:04 606 kB 00:08 1.7 MB 00:20 1.7 MB 00:16 5.1 kB 00:00 4.6 kB 00:00 4.7 kB 00:00 3.5 MB 00:48 received on stderr: running: createrepo -c cache -s sha /var/www/cobbler/repo_mirror/zabbix received on stdout: Spawning worker 0 with 7 pkgs Spawning worker 1 with 7 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete received on stderr: running: chown -R root:apache /var/www/cobbler/repo_mirror/zabbix received on stdout: received on stderr: running: chmod -R 755 /var/www/cobbler/repo_mirror/zabbix received on stdout: received on stderr: *** TASK COMPLETE *** [root@localhost repo_mirror]# 检查校验 [root@localhost repo_mirror]# cd /var/www/cobbler/repo_mirror/zabbix/ [root@localhost zabbix]# ll total 10644 drwxr-xr-x 2 root apache 4096 Jun 4 14:35 cache -rwxr-xr-x 1 root apache 111 Jun 4 14:32 config.repo drwxr-xr-x 2 root apache 4096 Jun 4 14:35 repodata -rwxr-xr-x 1 root apache 343120 Apr 25 03:56 zabbix-agent-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x 1 root apache 235320 Apr 25 03:57 zabbix-get-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x 1 root apache 730860 Apr 25 03:57 zabbix-java-gateway-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x 1 root apache 636756 Apr 25 03:57 zabbix-proxy-mysql-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x 1 root apache 636252 Apr 25 03:57 zabbix-proxy-pgsql-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x 1 root apache 620776 Apr 25 03:57 zabbix-proxy-sqlite3-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x 1 root apache 11416 Feb 15 2016 zabbix-release-3.0-1.el7.noarch.rpm -rwxr-xr-x 1 root apache 246096 Apr 25 03:57 zabbix-sender-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x 1 root apache 1819916 Apr 25 03:57 zabbix-server-mysql-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x 1 root apache 1818888 Apr 25 03:57 zabbix-server-pgsql-3.0.9-1.el7.x86_64.rpm -rwxr-xr-x 1 root apache 3679892 Apr 25 03:57 zabbix-web-3.0.9-1.el7.noarch.rpm -rwxr-xr-x 1 root apache 5224 Apr 25 03:57 zabbix-web-japanese-3.0.9-1.el7.noarch.rpm -rwxr-xr-x 1 root apache 4756 Apr 25 03:57 zabbix-web-mysql-3.0.9-1.el7.noarch.rpm -rwxr-xr-x 1 root apache 4768 Apr 25 03:57 zabbix-web-pgsql-3.0.9-1.el7.noarch.rpm [root@localhost zabbix]#
apache 映射的地址
http://192.168.56.113/cobbler/repo_mirror/zabbix/
[root@bogon ~]# vim /etc/yum.repos.d/zabbix.repo [local-zabbix] #可以自己定义 name=local zabbix baseurl=http://192.168.56.113/cobbler/repo_mirror/zabbix/ enabled=1 gpgcheck=0
下面我就没接着写 参考链接的
[root@aqdl ~]# cobbler repo add --name=epel --mirror=https://mirrors.aliyun.com/epel/7/x86_64/ --arch=x86_64 --breed=yum [root@aqdl ~]# cobbler repo add --name=saltstack --mirror=http://repo.saltstack.com/yum/redhat/latest/x86_64/latest/ --arch=x86_64 --breed=yum [root@aqdl ~]# cobbler repo add --name=openstack-mitaka --mirror=https://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-mitaka/ --arch=x86_64 --breed=yum [root@aqdl ~]# cobbler repo add --name=updates --mirror=https://mirrors.aliyun.com/centos/7/updates/x86_64/ --arch=x86_64 --breed=yum [root@aqdl ~]# cobbler repo add --name=extras --mirror=https://mirrors.aliyun.com/centos/7/extras/x86_64/ --arch=x86_64 --breed=yum [root@aqdl ~]# cobbler repo add --name=os --mirror=https://mirrors.aliyun.com/centos/7/os/x86_64/ --arch=x86_64 --breed=yum [root@aqdl ~]# cobbler reposync #在夜深人静的时候同步效果显著!
同步完毕制作
一个repo文件放在 /etc/yum.repos.d/
下面就可以了
上述内容就是怎么制作内网yum源,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注亿速云行业资讯频道。
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/199881.html