LINUX yum源配置

本文主要對本地yum源(file方式)以及遠程yum源(ftp及http方式)的配置進行說明

基礎材料:CentOS7


本地yum源配置:

將ISO文件掛載到/mnt下,或將ISO內容全部拷貝到/mnt下

[root@test]# mount /dev/cdrom /mnt

修改本地yum配置文件

[root@test]# rm -f /etc/yum.repo.d/*

[root@test]# echo '[base]' >>/etc/yum.repo.d/my.repo

[root@test]# echo 'name=base' >>/etc/yum.repo.d/my.repo

[root@test]# echo 'baseurl=file:///mnt' >>/etc/yum.repo.d/my.repo

[root@test]# echo 'enable=1' >>/etc/yum.repo.d/my.repo

[root@test]# echo 'gpgcheck=0' >>/etc/yum.repo.d/my.repo

測試

[root@test]# yum install -y tcpdump


遠程yum源(http方式):

服務端配置

使用本地yum源或者手動安裝方式安裝apache

[root@test]# yum install -y httpd

將ISO掛載到apache默認發佈路徑/var/www/html,或將ISO文件拷貝到apache默認發佈路徑/var/www/html

[root@test]# mount /dev/cdrom /var/www/html

啓動apache

[root@test]# systemctl start httpd

客戶端配置(其中紅色部分爲服務端IP地址)

[root@test]# rm -f /etc/yum.repo.d/*

[root@test]# echo '[base]' >>/etc/yum.repo.d/my.repo

[root@test]# echo 'name=base' >>/etc/yum.repo.d/my.repo

[root@test]# echo 'baseurl=http://xxx.xxx.xxx.xxx' >>/etc/yum.repo.d/my.repo 

[root@test]# echo 'enable=1' >>/etc/yum.repo.d/my.repo

[root@test]# echo 'gpgcheck=0' >>/etc/yum.repo.d/my.repo

測試

[root@test]# yum install -y tcpdump


遠程yum源(ftp方式):

服務端配置

使用本地yum源或者手動安裝方式安裝vsftpd

[root@test]# yum install -y vsftpd

將ISO掛載到ftp默認發佈路徑/var/ftp/pub,或將ISO文件拷貝到apache默認發佈路徑/var/ftp/pub

[root@test]# mount /dev/cdrom /var/ftp/pub

啓動vsftpd

[root@test]# systemctl start vsftpd

客戶端配置(其中紅色部分爲服務端IP地址)

[root@test]# rm -f /etc/yum.repo.d/*

[root@test]# echo '[base]' >>/etc/yum.repo.d/my.repo

[root@test]# echo 'name=base' >>/etc/yum.repo.d/my.repo

[root@test]# echo 'baseurl=ftp://xxx.xxx.xxx.xxx/pub' >>/etc/yum.repo.d/my.repo 

[root@test]# echo 'enable=1' >>/etc/yum.repo.d/my.repo

[root@test]# echo 'gpgcheck=0' >>/etc/yum.repo.d/my.repo

測試

[root@test]# yum install -y tcpdump

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章