Linux如何配置本地yum源(光盤鏡像掛載)
光盤鏡像掛載
上傳或者從其它服務(wù)器scp傳輸鏡像CentOS-7-x86_64-DVD-1908.iso到目標(biāo)服務(wù)器/mnt目錄下(我這里從集群中別的服務(wù)器scp過(guò)來(lái)的):
scp傳輸命令(1024是服務(wù)器端口,需要改成你自己的,IP地址也是同樣的需要修改):
如果服務(wù)器上有鏡像就不用管下面這條命令
scp -P 1024 -r CentOS-7-x86_64-DVD-1908.iso root@192.168.67.200:/mnt/
登錄到目標(biāo)服務(wù)器查看鏡像
[root@localhost mnt]# ll total 4554750 -rw-r--r-- 8 root root 4664066080 Dec 5 2016 CentOS-7-x86_64-DVD-1908.iso
創(chuàng)建掛載目錄
[root@localhost mnt]# mkdir /mnt/iso [root@localhost mnt]# ls 4554752 -rw-r--r-- 8 root root 4664066080 Dec 5 2016 CentOS-7-x86_64-DVD-1908.iso drwxr-xr-x 8 root root 2048 Dec 5 2016 iso
掛載鏡像
[root@localhost mnt]# mount CentOS-7-x86_64-DVD-1908.iso /mnt/iso/ mount: /dev/sr0 is write-protected, mounting read-only
有的系統(tǒng)會(huì)提示錯(cuò)誤需要使用mount -o loop -t iso9660
則將上面的mount語(yǔ)句換成下面語(yǔ)句:(如果你執(zhí)行上面的mount語(yǔ)句不報(bào)錯(cuò)就跳過(guò)下面這條命令)
mount -o loop -t iso9660 CentOS-7-x86_64-DVD-1908.iso /mnt/iso
掛載完畢進(jìn)入掛載目錄查看
[root@localhost mnt]# cd iso/ [root@localhost iso]# ll total 654 -rw-r--r-- 1 root root 14 Dec 5 2016 CentOS_BuildTag drwxr-xr-x 3 root root 2048 Dec 5 2016 EFI -rw-r--r-- 1 root root 215 Dec 10 2015 EULA -rw-r--r-- 1 root root 18009 Dec 10 2015 GPL drwxr-xr-x 3 root root 2048 Dec 5 2016 images drwxr-xr-x 2 root root 2048 Dec 5 2016 isolinux drwxr-xr-x 2 root root 2048 Dec 5 2016 LiveOS drwxrwxr-x 2 root root 630784 Dec 5 2016 Packages drwxrwxr-x 2 root root 4096 Dec 5 2016 repodata -rw-r--r-- 1 root root 1690 Dec 10 2015 RPM-GPG-KEY-CentOS-7 -rw-r--r-- 1 root root 1690 Dec 10 2015 RPM-GPG-KEY-CentOS-Testing-7 -r--r--r-- 1 root root 2883 Dec 5 2016 TRANS.TBL
鏡像已經(jīng)被解壓到掛載目錄。
備份原始repo文件
創(chuàng)建備份目錄
mkdir /etc/yum.repos.d/bak
移動(dòng)文件
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/
創(chuàng)建新的repo文件
新建Centos-CDROM.repo文件
vi /etc/yum.repos.d/Centos-CDROM.repo [CDROM] name=CentOS-$releasever - CDROM baseurl=file:///mnt/iso gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
刷新repo信息
[root@localhost ~]# yum clean all Loaded plugins: fastestmirror, langpacks Cleaning repos: CDROM Cleaning up everything Cleaning up list of fastest mirrors [root@localhost ~]# yum makecache Loaded plugins: fastestmirror, langpacks CDROM | 3.6 kB 00:00:00 (1/4): CDROM/group_gz | 155 kB 00:00:00 (2/4): CDROM/primary_db | 3.0 MB 00:00:00 (3/4): CDROM/filelists_db | 3.0 MB 00:00:00 (4/4): CDROM/other_db | 1.3 MB 00:00:00 Determining fastest mirrors Metadata Cache Created
驗(yàn)證一下
[root@localhost ~]# yum -y install mariadb Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package mariadb.x86_64 1:5.5.52-1.el7 will be installed --> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.52-1.el7 for package: 1:mariadb-5.5.52-1.el7.x86_64 --> Running transaction check ---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be installed Removing mariadb-libs.x86_64 1:5.5.52-1.el7 - u due to obsoletes from installed mysql-community-libs-5.6.37-2.el7.x86_64 Removing mariadb.x86_64 1:5.5.52-1.el7 - u due to obsoletes from installed mysql-community-client-5.6.37-2.el7.x86_64 --> Restarting Dependency Resolution with new changes. --> Running transaction check ---> Package mariadb.x86_64 1:5.5.52-1.el7 will be installed ---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be installed --> Finished Dependency Resolution
總結(jié)
可以看到?jīng)]問(wèn)題了,本地yum源已經(jīng)可以使用了。
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
linux系統(tǒng)用戶管理與grep正則表達(dá)式示例教程
這篇文章主要給大家介紹了關(guān)于linux系統(tǒng)用戶管理與grep正則表達(dá)式的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用linux系統(tǒng)具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。2018-03-03Linux使用nload監(jiān)控網(wǎng)絡(luò)流量的方法
Linux 中的 nload 命令是一個(gè)用于實(shí)時(shí)監(jiān)控網(wǎng)絡(luò)流量的工具,它提供了傳入和傳出流量的可視化表示,幫助用戶一目了然地了解網(wǎng)絡(luò)活動(dòng),本文給大家介紹了Linux使用nload監(jiān)控網(wǎng)絡(luò)流量的方法,需要的朋友可以參考下2025-02-02.httacces文件的密碼保護(hù)和防止盜鏈的實(shí)現(xiàn)方法
盡管有各種各樣的.htaccess用法,但至今最流行的也可能是最有用的做法是將其用于網(wǎng)站目錄可靠的密碼保護(hù)。2008-06-06Linux中對(duì)mysql用戶進(jìn)行管理的操作代碼
這是在Linux里面對(duì)MySQL數(shù)據(jù)庫(kù)的用戶進(jìn)行管理,其中包括查看全部用戶以及權(quán)限、賦予增刪改查權(quán)限、賦予遠(yuǎn)程連接%權(quán)限、刪除用戶的權(quán)限、刪除用戶、修改密碼等,本文給大家詳細(xì)介紹了Linux中對(duì)mysql用戶進(jìn)行管理的操作代碼,需要的朋友可以參考下2024-11-11CentOS 7.4下安裝Oracle 11.2.0.4數(shù)據(jù)庫(kù)的方法
本篇文章主要介紹了CentOS 7.4下安裝Oracle 11.2.0.4數(shù)據(jù)庫(kù)的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-12-12