使用centos搭建内网的yum源

1.安装httpd服务

2.启动服务,设置开机自启

#启动服务
systemctl start httpd
# 设置开机自动启动
systemctl enable httpd
systemctl status httpd

3.新建一个目录,将rpm文件放到该目录下

4.将/etc/httpd/conf/httpd.conf文件中的DocumentRoot "/var/www/html"和<Directory "/var/www/html">修改成数据盘的目录位置,并执行命令chmod -R 755 "新路径"

5.安装createrepo命令

6.切换到对应目录下,执行命令createrepo .

注:centos5执行:createrepo -s sha1 .

centos6、7执行:createrepo .

centos6、7使用sha256 作为hash 算法 ,在centos5中 默认使用的是sha 作为hash 算法。

7.查看此时多了个repodata的文件,说明执行成功

8.网页端访问

注意:永久关闭selinux和防火墙

#systemctl stop firewalld
#systemctl disable firewalld

9.在需要升级内核的机器上制作本地yum源

cat >>CentOS-kernel.repo<<EOF

[kernel]
name=CentOS-7 - Kernel
baseurl=http://10.0.131.38/CentOS7/
gpgcheck=0
enabled=1
EOF

10.生成yum源

11.查看repolist的情况

相关推荐
likfishdn4 分钟前
Linux的文件与目录管理
linux·运维·服务器
chian-ocean24 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=25 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
追寻光1 小时前
Cannot find a valid baseurl for repo: base/7/x86_64
linux
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos
北京耐用通信1 小时前
航空装配自动化神器Ethercat转profient网关搭配机器人精准控制
运维·机器人·自动化
吃汤圆的抹香鲸1 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net
sz66cm2 小时前
Linux基础 -- ARM 32 位架构动态注入代码技术文档
linux·arm开发·架构