Cargando

Ir a contenido

X


Ver Más! Profesionales IT y desarrolladores: Llega el evento más importante del año! Servicios cloud, Business Applications, Analytics, IoT, Machine Learning, Bots, Blockchain etc.


 


Como utilizar Zypper de Opensuse y Suse

Hablaremos de cómo utilizar zypper el gestor de paquetes de Suse y Opensuse ofreciendo en detalle desde lo más básico a algunos ejemplos avanzados.


Escrito por nov 03 2015 15:57 suse


suse.jpg



Seguimos con los gestores de paquetes de las distribuciones más importante en sector de servidores, esta vez hablaremos de Zypper que funciona con RPM y fue creado por SuSE para sus distribuciones privadas y públicas como lo son SLE y Opensuse.

A modo personal Zypper me parece uno de los mejores gestores que existen en la actualidad. Suse ha puesto mucho empeño en Yast y Zypper ofreciendo 2 productos muy estables y fácil de utilizar, es cierto que en el pasado Zypper tenía muchos problemas con las dependencias pero todo esto se ha acabado y otorga un rendimiento sobresaliente.

1 Cómo utilizar Zypper.

Empezaremos por lo más básico, si lanzamos el comando sin ningún argumento nos ofrecerá una sinopsis básica de como utilizarlo y una lista de todas opciones globales no te asustes con la cantidad de opciones me encargare de explicar las más útiles.
jcarrillo@linux-bp4q:~> zypper
  Usage:
        zypper [--global-options] <command> [--command-options] [arguments]


  Global Options:
        --help, -h              Help.
        --version, -V           Output the version number.
        --promptids             Output a list of zypper's user prompts.
        --config, -c <file>     Use specified config file instead of the default.
        --userdata <string>     User defined transaction id used in history and plugins.
        --quiet, -q             Suppress normal output, print only error
                                messages.
        --verbose, -v           Increase verbosity.
        --[no-]color            Whether to use colors in output if tty supports it.
        --no-abbrev, -A         Do not abbreviate text in tables.
        --table-style, -s       Table style (integer).
        --non-interactive, -n   Do not ask anything, use default answers
                                automatically.
        --non-interactive-include-reboot-patches
                                Do not treat patches as interactive, which have
                                the rebootSuggested-flag set.
        --xmlout, -x            Switch to XML output.
        --ignore-unknown, -i    Ignore unknown packages.


        --reposd-dir, -D <dir>  Use alternative repository definition file
                                directory.
        --cache-dir, -C <dir>   Use alternative directory for all caches.
        --raw-cache-dir <dir>   Use alternative raw meta-data cache directory.
        --solv-cache-dir <dir>  Use alternative solv file cache directory.
        --pkg-cache-dir <dir>   Use alternative package cache directory.
Si queremos una ayuda para algún argumento por ejemplo install usamos.
jcarrillo@linux-bp4q:~> zypper help in
install (in) [options] <capability|rpm_file_uri> ...


Install packages with specified capabilities or RPM files with specified
location. A capability is NAME[.ARCH][OP<VERSION>], where OP is one
of <, <=, =, >=, >.


  Command options:
    --from <alias|#|URI>    Select packages from the specified repository.
-r, --repo <alias|#|URI>    Load only the specified repository.
-t, --type <type>           Type of package (package, patch, pattern, product, srcpackage).
                            Default: package.
-n, --name                  Select packages by plain name, not by capability.
-C, --capability            Select packages by capability.
-f, --force                 Install even if the item is already installed (reinstall),
                            downgraded or changes vendor or architecture.
    --oldpackage            Allow to replace a newer item with an older one.
                            Handy if you are doing a rollback. Unlike --force
                            it will not enforce a reinstall.
    --replacefiles          Install the packages even if they replace files from other,
                            already installed, packages. Default is to treat file conflicts
                            as an error. --download-as-needed disables the fileconflict 
…
Para buscar un paquete usamos la opción se o search usaremos el ejemplo de Firefox.
jcarrillo@linux-bp4q:~> zypper se firefox
Loading repository data...
Reading installed packages...


S | Name                               | Summary                                               | Type       
--+------------------------------------+-------------------------------------------------------+------------
i | Firefox                            | Web Browser                                           | application
  | MozillaFirefox                     | Mozilla Firefox Web Browser                           | srcpackage 
i | MozillaFirefox                     | Mozilla Firefox Web Browser                           | package    
  | MozillaFirefox-branding-openSUSE   | openSUSE branding of MozillaFirefox                   | srcpackage 
i | MozillaFirefox-branding-openSUSE   | openSUSE branding of MozillaFirefox                   | package    
  | MozillaFirefox-branding-upstream   | Upstream branding for Firefox                         | package    
  | MozillaFirefox-buildsymbols        | Breakpad buildsymbols for Firefox                     | package    
  | MozillaFirefox-devel               | Devel package for Firefox                             | package    
  | MozillaFirefox-translations-common | Common translations for Firefox                       | package    
  | MozillaFirefox-translations-other  | Extra translations for Firefox                        | package    
  | mhtml-firefox                      | Provides Firefox with MHTML web archive compatibility | srcpackage 
  | mhtml-firefox                      | Provides Firefox with MHTML web archive compatibility | package
