Saltar al contenido

Instalar curl en Solaris 10 mediante OpenCSW

Curl es una herramienta utilizada a menudo en entornos GNU/Linux (scripts, invocación manual de APIs REST, auditorías de seguridad, etc…) y cuando se trabaja con el sistema operativo Solaris se la echa en falta. Es posible descargar binarios y el código fuente para despues compilarlo desde el sitio web oficial del proyecto: https://curl.haxx.se/. Sin embargo, no se aportará ningún sistema que permita resolver las dependencias y bajo este sistema operativo ejecutándose sobre un servidor con arquitectura Sun SPARC puede llegar a ser un quebradero de cabeza ir resolviéndolas de forma manual una a una.

Por fortuna existe OpenCSW, proyecto de código fuente abierto que consiste en un sistema de distribucion de software instalable para sistemas Solaris y derivados como Open Solaris. A través de este sistema se facilita y se agiliza enormemente la instalación y el portado de aplicaciones a esta plataforma UNIX, todo ello junto con las dependencias necesarias. Otros alicientes para utilizar este sistema a la hora de instalar paquetes son:

  • Dirigido por la comunidad.
  • Multitud de paquetes a instalar, la mayoría para varias versiones de Solaris.
  • Dispone de herramientas de búsqueda, listas de correo a las que suscribirse, IRC, wikis, etc…
  • Utiliza los ficheros nativos de Solaris, los SVR4.

Los pasos a seguir son:

Como superusuario descargarse la utilidad gestora de paquetes que provee OpenCSW, denominada CSWpkgutil.

# pkgadd -d http://get.opencsw.org/now

Una vez finalice la descarga se pedirá confirmación y se indicará que se desean instalar todos los paquetes (all).

## Downloading...
..............25%..............50%..............75%..............100%
## Download Complete


The following packages are available:
  1  CSWpkgutil     pkgutil - Installs Solaris packages easily
                    (all) 2.6.7,REV=2014.10.16

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all

La instalacion continuará y, además, se solicitará una segunda confirmación:

Processing package instance  from <http://get.opencsw.org/now>

pkgutil - Installs Solaris packages easily(all) 2.6.7,REV=2014.10.16

Please see /opt/csw/share/doc/pkgutil/license for license information.
Using </> as the package base directory.
## Processing package information.
## Processing system information.
   17 package pathnames are already properly installed.
## Verifying package dependencies.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user
permission during the process of installing this package.

Do you want to continue with the installation of  [y,n,?] y

Finalmente la instalación de la herramienta que gestiona los paquetes finaliza:

Installing pkgutil - Installs Solaris packages easily as 

## Installing part 1 of 1.
[ verifying class  ]
## Executing postinstall script.

/opt/csw/etc/pkgutil.conf already exists, will not copy pkgutil.conf.CSW to it.
/etc/opt/csw/pkgutil.conf already exists, will not copy pkgutil.conf.CSW to it.
/var/opt/csw/pkutil/admin already exists, will not copy admin.CSW to it.

NOTE!
NOTE! Make sure to check out any changes in /etc/opt/csw/pkgutil.conf.CSW.
NOTE!


Installation of  was successful.

Se actualiza el repositorio y las descripciones de los paquetes disponibles mediante el comando:

