首页 > 系统相关 >yum私有仓库的实现及博客输出

yum私有仓库的实现及博客输出

时间:2022-08-15 03:22:27浏览次数:72  
标签:02 CentOS mirrors 私有 博客 yum root localhost


title:yum私有仓库的实现及博客输出

1. 创建局域网的基于Base的私有yum源

1.1. 说明

centos的base包可以从系统镜像中获取或者第三方平台获取

1.2. repo仓库配置文件

[repositoryID]
name=Some name for this repository
baseurl=url://path/to/repository/
enabled={1|0}
gpgcheck={1|0}
gpgkey=URL
enablegroups={1|0}
failovermethod={roundrobin|priority}
roundrobin:意为随机挑选,默认值
priority:按顺序访问
cost= 默认为1000

1.3. 前期准备

#挂载光盘CentOS-8.5.2111-x86_64-dvd1.iso

1.4. 操作步骤:

1.4.1. yum服务器4种baseurl形式

file:///var/www/html/CD_Centos8.5
http://
https://
ftp://

1.4.2. 方法1file形式访问

[01:19:00 root@localhost ~]#mkdir /var/www/html/CD_Centos8.5
[01:28:19 root@localhost ~]#mount /dev/sr0 /var/www/html/CD_Centos8.5
mount: /var/www/html/CD_Centos8.5: WARNING: device write-protected, mounted read-only.

[01:59:19 root@localhost yum.repos.d]#cat Centos8-base.repo 
# 2. CentOS-Base.repo
#
# 3. The mirror system uses the connecting IP address of the client and the
# 4. update status of each mirror to pick mirrors that are updated to and
# 5. geographically close to the client.  You should use this for CentOS updates
# 6. unless you are manually picking other mirrors.
#
# 7. If the mirrorlist= does not work for you, as a fall back you can try the 
# 8. remarked out baseurl= line instead.
#
#
 
[base]
name=Centos8
baseurl=file:///var/www/html/CD_Centos8.5/BaseOS
        file:///var/www/html/CD_Centos8.5/AppStream

gpgcheck=0

[01:59:26 root@localhost yum.repos.d]#yum clean all
0 文件已删除
[01:59:48 root@localhost yum.repos.d]#yum repolist 
仓库 id                                                                                      仓库名称
base                                                                                         Centos8
[01:59:55 root@localhost yum.repos.d]#yum install mysql
Centos8                                                                                                                                                   50 MB/s | 2.6 MB     00:00    
上次元数据过期检查:0:00:01 前,执行于 2022年08月14日 星期日 02时00分03秒。
软件包 mysql-community-client-5.7.37-1.el7.x86_64 已安装。
依赖关系解决。
无需任何处理。
完毕!

1.4.3. http网页形式访问

  • 安装apache服务器

    [02:12:50 root@localhost yum.repos.d]#yum install httpd -y
    
  • 挂载光盘镜像

    [02:19:00 root@localhost ~]#mkdir /var/www/html/CD_Centos8.5
    [02:28:19 root@localhost ~]#mount /dev/sr0 /var/www/html/CD_Centos8.5
    mount: /var/www/html/CD_Centos8.5: WARNING: device write-protected, mounted read-only.
    
  • 访问浏览器地址:

    http://192.168.100.30/CD_Centos8.5/BaseOS/
    http://192.168.100.30/CD_Centos8.5/AppStream/
    

    image-20220814021920792

    image-20220814021852699

  • 配置repo源文件

    [02:20:46 root@localhost yum.repos.d]#cat Centos8-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=Centos8
    baseurl=http://192.168.100.30/CD_Centos8.5/BaseOS/
            http://192.168.100.30/CD_Centos8.5/AppStream/
    
    gpgcheck=0
    [02:20:49 root@localhost yum.repos.d]#yum clean all
    6 文件已删除
    [02:20:59 root@localhost yum.repos.d]#yum repolist 
    仓库 id                                                                                      仓库名称
    base                                                                                         Centos8
    [02:21:06 root@localhost yum.repos.d]#yum install mysql -y
    Centos8                                                                                                                                                  125 MB/s | 2.6 MB     00:00    
    软件包 mysql-community-client-5.7.37-1.el7.x86_64 已安装。
    依赖关系解决。
    无需任何处理。
    完毕!
    
    

2. 搭建第三方阿里云extras私有yum源

2.1. 下载阿里云的extras源

[02:44:02 root@localhost yum.repos.d]#yum reposync --repoid=extras --download-metadata -p /var/www/html/centos/
[02:44:19 root@localhost yum.repos.d]#ls /var/www/html/centos/