Podemos ver que busca en la lista de repositorios y luego ofrece todos los paquetes que contengan la palabra firefox como ya tengo instalado firefox me aparece una “i” para diferenciar.

Podemos realizar búsquedas de patrones o grupo de paquetes por ejemplo podremos instalar el pattern de lamp que incluye php, apache y mariadb, vemos que incluye una descripción muy útil para automatizar instalaciones.
zypper info -t pattern lamp_server


Loading repository data...
Reading installed packages...




Information for pattern lamp_server:
------------------------------------
Repository: openSUSE-13.2-Update
Name: lamp_server
Version: 20141007-5.1
Arch: x86_64
Vendor: openSUSE
Installed: No
Visible to User: Yes
Summary: Web and LAMP Server
Description: 
  Software to set up a Web server that is able to serve static, dynamic, and interactive content (like a Web shop). This includes Apache HTTP Server, the database management system MySQL,
  and scripting languages such as PHP, Python, Ruby on Rails, or Perl.
Contents:


S | Name                          | Type    | Dependency
--+-------------------------------+---------+-----------
  | apache2-mod_php5              | package |           
  | php5-iconv                    | package |           
i | patterns-openSUSE-base        | package |           
i | apache2-prefork               | package |           
  | php5-dom                      | package |           
  | php5-mysql                    | package |           
i | apache2                       | package |           
  | apache2-example-pages         | package |           
  | mariadb                       | package |           
  | apache2-mod_perl              | package |           
  | php5-ctype                    | package |           
  | apache2-doc                   | package |           
  | yast2-http-server             | package |           
  | patterns-openSUSE-lamp_server | package |   

1.1 Usar Zypper Shell


Al igual que yum podemos lanzar un shell de zypper si trabajaremos mucho tiempo con el.
# zypper shell
OR
# zypper sh


zypper> help
  Usage:
zypper [--global-options]
2 Gestión de Repositorios con Zypper

Podemos añadir, eliminar actualizar y modificar los repositorios oficiales y externos del sistema usando Zypper.

2.1 Listando repositorios


Podremos listar los Repositorios usando el argumento repos o lr se despliega una lista filtrando por habilitados y si están actualizados.
# zypper repos
OR
# zypper lr


jcarrillo@linux-bp4q:~> zypper lr
#  | Alias                       | Name                                | Enabled | GPG Check | Refresh
---+-----------------------------+-------------------------------------+---------+-----------+--------
 1 | download.opensuse.org-4.4   | openSUSE BuildService - LibreOffice | Yes     | (r ) Yes  | Yes
 2 | download.opensuse.org-Apps  | openSUSE BuildService - GNOME:Apps  | Yes     | (r ) Yes  | Yes
 3 | download.opensuse.org-Extra | openSUSE BuildService - KDE:Extra   | Yes     | (r ) Yes  | Yes
 4 | download.opensuse.org-games | openSUSE BuildService - Games       | Yes     | (r ) Yes  | Yes
 5 | download.opensuse.org-oss   | Main Repository (Sources)           | Yes     | (r ) Yes  | Yes
 6 | ftp.gwdg.de-suse            | Packman Repository                  | Yes     | (r ) Yes  | Yes
 7 | games:tools                 | games:tools                         | Yes     | (r ) Yes  | Yes
 8 | geeko.ioda.net-amd-fglrx    | AMD/ATI Graphics Drivers            | Yes     | (r ) Yes  | Yes
 9 | google-chrome               | google-chrome                       | Yes     | (r ) Yes  | Yes
10 | libdvdcss repository        | libdvdcss repository                | Yes     | (r ) Yes  | Yes
11 | openSUSE-13.2-0             | openSUSE-13.2-0                     | No      | ----      | Yes
12 | repo-debug                  | openSUSE-13.2-Debug                 | No      | ----      | Yes
13 | repo-debug-update           | openSUSE-13.2-Update-Debug          | No      | ----      | Yes
14 | repo-debug-update-non-oss   | openSUSE-13.2-Update-Debug-Non-Oss  | No      | ----      | Yes
15 | repo-non-oss                | openSUSE-13.2-Non-Oss               | Yes     | ( p) Yes  | Yes
16 | repo-oss              
      | openSUSE-13.2-Oss                   | Yes     | ( p) Yes  | Yes
17 | repo-source                 | openSUSE-13.2-Source                | No      | ----      | Yes
18 | repo-update                 | openSUSE-13.2-Update                | Yes     | (r ) Yes  | Yes
19 | repo-update-non-oss         | openSUSE-13.2-Update-Non-Oss        | Yes     | ( p) Yes  | Yes
De ser necesario podremos listar por URI ideal si tenemos repositorios locales y queremos respaldar o actualizar.
# zypper lr -u


