码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • CentOS7常用yum仓库操作及安装


            日常使用到的YUM仓库作整理,包括:YUM仓库常用命令、搭建本地YUM仓库、常见YUM仓库(CentOS-Base、EPEL、nux-dextop、elrepo、MySQL、GoogleChrome、OracleVirtualBox、Zabbix、Grafana等)

    目录

    1、YUM仓库操作

    1.1、YUM仓库常用命令

    1.2、搭建本地YUM仓库

    2、常见YUM仓库及安装

    2.1、CentOS-Base

    2.2、EPEL

    2.3、nux-dextop

    2.4、ELRepo

    2.5、MySQL

    2.6、Google-Chrome

    2.7、Oracle-VirtualBox

    2.8、Zabbix

    2.9、Grafana


    操作系统:CentOS-7.9-2009-x86_64

    1、YUM仓库操作

    1.1、YUM仓库常用命令

    YUM仓库常用命令,请根据实际需求组合使用。

    1. # 清理yum仓库下载的rpm包缓存(路径:/var/cache/yum/x86_64/7/*/package/*.rpm)
    2. yum clean all
    3. # 重新加载yum仓库的metadata数据,并生成文件目录缓存
    4. yum makecache
    5. # 查看仓库信息列表
    6. yum repolist
    7. # 查看本地指定仓库信息
    8. yum repoinfo YUM仓库名.repo
    9. # 显示指定软件信息
    10. yum info 软件包名
    11. # 查询rpm文件是由什么软件包提供(即被依赖)
    12. yum whatprovides 软件包名
    13. # 查询软件包列表
    14. yum list
    15. # 查询系统中已安装的软件包
    16. yum list installed
    17. # 查询仓库中尚未安装的软件包
    18. yum list available
    19. # 查询可以升级版本的软件包
    20. yum list updates
    21. # 查询安装历史
    22. yum history list
    23. # 查看指定ID(如:18)做了什么
    24. yum history info 18
    25. # 回滚指定ID(如:18)的操作
    26. yum history undo 18
    27. # 安装指定的软件
    28. yum install 软件包名
    29. # 重新安装指定的软件
    30. yum reinstall 软件包名
    31. # 卸载指定的软件
    32. yum remove 软件包名
    33. # 查看已安装的软件包组
    34. yum grouplist
    35. # 查看指定的软件包组
    36. yum groupinfo 软件包名
    37. # 安装指定的软件包组
    38. yum groupinstall 软件包名
    39. # 移除指定的软件包组
    40. yum groupremove 软件包名
    41. # 卸载指定的软件及依赖
    42. yum autoremove 软件包名
    43. # 更新指定的软件
    44. yum update 软件包名
    45. yum update 软件包名 check-update

    1.2、搭建本地YUM仓库

    使用场景:一个服务器集群,只有一台服务器能连接外网。连接外网那台服务器把外网源的包全部同步到本地,集群中其他服务器以该服务器为YUM仓库源。同步完包后,使用 createrepo 来生成本地的repodata数据。

    1. # 同步整个源到指定目录(注意:系统自动创建相关目录,并下载,时间较长请耐心等待)
    2. reposync -p /YUM仓库目录
    3. # 同步指定仓库源到指定目录
    4. reposync --repoid=仓库ID -p /YUM仓库目录
    5. # 只更新指定仓库源中已下载的软件包的最新版本
    6. reposync -n --repoid=仓库ID -p /YUM仓库目录
    7. # (局域网客户机)搭建本地YUM仓库
    8. # 安装 createrepo 创建本地YUM仓库工具
    9. yum install createrepo
    10. createrepo --version
    11. # 挂载局域网离线仓库到本地
    12. # mount /内网主机IP/YUM仓库目录 /本地YUM仓库目录
    13. # 创建本地(局域网离线)仓库
    14. createrepo --v /本地YUM仓库目录
    15. createrepo --update /本地YUM仓库目录
    16. # 创建本地仓库文件
    17. vi /etc/yum.repos.d/intranet-offline.repo
    18. [local]
    19. name=CentOS-$releasever-$basearch-local
    20. baseurl=file:///mnt/intranet-offline-yum/
    21. gpgcheck=0
    22. enabled=1
    23. # 清除yum缓存
    24. yum clean all
    25. # 重新加载yum仓库的metadata数据,并生成文件目录缓存
    26. yum makecache

    reposync命令及参数:

    1. reposync --help
    2. Usage:
    3. Reposync is used to synchronize a remote yum repository to a local
    4. directory using yum to retrieve the packages.
    5. /usr/bin/reposync [options]
    6. Options:
    7. -h, --help show this help message and exit
    8. -c CONFIG, --config=CONFIG
    9. config file to use (defaults to /etc/yum.conf)
    10. -a ARCH, --arch=ARCH act as if running the specified arch (default: current
    11. arch, note: does not override $releasever. x86_64 is a
    12. superset for i*86.)
    13. --source operate on source packages
    14. -r REPOID, --repoid=REPOID
    15. specify repo ids to query, can be specified multiple
    16. times (default is all enabled)
    17. -e CACHEDIR, --cachedir=CACHEDIR
    18. directory in which to store metadata
    19. -t, --tempcache Use a temp dir for storing/accessing yum-cache
    20. -d, --delete delete local packages no longer present in repository
    21. -p DESTDIR, --download_path=DESTDIR
    22. Path to download packages to: defaults to current dir
    23. --norepopath Don't add the reponame to the download path. Can only
    24. be used when syncing a single repository (default is
    25. to add the reponame)
    26. -g, --gpgcheck Remove packages that fail GPG signature checking after
    27. downloading
    28. -u, --urls Just list urls of what would be downloaded, don't
    29. download
    30. -n, --newest-only Download only newest packages per-repo
    31. -q, --quiet Output as little as possible
    32. -l, --plugins enable yum plugin support
    33. -m, --downloadcomps also download comps.xml
    34. --download-metadata download all the non-default metadata
    35. --allow-path-traversal
    36. Allow packages stored outside their repo directory to
    37. be synced (UNSAFE, USE WITH CAUTION!)

    2、常见YUM仓库及安装

    2.1、CentOS-Base

    CentOS官方默认源。

    rpm -Uvh http://mirror.centos.org/centos/7/os/x86_64/Packages/centos-release-7-7.1908.0.el7.centos.x86_64.rpm -- force

    The CentOS Projecthttps://www.centos.org/centos镜像_centos下载地址_centos安装教程-阿里巴巴开源镜像站阿里巴巴开源镜像站为您提供免费的centos下载地址及centos安装教程,centos镜像简介:CentOS,是基于Red Hat Linux提供的可自由使用源代码的企业级Linux发行版本,是RHEL(Red Hat Enterprise Linux)源代码再编译的产物,是一个免费的企业级计算平台;CentOS 定期发行及更新版本,以便支持新的硬件,从而建立一个安全、低维护、稳定、高预测性、高重复性的Linux环境。阿里巴巴开源镜像站,持续同步CentOS、CentOC-altarch等最新版镜像文件,为用户提供极致的下载体验。阿里巴巴开源镜像站icon-default.png?t=M666https://developer.aliyun.com/mirror/centos

    2.2、EPEL

    EPEL是Extra Packages for Enterprise Linux的缩写,其为EL6或EL7提供重建的Fedora组件,并且不会替换base中的包。EPEL算得上是最著名的第三方软件源,几乎各个云服务器厂商提供的CentOS 系统均会自带该源并默认启用。其收录了web中常用的Nginx软件包。

    1. # 安装EPEL仓库
    2. yum install epel-release
    3. # 替换为国内镜像源(如:阿里云)
    4. sed -i 's|^#baseurl=http://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
    5. sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*

    注意:如果CentOS-Base安装的阿里云源(https://mirrors.aliyun.com/repo/Centos-7.repo),则需要手工修改 epel.repo 中的 baseUrl;否则请直接安装epel-release。

    2.3、nux-dextop

    nux-dextop 用于 EL 的面向桌面和多媒体的 RPM 存储库。它包含许多图形程序,例如 Ardour,还有基于文本的应用程序 line Cone。Nux-Dextop库依赖于EPEL库。

    1. # 安装nux-dextop YUM仓库
    2. rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

    注意:该仓库与 EPEL 共存时,它可能会与 Repoforge/RPMforge 和 ATrpms 以及其他 repos 发生严重冲突。

    Index of /download/nux/dextopicon-default.png?t=M666http://li.nux.ro/download/nux/dextop/

    My GNU/Linux related projectsicon-default.png?t=M666http://li.nux.ro/

    2.4、ELRepo

    ELRepo是The Community Enterprise Linux Repository的缩写,旨在提供驱动程序来增强系统的硬件支持(包括:显示、文件系统、硬件监控、网络、音效、网络摄像镜驱动程序)

    1. # 导入仓库指纹文件
    2. rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
    3. # 安装 ELRepo YUM仓库
    4. rpm -Uvh https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm

    ELRepo | HomePageELRepohttp://elrepo.org/tiki/HomePage

    2.5、MySQL

    MySQL一种OLTP、OLAP开源数据库服务。

    1. # 导入仓库指纹文件
    2. #rpm --import http://repo.mysql.com/RPM-GPG-KEY-mysql
    3. rpm --import http://repo.mysql.com/RPM-GPG-KEY-mysql-2022
    4. # 安装 MySQL5.7社区版 YUM仓库
    5. # http://repo.mysql.com/mysql57-community-release-el7.rpm
    6. rpm -Uvh http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm
    7. # 安装 MySQL8.x社区版 YUM仓库
    8. # Install mysql80-community-release-el7 repository
    9. # http://repo.mysql.com/mysql80-community-release-el8.rpm
    10. rpm -Uvh http://repo.mysql.com/mysql80-community-release-el7-6.noarch.rpm
    11. # 安装 MySQL集群社区版 YUM仓库
    12. # http://repo.mysql.com/mysql-cluster-community-minimal-release-el7.rpm
    13. rpm -Uvh http://repo.mysql.com/mysql-cluster-community-minimal-release-el7-1.noarch.rpm

    MySQL :: Download MySQL Yum Repositoryhttps://dev.mysql.com/downloads/repo/yum/MySQL :: MySQL Community Downloadshttps://dev.mysql.com/downloads/

    2.6、Google-Chrome

    Google Chrome是一款由Google公司开发的网页浏览器,基于其他开源软件撰写,包括WebKit,目标是提升稳定性、速度和安全性,并创造出简单且有效率的使用者界面。软件的名称来自称作Chrome的网络浏览器GUI(图形用户界面)。

    1. # 导入仓库指纹文件
    2. rpm --import http://dl.google.com/linux/linux_signing_key.pub
    3. # 创建google-chrome YUM仓库
    4. vi /etc/yum.repos.d/google-chrome.repo
    5. [google-chromel]
    6. name=google-chrome
    7. baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
    8. enable=1
    9. gpgcheck=1
    10. gpgkey=http://dl.google.com/linux/linux_signing_key.pub

    注意:部分运营商网络下,连接http://dl.google.com/可能失败,是被墙的原因。

    Google Chrome 网络浏览器得益于 Google 智能工具,Chrome 现在更易用、更安全、更快速。https://www.google.cn/chrome/thank-you.html

    2.7、Oracle-VirtualBox

    Oracle VM VirtualBox、虚拟机扩展包和软件开发工具包 (SDK)。

    1. # 导入仓库指纹文件
    2. rpm --import https://www.virtualbox.org/download/oracle_vbox.asc
    3. # 下载Oracle VirtualBox仓库
    4. wget -O /etc/yum.repos.d/virtualbox.repo https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo

    Oracle VM VirtualBox https://www.virtualbox.org/

    2.8、Zabbix

    Zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案,能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。

    Zabbix官方仓库提供Red Hat Enterprise Linux、CentOS、Oracle Linux、Ubuntu、Debian、SUSE Linux Enterprise Server 甚至 Raspbian 的安装包。

    1. # 安装 Zabbix YUM仓库
    2. rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-2.el7.noarch.rpm

    zabbix开源地址icon-default.png?t=M666https://github.com/zabbix/zabbix

    Zabbix :: The Enterprise-Class Open Source Network Monitoring SolutionZabbix is a mature and effortless enterprise-class open source monitoring solution for network monitoring and application monitoring of millions of metrics.https://www.zabbix.com/

    2.9、Grafana

    Grafana 能够查询、可视化、警告和探索存储在任何位置的指标、日志和跟踪,并提供了将时间序列数据库 (TSDB) 数据转换为富有洞察力的图表和可视化的工具。

    grafana开源地址icon-default.png?t=M666https://github.com/grafana/grafana

    Grafana: The open observability platform | Grafana LabsGrafana is the open source analytics & monitoring solution for every database.https://grafana.com/

    1. # 官方安装参考 https://grafana.com/docs/grafana/next/setup-grafana/installation/rpm/#install-from-yum-repository
    2. # 新建Grafana YUM仓库文件
    3. # 以下两项配置实际需要配置任一即可
    4. vi /etc/yum.repos.d/grafana.repo
    5. # #################### OSS版本 ####################
    6. [grafana]
    7. name=grafana
    8. baseurl=https://packages.grafana.com/oss/rpm
    9. repo_gpgcheck=1
    10. enabled=1
    11. gpgcheck=1
    12. gpgkey=https://packages.grafana.com/gpg.key
    13. sslverify=1
    14. sslcacert=/etc/pki/tls/certs/ca-bundle.crt
    15. # #################### 企业版 ####################
    16. [grafana]
    17. name=grafana
    18. baseurl=https://packages.grafana.com/enterprise/rpm
    19. repo_gpgcheck=1
    20. enabled=1
    21. gpgcheck=1
    22. gpgkey=https://packages.grafana.com/gpg.key
    23. sslverify=1
    24. sslcacert=/etc/pki/tls/certs/ca-bundle.crt

    以上是自己常用的YUM仓库源,欢迎留言补充……

  • 相关阅读:
    static关键字续、继承、重写、多态
    Centos 优化ulimit
    深入探索OCR技术:前沿算法与工业级部署方案揭秘
    Vue中 computed 和 watch
    基于STM32人脸识别系统方案设计(程序代码+设计说明书)
    【CTF_SQL】[极客大挑战 2019]LoveSQL 1
    为什么我认识的机械工程师都抱怨工资低?
    Github每日精选(第12期):去中心化的社交平台mastodon
    一个比 Nginx 还简单的 Web 服务器
    CPU、GPU、IPU、NPU、TPU、LPU、MCU、MPU、SOC、DSP、FPGA、ASIC、GPP、ECU、
  • 原文地址:https://blog.csdn.net/Sn_Keys/article/details/126046050
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号