Friday, June 3, 2016

How to Install packages from my hard drive.

Most if not all packages (files ending in *.rpm) are on the online repositories. In some cases you have the rpm from your pc or you have downloaded it from some site/server etc.  Question is how would one install it?

Simple answer is to use the rpm utility since openSUSE is one of the rpm-based distro like Rhel and Centos but we will not use that in our example since openSUSE has zypper.

To install the package name foo

      
    zypper in foo.rpm
  

or one can use the absolute path

      
    zypper in /path/to/foo.rpm
 

e.g.

      
    zypper in /var/run/media/jetchisel/foo.rpm 
 


Another question is: 


What if you have a bunch of packages (rpm's) that you want to install?  


One can work around it by using some shell tricks on the cli. One in particular is the use of glob and an array.

Save the rpm's in an array.

      
    packages=(*.rpm)
 

or use an absolute path.

      
    packages=(/path/to/myrpm/*.rpm)
 

e.g.

      
    packages=(/var/run/media/jetchisel/*.rpm)
 


Install the rpm's

      
    zypper in "${packages[@]}"
 

The last but not the least question.  


I have a bunch of rpm's which are the dependencies from the program/package that is located on the online repositories.


The alternative question is:    


how can I make a local directory (folder) to become a local repository?


First option is using zypper.


   zypper ar -t plaindir . local 


or one can use an absolute path for the directory.


   zypper ar -t plaindir  /path/to/rpm local 


let's take out that zypper code piece by piece.

 zypper ar  is add repository

  -t plaindir   means type is a plain directory (folder)

the    .    (dot)  means where you are located the value of the command    pwd  
 
  /path/to/rpm      is the absolute path.

   local   is the alias of the repository and it is arbitrary

Once the directory (folder) is added as a repo you can now refresh it.


   zypper ref local


Print the packages from the local repo.


   zypper --no-refresh se -t package -r local




Now install the package(s) and enjoy! :)


One can look for more option using the help option for zypper.


   zypper help ar 


The second option is using yast2 in the following order.

  1. yast2 
  2. Software Repositories
  3. Add
  4. Local Directory




1 comment:

  1. Most of them can be accessed by way of each desktop and cell companions, giving you the freedom determine on} probably the most convenient 카지노사이트 method. Ontario gamers will in a position to|be succesful of|have the flexibility to} choose from selection of|quite so much of|a wide selection of} different choices, together with basic blackjack, first individual blackjack, Blazing 7s Blackjack and Zappit Blackjack. Firewalls and other on-line safety software program technology maintain criminals from mining your data and your privateness intact.

    ReplyDelete