# | Alias                     | Name                               | Enabled | Refresh | URI                                                            
--+---------------------------+------------------------------------+---------+---------+----------------------------------------------------------------
1 | openSUSE-13.2-0           | openSUSE-13.2-0                    | Yes     | No      | cd:///?devices=/dev/disk/by-id/ata-VBOX_CD-ROM_VB2-01700376    
2 | repo-debug                | openSUSE-13.2-Debug                | Yes     | Yes     | http://download.opensuse.org/debug/distribution/13.2/repo/oss/ 
3 | repo-debug-update         | openSUSE-13.2-Update-Debug         | No      | Yes     | http://download.opensuse.org/debug/update/13.2/                
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No      | Yes     | http://download.opensuse.org/debug/update/13.2-non-oss/        
5 | repo-non-oss              | openSUSE-13.2-Non-Oss              | Yes     | Yes     | http://download.opensuse.org/distribution/13.2/repo/non-oss/   
6 | repo-oss                  | openSUSE-13.2-Oss                  | Yes     | Yes     | http://download.opensuse.org/distribution/13.2/repo/oss/       
7 | repo-source               | openSUSE-13.2-Source               | No      | Yes     | http://download.opensuse.org/source/distribution/13.2/repo/oss/
8 | repo-update               | openSUSE-13.2-Update               | Yes     | Yes     | http://download.opensuse.org/update/13.2/                      
9 | repo-update-non-oss       | openSUSE-13.2-Update-Non-Oss       | Yes     | Yes     | http://download.opensuse.org/update/13.2-non-oss/
Deben saber que los repositorios se manejan por prioridad ejemplo tenemos el paquete mysql en el REPO local y oficial para ahorrar ancho de banda una buena práctica es ofrecer mayor prioridad a los REPO locales. Podemos listar los REPO por prioridad con -P
# zypper lr -P


# | Alias                     | Name                               | Enabled | Refresh | Priority
--+---------------------------+------------------------------------+---------+---------+---------
1 | openSUSE-13.2-0           | openSUSE-13.2-0                    | Yes     | No      |   99    
2 | repo-debug                | openSUSE-13.2-Debug                | Yes     | Yes     |   99    
3 | repo-debug-update         | openSUSE-13.2-Update-Debug         | No      | Yes     |   99    
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No      | Yes     |   99    
5 | repo-non-oss              | openSUSE-13.2-Non-Oss              | Yes     | Yes     |   85    
6 | repo-oss                  | openSUSE-13.2-Oss                  | Yes     | Yes     |   99    
7 | repo-source               | openSUSE-13.2-Source               | No      | Yes     |   99    
8 | repo-update               | openSUSE-13.2-Update               | Yes     | Yes     |   99    
9 | repo-update-non-oss       | openSUSE-13.2-Update-Non-Oss       | Yes     | Yes     |   99    

2.2 Refrescando Repositorios


Tenemos un comando global para refrescar todos al mismo tiempo o la opción de uno en específico

En caso de refrescar todos usamos ref o refresh
 # zypper refresh
OR
# zypper ref


Repository 'openSUSE-13.2-0' is up to date.
Repository 'openSUSE-13.2-Debug' is up to date.
Repository 'openSUSE-13.2-Non-Oss' is up to date.
Repository 'openSUSE-13.2-Oss' is up to date.
Repository 'openSUSE-13.2-Update' is up to date.
Repository 'openSUSE-13.2-Update-Non-Oss' is up to date.
All repositories have been refreshed.


En caso de refrescar uno en específico por ejemplo Non-oss


# zypper refresh repo-non-oss


Repository 'openSUSE-13.2-Non-Oss' is up to date.
Specified repositories have been refreshed.
En ocasiones zypper no permite refrescar por certificados de seguridad podemos forzar en ese caso con -f
# zypper ref -f repo-non-oss 


Forcing raw meta-data refresh
Retrieving repository 'openSUSE-13.2-Non-Oss' metadata ............................................................[done]
Forcing building of repository cache
Building repository 'openSUSE-13.2-Non-Oss' cache ............................................................[done]
Specified repositories have been refreshed.

2.3 Modificar Repositorios


Cuando hablamos de modificar me refiero a habilitar o inhabilitar un REPO o modificar su prioridad antes de modificar cualquier REPO debemos saber que en Zypper cada repositorio tiene un ID único que se usar para habilitar un REPO podemos su número listando con zypper lr.
# zypper lr