# /opt/csw/bin/pkgutil -U
=> Fetching new catalog and descriptions (http://mirror.opencsw.org/opencsw/testing/i386/5.10) if available ...
==> 3822 packages loaded from /var/opt/csw/pkgutil/catalog.mirror.opencsw.org_opencsw_testing_i386_5.10

Ahora se procede a instalar curl con sus dependencias:

# /opt/csw/bin/pkgutil -y -i curl
Solving needed dependencies ...
Solving dependency order ...
7 CURRENT packages:
        CSWcommon-1.5,REV=2010.12.11
        CSWggettext-data-0.18.1.1,p,REV=2011.03.15
        CSWiconv-1.14,REV=2011.08.08
        CSWlibcharset1-1.14,REV=2011.08.07
        CSWlibiconv2-1.14,REV=2011.08.07
        CSWlibintl8-0.18.1.1,p,REV=2011.03.15
        CSWlibz1-1.2.8,REV=2013.09.23
Install 13 NEW packages:
        CSWcacertificates-20120511,REV=2012.05.11 (opencsw/testing)
        CSWcas-migrateconf-1.50,REV=2015.01.17 (opencsw/testing)
        CSWcas-preserveconf-1.50,REV=2015.01.17 (opencsw/testing)
        CSWcurl-7.47.1,REV=2016.02.08 (opencsw/testing)
        CSWlibcurl4-7.47.1,REV=2016.02.08 (opencsw/testing)
        CSWlibexpat1-2.1.0,REV=2013.01.01 (opencsw/testing)
        CSWlibgcc-s1-5.2.0,REV=2015.07.31 (opencsw/testing)
        CSWlibicudata54-54.1,REV=2015.01.22 (opencsw/testing)
        CSWlibicuuc54-54.1,REV=2015.01.22 (opencsw/testing)
        CSWlibidn11-1.26,REV=2013.01.01 (opencsw/testing)
        CSWlibmetalink3-0.1.3,REV=2015.06.27 (opencsw/testing)
        CSWlibpsl0-0.7.1,REV=2015.03.01 (opencsw/testing)
        CSWlibssl1-0-0-1.0.1r,REV=2016.01.29 (opencsw/testing)
Total size: 24.2 MB
=> Fetching CSWlibicudata54-54.1,REV=2015.01.22 (1/13) ...
=> Fetching CSWcas-preserveconf-1.50,REV=2015.01.17 (2/13) ...
=> Fetching CSWcas-migrateconf-1.50,REV=2015.01.17 (3/13) ...
=> Fetching CSWlibicuuc54-54.1,REV=2015.01.22 (4/13) ...
=> Fetching CSWlibexpat1-2.1.0,REV=2013.01.01 (5/13) ...
=> Fetching CSWlibgcc-s1-5.2.0,REV=2015.07.31 (6/13) ...
=> Fetching CSWcacertificates-20120511,REV=2012.05.11 (7/13) ...
=> Fetching CSWlibpsl0-0.7.1,REV=2015.03.01 (8/13) ...
=> Fetching CSWlibssl1-0-0-1.0.1r,REV=2016.01.29 (9/13) ...
=> Fetching CSWlibmetalink3-0.1.3,REV=2015.06.27 (10/13) ...
=> Fetching CSWlibidn11-1.26,REV=2013.01.01 (11/13) ...
=> Fetching CSWlibcurl4-7.47.1,REV=2016.02.08 (12/13) ...
=> Fetching CSWcurl-7.47.1,REV=2016.02.08 (13/13) ...

=> Installing CSWlibicudata54-54.1,REV=2015.01.22 (1/13) ...
Please see /opt/csw/share/doc/libicudata54/license for license information.

Installation of  was successful.

=> Installing CSWcas-preserveconf-1.50,REV=2015.01.17 (2/13) ...
Please see /opt/csw/share/doc/cas_preserveconf/license for license information.

Installation of  was successful.

=> Installing CSWcas-migrateconf-1.50,REV=2015.01.17 (3/13) ...
Please see /opt/csw/share/doc/cas_migrateconf/license for license information.

Installation of  was successful.

=> Installing CSWlibicuuc54-54.1,REV=2015.01.22 (4/13) ...
Please see /opt/csw/share/doc/libicuuc54/license for license information.

Installation of  was successful.

=> Installing CSWlibexpat1-2.1.0,REV=2013.01.01 (5/13) ...
Please see /opt/csw/share/doc/libexpat1/license for license information.

Installation of  was successful.

=> Installing CSWlibgcc-s1-5.2.0,REV=2015.07.31 (6/13) ...
Please see /opt/csw/share/doc/libgcc_s1/license for license information.

Installation of  was successful.

=> Installing CSWcacertificates-20120511,REV=2012.05.11 (7/13) ...
Copying sample config to /etc/opt/csw/ca-certificates.conf

Updating certificates in /etc/opt/csw/ssl/certs...done.

Installation of  was successful.

=> Installing CSWlibpsl0-0.7.1,REV=2015.03.01 (8/13) ...
Please see /opt/csw/share/doc/libpsl0/license for license information.

Installation of  was successful.

=> Installing CSWlibssl1-0-0-1.0.1r,REV=2016.01.29 (9/13) ...
Please see /opt/csw/share/doc/libssl1_0_0/license for license information.

Installation of  was successful.

=> Installing CSWlibmetalink3-0.1.3,REV=2015.06.27 (10/13) ...
Please see /opt/csw/share/doc/libmetalink3/license for license information.

Installation of  was successful.

=> Installing CSWlibidn11-1.26,REV=2013.01.01 (11/13) ...
Please see /opt/csw/share/doc/libidn11/license for license information.

Installation of  was successful.

=> Installing CSWlibcurl4-7.47.1,REV=2016.02.08 (12/13) ...
Please see /opt/csw/share/doc/libcurl4/license for license information.

Installation of  was successful.

=> Installing CSWcurl-7.47.1,REV=2016.02.08 (13/13) ...
Please see /opt/csw/share/doc/curl/license for license information.

Installation of  was successful.

Listamos los ficheros instalados y todo pinta bien (la instalación da igual que sea con Bourne Shell/sh o con Bourne Again Shell/bash).

# /usr/sbin/pkgchk -L CSWcurl # list files
/opt/csw/bin/curl f none 0755 root bin 267420 9881 1454935123 CSWcurl
/opt/csw/share/doc/curl d none 0755 root bin CSWcurl
/opt/csw/share/doc/curl/license f none 0644 root bin 1088 21700 1454935689 CSWcurl/opt/csw/share/man/man1 d none 0755 root bin CSWbinutils CSWpkgutil CSWcurl
/opt/csw/share/man/man1/curl.1 f none 0644 root bin 104490 29422 1454935129 CSWcurl
/opt/csw/share/zsh d none 0755 root bin CSWcurl
/opt/csw/share/zsh/site-functions d none 0755 root bin CSWcurl
/opt/csw/share/zsh/site-functions/_curl f none 0644 root bin 11090 63739 1454935124 CSWcurl

OpenCSW instala el ejecutable en un subdirectorio propio (/opt/csw/bin), lo cual hace que sea incómodo trabajar con curl puesto que no estará disponible en la consola de comandos sin indicar explicitamente la ruta.

# ls /opt/csw/bin
amd64       gc++filt    ggprof      gobjcopy    gsrconv     gwindres
curl        gcoffdump   gld         gobjdump    gstrings    i486
gaddr2line  gdlltool    gld.bfd     granlib     gstrip      pentium
gar         gdllwrap    gnlmconv    greadelf    gsysdump    pkgutil
gas         gelfedit    gnm         gsize       gwindmc

Lo ideal es crear un enlace simbólico al ejecutable anterior en el directorio /bin para que sea accesible como si fuese una utilidad más del sistema operativo.

# ln -s /opt/csw/bin/curl /bin/curl

Ahora si se invoca el comando ya no es necesario hacerlo a través de la ruta absoluta o relativa, además de estar disponible para todos los usuarios del sistema:

# curl
curl: try 'curl --help' or 'curl --manual' for more information

Finalmente se prueba el comando para verificar su correcto funcionamiento:

# curl http://ingenieroinformatico.org
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.ingenieroinformatico.org/">here</a>.</p>
<hr>
<address>Apache/2.2.22 (Debian) Server at ingenieroinformatico.org Port 80</address>
</body></html>
Publicado enAdministración de sistemasApuntesManualSistemas OperativosTutorial