lunes, 17 de marzo de 2014

Cómo instalar ps2pdf en CentOS 6.5

Una herramienta muy útil que empleo para pasar man pages a formato PDF es ps2pdf (contracción de postscript to pdf).

La sintaxis utilizada es la siguiente:

man -t <herramienta> | ps2pdf - herramienta.pdf

donde <herramienta> es el nombre del programa cuyo manual deseo convertir en PDF.

Este proceso involucra dos pasos:

1) Desplegar el manual del programa en formato PostScript.

2) En vez de mostrar la salida por pantalla, redireccionar la misma a ps2pdf, que creará el archivo herramienta.pdf en el directorio donde se esté trabajando.

¿Pero qué hacer si ps2pdf no está instalado en el sistema?

[root@centos ~]# man -t ps | ps2pdf - ps.pdf
bash: ps2pdf: command not found
[root@centos ~]

[root@centos ~]# cat /etc/centos-release
CentOS release 6.5 (Final)
[root@centos ~]#

En ese caso hay que instalar los paquetes ghostscript y ghostscript-fonts. El primero contiene a ps2pdf y el segundo es incluye el conjunto de fuentes que ghostscript utiliza para renderizar texto:

[root@centos ~]# yum info ghostscript ghoscript-fonts
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.dcarsat.com.ar
 * extras: mirrors.dcarsat.com.ar
 * updates: mirror.gtdinternet.com
Available Packages
Name        : ghostscript
Arch        : i686
Version     : 8.70
Release     : 19.el6
Size        : 4.5 M
Repo        : base
Summary     : A PostScript interpreter and renderer
URL         : http://www.ghostscript.com/
License     : GPLv3+ and Redistributable, no modification permitted
Description : Ghostscript is a set of software that provides a PostScript
            : interpreter, a set of C procedures (the Ghostscript library, which
            : implements the graphics capabilities in the PostScript language) and
            : an interpreter for Portable Document Format (PDF) files. Ghostscript
            : translates PostScript code into many common, bitmapped formats, like
            : those understood by your printer or screen. Ghostscript is normally
            : used to display PostScript files and to print PostScript files to
            : non-PostScript printers.
            :
            : If you need to display PostScript files or print them to
            : non-PostScript printers, you should install ghostscript. If you
            : install ghostscript, you also need to install the ghostscript-fonts
            : package.

Name        : ghostscript
Arch        : x86_64
Version     : 8.70
Release     : 19.el6
Size        : 4.4 M
Repo        : base
Summary     : A PostScript interpreter and renderer
URL         : http://www.ghostscript.com/
License     : GPLv3+ and Redistributable, no modification permitted
Description : Ghostscript is a set of software that provides a PostScript
            : interpreter, a set of C procedures (the Ghostscript library, which
            : implements the graphics capabilities in the PostScript language) and
            : an interpreter for Portable Document Format (PDF) files. Ghostscript
            : translates PostScript code into many common, bitmapped formats, like
            : those understood by your printer or screen. Ghostscript is normally
            : used to display PostScript files and to print PostScript files to
            : non-PostScript printers.
            :
            : If you need to display PostScript files or print them to
            : non-PostScript printers, you should install ghostscript. If you
            : install ghostscript, you also need to install the ghostscript-fonts
            : package.

[root@centos ~]#

Procedemos a la instalación de los dos paquetes mencionados anteriormente:

[root@centos ~]# yum install ghostscript ghoscript-fonts
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.dcarsat.com.ar
 * extras: mirrors.dcarsat.com.ar
 * updates: mirror.gtdinternet.com