# | Alias                     | Name                               | Enabled | Refresh
--+---------------------------+------------------------------------+---------+--------
1 | openSUSE-13.2-0           | openSUSE-13.2-0                    | Yes     | No     
2 | repo-debug                | openSUSE-13.2-Debug                | Yes     | Yes    
3 | repo-debug-update         | openSUSE-13.2-Update-Debug         | No      | Yes    
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No      | Yes    
5 | repo-non-oss              | openSUSE-13.2-Non-Oss              | Yes     | Yes    
6 | repo-oss                  | openSUSE-13.2-Oss                  | No      | Yes    
7 | repo-source               | openSUSE-13.2-Source               | No      | Yes    
8 | repo-update               | openSUSE-13.2-Update               | Yes     | Yes    
9 | repo-update-non-oss       | openSUSE-13.2-Update-Non-Oss       | Yes     | Yes
En caso de deshabilitar el ID 6 que sería Oss usamos
# zypper mr -d 6


Repository 'repo-oss' has been successfully disabled.
Para habilitarlo de nuevo usamos -e ejemplo
# zypper mr -e 6


Repository 'repo-oss' has been successfully enabled.
Vamos a opciones más avanzadas por ejemplo habilitamos el auto refresh y colocamos una prioridad de 85 al repo non-oss.
# zypper mr -rk -p 85 repo-non-oss


Repository 'repo-non-oss' priority has been left unchanged (85)
Nothing to change for repository 'repo-non-oss'.
O podemos restringir el caching de todos los repo por si estamos cortos de espacio.
# zypper mr -Ka


RPM files caching has been disabled for repository 'openSUSE-13.2-0'.
RPM files caching has been disabled for repository 'repo-debug'.
RPM files caching has been disabled for repository 'repo-debug-update'.
RPM files caching has been disabled for repository 'repo-debug-update-non-oss'.
RPM files caching has been disabled for repository 'repo-non-oss'.
RPM files caching has been disabled for repository 'repo-oss'.
RPM files caching has been disabled for repository 'repo-source'.
RPM files caching has been disabled for repository 'repo-update'.
RPM files caching has been disabled for repository 'repo-update-non-oss'.
En caso de querer volver a habilitarlos usamos.
# zypper mr -ka


RPM files caching has been enabled for repository 'openSUSE-13.2-0'.
RPM files caching has been enabled for repository 'repo-debug'.
RPM files caching has been enabled for repository 'repo-debug-update'.
RPM files caching has been enabled for repository 'repo-debug-update-non-oss'.
RPM files caching has been enabled for repository 'repo-non-oss'.
RPM files caching has been enabled for repository 'repo-oss'.
RPM files caching has been enabled for repository 'repo-source'.
RPM files caching has been enabled for repository 'repo-update'.
RPM files caching has been enabled for repository 'repo-update-non-oss'.
Pero podemos incluso filtrar entre repo locales y remotos y es posible deshabilitar el caching de solo los repo remotos.
# zypper mr -Kt


RPM files caching has been enabled for repository 'repo-debug'.
RPM files caching has been enabled for repository 'repo-debug-update'.
RPM files caching has been enabled for repository 'repo-debug-update-non-oss'.
RPM files caching has been enabled for repository 'repo-non-oss'.
RPM files caching has been enabled for repository 'repo-oss'.
RPM files caching has been enabled for repository 'repo-source'.
RPM files caching has been enabled for repository 'repo-update'.
RPM files caching has been enabled for repository 'repo-update-non-oss'.
Para volverlos a habilitar usamos casi el mismo argumento pero con K en minúscula.
# zypper mr -kt


RPM files caching has been enabled for repository 'repo-debug'.
RPM files caching has been enabled for repository 'repo-debug-update'.
RPM files caching has been enabled for repository 'repo-debug-update-non-oss'.
RPM files caching has been enabled for repository 'repo-non-oss'.
RPM files caching has been enabled for repository 'repo-oss'.
RPM files caching has been enabled for repository 'repo-source'.
RPM files caching has been enabled for repository 'repo-update'.
RPM files caching has been enabled for repository 'repo-update-non-oss'.

2.4 Añadiendo los REPO con Zypper


Vamos a añadir repositorios no confundamos con habilitar es recomendable añadir REPO con chequeo de GPG vigente para evitar ser víctimas de ataques.

Empecemos por añadir un REPO oficial pero de la versión antigua de Opensuse.
# zypper ar http://download.opensuse.org/update/11.1/ update


Adding repository 'update' .............................................................................................................................................................[done]
Repository 'update' successfully added
Enabled     : Yes                                      
Autorefresh : No                                       
GPG check   : Yes                                      
URI         : http://download.opensuse.org/update/11.1/
Fijense que Zypper nos da un sumario del REPO luego de ser añadido importante la opcion GPG.

En caso que te enredes con nombres de REPO parecidos podemos modificar su ALIAS para poder identificarlo mejor, Digamos que queremos cambiar el nombre del repo 10 a upd8 primero debemos saber su ID en mi caso es 10 y luego lanzamos
# zypper nr 10 upd8


Repository 'update' renamed to 'upd8'.

2.5 Removiendo Repositorios


Para remover usamos rr o removerepo, después de eliminar un REPO no podremos recuperarlo sin saber su dirección de origen tener cuidado aca.
# zypper rr upd8


