OpenSUSE Linux Rants

OpenSUSE Linux Tips, tricks, how-tos, opinions, and news

My Resume  -  My LinkedIn Profile

November 1, 2009

OpenSUSE Linux: Quick Zypper Tutorial

by @ 1:21 am. Filed under bash, command-line, SUSE Tips & Tricks

OpenSUSE Linux provides a command-line method of managing repositories and packages. This tool is called zypper. The following is a basic tutorial by example of how to use zypper.

Repository Management

To list repositories:

[1342][root@dev:/home/scott]$ zypper repos
#  | Alias             | Name                  | Enabled | Refresh
---+-------------------+-----------------------+---------+--------
1  | Enlightenment CVS | Enlightenment CVS     | Yes     | Yes    
2  | OpenSUSE_11.1_ISO | OpenSUSE 11.1 ISO     | Yes     | No     
3  | Packman           | Packman               | Yes     | Yes    
4  | Window_Managers   | Window Managers       | Yes     | Yes    
5  | XFCE4             | XFCE4                 | Yes     | Yes    
6  | aterm             | aterm                 | Yes     | Yes    
7  | home:danci1973    | home:danci1973        | Yes     | Yes    
8  | home:dauphin      | home:dauphin          | Yes     | Yes    
9  | home:jnelson-suse | home:jnelson-suse     | Yes     | Yes    
10 | mozilla           | mozilla               | Yes     | Yes    
11 | openSUSE 11.1-0   | openSUSE 11.1-0       | Yes     | Yes    
12 | repo-debug        | openSUSE-11.1-Debug   | No      | Yes    
13 | repo-non-oss      | openSUSE-11.1-Non-Oss | Yes     | Yes    
14 | repo-source       | openSUSE-11.1-Source  | No      | Yes    
15 | repo-update       | openSUSE-11.1-Update  | Yes     | Yes    
[1402][root@dev:/home/scott]$

To add a repository (we’re going to use Packman as an example):

[1341][root@dev:/home/scott]$ zypper addrepo "http://packman.unixheads.com/suse/11.1/" Packman
Adding repository 'Packman' [done]
Repository 'Packman' successfully added
Enabled: Yes
Autorefresh: No
URI: http://packman.unixheads.com/suse/11.1/

[1341][root@dev:/home/scott]$ 

To turn on autorefresh, because it’s disabled by default (again, with Packman):

[1341][root@dev:/home/scott]$ zypper modifyrepo -r Packman
Autorefresh has been enabled for repository 'Packman'.
[1342][root@dev:/home/scott]$

To refresh a repo manually:

[1342][root@dev:/home/scott]$ zypper refresh -r Packman
Retrieving repository 'Packman' metadata [done]
Building repository 'Packman' cache [done]
Specified repositories have been refreshed.
[1342][root@dev:/home/scott]$

Leave out the “-r” and leave off the name of the repo if you want to refresh all of them.

To remove a repository:

[1337][root@dev:/home/scott]$ zypper rr Packman
Removing repository 'Packman' [done]
Repository 'Packman' has been removed.
[1337][root@dev:/home/scott]$ 

Package Management

To search for a package (id3v2, in this example):

[1224][root@dev:/home/scott]$ zypper search id3v2
Loading repository data...
Reading installed packages...

S | Name  | Summary                              | Type   
--+-------+--------------------------------------+--------
  | id3v2 | A Command Line Editor for ID3V2 Tags | package
[1229][root@dev:/home/scott]$

To get information on a package (again, id3v2):

[1229][root@dev:/home/scott]$ zypper info id3v2
Loading repository data...
Reading installed packages...


Information for package id3v2:

Repository: openSUSE 11.1-0
Name: id3v2
Version: 0.1.11-77.60
Arch: x86_64
Vendor: openSUSE
Installed: No
Status: not installed
Installed Size: 79.0 K
Summary: A Command Line Editor for ID3V2 Tags
Description: 
ID3 tags are found in MP3 files. They canstore information about what band recorded the song, the song name, and more.

ID3V1 tags are seriously deficient as to the kind of and length ofinformation that they can store. This is a tool for editing ID3V2tags in Linux.


[1333][root@dev:/home/scott]$ 

To install a package:

[1333][root@dev:/home/scott]$ zypper install id3v2
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  id3v2 


Overall download size: 30.0 K. After the operation, additional 79.0 K will be used.
Continue? [YES/no]: 
Retrieving package id3v2-0.1.11-77.60.x86_64 (1/1), 30.0 K (79.0 K unpacked)
Retrieving: id3v2-0.1.11-77.60.x86_64.rpm [done]          
Installing: id3v2-0.1.11-77.60 [done]
[1334][root@dev:/home/scott]$

To remove a package:

[1334][root@dev:/home/scott]$ zypper remove id3v2
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following package is going to be REMOVED:
  id3v2 


After the operation, 79.0 K will be freed.
Continue? [YES/no]: 
Removing id3v2-0.1.11-77.60 [done]
[1336][root@dev:/home/scott]$

These are some common zypper commands that will help you manage your repositories and packages from the command-line.

OpenSUSE Linux Rants
Official OpenSUSE Linux Site

internal links:

categories:

SUSE Resources

search blog:

archives:

November 2009
S M T W T F S
« Oct   Mar »
1234567
891011121314
15161718192021
22232425262728
2930  

55 queries. 0.614 seconds