2.2. 配置阿里云yum源文件

[02:24:39 root@localhost yum.repos.d]#cat Centos-8.repo 
# 10. CentOS-Base.repo
#
# 10. The mirror system uses the connecting IP address of the client and the
# 10. update status of each mirror to pick mirrors that are updated to and
# 10. geographically close to the client.  You should use this for CentOS updates
# 10. unless you are manually picking other mirrors.
#
# 10. If the mirrorlist= does not work for you, as a fall back you can try the 
# 10. remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-8.5.2111 - Base - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/BaseOS/$basearch/os/
        http://mirrors.aliyuncs.com/centos-vault/8.5.2111/BaseOS/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/BaseOS/$basearch/os/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
 
#additional packages that may be useful
[extras]
name=CentOS-8.5.2111 - Extras - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/extras/$basearch/os/
        http://mirrors.aliyuncs.com/centos-vault/8.5.2111/extras/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/extras/$basearch/os/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

[02:24:53 root@localhost yum.repos.d]#yum repolist 
仓库 id                                                                  仓库名称
AppStream                                                                CentOS-8.5.2111 - AppStream - mirrors.aliyun.com
base                                                                     CentOS-8.5.2111 - Base - mirrors.aliyun.com
extras                                                                   CentOS-8.5.2111 - Extras - mirrors.aliyun.com

2.3. 安装apache服务器

[02:40:50 root@localhost yum.repos.d]#yum install httpd -y

2.4. 访问浏览器地址查看

http://192.168.100.30/centos/extras/

image-20220814024549830

2.5. 配置repo源文件,并测试

[02:47:44 root@localhost yum.repos.d]#cat Centos-8.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.
#
#
 
#additional packages that may be useful
[extras]
name=CentOS-8.5.2111 - Extras - mirrors.aliyun.com
baseurl=http://192.168.100.30/centos/extras/
gpgcheck=0
[base]
name=Centos8
baseurl=http://192.168.100.30/CD_Centos8.5/BaseOS/
        http://192.168.100.30/CD_Centos8.5/AppStream/
gpgcheck=0
[02:47:47 root@localhost yum.repos.d]#yum clean all
11 文件已删除
[02:47:56 root@localhost yum.repos.d]#yum repolist 
仓库 id                                仓库名称
base                                   Centos8
extras                                 CentOS-8.5.2111 - Extras - mirrors.aliyun.com
[02:49:00 root@localhost yum.repos.d]#yum install centos-release-scl  -y
CentOS-8.5.2111 - Extras - mirrors.aliyun.com                                      1.3 MB/s |  10 kB     00:00    

标签:02,CentOS,mirrors,私有,博客,yum,root,localhost
From: https://www.cnblogs.com/zxl1024320609/p/16586908.html

相关文章

  • 【Linux】yum源安装nginx服务
    前言centos通过yum命令安装nginx服务,并开放监听端口、设置开机自启等1、配置yum源并进行安装如有其他版本需求的,可以跳转官网nginx:Linuxpackages,选取适合自......
  • 基于.NetCore开发博客项目 StarBlog - (17) 自动下载文章里的外部图片
    系列文章基于.NetCore开发博客项目StarBlog-(1)为什么需要自己写一个博客?基于.NetCore开发博客项目StarBlog-(2)环境准备和创建项目基于.NetCore开发博客项目......
  • 开通博客的第一天
    博客地址取名为:dreamhui,我最喜欢的一个英文网名。先记录下最近写的一段pl/Sql函数吧,里面用到了pl/json包。--总函数createorreplacefunctionf_all(p_jsonvarchar2,......
  • Linux下yum安装mysql 遇到的问题Can't open and lock privilege tables: Table 'mysql
    今天在linux下安装mysql时执行servicemysqldstart时,mysql总是启动失败后来查看mysql日志:/var/log/mysqld.log,发现有个Can'topenandlockprivilegetables:Table'......
  • 程序解题报告博客的书写格式
    每个题目编程完成后,必须完成解题报告的整理解题报告格式:1.试题名称及出处2.试题算法分析(试题分析、解题思路、算法与数据结构设计)3.试题程序解析(程序+注释) 书写结题报告......
  • 2022.8.7暑假第七周博客
    2022.8.7构造方法我们对封装已经有了基本的了解,接下来我们来看一个新的问题,依然以Person为例,由于Person中的属性都被private了,外界无法直接访问属性,必须对外提供相应的se......