# Removing repository 'upd8' .........................................................................................[done]
Repository 'upd8' has been removed.
3 Gestión de Paquetes con Zypper

Con Zypper podemos hacer muchas de las funciones de RPM de manera más fácil hablaremos de toda su gestión de paquetes.

3.1 Instalar un Paquete con Zypper


Para instalar un nuevo paquete utilizamos in or install haremos el ejemplo con el navegador firefox.
# zypper in MozillaFirefox


Loading repository data...
Reading installed packages...
Resolving package dependencies...


The following 128 NEW packages are going to be installed:
  adwaita-icon-theme at-spi2-atk-common at-spi2-atk-gtk2 at-spi2-core cantarell-fonts cups-libs desktop-file-utils fontconfig gdk-pixbuf-query-loaders gstreamer gstreamer-fluendo-mp3 
  gstreamer-plugins-base gtk2-branding-openSUSE gtk2-data gtk2-immodule-amharic gtk2-immodule-inuktitut gtk2-immodule-thai gtk2-immodule-vietnamese gtk2-metatheme-adwaita 
  gtk2-theming-engine-adwaita gtk2-tools gtk3-data gtk3-metatheme-adwaita gtk3-tools hicolor-icon-theme hicolor-icon-theme-branding-openSUSE libasound2 libatk-1_0-0 libatk-bridge-2_0-0 
  libatspi0 libcairo2 libcairo-gobject2 libcanberra0 libcanberra-gtk0 libcanberra-gtk2-module libcanberra-gtk3-0 libcanberra-gtk3-module libcanberra-gtk-module-common libcdda_interface0 
  libcdda_paranoia0 libcolord2 libdrm2 libdrm_intel1 libdrm_nouveau2 libdrm_radeon1 libFLAC8 libfreebl3 libgbm1 libgdk_pixbuf-2_0-0 libgraphite2-3 libgstapp-1_0-0 libgstaudio-1_0-0 
  libgstpbutils-1_0-0 libgstreamer-1_0-0 libgstriff-1_0-0 libgsttag-1_0-0 libgstvideo-1_0-0 libgthread-2_0-0 libgtk-2_0-0 libgtk-3-0 libharfbuzz0 libjasper1 libjbig2 libjpeg8 libjson-c2 
  liblcms2-2 libLLVM libltdl7 libnsssharedhelper0 libogg0 liborc-0_4-0 libpackagekit-glib2-18 libpango-1_0-0 libpciaccess0 libpixman-1-0 libpulse0 libsndfile1 libsoftokn3 libspeex1 
  libsqlite3-0 libstartup-notification-1-0 libtheoradec1 libtheoraenc1 libtiff5 libvisual libvorbis0 libvorbisenc2 libvorbisfile3 libwayland-client0 libwayland-cursor0 libwayland-server0 
  libX11-xcb1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 libXcomposite1 libXcursor1 libXdamage1 libXevie1 
  libXfixes3 libXft2 libXi6 libXinerama1 libxkbcommon-0_4_3 libXrandr2 libXrender1 libxshmfence1 libXtst6 libXv1 libXxf86vm1 Mesa Mesa-libEGL1 Mesa-libGL1 Mesa-libglapi0 
  metatheme-adwaita-common MozillaFirefox MozillaFirefox-branding-openSUSE mozilla-nss mozilla-nss-certs PackageKit-gstreamer-plugin pango-tools sound-theme-freedesktop 


The following 10 recommended packages were automatically selected:
  gstreamer-fluendo-mp3 gtk2-branding-openSUSE gtk2-data gtk2-immodule-amharic gtk2-immodule-inuktitut gtk2-immodule-thai gtk2-immodule-vietnamese libcanberra0 libpulse0 
  PackageKit-gstreamer-plugin 


128 new packages to install.
Overall download size: 77.2 MiB. Already cached: 0 B  After the operation, additional 200.0 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package cantarell-fonts-0.0.16-1.1.noarch                                                                                                   (1/128),  74.1 KiB (115.6 KiB unpacked)
Retrieving: cantarell-fonts-0.0.16-1.1.noarch.rpm .........................................................................................................................[done (63.4 KiB/s)]
Retrieving package hicolor-icon-theme-0.13-2.1.2.noarch                                                                                                (2/128),  40.1 KiB ( 50.5 KiB unpacked)
Retrieving: hicolor-icon-theme-0.13-2.1.2.noarch.rpm ...................................................................................................................................[done]
Retrieving package sound-theme-freedesktop-0.8-7.1.2.noarch                                                                                            (3/128), 372.6 KiB (460.3 KiB unpacked)
Podemos incluso instalar una versión de un paquete en especifico.
# zypper in 'gcc<5.1'


Loading repository data...
Reading installed packages...
Resolving package dependencies...


