linux中如何进行yum源的挂载

linux中如何进行yum源的挂载

1.首先创建目录

[root@server /]# mkdir /rhel9


2.使用mount命令进行、dev/cdrom/的镜像文件进行挂载

[root@server /]# mount /dev/cdrom  /rhel9/
​
注意:此时设立的是临时命令。重启后则失效,若想在下次开启后仍然挂载,则需要写开机启动脚本

3.设置开机启动自动挂载脚本
[root@server /]# vim /etc/rc.d/rc.local

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
mount /dev/cdrom   /rhel9
~                                                                                   
~                                                                                   
~                                                                                   
~                               



5.给编写的脚本一个可执行权限:
[root@server /]# chmod +x /etc/rc.d/rc.local 



6./etc/yum.repo下创建阿里源,用于下载
[root@server /]# cd /etc/yum.repos.d/
[root@server yum.repos.d]# vim rhel9.repo 
[Appstream]
name=Appstream
baseurl=file:///rhel9/AppStream
gpgcheck=0



[BaseOS]
name=BaseOS
baseurl=file:///rhel9/BaseOS
gpgcheck=0



7.在linux自带的firefox中访问网址,使其可以正常访问,则配置成功
 例如访问网址file:///rhel9/BaseOS
8.实验:下载gcc编辑器:
[root@server /]# yum install gcc
上次元数据过期检查:3:40:17 前,执行于 2024年06月17日 星期一 19时48分53秒。
依赖关系解决。
====================================================================================
 软件包               架构        版本                         仓库            大小
====================================================================================
安装:
 gcc                  x86_64      11.3.1-2.1.el9               Appstream       32 M
安装依赖关系:
 glibc-devel          x86_64      2.34-40.el9                  Appstream       47 k
 glibc-headers        x86_64      2.34-40.el9                  Appstream      547 k
 kernel-headers       x86_64      5.14.0-162.6.1.el9_1         Appstream      3.4 M
 libxcrypt-devel      x86_64      4.4.18-3.el9                 Appstream       32 k
 make                 x86_64      1:4.3-7.el9                  BaseOS         542 k

事务概要
====================================================================================
安装  6 软件包

总计:37 M
安装大小:94 M
确定吗?[y/N]: y
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                     1/1 
  安装    : make-1:4.3-7.el9.x86_64                                             1/6 
  安装    : kernel-headers-5.14.0-162.6.1.el9_1.x86_64                          2/6 
  安装    : glibc-headers-2.34-40.el9.x86_64                                    3/6 
  安装    : libxcrypt-devel-4.4.18-3.el9.x86_64                                 4/6 
  安装    : glibc-devel-2.34-40.el9.x86_64                                      5/6 
  安装    : gcc-11.3.1-2.1.el9.x86_64                                           6/6 
  运行脚本: gcc-11.3.1-2.1.el9.x86_64                                           6/6 
  验证    : gcc-11.3.1-2.1.el9.x86_64                                           1/6 
  验证    : glibc-devel-2.34-40.el9.x86_64                                      2/6 
  验证    : glibc-headers-2.34-40.el9.x86_64                                    3/6 
  验证    : kernel-headers-5.14.0-162.6.1.el9_1.x86_64                          4/6 
  验证    : libxcrypt-devel-4.4.18-3.el9.x86_64                                 5/6 
  验证    : make-1:4.3-7.el9.x86_64                                             6/6 

已安装:
  gcc-11.3.1-2.1.el9.x86_64             glibc-devel-2.34-40.el9.x86_64              
  glibc-headers-2.34-40.el9.x86_64      kernel-headers-5.14.0-162.6.1.el9_1.x86_64  
  libxcrypt-devel-4.4.18-3.el9.x86_64   make-1:4.3-7.el9.x86_64 
​
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

桔梗.py

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值