You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

This is the story of how I set up my CUPS print server on a P3-450 box running SuSE 9.1.

I print directly from that box to an Epson Stylus Color 440. I also use it as a print server for two WinXP machines on my home network. I got a lot of the standard problems: server starts but dies as soon as the client accesses it; permission problems; invisible to the clients etc. In the end I started from scratch with the latest stable version from CUPS and built it myself.

I had already got SAMBA working across the network, this is an essential first step. I’ll come back to the SAMBA setup later.

I started with my standard SuSE setup, but could not get it to work. I know it should “work out of the box”, but I never had a box and I think that the number of CUPS posts indicates that working out of the box is not a CUPS strong point! I suspect that other things I have done on my system messed up the SuSE setup and returning it to a base condition was too difficult.

I got so mad I uninstalled the whole SuSE CUPS setup, don’t do this yourself. It may have been necessary, obviously I can’t tell, but I did have to reinstall a few things that I suspect I may have trashed. Leave your current setup in place first, then if it does not work try uninstalling.

Download the latest stable version of CUPS from the ESP website:

http://www.cups.org/index.php

I used cups-1.1.23-source.tar.gz

While you are there also download ESP Ghostscript, I used

espgs-8.15.1-source.tar.gz

You may not need their ghostscript, it is one of the things I may have trashed in SuSE. But it works well for me: it translates the format of files for printing. I have also heard that ESP Ghostscript has a very good range of drivers. For the moment ignore my instructions on ghostscript if you want to try and use whatever is already on your machine.

Step 1 - Get the sources

I put them into /usr/local (my choice, feel free to make your own) and ran

I changed directory into /usr/local/cups-1.1.23 and ran the following commands:
./configure
./make
./make install

These should run without errors. If yours do not it is likely that you lack a library that I have installed for some other purpose. You will have to check the errors carefully. Also consult the config-log in /usr/local/cups-1.1.23 for hints as to what is wrong.

Whenever a library has been missing in the past I have always found it in SuSE’s ftp site:

ftp://ftp.suse.com/pub/suse/install/9.1/suse/i586/

These are provided as rpms so I simply double click on them and let YaST get on with it. Other distros will have similar sources.

Once you have CUPS-1.1.23 installed clean then it is worth trying to get it to work before messing around with new installations of ghostscript.

Step 3 - Set up the system users

Create the necessary system user “lp” with group “sys”, I set a UID of 8, I think it may be important to give it a UID below 10.

You must add your root user to CUPS for administration purposes. Execute:

lppasswd –g sys –a root, you will be prompted for the password.

Step 4 - Start the daemon

My installation created a script: /etc/init.d/init.d/cups - very irritating location and I shall move it shortly, but it does work.

With the daemon running you will be able to use the web-based admin tool. You may need to open port 631 in your firewall first.

Navigate to: http://localhost:631

Log in as root with your usual password. Plug in your printer and turn it on – wait a little while for Linux to find it. Click on printers and Add Printer. Give it a name; Location and Description are optional and really for the big boys who might be adding printers in different cities and need to describe them. The important stuff is on the next page.

For device tell it to find the printer on whichever physical connection you are using. For me this was Parallel Port #1. The dialogue is straightforward if your printer is well known. If you have some rare machine which ESP have not created drivers for you are on your own. You could try Adobe’s site for a generic postscript printer driver – they have them for XP which may help you set up your clients.

Click on Print Test Page and you may be very lucky. If you are skip to “Setting up the clients”.

Step 6 - debug!

At this point my system did not work. I found the configuration file in /etc/cups it is called cupsd.conf.

It is very clear and has the look and feel of the Apache configuration file. Find the debug level and set it to “debug”. I would not recommend debug2 at this stage – you will get 1000 lines of information for simply starting up!

The log file is in /var/log/cups and is called error_log! Go there and note the last line number.

Go back to /etc/init.d/init.d and stop and start the daemon again to give yourself a clean start in the log.

Now try to send another testpage. Check the log and see what it says. One source of confusion is that it may fail to create content very early in the process, then spend a huge amount of effort successfully doing nothing. Don’t expect the error to be the last line in the log. Mine had an error failing to convert the file “Unable to convert file 0 to printable format for job 1!” and a hint: “Have you installed Ghostscript?” Then it produced a couple of hundred more lines of log output before announcing successful completion of the job. If you get this problem read on.

From the hints and errors I could see that I needed versions of libpng, libtiff and libjpeg libraries. I downloaded them from SuSE and used YaST to install them. I tried again but now still got the error:

“No rule for png.c”

Searching the makefile I found a hint that I may need to change source directory. Libpng.mak in /usr/local/espgs-8.1.15/src needed to be amended to tell it where SuSE had put the png library. This is what I changed it to:

You will need to find the location of your own missing libraries, if there are any missing.

My notes also say that I installed libjpeg and libtiff, unfortunately I did not write down the error that prompted this. You will need to read the results of compilation carefully because they will depend on your own setup.

Following this I ran

./make - this time without errors and then
./make install.

Step 8 - Configure for network use

My present setup works with minimal changes from the defaults in the configuration file: /etc/cup/cupsd.conf.

I set the user to lp with group sys, but no RunAsUser directive. It will run without any user set but the notes say that lp and sys are normal. If you set RunAsUser Yes you may start to get errors where the daemon cannot create the spool files, but this may be a SuSE problem.
I set

Browsing On
BrowseAddress @LOCAL
BrowseAllow All

My Location settings are:

Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 192.168.1.*
Authclass Anonymous
AuthType None

and the admin settings are:

AuthType Basic
AuthClass System
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 192.168.1.*

I need to be able to administer my machine from my network because the server has no monitor. You probably will not need the Allow From 192.168.1.*

At this point I could print locally.

Step 9 – Setting up the clients

This was pretty easy after I got CUPS working locally. My Allow From instruction above tells CUPS to allow clients on the LAN. If the network were all Linux this would probably be enough. My clients are WinXP so I needed SAMBA as well. Make sure your SAMBA is working properly before expending any effort here.

Step 10 – SAMBA settings

In SAMBA I used the SWAT tool (http://localhost:901) and selected the printers option. Tell it you are using CUPS and give it the path of your spool directory. Allow connections from your LAN. The printers section of my smb.conf file is given below and may be the easiest way.

In each WinXP client I opened the printers and faxes dialogue window and selected Add Printer. Obviously you want a Network printer. I connect using the option “Connect to a printer on the internet or on a home or office network”

My server is called “linux” so I use the address: http://linux:631/printers/Epson

You will need to use: http://yourservername:631/printers/yourprintername

You should then get a dialogue to find a suitable driver for your printer. After that tell it whether you want it as a default and you are ready to test it.

I hope this is useful, it may be too specific to my circumstances but perhaps you will get some clues.