The following 13 NEW packages are going to be installed:
  cpp cpp48 gcc gcc48 libasan0 libatomic1-gcc49 libcloog-isl4 libgomp1-gcc49 libisl10 libitm1-gcc49 libmpc3 libmpfr4 libtsan0-gcc49 


13 new packages to install.
Overall download size: 14.5 MiB. Already cached: 0 B  After the operation, additional 49.4 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Como sabemos los paquetes están pre-compilados para varias arquitecturas podemos instalar una version en especifico, puede ser de ayuda si tenemos 64bits pero un soft solo funciona bajo 32bits lo mejor es hacer un PATH para 32bits y luego instalar el paquete.
 # zypper in gcc.i586


Loading repository data...
Reading installed packages...
Resolving package dependencies...


The following 13 NEW packages are going to be installed:
  cpp cpp48 gcc gcc48 libasan0 libatomic1-gcc49 libcloog-isl4 libgomp1-gcc49 libisl10 libitm1-gcc49 libmpc3 libmpfr4 libtsan0-gcc49 


13 new packages to install.
Overall download size: 14.5 MiB. Already cached: 0 B  After the operation, additional 49.4 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package libasan0-4.8.3+r212056-2.2.4.x86_64                                                                                                  (1/13),  74.2 KiB (166.9 KiB unpacked)
Retrieving: libasan0-4.8.3+r212056-2.2.4.x86_64.rpm .......................................................................................................................[done (79.2 KiB/s)]
Retrieving package libatomic1-gcc49-4.9.0+r211729-2.1.7.x86_64                                                                                          (2/13),  14.3 KiB ( 26.1 KiB unpacked)
Retrieving: libatomic1-gcc49-4.9.0+r211729-2.1.7.x86_64.rpm ...............................................................................................................[done (55.3 KiB/s)]
Para instalar una versión y una arquitectura usamos.
# zypper in 'gcc.i586<5.1'


Loading repository data...
Reading installed packages...
Resolving package dependencies...
….
Es posible instalar un paquete de un REPO en específico. Ejemplo buscaré el paquete libxinel del REPO de amarok para mayor compatibilidad.
# zypper in amarok upd:libxine1


Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 202 NEW packages are going to be installed:
  amarok bundle-lang-kde-en clamz cups-libs enscript fontconfig gdk-pixbuf-query-loaders ghostscript-fonts-std gptfdisk gstreamer gstreamer-plugins-base hicolor-icon-theme 
  hicolor-icon-theme-branding-openSUSE htdig hunspell hunspell-tools icoutils ispell ispell-american kde4-filesystem kdebase4-runtime kdebase4-runtime-branding-openSUSE kdelibs4 
  kdelibs4-branding-openSUSE kdelibs4-core kdialog libakonadi4 l
.....
Es posible el uso de wildcards para búsquedas
# zypper in php5*


Loading repository data...
Reading installed packages...
Resolving package dependencies...


Problem: php5-5.6.1-18.1.x86_64 requires smtp_daemon, but this requirement cannot be provided
  uninstallable providers: exim-4.83-3.1.8.x86_64[openSUSE-13.2-0]
                   postfix-2.11.0-5.2.2.x86_64[openSUSE-13.2-0]
                   sendmail-8.14.9-2.2.2.x86_64[openSUSE-13.2-0]
                   exim-4.83-3.1.8.i586[repo-oss]
                   msmtp-mta-1.4.32-2.1.3.i586[repo-oss]
                   postfix-2.11.0-5.2.2.i586[repo-oss]
                   sendmail-8.14.9-2.2.2.i586[repo-oss]
                   exim-4.83-3.1.8.x86_64[repo-oss]
                   msmtp-mta-1.4.32-2.1.3.x86_64[repo-oss]
                   postfix-2.11.0-5.2.2.x86_64[repo-oss]
                   sendmail-8.14.9-2.2.2.x86_64[repo-oss]
                   postfix-2.11.3-5.5.1.i586[repo-update]
                   postfix-2.11.3-5.5.1.x86_64[repo-update]
 Solution 1: Following actions will be done:
  do not install php5-5.6.1-18.1.x86_64
  do not install php5-pear-Auth_SASL-1.0.6-7.1.3.noarch
  do not install php5-pear-Horde_Http-2.0.1-6.1.3.noarch
  do not install php5-pear-Horde_Image-2.0.1-6.1.3.noarch
  do not install php5-pear-Horde_Kolab_Format-2.0.1-6.1.3.noarch
  do not install php5-pear-Horde_Ldap-2.0.1-6.1.3.noarch
  do not install php5-pear-Horde_Memcache-2.0.1-7.1.3.noarch
  do not install php5-pear-Horde_Mime-2.0.2-6.1.3.noarch
  do not install php5-pear-Horde_Oauth-2.0.0-6.1.3.noarch
  do not install php5-pear-Horde_Pdf-2.0.1-6.1.3.noarch
....
Como mencionaba antes es posible el uso de grupos por ejemplo instalar todo el stack de lamp-server
# zypper in -t pattern lamp_server


