zoukankan      html  css  js  c++  java
  • YUM仓库部署

    一、简介及背景描述

    角色 IP Addr
    服务端 192.168.1.3
    客户端 192.168.1.4

    二、服务安装及配置

    2.1 配置web服务器

    # 默认系统基础repo中可能没有nginx安装包,可以自行添加一个阿里的epel源
    [root@my-test ~]# yum -y install nginx
    # 启动服务
    [root@my-test ~]# systemctl start nginx.service
    

    2.2 安装createrepo

    createrepo是linux下创建仓库的软件包。create是创建的意思,repo是repository的缩写,是仓库的意思。
    只有安装createrepo这个软件,才能在yum服务器创建软件仓库。

    [root@my-test ~]# yum -y install createrepo
    

    2.3 光盘镜像

    # 创建光盘挂载的目录并挂载镜像文件
    [root@my-test ~]# mkdir /iso/
    [root@my-test yum.repos.d]# cd /usr/local/src/
    [root@my-test src]# mount -o loop CentOS-7-x86_64-DVD-2009.iso /iso/
    
    # 创建软件源所在的位置
    [root@my-test ~]# mkdir -p /yum/centos/centos7/os/
    
    # 复制到光盘下的所有文件到软件源目录
    [root@my-test src]# cp -rv /iso/* /yum/centos/centos7/os/
    

    三、客户端指定yum源

    3.1 默认的yum信息

    [root@centos-linux-1 ~]# yum repolist
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.bfsu.edu.cn
     * updates: mirrors.bfsu.edu.cn
    repo id                                                     repo name                                                     status
    base/7/x86_64                                               CentOS-7 - Base                                               10,072
    extras/7/x86_64                                             CentOS-7 - Extras                                                476
    updates/7/x86_64                                            CentOS-7 - Updates                                             2,189
    repolist: 12,737
    

    3.2 更换yum源

    3.2.1 备份原有的yum配置文件

    [root@centos-linux-1 ~]# cd /etc/yum.repos.d/
    [root@centos-linux-1 yum.repos.d]# mkdir bak
    [root@centos-linux-1 yum.repos.d]# rename .repo .repo.bak *.repo
    [root@centos-linux-1 yum.repos.d]# mv *.bak bak/
    

    3.2.2 指定本地yum源

    [root@centos-linux-1 yum.repos.d]# vi CentOS-Base.repo
    [base]
    name=CentOS-$releasever - Base
    baseurl=http://192.168.1.3/$releasever/os/
    gpgcheck=0
    
    [epel]
    name=CentOS-$releasever - EPE
    baseurl=http://192.168.1.3/$releasever/epel/
    gpgcheck=0
    

    四、更新YUM仓库

    4.1 仓库更新

    搭建完毕内网yum源后,会经常遇软件版本或新增软件软件的情况;这时候需要执行仓库更新操作;

    # epel中添加新软件
    [root@my-test epel]# cp /usr/local/src/nginx-1.18.0-2.el7.ngx.x86_64.rpm ./
    # 更新仓库
    [root@my-test epel]# createrepo --update ./
    

    4.2 客户端更新

    # 客户端重新加载yum缓存并下载nginx
    [root@centos-linux-1 ~]# yum clean all
    [root@centos-linux-1 ~]# yum makecache
    [root@centos-linux-1 ~]# yum -y install nginx
    
  • 相关阅读:
    Angular 学习笔记 (Material table sticky 原理)
    Asp.net core 学习笔记 ( ef core transaction scope & change level )
    sql server 学习笔记 (nested transaction 嵌套事务)
    html 图片文字并排显示
    Maven 的配置
    Eclipse的配置
    tomcat 的安装与配置
    java jdk的安装与配置
    javascript 拖拽
    html5 CSS input placeholder兼容性处理
  • 原文地址:https://www.cnblogs.com/sparkss/p/14785257.html
Copyright © 2011-2022 走看看