redhat7配置yum repos软件仓库远程yum
redhat7配置yum repos软件仓库&远程yum
Red Hat Enterprise Linux 7 安装后,执行yum命令是提示无可用yum repos(There are no enabled repos),报错信息如下:
[root@localhost opt]# yum install -y vim
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable <repo>
To enable custom repositories:
yum-config-manager --enable <repo>
[root@localhost opt]#
按照提示查看repolist为0:
[root@localhost opt]# yum repolist all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
repolist: 0
[root@localhost opt]# ls -l /etc/yum.repos.d/
total 4
-rw-r--r--. 1 root root 358 Jul 13 19:37 redhat.repo
[root@localhost opt]# cat /etc/yum.repos.d/redhat.repo
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# *** This file is auto-generated. Changes made here will be over-written. ***
# *** Use "subscription-manager repo-override --help" if you wish to make changes. ***
#
# If this file is empty and this system is subscribed consider
# a "yum repolist" to refresh available repos
#
[root@localhost opt]#
cat /etc/yum.repos.d/redhat.repo 查看软件仓库配置文件确实为空。
RedHatEnterpriseLinux 为了得系统更新并安装新软件,需要配置软件包存储库。
解决办法:
方法1)使用Redhat ISO配置本地软件仓库
mount /dev/cdrom /mnt/
mkdir -p /opt/rhel7-iso
cp -r /mnt/* /opt/rhel7-iso/ #拷贝软件包
echo '
[RHEL_7]
name=RHEL_7_x86_64 #仓库名称
baseurl="file:///opt/rhel7-iso" #仓库路径
gpgcheck=0
' > /etc/yum.repos.d/rhel7.repo
通过yum安装vim测试一下
yum install -y vim
命令执行后,会在 /opt/rhel7-iso 目录下生成一个 repodata 目录。
# yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
repo id repo name status
RHEL_7 RHEL_7_x86_64 5,231
repolist: 5,231
配置提供局域网其他服务器的远程共享软件仓库
安装Apache(httpd)服务
yum install -y httpd
默认将网站的根目录指向 /var/www/html 目录
默认的主配置文件是 /etc/httpd/conf/httpd.conf
配置存储在的 /etc/httpd/conf.d/ 目录
修改配置文件:
vim /etc/httpd/conf/httpd.conf
ServerName 192.168.1.100:80
启动/查询/停止服务:
service httpd start
netstat -an |grep 80 #默认监听80端口
service httpd stop
设置开机自启动服务
systemctl enable httpd.service
设置防火墙:
firewall-cmd --zone=public --add-port 80/tcp --permanent
firewall-cmd --reload
cd /var/www/html/
创建一个测试页面:
touch '<html><head>yum repos server</head><body> rhel7.repo file: http://192.168.1.100/rhel7.repo , save to /etc/yum.repos.d/rhel7.repo </body></html>' > index.html
测试浏览器能正常访问:http://192.168.1.100/index.html
在 /var/www/html/ 下创建软件仓库目录 rhel7-iso。由于我已创建过了 /opt/rhel7-iso/,所以这里直接创建软连接(不再创建仓库软件包目录了):
ln -s /opt/rhel7-iso/ rhel7
浏览器测试能正常访问: http://192.168.1.100/rhel7/
在 /var/www/html/ 下创建文件 rhel7.repo for 其他机器可以远程下载
echo '
[RHEL_7]
name=RHEL_7_x86_64
baseurl="http://192.168.1.100/rhel7/"
gpgcheck=0
' > /var/www/html/rhel7.repo
其他局域网的机器,直接下载rhel7.repo或者直接手动创建 /etc/yum.repos.d/rhel7.repo 文件:
echo '
[RHEL_7]
name=RHEL_7_x86_64
baseurl="http://192.168.1.100/rhel7/"
gpgcheck=0
' > /etc/yum.repos.d/rhel7.repo
测试通过网络仓库进行 yum 安装:
yum install -y vim
方法2)配置Centos仓库
去阿里云下载一个OS对应的仓库:http://mirrors.aliyun.com/repo/
wget http://mirrors.aliyun.com/repo/Centos-7.repo
也可以直接 vi /etc/yum.repos.d/CentOS-Base.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-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
清除yum缓存
yum clean all
使用yum安装vim
yum install -y vim
方法2)使用subscription-manager
提示使用 subscription-manager 并遵循说明来注册您的 RHEL7 系统,从而启用 RHEL 的回购,这样的话,需要付费或试用 Redhat 订阅。
如果您只是想在不需要最新Redhat订阅的情况下进行游戏并安装软件,则可以安装下载的Redhat ISO映像,配置使用本地仓库,并从而克服 There are no enabled repos。
这个方法我没有尝试。
redhat7配置yum repos软件仓库远程yum相关推荐
- Linux yum软件仓库配置,linux配置软件仓库 、 yum管理应用软件 、 快速部署Web/FTP...
1.yum简介 基于rpm软件包的安装部署机制 自动解决软件包的依赖关系 需要先配置软件仓库 2.配置本地的软件仓库 a.放入centos7.iso镜像文件到光驱中,确保电源开启 b.命令操作 3.客 ...
- yum软件包管理 yum(软件仓库)
yum(软件仓库):提供众多软件包的仓库,并自动解决软件包之间复杂依赖关系 yum常用命令 yum repolist #列出仓库可用软件包 yum list 软件包名 #查看系统中提供的软件包(包含未 ...
- 配置yum本地软件仓库
第1步:进入到/etc/yum.repos.d/目录中(因为该目录存放着 Yum 软件仓库的配置文件). 第2步:使用 Vim 编辑器创建一个名为 rhel7.repo 的新配置文件(文件名称可随意, ...
- Linux 创建yum源和软件仓库实例
建议打这些命令的时候多按tab键,不同的计算机或虚拟机上不同 [root@localhost Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6. ...
- yum查询软件:使用yum命令查询软件包信息
4.1 问题 本例要求学会使用yum命令查询软件包信息,完成下列任务: 1)列出软件包名称.版本信息 列出所有已安装的软件.所有未安装但软件源能提供的软件包 检查软件 httpd.firefox.ra ...
- RedHat8.4配置本地yum软件仓库(RHEL8.4)
目录 前言 实验准备 1.挂载光盘镜像 2.查看 3.创建挂载点并写入配置文件 挂载点 写入配置文件 挂载 4.创建repo文件 进入配置目录 添加yum源配置 5.清除并生成yum缓存 6.验证 前 ...
- yum软件仓库的配置详解
生活不会突变,你要做的只是耐心和积累.人这一辈子没法做太多的事情,所以每一件都要做得精彩绝伦.你的时间有限,做喜欢的事情会令人愉悦,所以跟随自己的本心. yum概述 yum:Yellowdog Upd ...
- centos7安装配置yum软件仓库
1.流程 [root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# vim rhel7.repo [rhel7] n ...
- Linux网络系列--YUM仓库部署与NFS服务(YUM本地源仓库与远程ftp仓库部署、YUM命令使用、NFS共享存储服务讲解及实验)
文章目录 一. 构建YUM软件仓库 1.1 本地源YUM仓库配置 1.2 远程yum仓库(借助FTP协议) 1.2.1 准备网络安装源(服务器端) 1.2.2 配置软件仓库位置(客户机端) 二. YU ...
最新文章
- python编程用什么电脑好-初学Python编程看哪些书比较好?
- linux挂载点的容量设置
- 开发常识 持续更新~~
- Observer(订阅与发布)
- 7 款顶级开源 BI(商务智能)软件和报表工具
- JavaScript从入门到精通之入门篇(二)函数和数组
- ABP入门系列(3)——领域层定义仓储并实现
- 7-41 大数的乘法 (10 分)
- 苹果或推出不到两千元的iPhone!安卓手机不淡定了
- 如何让jquery-easyui的combobox像select那样不可编辑
- 实习成长之路——设计原则三:里式替换(LSP)跟多态有何区别?哪些代码违背了LSP?
- LINUX安装文件DEB的postrm运行报错,无法卸载怎么办
- 阿里云云计算 22 VPC连接
- 【问题解决】sql2012安装时卡在正在启动操作系统功能"NetFx3"上不动的解决办法...
- 基于FPGA的QAM调制
- 「解决方案」用户变电站配电监控解决方案
- 金三角图形c语言,升哥学堂 | 实战均线形态——“金三角”
- 社会网络分析法SNA
- 初识python之概念认知篇
- 视频合并软件怎么把多个视频合并为一个视频