ading repository data...
Reading installed packages...
Resolving package dependencies...


The following 29 NEW packages are going to be installed:
  apache2 apache2-doc apache2-example-pages apache2-mod_perl apache2-prefork patterns-openSUSE-lamp_server perl-Data-Dump perl-Encode-Locale perl-File-Listing perl-HTML-Parser 
  perl-HTML-Tagset perl-HTTP-Cookies perl-HTTP-Daemon perl-HTTP-Date perl-HTTP-Message perl-HTTP-Negotiate perl-IO-HTML perl-IO-Socket-SSL perl-libwww-perl perl-Linux-Pid 
  perl-LWP-MediaTypes perl-LWP-Protocol-https perl-Net-HTTP perl-Net-SSLeay perl-Tie-IxHash perl-TimeDate perl-URI perl-WWW-RobotRules yast2-http-server 


The following NEW pattern is going to be installed:
  lamp_server 


The following 10 recommended packages were automatically selected:
  apache2 apache2-doc apache2-example-pages apache2-mod_perl apache2-prefork perl-Data-Dump perl-IO-Socket-SSL perl-LWP-Protocol-https perl-TimeDate yast2-http-server 


29 new packages to install.
Overall download size: 7.2 MiB. Already cached: 1.2 MiB  After the operation, additional 34.7 MiB will be used.
Continue? [y/n/? shows all options] (y):
Una opción posible y útil es instalar un nuevo paquete y eliminar su alternativa por ejemplo instalar nano y eliminar vi.
# zypper in nano -vi


Loading repository data...
Reading installed packages...
'-vi' not found in package names. Trying capabilities.
Resolving package dependencies...


The following 2 NEW packages are going to be installed:
  nano nano-lang 


The following package is going to be REMOVED:
  vim 


The following recommended package was automatically selected:
  nano-lang 


2 new packages to install, 1 to remove.
Overall download size: 550.0 KiB. Already cached: 0 B  After the operation, 463.3 KiB will be freed.
Continue? [y/n/? shows all options] (y): 
...
Si hemos descargado un paquete RPM de manera externa y queremos instalar con zypper para que resuelva sus dependencias (Recomendado) lanzamos
zypper in teamviewer*.rpm


Loading repository data...
Reading installed packages...
Resolving package dependencies...


The following 24 NEW packages are going to be installed:
  alsa-oss-32bit fontconfig-32bit libasound2-32bit libexpat1-32bit libfreetype6-32bit libgcc_s1-gcc49-32bit libICE6-32bit libjpeg62-32bit libpng12-0-32bit libpng16-16-32bit libSM6-32bit 
  libuuid1-32bit libX11-6-32bit libXau6-32bit libxcb1-32bit libXdamage1-32bit libXext6-32bit libXfixes3-32bit libXinerama1-32bit libXrandr2-32bit libXrender1-32bit libXtst6-32bit 
  libz1-32bit teamviewer 


The following recommended package was automatically selected:
  alsa-oss-32bit 


24 new packages to install.
Overall download size: 41.2 MiB. Already cached: 0 B  After the operation, additional 119.7 MiB will be used.
Continue? [y/n/? shows all options] (y): 
..

3.2 Eliminar paquetes con Zypper


Para eliminar paquetes podemos usar zypper remove o solo rm por ejemplo eliminaremos el paquete apache2.
# zypper remove apache2
Or
# zypper rm apache2


Loading repository data...
Reading installed packages...
Resolving package dependencies...


The following 2 packages are going to be REMOVED:
  apache2 apache2-prefork 


2 packages to remove.
After the operation, 4.2 MiB will be freed.
Continue? [y/n/? shows all options] (y): y
(1/2) Removing apache2-2.4.10-19.1 ........................................................................[done]
(2/2) Removing apache2-prefork-2.4.10-19.1 ................................................................[done]

3.3 Actualizar paquetes usando Zypper


Podemos usar el comando universal zypper up para actualizar todo.
# zypper up
OR
# zypper update


Loading repository data...
Reading installed packages...
Nothing to do.
O actualizar solo un paquete en especifico, ideal en un ambiente de producción controlado.
# zypper up apache2 openssh


Loading repository data...
Reading installed packages...
No update candidate for 'apache2-2.4.10-19.1.x86_64'. The highest available version is already installed.
No update candidate for 'openssh-6.6p1-5.1.3.x86_64'. The highest available version is already installed.
Resolving package dependencies...


Nothing to do.
Cada vez que lanzamos un zypper in verifica que el paquete este instalado de estarlo verifica si está actualizado.
# zypper in mariadb


Loading repository data...
Reading installed packages...
'mariadb' is already installed.
No update candidate for 'mariadb-10.0.13-2.6.1.x86_64'. The highest available version is already installed.
Resolving package dependencies...


