CentOS7利用yum缓存搭建本地源
CentOS7利用yum缓存搭建本地源
环境说明
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@localhost ~]# hostnamectl --static set-hostname yum-cache
[root@yum-cache ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@yum-cache ~]# sestatus
SELinux status: disabled
[root@yum-cache ~]# iptables -nL
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
配置yum缓存
[root@yum-cache ~]# egrep -v "^$|#" /etc/yum.conf
[main]
cachedir=/var/cache/yum # 设置rpm包缓存的路径
keepcache=1 # 默认为0,改为1
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
[root@yum-cache ~]# yum -y install mysql-community-server mysql # 这边用mysql做实验,下过mysql的都知道,没有rpm包,下载真的慢
[root@yum-cache ~]# pwd
/root
[root@yum-cache ~]# mkdir mysql-5.7.31
[root@yum-cache ~]# ls
anaconda-ks.cfg mysql-5.7.31
[root@yum-cache ~]# find /var/cache/yum/ -name "*.rpm" -exec cp {} /root/mysql-5.7.31/ \;
[root@yum-cache ~]# ls /root/mysql-5.7.31/
mysql-community-client-5.7.31-1.el7.x86_64.rpm mysql-community-server-5.7.31-1.el7.x86_64.rpm
mysql-community-common-5.7.31-1.el7.x86_64.rpm net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
mysql-community-libs-5.7.31-1.el7.x86_64.rpm postfix-2.10.1-9.el7.x86_64.rpm
mysql-community-libs-compat-5.7.31-1.el7.x86_64.rpm
[root@yum-cache ~]# yum -y install createrepo
[root@yum-cache ~]# createrepo -v mysql-5.7.31/
Spawning worker 0 with 7 pkgs
Worker 0: reading mysql-community-client-5.7.31-1.el7.x86_64.rpm
Worker 0: reading mysql-community-common-5.7.31-1.el7.x86_64.rpm
Worker 0: reading mysql-community-libs-5.7.31-1.el7.x86_64.rpm
Worker 0: reading mysql-community-libs-compat-5.7.31-1.el7.x86_64.rpm
Worker 0: reading mysql-community-server-5.7.31-1.el7.x86_64.rpm
Worker 0: reading net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
Worker 0: reading postfix-2.10.1-9.el7.x86_64.rpm
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Starting other db creation: Mon Jul 20 22:17:18 2020
Ending other db creation: Mon Jul 20 22:17:18 2020
Starting filelists db creation: Mon Jul 20 22:17:18 2020
Ending filelists db creation: Mon Jul 20 22:17:18 2020
Starting primary db creation: Mon Jul 20 22:17:18 2020
Ending primary db creation: Mon Jul 20 22:17:18 2020
Sqlite DBs complete
[root@yum-cache ~]# cd mysql-5.7.31/ # createrepo后,会产生repodata目录
[root@yum-cache mysql-5.7.31]# ls
mysql-community-client-5.7.31-1.el7.x86_64.rpm mysql-community-server-5.7.31-1.el7.x86_64.rpm
mysql-community-common-5.7.31-1.el7.x86_64.rpm net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
mysql-community-libs-5.7.31-1.el7.x86_64.rpm postfix-2.10.1-9.el7.x86_64.rpm
mysql-community-libs-compat-5.7.31-1.el7.x86_64.rpm repodata
[root@yum-cache mysql-5.7.31]# vim mysql-5.7.31.repo
[root@yum-cache mysql-5.7.31]# cat mysql-5.7.31.repo
[mysql]
name="mysql-5.7.31-local"
baseurl=file:///root/mysql-5.7.31/
enable=1
gpgcheck=0
[root@yum-cache ~]# tar czvf mysql-5.7.31.tar.gz mysql-5.7.31/ # 将rpm包和repo文件打包,放到其他机器上测试
[root@yum-cache ~]# ls
anaconda-ks.cfg mysql-5.7.31 mysql-5.7.31.tar.gz
测试
[root@localhost ~]# ls # 将tar包上传到服务器上
anaconda-ks.cfg mysql-5.7.31.tar.gz
[root@localhost ~]# tar xf mysql-5.7.31.tar.gz
[root@localhost ~]# cd mysql-5.7.31/
[root@localhost mysql-5.7.31]# ls
mysql-5.7.31.repo mysql-community-server-5.7.31-1.el7.x86_64.rpm
mysql-community-client-5.7.31-1.el7.x86_64.rpm net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
mysql-community-common-5.7.31-1.el7.x86_64.rpm postfix-2.10.1-9.el7.x86_64.rpm
mysql-community-libs-5.7.31-1.el7.x86_64.rpm repodata
mysql-community-libs-compat-5.7.31-1.el7.x86_64.rpm
[root@localhost mysql-5.7.31]# cp mysql-5.7.31.repo /etc/yum.repos.d/ # 把写好的repo文件复制到yum.repos.d目录下
[root@localhost mysql-5.7.31]# yum clean all # 清除缓存
Loaded plugins: fastestmirror
Cleaning repos: base extras mysql updates
Cleaning up list of fastest mirrors
[root@localhost mysql-5.7.31]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
mysql | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/13): base/7/x86_64/group_gz | 153 kB 00:00:01
(2/13): extras/7/x86_64/filelists_db | 217 kB 00:00:02
(3/13): extras/7/x86_64/other_db | 125 kB 00:00:00
(4/13): base/7/x86_64/other_db | 2.6 MB 00:00:03
(5/13): mysql/filelists_db | 6.5 kB 00:00:00
(6/13): mysql/other_db | 4.1 kB 00:00:00
(7/13): mysql/primary_db | 10 kB 00:00:00
(8/13): updates/7/x86_64/filelists_db | 1.7 MB 00:00:00
(9/13): updates/7/x86_64/other_db | 250 kB 00:00:00
(10/13): extras/7/x86_64/primary_db | 205 kB 00:00:02
(11/13): updates/7/x86_64/primary_db | 3.0 MB 00:00:01
(12/13): base/7/x86_64/filelists_db | 7.1 MB 00:00:10
(13/13): base/7/x86_64/primary_db | 6.1 MB 00:00:12
Metadata Cache Created
[root@localhost ~]# yum -y install mysql-community-server mysql # 然后你就会发现,直接开始installing了
CentOS7利用yum缓存搭建本地源的更多相关文章
- CentOS7基于http方式搭建本地yum源
1.创建yum软件保存目录[root@localhost ~]# mkdir -p /www/share/yum 2. 修改yum配置文件先备份yum配置文件,修改yum配置文件中yum软件包保存目录 ...
- suse 12 利用缓存创建本地源供内网服务使用
文章目录 服务端获取 添加源 刷新源 清除缓存 安装软件 获取rpm包 客户端测试 zypper --help 前言: 其实,咱也不知道为啥写了这篇博客,咱就是想学一学suse,咱也不会,咱也只能学, ...
- CentOS6.5使用createrepo搭建本地源
本地搭建本地yum源采用的rpm全部来自CentOS-6.5-bin-DVD1&DVD2; 我的是在虚拟机环境安装,先检查我的操作系统版本: 1 2 3 4 [adam@ultraera ~] ...
- 在VMware CentOS7挂载系统光盘搭建本地仓库
1.软件准备: 安装VMware环境,在这里我使用的是VMware15 一个虚拟机系统,在这里我使用的是CentOS7(版本不同可能会有一点出入,但是应该相差不大) 在这里还有一个前提是已经建立好了y ...
- CentOS7清理yum缓存和释放内存方法
清理yum缓存 清理yum缓存使用yum clean 命令,yum clean 的参数有headers, packages, metadata, dbcache, plugins, expire-ca ...
- CentOS7使用yum详细搭建zabbix3.2过程
本文引用于:http://blog.csdn.net/s3275492383/article/details/62417210 一.准备搭建环境: 1.系统:CentOS7 2.默认有使用linux服 ...
- redhat利用yum快速搭建LAMP环境
LAMP LAMP环境,对于PHP开发及其开源的PHP项目的部署都很关键的. LAMP的含义: L ---Linux A ---Apache web M ---Mysql datab ...
- CentOS7用yum快速搭建LAMP平台
实验环境: [root@nmserver-7 html]# cat /etc/redhat-release CentOS release 7.3.1611 (AltArch) [root@nmserv ...
- 利用nodeJs anywhere搭建本地服务器环境【转载】
首先去nodeJs官网下载最新版nodeJs https://nodejs.org/en/ 安装成功后win+r打开cmd 输入node -help 或者node -v查看是否安装成功 装好后 ...
随机推荐
- 利用EndpointSlices扩展Kubernetes网络,提供更强的可伸缩性和功能
EndpointSlices是一个令人兴奋的新API,它提供了Endpoints API的可扩展和可扩张的替代方案.EndpointSlice跟踪Pod服务后面的IP地址,端口,准备情况和拓扑信息.在 ...
- 5大最新云原生镜像构建工具全解析,3个来自Google,你了解几个?
1云原生大背景下的镜像构建在分享开始,我想先跟大家简单聊一下云原生,可能不会详细展开,而是带领大家了解一下云原生对镜像构建方面的影响.第一,在接触云原生相关的技术时,无论是要解决开发.测试环境的问题, ...
- JDK8 一文搞定👍
! https://zhuanlan.zhihu.com/p/442182870 Java8 新特性 学习来源于 B站 尚硅谷yyds Java学习源码 2021/11/22 距离,过年还有 57 天 ...
- Java中:接口,抽象类,内部类
Java8中的接口 public interface Output { //接口里定义的成员变量只能是常量 //默认使用public static final修饰 int MAX_CACHE_LINE ...
- [硬件]USB TYPE C引脚定义
- 【机器学习】GMM和EM算法
机器学习算法-GMM和EM算法 目录 机器学习算法-GMM和EM算法 1. GMM模型 2. GMM模型参数求解 2.1 参数的求解 2.2 参数和的求解 3. GMM算法的实现 3.1 gmm类的定 ...
- 【刷题-LeetCode】205. Isomorphic Strings
Isomorphic Strings Given two strings *s* and *t*, determine if they are isomorphic. Two strings are ...
- 【记录一个问题】opencv中 cv::dft()与cv::ocl_dft()计算的结果相差较大
以一个跟踪算法来测试: 使用cv::dft(), 矩阵未按照2次幂对齐,最终跟踪平均准确率 84.3% 使用cv::dft(),矩阵使用cv::copyMakeBorder对齐,最终跟踪平均准确率 8 ...
- Cesium源码剖析---视频投影
Cesium中的视频投影是指将视频作为一种物体材质,实现在物体上播放视频的效果.这个功能在Cesium早期版本中就支持了,在Code Example中有一个示例.今天就来分析一下其内部实现原理. 1. ...
- @WebServlet注解(Servlet注解)
@WebServlet 注解的属性 @WebServlet 用于将一个类声明为 Servlet,该注解会在部署时被容器处理,容器根据其具体的属性配置将相应的类部署为 Servlet.该注解具有下表给出 ...