搭建私有yum源与仓库
2021/9/29 7:12:21
本文主要是介绍搭建私有yum源与仓库,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、修改IP
[root@localhost ~]# sed -i 's#.200#.50#g' /etc/sysconfig/network-scripts/ifcfg-eth[01] [root@localhost ~]# systemctl restart network
2、关闭selinux
/etc/selinux/config 1、临时关闭 [root@localhost ~]# setenforce 0 2、永久关闭 [root@localhost ~]# vi /etc/selinux/config SELINUX=disabled
3、关闭默认的防火墙 [root@localhost ~]# systemctl disable --now firewalld
disable : 禁用 enable : 启用 --now :立即执行
4、安装web服务软件以及yum仓库软件
1、清理yum源 [root@localhost yum.repos.d]# mkdir backup [root@localhost yum.repos.d]# mv ./*.repo* backup/ [root@localhost yum.repos.d]# ll total 4 drwxr-xr-x. 2 root root 4096 Sep 24 09:15 backup 2、安装base源和epel源 [root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo [epel] name="epel" baseurl=https://repo.huaweicloud.com/epel/7/x86_64/ gpgcheck=0 yum clean all yum makecache 3、安装 yum install nginx yum-utils createrepo -y
5、建立仓库
[root@localhost yum.repos.d]# mkdir -p /yumrepo3/Packages
6、下载软件
curl -o /yumrepo3/Packages/zip-3.0-11.el7.x86_64.rpm https://repo.huaweicloud.com/centos/7/os/x86_64/Packages/zip-3.0-11.el7.x86_64.rpm
扩展内容: curl 和 wget 之间的区别
curl 是用来访问链接的 -o : 指定保存文件的路径 curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
wget 是用来下载文件的
-O :指定下载文件的路径 wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
7、修改Nginx配置文件
[root@localhost ~]# vi /etc/nginx/nginx.conf # 大致在42行左右 root /yumrepo3; autoindex on; autoindex_exact_size off; autoindex_localtime on;
8、重启Nginx服务
systemctl restart nginx
9、初始化yum仓库
createrepo /yumrepo3
10、编写yum源测试
[root@localhost yum.repos.d]# vi local.repo [root@localhost yum.repos.d]# cat local.repo [local] name="This is Local repo" baseurl=http://192.168.15.50/ gpgcheck=0
11、更新yum源 yum clean all yum makecache
12、测试安装
yum remove zip -y yum install zip -y
这篇关于搭建私有yum源与仓库的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-29P标签教程:初学者必备指南
- 2024-09-29PS网页切图教程:新手必学的网页设计技巧
- 2024-09-29简单易懂的Web布局教程
- 2024-09-29Web网页开发教程:从零开始的简单入门指南
- 2024-09-298D项目实战:新手入门教程
- 2024-09-29变形项目实战:新手必备入门指南
- 2024-09-29弹性盒子布局项目实战:从入门到上手
- 2024-09-29点击加载项目实战:新手入门必读教程
- 2024-09-29电商网页开发项目实战:新手入门教程
- 2024-09-29封装项目实战:从入门到初级应用