09.53
0
When you define a repository, zypper holds a configuration that tells zypper where to find software to work with. If you have configured software locations in YaST, zypperwilluse them as well as other installation sources you may have configured throughaptRPM, local file sources, and most ZENworks management systems. You can use zypper to list, add, rename and delete repositories. Table 2-5 shows the commands needed for managing zypper repositories, along with shortcut abbreviations for the commands. Also, keep in mind that command line help can be obtained by typingzypper  h at the command line.


Table 2-5: Managing zypper Repositories

zypper Command     Abbreviation         Description
addrepo                       ar                            Adds a new repository. You will need to provide a
URI for the install source as well as a name for it.
removerepo           rr                           Removes a repository.
repos                        rr                           Lists all known repositories and shows informa- tion about the repository such as its name and whether it’s enabled or not.
renamerepo                 nr                           Renames the alias of a repository. The source repos- itory has to be referred to by its alias. Remember to use quotes if you have whitespace or special shell characters in the alias.
modifyrepo                 mr                          Modifies whether the repository is automatically refreshed or not, and whether it is enabled or not.
refresh                     ref                         Re-downloads metadata for all known services or specific alias if given.


In the YaST section earlier, we added a repository from ftp.gwdg.de. We can demon- strate adding a Zypper repository using this same install location. First we’ll remove the install location and then add, refresh, modify, and rename it.

The following example tells zypper to show all the repositories it knows about as well as the status of those repositories (in all example output, fields too long to display have beenedited to fit the page width).

 zypper lr
 | Enabled | Refresh | Type          | Alias                         | Name
--+---------+---------+--------+-------------------+---------------
 | Yes
| No
| yast2   |  openSUSE-10.3-...
|  openSUSE-10.3-...
 | Yes
| Yes
| rpm-md  | madwifi
| madwifi
 | Yes
| Yes
| rpm-md  | Guru’s RPM  site
| Guru’s RPM  si...
 | Yes
| Yes
| yast2   |  http://downloa...
| Main  Repositor...
 | Yes
| Yes
| rpm-md  |  openSUSE-10.3-...
|  openSUSE-10.3-...
 | Yes
| No
| yast2   | testcdrom
| testcdrom
 | Yes
| Yes
| yast2   |  http://downloa...
| Main  Repositor...

Zypper shows the repositories we had configured inYaST (your list may look a bit different). The following command will remove the repository named Gurus RPM site:

 zypper rr   “Guru’s RPM  site”
 Removing   repository  ‘Guru’s_RPM_site’Repository  Guru’s  RPM  site 1  has  beenremoved.

To add this location using zypper and give it the alias name Gurus RPM site, issue the zypper command as follows (you must use quotes around the service name as it contains whitespace and a single quote):

 zypper ar  http://ftp.gwdg.de/pub/linux/misc/suser-guru/rpm/10.3/RPMS/ \ “Guru’s RPM  site”
 Adding repository  ‘Guru’s RPM  site’
Repository  ‘Guru’s RPM  site’  successfully added: Enabled:  Yes
Autorefresh:   Yes

Zypper will configure the new repository for use. After zypper is done, you can see it has added the new repository by issuing zypper  lr as before. If you decide at a later date to rename the Gurus site to something different, you can use the zypper command like this to do so:

 zypper nr  “Guru’s RPM  site”  ftp.gwdg.de
Repository  Guru’s RPM  site renamed to ftp.gwdg.de

 zypper lr
 | Enabled | Refresh | Type          | Alias                         | Name
--+---------+---------+--------+-------------------+---------------
 | Yes
| No
| yast2   |  openSUSE-10.3-...
|  openSUSE-10.3-...
 | Yes
| Yes
| rpm-md  | madwifi
| madwifi
 | Yes
| Yes
| rpm-md  |  ftp.gwdg.de
| ftp.gwdg.de
...




You can use the mr command to modify the Refresh or Enabled repository attrib- utes. Turning off the Refresh attribute will mean you have to refresh this repository manually; zypper will not do it automatically. You may want to disable repositories that you’ve added that deal with development software so you aren’t automatically retrieving software from places that may be unstable. Here’s an example of disabling a repository:

 zypper mr-d   “ftp.gwdg.de”
Repository ftp.gwdg.de has been sucessfully  modified.

You can see the ftp.gwdg.de repository as disabled now:

 zypper lr
 | Enabled | Refresh | Type          | Alias                         | Name
--+---------+---------+--------+-------------------+---------------
 | Yes
| No
| yast2   |  openSUSE-10.3-...
|  openSUSE-10.3-...
 | Yes
| Yes
| rpm-md  | madwifi
| madwifi
 | No
| Yes
| rpm-md  |  ftp.gwdg.de
| ftp.gwdg.de
...




Likewise, the following command turns off theRefresh of the ftp.gwdg.de repository:

 zypper mr--disable-autorefresh  “ftp.gwdg.de”
Repository ftp.gwdg.de has been sucessfully  modified.

If you refresh all the repositories now, you can see ftp.gwdg.de is left alone:

 zypper ref
Repository  ‘openSUSE-10.3-DVD  10.3’ is  up  to date. Repository ‘madwifi’ is  up  to date.
Repository   ‘Main Repository  (NON-OSS)’   is  up  to date. Repository  ‘openSUSE-10.3-Updates’ is up  to date. Repository ‘testcdrom’ is  up  to date.
Repository   ‘MainRepository  (OSS)’is up  to date.

All repositories have been refreshed. Note that the first repository is a DVD. You need to have the DVD mounted to refresh from that repository. You can use the –e flag, just as the d flag was used, to re-enable the ftp.gwdg.derepository. The a flag, used thesame way, will re-enable automatic-refresh.

 zypper mr-aftp.gwdg.de
Repository ftp.gwdg.de has been sucessfully  modified.

 zypper mr-e ftp.gwdg.de
Repository ftp.gwdg.de has been sucessfully  modified.

In the course of adding repositories, you may get prompted to accept a Package
Signing Key.

...
Do  you  want   to trustkey   id A84EDAE89C800ACA  SuSE  Package  Signing Key
<build@suse.de>  fingerprint:79C179B2E1C820C1890F9994A84EDAE89C800ACA  ?  [y/n]:

This is a method of digitallyverifying the authenticity of packages you download fromvarious installation sources. There is a potential for malicious software to be introduced into your system through the use of third-party sources, which may be difficult to verify. The signing key is a way for your system to verify that the software came from where it says it came from. There is no 100 percent surefire way to absolutely guarantee thatthe key you are about to accept hasn’t been inserted into your network session some- where in the middle of your network connection. The odds may be slim, but nonethe- less there is some risk because the Internet is a public network.

NOTE    For more information on GPG and digitally signed packages, visit the GnuPG web site (www.gnupg.org) or have a look at the Security and Authentication with Digital Signatures article on the Linux Journal web site (www.linuxjournal.com/article/2304).


For more information about adding zypper services to openSUSE, visit the opensuse-community.org web site (http://opensuse-community.org/Package_ Sources).

0 komentar:

Posting Komentar