您的位置:首页 > 运维架构 > Linux

Linux网络服务第四章部署yum仓库

2019-08-23 20:00 375 查看
原文链接:http://www.cnblogs.com/ZCQ123456/p/11402308.html

第四章部署yum仓库服务

1.笔记

systemctl start 命令 :重启

systemctl enable 命令 :开机自启动

netstat -anput | grep 命令:查看是否开启

echo $ ?:判断上条命令是否执行成功,是0执行成功,非0不成功

yum provides 包:查看包名

 

2.基于ftp://的本地光盘创建yum仓库过程

yum -y install ftp (安装ftp 软件包)

umount /dev/sr0      (卸载光盘 /dev/sr0)

mkdir /var/ftp/centos7  (建立目录,在/var/ftp/centos7)

mount /dev/sr0 /var/ftp/centos7/(挂载/dev/sr0 挂载/var/ftp/centos7)

vim /etc/yum.repos.d/local.repo  (编辑/etc/yum.repos.d/local.repo)

[local](仓库名称)

name=local(仓库名称)

baseurl=ftp://192.168.203.4(本机地址)/centos7(指定rpm包的位置)

gpgcheck=0(禁用gpg 校验)

enabled=1(启用本地yum仓库)

yum  -y clean all(清空缓存)

yum makecache(重建缓存)

 

 

3.centos7配置在线yum仓库yum源和EPEL源

 

http://rpm.pbone.net/

http://rpmfind.net/

 

rpm-Uvhhttps://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

  1. 挂载完镜像后进入与/etc/yum.repos.d下创建一个文件夹把文件备份后

cd /etc/yum.r*

mkdir a/

mv C* a/

2.下载新的CentOS-Base.repo 到/etc/yum.repos.d/或下载后将文件传输到虚拟机的/etc/yum.repos.dxia下

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

 

 

3、之后运行yum -y clean all 清除缓存,运行 yum makecache 生成新的缓存

 

[root@bogon yum.repos.d]# yum -y clean all

[root@bogon yum.repos.d]# yum makecache

 

安装EPEL源

[root@bogon yum.repos.d]# yum list | grep epel-release

epel-release.noarch 7-9 extras
[root@bogon yum.repos.d]# yum install -y epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-9 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
epel-release noarch 7-9 extras 14 k

Transaction Summary
==================================================================================================================================
Install 1 Package

Total download size: 14 k
Installed size: 24 k
Downloading packages:
epel-release-7-9.noarch.rpm | 14 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-9.noarch 1/1
Verifying : epel-release-7-9.noarch 1/1

Installed:
epel-release.noarch 0:7-9

Complete!
[root@bogon yum.repos.d]# ls

#多了epel.repo和epel-testing.repo
CentOS-Base.repo epel.repo epel-testing.repo repo_bak

 

运行yum clean all 清除缓存,运行 yum makecache 生成新的缓存

[root@bogon yum.repos.d]# yum repolist enabled #查看启用的仓库
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 9,591
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 12,277
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 388
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 1,929
repolist: 24,185
[root@bogon yum.repos.d]# yum repolist all #查看所有的仓库
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com enabled: 9,591
centosplus/7/x86_64 CentOS-7 - Plus - mirrors.aliyun.com disabled
contrib/7/x86_64 CentOS-7 - Contrib - mirrors.aliyun.com disabled
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 enabled: 12,277
epel-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Debug disabled
epel-source/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Source disabled
epel-testing/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 disabled
epel-testing-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug disabled
epel-testing-source/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Source disabled
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com enabled: 388
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com enabled: 1,929
repolist: 24,185

转载于:https://www.cnblogs.com/ZCQ123456/p/11402308.html

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: