Linux 启用本地ISO作为软件源

环境:sle12sp5 (open SUSE)

1、禁用现有的源

查看源:sle12sp5 zypper lr -u

➜  sle12sp5 zypper lr -u                         
Repository priorities are without effect. All enabled repositories share the same priority.

# | Alias             | Name              | Enabled | GPG Check | Refresh | URI                                                                                   
--+-------------------+-------------------+---------+-----------+---------+---------------------------------------------------------------------------------------
1 | SLES12-SP5-12.5-0 | SLES12-SP5-12.5-0 | Yes     | (r ) Yes  | No      | cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_SATA_CDRW_Drive_01000000000000000001

SLES12-SP5-12.5-0 是系统的,禁用掉:ypper mr --disable SLES12-SP5-12.5-0

➜  sle12sp5 zypper mr --disable SLES12-SP5-12.5-0
Repository 'SLES12-SP5-12.5-0' has been successfully disabled.
➜  sle12sp5 zypper lr -u                         
Repository priorities are without effect. All enabled repositories share the same priority.

# | Alias             | Name              | Enabled | GPG Check | Refresh | URI                                                                                   
--+-------------------+-------------------+---------+-----------+---------+---------------------------------------------------------------------------------------
1 | SLES12-SP5-12.5-0 | SLES12-SP5-12.5-0 | No      | ----      | ----    | cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_SATA_CDRW_Drive_01000000000000000001

2、准备ISO文件

如果 ISO在远程服务器,先挂载到本地

mount -t cifs //0.0.0.0/public  /mnt/hgfs/public 

然后添加ISO源:

zypper addrepo --refresh "iso:/?iso=/mnt/hgfs/public/sle12sp5/SLE-12-SP5-Server-DVD-x86_64-GM-DVD1.iso" Server

再看一下:

➜  sle12sp5 zypper lr -u                                                                                                  
Repository priorities are without effect. All enabled repositories share the same priority.

# | Alias             | Name              | Enabled | GPG Check | Refresh | URI                                                                                   
--+-------------------+-------------------+---------+-----------+---------+---------------------------------------------------------------------------------------
1 | SLES12-SP5-12.5-0 | SLES12-SP5-12.5-0 | No      | ----      | ----    | cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_SATA_CDRW_Drive_01000000000000000001
2 | Server            | Server            | Yes     | (r ) Yes  | Yes     | iso:///?iso=/mnt/hgfs/public/sle12sp5/SLE-12-SP5-Server-DVD-x86_64-GM-DVD1.iso

手动刷新的命令是:

➜  sle12sp5 zypper ref -r Server
Repository 'Server' is up to date.                                                                                                                                                                                                  
Specified repositories have been refreshed.

代表成功了,安装软件git:

➜  sle12sp5 zypper install git            
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 10 NEW packages are going to be installed:
  cvsps git git-cvs git-email git-gui git-svn gitk perl-Authen-SASL perl-Net-SMTP-SSL subversion-perl

The following 7 recommended packages were automatically selected:
  git-cvs git-email git-gui git-svn gitk perl-Authen-SASL perl-Net-SMTP-SSL

The following 2 packages are suggested, but will not be installed:
  git-daemon git-web

The following 9 packages have no support information from their vendor:
  cvsps git git-cvs git-email git-gui git-svn gitk perl-Net-SMTP-SSL subversion-perl

10 new packages to install.
Overall download size: 2.6 MiB. Already cached: 0 B. After the operation, additional 8.5 MiB will be used.
Continue? [y/n/...? shows all options] (y): 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

一如既往の

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

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

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

打赏作者

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

抵扣说明:

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

余额充值