国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

Linux如何配置本地yum源(光盤鏡像掛載)

瀏覽:105日期:2023-10-08 21:02:50
目錄光盤鏡像掛載登錄到目標服務器查看鏡像創建掛載目錄掛載鏡像掛載完畢進入掛載目錄查看備份原始repo文件創建備份目錄移動文件創建新的repo文件新建Centos-CDROM.repo文件刷新repo信息驗證一下總結光盤鏡像掛載

上傳或者從其它服務器scp傳輸鏡像CentOS-7-x86_64-DVD-1908.iso到目標服務器/mnt目錄下(我這里從集群中別的服務器scp過來的):

scp傳輸命令(1024是服務器端口,需要改成你自己的,IP地址也是同樣的需要修改):

如果服務器上有鏡像就不用管下面這條命令

scp -P 1024 -r CentOS-7-x86_64-DVD-1908.iso root@192.168.67.200:/mnt/登錄到目標服務器查看鏡像[root@localhost mnt]# lltotal 4554750-rw-r--r-- 8 root root 4664066080 Dec 5 2016 CentOS-7-x86_64-DVD-1908.iso創建掛載目錄[root@localhost mnt]# mkdir /mnt/iso[root@localhost mnt]# ls4554752-rw-r--r-- 8 root root 4664066080 Dec 5 2016 CentOS-7-x86_64-DVD-1908.isodrwxr-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

有的系統會提示錯誤需要使用mount -o loop -t iso9660

則將上面的mount語句換成下面語句:(如果你執行上面的mount語句不報錯就跳過下面這條命令)

mount -o loop -t iso9660 CentOS-7-x86_64-DVD-1908.iso /mnt/iso掛載完畢進入掛載目錄查看[root@localhost mnt]# cd iso/[root@localhost iso]# lltotal 654-rw-r--r-- 1 root root 14 Dec 5 2016 CentOS_BuildTagdrwxr-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 GPLdrwxr-xr-x 3 root root 2048 Dec 5 2016 imagesdrwxr-xr-x 2 root root 2048 Dec 5 2016 isolinuxdrwxr-xr-x 2 root root 2048 Dec 5 2016 LiveOSdrwxrwxr-x 2 root root 630784 Dec 5 2016 Packagesdrwxrwxr-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

鏡像已經被解壓到掛載目錄。

備份原始repo文件創建備份目錄mkdir /etc/yum.repos.d/bak移動文件mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/創建新的repo文件新建Centos-CDROM.repo文件vi /etc/yum.repos.d/Centos-CDROM.repo[CDROM]name=CentOS-$releasever - CDROMbaseurl=file:///mnt/isogpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7刷新repo信息[root@localhost ~]# yum clean allLoaded plugins: fastestmirror, langpacksCleaning repos: CDROMCleaning up everythingCleaning up list of fastest mirrors[root@localhost ~]# yum makecacheLoaded plugins: fastestmirror, langpacksCDROM | 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 mirrorsMetadata Cache Created驗證一下[root@localhost ~]# yum -y install mariadbLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfileResolving 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 installedRemoving 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_64Removing 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總結

可以看到沒問題了,本地yum源已經可以使用了。

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持好吧啦網。

標簽: Linux
主站蜘蛛池模板: 乐业县| 图木舒克市| 德阳市| 永修县| 古丈县| 蓬溪县| 黄山市| 泾阳县| 临朐县| 江山市| 新干县| 阿拉善左旗| 界首市| 泊头市| 长岭县| 浦北县| 于都县| 张家界市| 海门市| 高邑县| 朔州市| 日照市| 南投市| 四子王旗| 怀柔区| 阳城县| 抚宁县| 南城县| 邵东县| 夹江县| 苍梧县| 夹江县| 洱源县| 铅山县| 库伦旗| 鲁甸县| 尚志市| 威海市| 高要市| 连云港市| 尉氏县|