原标题:小仙女Linux很懂——yum搭建
配置yum仓库:
切换到/etc/yum.repos.d/目录下
[root@localhost yum.repos.d]# cd /etc/yum.repos.d
2.新创建一个以.repo结尾的文件编写配置路径。
[root@localhost yum.repos.d]# vim wy.repo
[wy] #标识自定义
name=wy #名字自定义
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
3.创建挂载光盘的目录
[root@localhost yum.repos.d]# mkdir -p /mnt/cdrom
将景象挂载在创建的目录下
[root@localhost yum.repos.d]# mount /dev/cdrom /mnt/cdrom
测试是否安装成功,安装httpd.
报错了:
[root@localhost ~]# yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist ht*tp*// *mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo= ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable
Cannot find a valid baseurl for repo: base/7/x86_64
提示信息:不能找到一个有效的baseurl。
解决方法:
[root@localhost yum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
删除 /etc/yum.repos.d/CentOS-Base.repo
CentOS-base.repo记录本地yum的路径信息
问题解决:
[root@localhost yum.repos.d]# yum install httpd
apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-88.el7.centos
mailcap.noarch 0:2.1.41-2.el7
Complete!返回搜狐,查看更多
责任编辑: