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): 

你可能感兴趣的:(linux,elasticsearch,运维)