Linux7 配置本地yum源
mount挂载
临时挂载,重启后还需再挂载才生效
创建挂载的目录
mkdir /mnt/cdrom
显示找不到介质,需要在设置里添加IOS镜像
注意:设备状态一定要勾选“已连接”
未勾选的报错内容:
再次测试挂载,成功
mount -t iso9660 /dev/cdrom /mnt/cdrom/
ls /mnt/cdrom/
永久挂载,重启后也生效
在临时挂载的操作基础上,修改配置文件
在/etc/fstab表中,添加最后的一行,将iso文件永久挂载到系统中
/dev/cdrom /mnt/cdrom iso9660 defaults 0 0
配置yum
进入yum的配置目录
[root@oracle-1 dev]# cd /etc/yum.repos.d/
[root@oracle-1 yum.repos.d]# ls
public-yum-ol7.repo
[root@oracle-1 yum.repos.d]#
创建一个本地源的文件
[root@oracle-1 yum.repos.d]# vim centos.repo
内容如下:
[name]
name=“local repo”
baseurl=file:///mnt/cdrom/
enabeld=1
gpgcheck=0
清除缓存
[root@oracle-1 yum.repos.d]# yum clean all
BDB2053 Freeing read locks for locker 0x15: 3068/139684978857792
已加载插件:langpacks, ulninfo
正在清理软件源: name ol7_UEKR4 ol7_latest
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
查看yum列表及已有的程序
[root@oracle-1 yum.repos.d]# yum list
已加载插件:langpacks, ulninfo
name | 3.6 kB 00:00
ol7_UEKR4 | 3.0 kB 00:00
ol7_latest | 3.6 kB 00:00
(1/7): name/group_gz | 144 kB 00:00
(2/7): name/primary_db | 4.8 MB 00:00
(3/7): ol7_UEKR4/x86_64/updateinfo | 111 kB 00:01
(4/7): ol7_latest/x86_64/group_gz | 136 kB 00:02
(5/7): ol7_latest/x86_64/updateinfo | 3.4 MB 00:03
(6/7): ol7_UEKR4/x86_64/primary_db | 21 MB 00:05
(7/7): ol7_latest/x86_64/primary_db | 39 MB 00:36
已安装的软件包
GConf2.x86_64 3.2.6-8.el7 @anaconda/7.5
GeoIP.x86_64 1.5.0-11.el7 @anaconda/7.5
ModemManager.x86_64 1.6.10-1.el7 @anaconda/7.5
ModemManager-glib.x86_64 1.6.10-1.el7 @anaconda/7.5
NetworkManager.x86_64 1:1.10.2-13.el7 @anaconda/7.5
统计yum的个数
[root@oracle-1 yum.repos.d]# yum list | wc -l
6371
测试:安装MySQL,看是否成功
[root@oracle-1 yum.repos.d]# yum -y install mysql mysql-server mysql-devel