Installation Wiki

Installing CUPS

From InstallationWiki

Jump to: navigation, search
CUPS
Official Page
Project Documentation
Download
Source Book
200px-1847192580.jpg
ISBN 978-1-847192-58-
Publisher Packt Publishing
Author(s) Ankur Shah

Today, most of the UNIX and Linux systems come with the CUPS printing system. CUPS is supported by Caldera, Debian, Conectiva, easyLinux, HP-UX, IRIX, Linux Mandrake, Peanut, Red Hat, Solaris, SusE, Tru64, UNIX, TurboLinux, and AIX. Of these, Conectiva, easyLinux, Linux Mandrake, and Peanut use CUPS as their primary printing system.

This tutorial describes how to compile and install CUPS on your system from the source code.

Contents

[edit] Downloading Source Code

Today, most of the UNIX and Linux distributions install CUPS by default. CUPS requires ANSI-compliant C and C++ compilers, a Make program and Bourne shell. The GNU compiler tools also work well with CUPS.

CUPS has been tested with GNU Make as well as the other Make programs shipped by Compaq, HP, SGI, and Sun. BSD users should use GNU make (gmake). The latest version of CUPS can be downloaded from http://www.cups.org/software.php. The current stable version of CUPS is 1.3.8.

Apart from these tools, we also require support for the following libraries that provides additional functionality for printing service. CUPS mainly supports two libraries:

  • CUPS imaging library
  • CUPS library

The CUPS imaging library consists of libraries for JPEG, PNG, TIFF, ZLIB, and so on, and it is used for images support.

The CUPS library contains CUPS-specific functions that support the use of CDSA, GNU TLS, and the OpenSSL libraries for encryption. We will discuss these in details in Tutorial 10, on Security. For the directory service, you can use the OpenLDAP and the OpenSLP libraries.

You can find a mirror of CUPS related libraries which is maintained by Easy Software Products at:

ftp://ftp.easysw.com/pub/libraries.

CUPS can easily compile and run without above libraries. However, you will miss out on many of the features provided by CUPS.


If any changes need to be made in the man pages, you will need GNU Troff (Groff) or another nroff-like package. Groff is available at ftp://ftp.gnu.org/gnu/groff/.

The documentation is formatted using the HTMLDOC software. If you need to make changes, you can get the HTMLDOC software from http://www.htmldoc.org/index.php.

[edit] Compiling CUPS

The source code of CUPS is available in two formats:

  • Gnu zip—with .gz extension
  • bzip2—with .bz2 extension

Once you download the source code for the CUPS, it must be extracted using the following command:

#tar -xvf cups-1.3.8-source.tar.gz

Or

#tar xvjf cups-1.3.8-source.tar.bz2

In the example above, cups-1.3.8-source.tar.gz is the source code of CUPS in a .gz format. To compile the source code, we need to go to the CUPS source directory which has just been created.

#cd cups-1.3.8

CUPS uses GNU Autoconf to configure the Makefiles and source code for your system. Type the following command to configure CUPS for your system:

#./configure

The default installation will put the CUPS software in the /etc, /usr, and /var directories on your system, which will overwrite all existing print commands on your system.

You can also use the --prefix option to install the CUPS software in another location:

#./configure --prefix=/some/directory

You can see a complete list of configuration options using the --help option:

#./configure -help

If the PNG, JPEG, TIFF, and ZLIB libraries are not installed in a system in the default location (typically /usr/include and /usr/lib), we need to set the CFLAGS,CPPFLAGS, CXXFLAGS, DSOFLAGS and LDFLAGS environment variables prior to configuration:

  setenv CFLAGS "-I/any/dir"
  setenv CPPFLAGS "-I/any/dir"
  setenv CXXFLAGS "-I/any/dir"
  setenv DSOFLAGS "-Lany/dir"
  setenv LDFLAGS "-L/any/dir"

./configure

Or

  CFLAGS="-I/any/dir" \
  CPPFLAGS="-I/any/dir" \
  CXXFLAGS="-I/any/dir" \
  DSOFLAGS="-L/any/dir" \
  LDFLAGS="-L/any/dir" \

./configure

To enable support for encryption, you will need to add the --enable-ssl option:

#./configure --enable-ssl

SSL and TLS support requires the OpenSSL library, which is available at http://www.openssl.org.

If the OpenSSL headers and libraries are not installed in the standard directories, you can configure them using --with-openssl-includes and --with-openssl-libs options:

  #./configure --enable-ssl \
  --with-openssl-includes=/foo/bar/include \

--with-openssl-libs=/foo/bar/lib

Once the configuration is done, you can start building the software by using the following command:

#make

If you are using FreeBSD, NetBSD, or OpenBSD systems, use the following command instead:

#gmake

[edit] Installing the Software

Once the CUPS software is built, you need to install it. The install target provides a quick way to install the software on your local system:

#make install

You should use the following command to install built CUPS, if the system is FreeBSD, NetBSD, or OpenBSD:

#gmake install
Installing CUPS will overwrite your existing printing system. If you experiences difficulties with the CUPS software and want to go back to your old printing system, the reinstallation of the old printing system can be done via the operating system CDs.

If you find any difficulties with compiling CUPS, you can submit a trouble report on the CUPS website. The Software Trouble Reports (STR) are maintained on the Bugs and Feature page on the CUPS website: http://www.cups.org/str.php.

You can find the guidance documents and processes consisting of information related to STR in the developer guidelines at the following URL:

http://www.cups.org/documentation.php/spec-cmp.html

[edit] Installing a Binary Distribution

You can also build binary packages that can be installed on other machines using the RPM spec file (packaging/cups.spec) or EPM list file (packaging/cups.list). The latter also supports building of binary RPMs (Red Hat Package Manager), which makes it more convenient to use.

[edit] Building RPMs

You can find the RPM software at http://www.rpm.org/.

The source distributions include an RPM spec file that can be used to build RPM packages for your Linux distribution. The rpmbuild command is used to build from the tar files:

#rpmbuild -ta cups-version-source.tar.gz

Or

#rpmbuild -ta cups-version-source.tar.bz2

You will need the gcc, libjpeg, libjpeg-devel, libpng, libpng-devel, libtiff, libtiff-devel, zlib, and zlib-devel packages installed to compile CUPS with all the standard functionalities. The krb5-devel and krb5-libs packages, openldap and openldap-devel packages, openslp, and openslp-devel packages will allow support for Kerberos (CUPS 1.3.x only), LDAP, and SLP respectively.

The spec file supports two options, --without php and --without dbus, which control whether the PHP and DBUS support is compiled into the packages. For example, if you are compiling CUPS 1.2.4 or earlier on Red Hat Enterprise Linux, you will need to provide the --without dbus option since that distribution does not have a compatible version of the D-BUS libraries available:

#rpmbuild -ta cups-version-source.tar.gz --without dbus

Similarly, if you don t have the php-devel package installed, then you can use the --without the php option to omit the PHP support from the generated RPMs.

  1. rpmbuild -ta cups-version-source.tar.gz --without php

[edit] Creating Binary Distribution with EPM

The EPM software is available at http://www.easysw.com/epm/.

The top level makefile supports generation of many types of binary distributions using EPM. To build a binary distribution type:

#make <format>

Or

#gmake <format>

For FreeBSD, NetBSD, and OpenBSD, the <format> target is one of the following:

  • epm—Builds a script + tarfi le package
  • aix—Builds an AIX package
  • bsd—Builds a BSD package
  • deb—Builds a Debian package
  • depot—Builds a HP-UX package (also swinstall)
  • inst—Builds an IRIX package (also tardist)
  • osx—Builds a MacOS X package
  • pkg—Builds a Solaris package
  • rpm—Builds a RPM package
  • setld—Build a Tru64 UNIX package
  • slackware—Build a Slackware package
  • swinstall—Build a HP-UX package (also depot)
  • tardist—Builds an IRIX package (also inst)

You can also use Google search engine to find other free binaries:

http://www.google.com/search?q=cups+binary+package&btnG=Search

Mac OS X 10.5 comes with the CUPS 1.3. Cups1.3.x can be compiled and installed on the earlier versions of Mac OS X directly from source. Some GUI admin tools may not work properly in these versions.