Setting up Install Process
No package ghoscript-fonts available.
Resolving Dependencies
--> Running transaction check
---> Package ghostscript.x86_64 0:8.70-19.el6 will be installed
--> Processing Dependency: urw-fonts >= 1.1 for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libpng12.so.0(PNG12_0)(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: ghostscript-fonts for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libpng12.so.0()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libjasper.so.1()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libfontconfig.so.1()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libcupsimage.so.2()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libcups.so.2()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libcairo.so.2()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libXt.so.6()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libXext.so.6()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libSM.so.6()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Processing Dependency: libICE.so.6()(64bit) for package: ghostscript-8.70-19.el6.x86_64
--> Running transaction check
---> Package cairo.x86_64 0:1.8.8-3.1.el6 will be installed
--> Processing Dependency: libpixman-1.so.0()(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
--> Processing Dependency: libfreetype.so.6()(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
--> Processing Dependency: libXrender.so.1()(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
---> Package cups-libs.x86_64 1:1.4.2-50.el6_4.5 will be installed
--> Processing Dependency: libgnutls.so.26(GNUTLS_1_4)(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
--> Processing Dependency: libtiff.so.3()(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
--> Processing Dependency: libgnutls.so.26()(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
--> Processing Dependency: libavahi-common.so.3()(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
--> Processing Dependency: libavahi-client.so.3()(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
---> Package fontconfig.x86_64 0:2.8.0-3.el6 will be installed
---> Package ghostscript-fonts.noarch 0:5.50-23.1.el6 will be installed
--> Processing Dependency: xorg-x11-font-utils for package: ghostscript-fonts-5.50-23.1.el6.noarch
---> Package jasper-libs.x86_64 0:1.900.1-15.el6_1.1 will be installed
---> Package libICE.x86_64 0:1.0.6-1.el6 will be installed
---> Package libSM.x86_64 0:1.2.1-2.el6 will be installed
---> Package libX11.x86_64 0:1.5.0-4.el6 will be installed
--> Processing Dependency: libX11-common = 1.5.0-4.el6 for package: libX11-1.5.0-4.el6.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.5.0-4.el6.x86_64
---> Package libXext.x86_64 0:1.3.1-2.el6 will be installed
---> Package libXt.x86_64 0:1.1.3-1.el6 will be installed
---> Package libjpeg-turbo.x86_64 0:1.2.1-3.el6_5 will be installed
---> Package libpng.x86_64 2:1.2.49-1.el6_2 will be installed
---> Package urw-fonts.noarch 0:2.4-10.el6 will be installed
--> Running transaction check
---> Package avahi-libs.x86_64 0:0.6.25-12.el6 will be installed
---> Package freetype.x86_64 0:2.3.11-14.el6_3.1 will be installed
---> Package gnutls.x86_64 0:2.8.5-13.el6_5 will be installed
---> Package libX11-common.noarch 0:1.5.0-4.el6 will be installed
---> Package libXrender.x86_64 0:0.9.7-2.el6 will be installed
---> Package libtiff.x86_64 0:3.9.4-10.el6_5 will be installed
---> Package libxcb.x86_64 0:1.8.1-1.el6 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.8.1-1.el6.x86_64
---> Package pixman.x86_64 0:0.26.2-5.1.el6_5 will be installed
---> Package xorg-x11-font-utils.x86_64 1:7.2-11.el6 will be installed
--> Processing Dependency: libfontenc.so.1()(64bit) for package: 1:xorg-x11-font-utils-7.2-11.el6.x86_64
--> Processing Dependency: libXfont.so.1()(64bit) for package: 1:xorg-x11-font-utils-7.2-11.el6.x86_64
--> Running transaction check
---> Package libXau.x86_64 0:1.0.6-4.el6 will be installed
---> Package libXfont.x86_64 0:1.4.5-3.el6_5 will be installed
---> Package libfontenc.x86_64 0:1.0.5-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                       Arch                             Version                                         Repository                         Size
========================================================================================================================================================================
Installing:
 ghostscript                                   x86_64                           8.70-19.el6                                     base                              4.4 M
Installing for dependencies:
 avahi-libs                                    x86_64                           0.6.25-12.el6                                   base                               54 k
 cairo                                         x86_64                           1.8.8-3.1.el6                                   base                              309 k
 cups-libs                                     x86_64                           1:1.4.2-50.el6_4.5                              base                              317 k
 fontconfig                                    x86_64                           2.8.0-3.el6                                     base                              186 k
 freetype                                      x86_64                           2.3.11-14.el6_3.1                               base                              359 k
 ghostscript-fonts                             noarch                           5.50-23.1.el6                                   base                              751 k
 gnutls                                        x86_64                           2.8.5-13.el6_5                                  updates                           346 k
 jasper-libs                                   x86_64                           1.900.1-15.el6_1.1                              base                              136 k
 libICE                                        x86_64                           1.0.6-1.el6                                     base                               53 k
 libSM                                         x86_64                           1.2.1-2.el6                                     base                               37 k
 libX11                                        x86_64                           1.5.0-4.el6                                     base                              584 k
 libX11-common                                 noarch                           1.5.0-4.el6                                     base                              192 k
 libXau                                        x86_64                           1.0.6-4.el6                                     base                               24 k
 libXext                                       x86_64                           1.3.1-2.el6                                     base                               35 k
 libXfont                                      x86_64                           1.4.5-3.el6_5                                   updates                           136 k
 libXrender                                    x86_64                           0.9.7-2.el6                                     base                               30 k
 libXt                                         x86_64                           1.1.3-1.el6                                     base                              184 k
 libfontenc                                    x86_64                           1.0.5-2.el6                                     base                               24 k
 libjpeg-turbo                                 x86_64                           1.2.1-3.el6_5                                   updates                           174 k
 libpng                                        x86_64                           2:1.2.49-1.el6_2                                base                              182 k
 libtiff                                       x86_64                           3.9.4-10.el6_5                                  updates                           343 k
 libxcb                                        x86_64                           1.8.1-1.el6                                     base                              110 k
 pixman                                        x86_64                           0.26.2-5.1.el6_5                                updates                           200 k
 urw-fonts                                     noarch                           2.4-10.el6                                      base                              3.1 M
 xorg-x11-font-utils                           x86_64                           1:7.2-11.el6                                    base                               75 k

Transaction Summary
========================================================================================================================================================================
Install      26 Package(s)

Total download size: 12 M
Installed size: 37 M
Is this ok [y/N]: Y

Luego de presionar Enter, la instalación comienza y continúa su curso:

Downloading Packages:
(1/26): avahi-libs-0.6.25-12.el6.x86_64.rpm                                                                                                      |  54 kB     00:00    
(2/26): cairo-1.8.8-3.1.el6.x86_64.rpm                                                                                                           | 309 kB     00:00    
(3/26): cups-libs-1.4.2-50.el6_4.5.x86_64.rpm                                                                                                    | 317 kB     00:00    
(4/26): fontconfig-2.8.0-3.el6.x86_64.rpm                                                                                                        | 186 kB     00:00    
(5/26): freetype-2.3.11-14.el6_3.1.x86_64.rpm                                                                                                    | 359 kB     00:01    
(6/26): ghostscript-8.70-19.el6.x86_64.rpm                                                                                                       | 4.4 MB     00:10    
(7/26): ghostscript-fonts-5.50-23.1.el6.noarch.rpm                                                                                               | 751 kB     00:01    
(8/26): gnutls-2.8.5-13.el6_5.x86_64.rpm                                                                                                         | 346 kB     00:00    
(9/26): jasper-libs-1.900.1-15.el6_1.1.x86_64.rpm                                                                                                | 136 kB     00:00    
(10/26): libICE-1.0.6-1.el6.x86_64.rpm                                                                                                           |  53 kB     00:00    
(11/26): libSM-1.2.1-2.el6.x86_64.rpm                                                                                                            |  37 kB     00:00    
(12/26): libX11-1.5.0-4.el6.x86_64.rpm                                                                                                           | 584 kB     00:01    
(13/26): libX11-common-1.5.0-4.el6.noarch.rpm                                                                                                    | 192 kB     00:00    
(14/26): libXau-1.0.6-4.el6.x86_64.rpm                                                                                                           |  24 kB     00:00    
(15/26): libXext-1.3.1-2.el6.x86_64.rpm                                                                                                          |  35 kB     00:00    
(16/26): libXfont-1.4.5-3.el6_5.x86_64.rpm                                                                                                       | 136 kB     00:00    
(17/26): libXrender-0.9.7-2.el6.x86_64.rpm                                                                                                       |  30 kB     00:00    
(18/26): libXt-1.1.3-1.el6.x86_64.rpm                                                                                                            | 184 kB     00:00    
(19/26): libfontenc-1.0.5-2.el6.x86_64.rpm                                                                                                       |  24 kB     00:00    
(20/26): libjpeg-turbo-1.2.1-3.el6_5.x86_64.rpm                                                                                                  | 174 kB     00:00    
(21/26): libpng-1.2.49-1.el6_2.x86_64.rpm                                                                                                        | 182 kB     00:00    
(22/26): libtiff-3.9.4-10.el6_5.x86_64.rpm                                                                                                       | 343 kB     00:01    
(23/26): libxcb-1.8.1-1.el6.x86_64.rpm                                                                                                           | 110 kB     00:00    
(24/26): pixman-0.26.2-5.1.el6_5.x86_64.rpm                                                                                                      | 200 kB     00:00    
(25/26): urw-fonts-2.4-10.el6.noarch.rpm                                                                                                         | 3.1 MB     00:08    
(26/26): xorg-x11-font-utils-7.2-11.el6.x86_64.rpm                                                                                               |  75 kB     00:00    
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   326 kB/s |  12 MB     00:38    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libjpeg-turbo-1.2.1-3.el6_5.x86_64                                                                                                                  1/26
  Installing : freetype-2.3.11-14.el6_3.1.x86_64                                                                                                                   2/26
  Installing : fontconfig-2.8.0-3.el6.x86_64                                                                                                                       3/26
  Installing : libICE-1.0.6-1.el6.x86_64                                                                                                                           4/26
  Installing : 2:libpng-1.2.49-1.el6_2.x86_64                                                                                                                      5/26
  Installing : libSM-1.2.1-2.el6.x86_64                                                                                                                            6/26
  Installing : libfontenc-1.0.5-2.el6.x86_64                                                                                                                       7/26
  Installing : libXfont-1.4.5-3.el6_5.x86_64                                                                                                                       8/26
  Installing : 1:xorg-x11-font-utils-7.2-11.el6.x86_64                                                                                                             9/26
  Installing : ghostscript-fonts-5.50-23.1.el6.noarch                                                                                                             10/26
  Installing : urw-fonts-2.4-10.el6.noarch                                                                                                                        11/26
  Installing : libtiff-3.9.4-10.el6_5.x86_64                                                                                                                      12/26
  Installing : jasper-libs-1.900.1-15.el6_1.1.x86_64                                                                                                              13/26
  Installing : avahi-libs-0.6.25-12.el6.x86_64                                                                                                                    14/26
  Installing : libXau-1.0.6-4.el6.x86_64                                                                                                                          15/26
  Installing : libxcb-1.8.1-1.el6.x86_64                                                                                                                          16/26
  Installing : libX11-common-1.5.0-4.el6.noarch                                                                                                                   17/26
  Installing : libX11-1.5.0-4.el6.x86_64                                                                                                                          18/26
  Installing : libXrender-0.9.7-2.el6.x86_64                                                                                                                      19/26
  Installing : libXt-1.1.3-1.el6.x86_64                                                                                                                           20/26
  Installing : libXext-1.3.1-2.el6.x86_64                                                                                                                         21/26
  Installing : pixman-0.26.2-5.1.el6_5.x86_64                                                                                                                     22/26
  Installing : cairo-1.8.8-3.1.el6.x86_64                                                                                                                         23/26
  Installing : gnutls-2.8.5-13.el6_5.x86_64                                                                                                                       24/26
  Installing : 1:cups-libs-1.4.2-50.el6_4.5.x86_64                                                                                                                25/26
  Installing : ghostscript-8.70-19.el6.x86_64                                                                                                                     26/26
  Verifying  : libtiff-3.9.4-10.el6_5.x86_64                                                                                                                       1/26
  Verifying  : gnutls-2.8.5-13.el6_5.x86_64                                                                                                                        2/26
  Verifying  : libXfont-1.4.5-3.el6_5.x86_64                                                                                                                       3/26
  Verifying  : libfontenc-1.0.5-2.el6.x86_64                                                                                                                       4/26
  Verifying  : libSM-1.2.1-2.el6.x86_64                                                                                                                            5/26
  Verifying  : fontconfig-2.8.0-3.el6.x86_64                                                                                                                       6/26
  Verifying  : jasper-libs-1.900.1-15.el6_1.1.x86_64                                                                                                               7/26
  Verifying  : urw-fonts-2.4-10.el6.noarch                                                                                                                         8/26
  Verifying  : freetype-2.3.11-14.el6_3.1.x86_64                                                                                                                   9/26
  Verifying  : 1:xorg-x11-font-utils-7.2-11.el6.x86_64                                                                                                            10/26
  Verifying  : ghostscript-fonts-5.50-23.1.el6.noarch                                                                                                             11/26
  Verifying  : pixman-0.26.2-5.1.el6_5.x86_64                                                                                                                     12/26
  Verifying  : libXrender-0.9.7-2.el6.x86_64                                                                                                                      13/26
  Verifying  : 1:cups-libs-1.4.2-50.el6_4.5.x86_64                                                                                                                14/26
  Verifying  : libX11-common-1.5.0-4.el6.noarch                                                                                                                   15/26
  Verifying  : libxcb-1.8.1-1.el6.x86_64                                                                                                                          16/26
  Verifying  : 2:libpng-1.2.49-1.el6_2.x86_64                                                                                                                     17/26
  Verifying  : libjpeg-turbo-1.2.1-3.el6_5.x86_64                                                                                                                 18/26
  Verifying  : libXt-1.1.3-1.el6.x86_64                                                                                                                           19/26
  Verifying  : libXau-1.0.6-4.el6.x86_64                                                                                                                          20/26
  Verifying  : ghostscript-8.70-19.el6.x86_64                                                                                                                     21/26
  Verifying  : libICE-1.0.6-1.el6.x86_64                                                                                                                          22/26
  Verifying  : libX11-1.5.0-4.el6.x86_64                                                                                                                          23/26
  Verifying  : libXext-1.3.1-2.el6.x86_64                                                                                                                         24/26
  Verifying  : cairo-1.8.8-3.1.el6.x86_64                                                                                                                         25/26
  Verifying  : avahi-libs-0.6.25-12.el6.x86_64                                                                                                                    26/26

Installed:
  ghostscript.x86_64 0:8.70-19.el6                                                                                                                                     

Dependency Installed:
  avahi-libs.x86_64 0:0.6.25-12.el6         cairo.x86_64 0:1.8.8-3.1.el6               cups-libs.x86_64 1:1.4.2-50.el6_4.5    fontconfig.x86_64 0:2.8.0-3.el6         
  freetype.x86_64 0:2.3.11-14.el6_3.1       ghostscript-fonts.noarch 0:5.50-23.1.el6   gnutls.x86_64 0:2.8.5-13.el6_5         jasper-libs.x86_64 0:1.900.1-15.el6_1.1 
  libICE.x86_64 0:1.0.6-1.el6               libSM.x86_64 0:1.2.1-2.el6                 libX11.x86_64 0:1.5.0-4.el6            libX11-common.noarch 0:1.5.0-4.el6      
  libXau.x86_64 0:1.0.6-4.el6               libXext.x86_64 0:1.3.1-2.el6               libXfont.x86_64 0:1.4.5-3.el6_5        libXrender.x86_64 0:0.9.7-2.el6         
  libXt.x86_64 0:1.1.3-1.el6                libfontenc.x86_64 0:1.0.5-2.el6            libjpeg-turbo.x86_64 0:1.2.1-3.el6_5   libpng.x86_64 2:1.2.49-1.el6_2          
  libtiff.x86_64 0:3.9.4-10.el6_5           libxcb.x86_64 0:1.8.1-1.el6                pixman.x86_64 0:0.26.2-5.1.el6_5       urw-fonts.noarch 0:2.4-10.el6           
  xorg-x11-font-utils.x86_64 1:7.2-11.el6 

Complete!
[root@centos ~]#

Por la paciencia demostrada al seguir este post hasta este punto, comparto una perlita muy útil que podemos utilizar para localizar en qué paquete está contenida una cierta herramienta que deseemos instalar (que fue la que usé yo para localizar a ps2pdf):

[root@centos ~]# yum provides "*/ps2pdf"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.dcarsat.com.ar
 * extras: mirrors.dcarsat.com.ar
 * updates: mirror.gtdinternet.com
base/filelists_db                                                                                                                                | 5.9 MB     00:13    
extras/filelists_db                                                                                                                              |  11 kB     00:00    
updates/filelists_db                                                                                                                             | 1.3 MB     00:02    
ghostscript-8.70-19.el6.i686 : A PostScript interpreter and renderer
Repo        : base
Matched from:
Filename    : /usr/bin/ps2pdf

ghostscript-8.70-19.el6.x86_64 : A PostScript interpreter and renderer
Repo        : base
Matched from:
Filename    : /usr/bin/ps2pdf

[root@centos ~]#

No hay comentarios:

Publicar un comentario