RHEL7环境下搭建本地yum源


本地yum源服务,可以通过http服务或者ftp服务来实现文件共享。
这里,我使用http的方式,因为如果用ftp的话,必须要开启允许匿名登录,存在一定的安全隐患。
计划把不同版本的RHEL安装光盘镜像作为yum文件直接共享出去,方便之后维护装包,不用每次都手工挂载镜像了。
我采用RHEL7+Apache的组合,当然你也可以用Nginx。本机ip地址为192.168.93.211。
--------------------------------------------------------------------------------------------------------------------------------------------------------

1、安装Apache Web服务组件
# yum groupinstall web* -y

2、拷贝镜像文件到共享目录中
创建共享目录
#mkdir -p /var/www/html/rhel/7Server/x86_64(其他的版本也类似创建相应目录就可以了)
#cd /mnt(镜像文件挂载在/mnt目录下)
拷贝镜像文件
#cp -rfa * /var/www/html/rhel/7Server/x86_64

3、开启httpd服务,并设为开机自启动
#systemctl start httpd
#systemctl enable httpd

4、配置防火墙,SeLinux
设置同网段的服务器可以访问该主机的http服务,并永久生效
#firewall-cmd --add-rich-rule "rule family="ipv4" source address="192.168.93.0/24" service name="httpd" accept"
#firewall-cmd --add-rich-rule "rule family="ipv4" source address="192.168.93.0/24" service name="httpd" accept" --permanent


#getenforce查看一下SeLinux的状态,Enforcing表示强制执行。这里其实没有影响,如果你做的不行的话,可以把SeLinux设成disabled。

5、本地测试一下
#vi /etc/yum.repos.d/yum.repo
[pecyum] 
name=RHEL7 Yum 
baseurl=http://192.168.93.211/rhel/7Sever/x86_64
enabled=1  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

#yum clean all
#yum list tree(随便写个包,测试一下看看是否可以获取到信息)

OK了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
redhat 7.2 可用的yum源, 亲自测试可以使用 ,使用过程: 1.卸载已经存在的yum: rpm -qa | grep yum | xargs rpm -e --nodeps 2.将yum 文件放到server中 3.执行rpm -ivh yum-* 4.创建repo文件: #CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$7 - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=os baseurl=http://mirrors.163.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$7 - Updates - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$7 - Extras - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$7 - Plus - 163.com baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 5.测试是否安装成功 yum -y install tree
1.查看系统本身存在的版本 rpm -qa | grep yum 2.卸载centos7上存在的yum安装源包 rpm -e 源包 --nodeps 3.下载yum源包(http://mirrors.163.com/centos/7/os/x86_64/Packages/) yum-metadata-parser-1.1.4-10.el7.x86_64 PackageKit-yum-1.0.7-6.el7.centos.x86_64 yum-utils-1.1.31-40.el7.noarch 下方两个一起装 yum-plugin-fastestmirror-1.1.31-40.el7.noarch yum-langpacks-0.4.2-7.el7.noarch yum-3.4.3-150.el7.centos.noarch yum-rhn-plugin-2.0.1-6.el7.noarch 4.安装yum源包 rpm -ivh yum* 5.创建配置文件(/etc/yum.repos.d/CentOS-Base.repo) vi /etc/yum.repos.d/CentOS-Base.repo [base] name=CentOS-$releasever - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch;=$basearch&repo=os baseurl=http://mirrors.163.com/centos/(系统版本号)7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch;=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch;=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=$releasever - Plus - 163.com baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 每一个baseurl的centos后都改成自己系统的版本号 6.执行命令 yum clean all yum makecache yum install telnet
为了在RHEL6.8上搭建本地yum源服务器,你需要进行以下步骤: 1. 首先,安装"Development Tools"软件包,可以使用以下命令进行安装:yum groupinstall "Development Tools" 2. 接下来,我们需要更换yum源。首先,删除RHEL原有的yum源,可以使用命令:rpm -qa|grep yum|xargs rpm -e --nodeps 3. 然后,下载CentOS的yum安装包并进行安装,可以使用以下命令:yum install -y http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm 4. 创建本地yum源的配置文件。在/etc/yum.repos.d/目录下创建一个新的文件,比如rhel6server.repo,并在其中加入以下内容: [Server] name=rhel6server baseurl=file:///rhel6/Server enabled=1 gpgcheck=0 5. 最后,创建本地yum源的目录。在根目录下创建一个名为rhel6的文件夹,并在其中创建一个名为Server的子文件夹。 现在你已经成功搭建了RHEL6.8的本地yum源服务器。你可以使用yum命令来安装和更新软件包,它会从你的本地源中获取软件包。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [开发环境——基于RHEL 6.8开发环境搭建](https://blog.csdn.net/weixin_33810006/article/details/92651442)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [RHEL6/redhat6通过安装光盘制作本地yum源](https://blog.csdn.net/sj349781478/article/details/126881729)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值