[edit] Installing a Portable Distribution

To install the CUPS software from a portable distribution, you will need to login as root user. You can also use the su command to login as root user. Once the user is set as root the shell script should be run:

#./cups.install

After asking you a few yes/no questions, the CUPS software will be installed and the scheduler will be started automatically.

The su(switch user) can be used to change the ownership of a session to any user. It is most commonly employed to change the ownership from an ordinary user to the root user, thereby providing access to all parts, and all commands on the computer or system. For this reason, it is often referred to (although somewhat inaccurately) as the superuser command. It is also sometimes called the switch user command.

[edit] Installing an RPM Distribution

To install the CUPS software from an RPM distribution, you will need to be logged in as root user. As discussed earlier, doing a su login is also good enough. Once this is done, we can use the following commands to start installation:

 #rpm -e lpr

#rpm -i cups-1.1-linux-M.m.n-intel.rpm

After a short delay, the CUPS software will be installed and the scheduler will be started automatically.

[edit] Installing CUPS from a Debian Distribution

To install the CUPS software from a Debian distribution, you will need to be logged in as the root user. Using the su is not good enough. Once you are logged in as the root user, you may run dpkg with:

#dpkg -i cups-1.1-linux-M.m.n-intel.deb

After a short delay, the CUPS software will be installed and the scheduler will be started automatically.

[edit] Subversion Access

The CUPS source files are managed by the Subversion (SVN) software, available at:

http://subversion.tigris.org/

Source files are "checked in" with each change so that modifications can be tracked. The CUPS software is available via Subversion using the following URL:

http://svn.easysw.com/public/cups/

The following command can be used to check the current CUPS 1.3.x source from Subversion:

#svn co http://svn.easysw.com/public/cups/branches/branch-1.3/cups-1.3.x

Similarly, the following command can be used to check the current CUPS 1.4.x source from Subversion:

#svn co http://svn.easysw.com/public/cups/trunk/cups

[edit] Compiling from Subversion

The CUPS Subversion repository does not hold a copy of the pre-built configure script. It requires running the GNU autoconf software (2.60 or higher) before compiling the software from Subversion:

#autoconf f

[edit] Running the Software

Once the software is installed, the CUPS server can be started using the following command:

#/usr/sbin/cupsd

You can check whether CUPS is running using the following command:

#service cups status 

Or

#ps ax | grep cups 

[edit] Installing CUPS Using the Package Manager on Linux

To install the CUPS software from the package manager available in the control center, click on Install Software. This will launch the package manager for software installation as shown in the following screenshot. Here, we have used the rpmdrake package manager of Mandriva (originally Mandrake) Distribution. Therpmdrake is a simple graphical frontend to manage software packages on a Mandriva Linux system. You can see the options for installation, removal and updation of software packages.

You can select the package that you want to install. The package can be selected by one of the following three options:

1. Search by choices

2. List by alphabetical order

3. All packages by group

Further, you should perform following steps to search for the desired package, cups:

  • Leave as default and enter the name of the application
  • Click on the Search button
  • On the search result, click on the correct package
Some of the packages might require additional packages called dependencies. You can check out these dependencies by clicking on the main package and then reading the description to find out what dependencies that package may have (if any).

The installation options are displayed here. You can then perform the steps mentioned here:

  • Click on Install
  • Enter the appropriate CDs and Click OK

You will be prompted once the installation is complete. You may also see a warning similar to the following:

This message appears if you have just uninstalled CUPS, and trying to install it again. If this message appears on the screen, click on Inspect and remove the saved file that will help to keep the system clean. Once you have finished reviewing the installation notice, click OK.

[edit] Testing CUPS

We have seen various processes to install CUPS. Once installed, you should test CUPS to make sure whether it is working properly. Since CUPS uses the IPP (Internet Printing Protocol), you can verify this by opening a browser and typing http://localhost:631/.

The default port number on which CUPS listens is 631, but you can change it.

[edit] Source

The source of this content is Chapter 2: Building and Installing CUPS of CUPS Administrative Guide by Ankur Shah (Packt Publishing, 2008).

[edit] Additional References

  • For instructions on Basic Debugging in CUPS-SNMP, click here
Personal tools