Nothing to do.
SI tenemos problemas cuando instalamos un paquete lo cual es muy raro, podemos intentar instalar directamente desde el source al más puro estilo de arch linux. Usamos zypper source-install o zypper si.
# zypper si mariadb


Reading installed packages...
Loading repository data...
Resolving package dependencies...


The following 36 NEW packages are going to be installed:
  autoconf automake bison cmake cpp cpp48 gcc gcc48 gcc48-c++ gcc-c++ libaio-devel libarchive13 libasan0 libatomic1-gcc49 libcloog-isl4 libedit-devel libevent-devel libgomp1-gcc49 libisl10 
  libitm1-gcc49 libltdl7 libmpc3 libmpfr4 libopenssl-devel libstdc++48-devel libtool libtsan0-gcc49 m4 make ncurses-devel pam-devel readline-devel site-config tack tcpd-devel zlib-devel 


The following source package is going to be installed:
  mariadb 


36 new packages to install, 1 source package.
Overall download size: 71.5 MiB. Already cached: 129.5 KiB  After the operation, additional 183.9 MiB will be used.
Continue? [y/n/? shows all options] (y): y
4 Utilizar Zypper en Scripts Automatizados.

Todos los comandos anteriores necesitan de la interacción del usuario y no podremos añadirlos a scripts pero no te preocupes hablaremos de qué opciones tenemos disponibles.

4.1 Instalar un paquete para scripts.


Usamos la opción --non-interactive seguiremos con el ejemplo de mariadb.
# zypper --non-interactive in mariadb


Loading repository data...
Reading installed packages...
'mariadb' is already installed.
No update candidate for 'mariadb-10.0.13-2.6.1.x86_64'. The highest available version is already installed.
Resolving package dependencies...


Nothing to do.

4.2 Remove un paquete para scripts.


Usamos la misma opción pero con rm.
# zypper --non-interactive rm mariadb


Loading repository data...
Reading installed packages...
Resolving package dependencies...


The following package is going to be REMOVED:
  mariadb 


1 package to remove.
After the operation, 71.8 MiB will be freed.
Continue? [y/n/? shows all options] (y): y
(1/1) Removing mariadb-10.0.13-2.6.1 .............................................................................[done]
5 Limpiar cache con Zypper

Por defecto zypper tiene una cuota para el caché cuando esta cuota llega el tope el nuevo caché reemplaza al antiguo pero si tenemos problemas al instalar un paquete puede que al momento de descargar estuviera corrupto y es recomendable limpiar el cache.

5.1 Limpiar cache de los REPO


Aca solo eliminamos el cache descargado por los REPO.
# zypper clean


All repositories have been cleaned up.

5.2 Limpiar Metadatos y Cache


Limpiar los metadatos puede solucionar algunos problemas.
# zypper clean -a


All repositories have been cleaned up.
6 Actualizar Distro Usando Zypper

Para finalizar es posible actualizar a una nueva versión de SuSE por ejemplo tenemos OpenSuSE 12.3 y queremos migrar a las 13.2 lanzamos.
# zypper dist-upgrade


You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Building repository 'openSUSE-13.2-0' cache .....................................................................[done]
Retrieving repository 'openSUSE-13.2-Debug' metadata ............................................................[done]
Building repository 'openSUSE-13.2-Debug' cache .................................................................[done]
Retrieving repository 'openSUSE-13.2-Non-Oss' metadata ..........................................................[done]
Building repository 'openSUSE-13.2-Non-Oss' cache ...............................................................[done]


¿Te ha gustado y ayudado este Tutorial?
Puedes premiar al autor pulsando este botón para darle un punto positivo
  • -
  • 0


AYUDA A MEJORAR ESTE TUTORIAL!

¿Quieres ayudarnos a mejorar este tutorial más? Puedes enviar tu Revisión con los cambios que considere útiles. Ya hay 0 usuario que han contribuido en este tutorial al enviar sus Revisiones. ¡Puedes ser el próximo!


Tutoriales Relacionados



5 Comentarios

No sabia que se podia usar en modo de grupos Zipper. gracias Jonathan.


Jonathan Carrillo
nov 04 2015 01:17

Si no te creas que tampoco tiene mucho tiempo de implementado! pero es muy util para nuevas instalaciones.


Pablo Santos
nov 04 2015 10:57

Para limpiar la cache tampoco lo conocía. Que interesante aplicarlo. ya os contaré que tal. gracias Jonathan.

Es super util para las instalaciones, la verdad que está muy bien preparado, tiene que ir a favoritos.


santiago bravo
nov 09 2015 16:17

gracias Jonathan

No esperes más y entra en Solvetic
Deja tus comentarios y aprovecha las ventajas de la cuenta de usuario ¡Únete!
10
VOTA
5
100%
4
0%
3
0%
2
0%
1
0%

  Información

  •   Publicado nov 03 2015 15:57
  •   Actualizado nov 03 2015 18:26
  •   Visitas 1.5K
  •   Nivel
    Profesional