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.

Scope and Purpose
As the description states, this tutorial deals with setting up a network printer with just linux computers. There is already plenty of information in the forums if you have a windows box. I don't have a windows box, so when I hit a snag I had a tough time finding an answer. Also, I will NOT be specifically describing how to install print drivers on the local machine--there's already plenty of documentation out there on that too, so why waste your time! I will go through the extreme basics of installing and starting the cups server. So, if you're having trouble connecting your linux box to your linux print server, this article is for you! While I am using Slackware 10.1 and KDE, these instructions should be nearly universal for any linux distro (the exception is starting and stopping the cups daemon).

Background
I have a simple home network set up with two computers and a wireless router. One computer is in my office, while my wife's is in hers. She is connected wirelessly. We both have printers but after a while, paying for two different types of ink cartridges gets to be a hassle. So I decided to turn my box into a print server, so that we could share a printer.

NOTE: From here on out, I will call the CUPS server (the computer that has the printer physically plugged into it) server and the networked computer (the computer in the other room) client.

Step 1: Make sure your printer works locally
Before trying to get a network printer to work, make sure it works locally. While not specific, here's the basics of it (if your printer already works, skip to Step 2):

Download and install cups and any other driver software that you need (for example, gimp-print). If you are using swaret, it's as simple as

Code:

root# swaret --install cups
root# swaret --install gimp-print

Once installed, you need to start the cups daemon (this command will be different if you aren't using Slackware):

Code:

root#/etc/rc.d/rc.cups start

This will start the cups server. Next, you'll need to add a printer by using the web interface. To do this, open a web browser and type in localhost:631. If your server is started, a page should load with links to various tasks. Click the first link Do Administration Tasks. A dialog will pop up asking for username and password. You need to log in as root and use your root password to access the administration menu.
Once logged in, click add printers and follow the prompts to set up your printer. When the printer is added, click on the "Configure Printer" to set page size and printing quality. Finally, click "Print Test Page". If a test page prints, you're almost ready to go on to Step 2.

You'll want to double check your network setup. It will be easier on everyone involved if your printer server has a static ip instead of dhcp. This can be done using Slackware's netconfig tool (be sure to restart inet1 to put your changes into effect--this is done by typing: /etc/rc.d/rc.inet1 restart). You may also have to adjust your router for a static ip. A quick not regarding static ip's:when you enter the gateway, enter the ip address of your router, or you won't be able to see the wonderfully wide web of the world!

Once your printer is setup and your ip is static, go on to Step 2.

Step 2: Editing cupsd.confWARNING: When editing conf files, always make a backup before making changes. That way, when it gets messed up, you have an easy fix! This is done very simply:

You can uncomment one of these lines or just add your own. It needs to look like this:

Code:

BrowseAddress 192.168.1.255

This should your broadcast for your entire network. Adjust the 255 to whatever your netmask is.

Finally look for this section of the cupsd.conf file:

Code:

<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Location>

Create a new line after Allow From 127.0.0.1 and add the ip addresses or ranges for your network. The <Location /> section should look like this when you are done(the new line is in red):

Code:

<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 192.168.1.*
</Location>

You should adjust this line according to your network address setup. For example, my network has static ips so I just added the ip address for the client, or networked computer. In networks with many more clients, this is a hassle, so doing the above is more friendly. Save the file and restart the cups server.

Code:

root#/etc/rc.d/rc/cups restart

If the server restarts, you are ready to go on to Step 3. If you get an error, make sure that you typed in all of your ip addresses correctly. I ran into trouble when I updated the listen section. It only borked it up, so unless you know what you're doing, only make the changes mentioned above.

Step 3: Setting Up the Client
Your server is ready to roll, so now it's time to set up your client machine. In order for your client to communicate with the server, the client needs to be running the cups daemon. Install cups and any other driver libraries that you needed on the server. In the above example, it was cups and gimp-print. Start cups:

Code:

root#/etc/rc.d.rc.cups start

You need to have cups running to access the network printer. You don't need to do anything with the cupsd.conf though, so once the daemon is started, move on to Step 4.

Step 4: Introducing Your Client to Your Server
Many tutorials state that you can just add a printer using the KDE control center. I tried it, and I kept getting an error that said "You don't have access." So try to add a printer and if it works, fantastic. If it doesn't or if you don't use kde, read on.

On the client, open up your web browser and access localhost:631. Login in using root and root's password. Click on manage printers. If your network printer shows up, you are done and ready to go. If it doesn't, keep going!

Click on administration and add printer (de ja vu?).
1. Fill in the name of the printer.
2. Under location, I type in the ip address of the server.
3. You can fill in a description, but you don't have to.
4. Click continue.

The next page comes up called Device with a drop down list. Select Internet Printing Protocol (ipp) and click continue.

Now you need to tell cups the network location of your print server. To do this, you will need the server's ip address, and the name of your printer as cups sees it. (For example, if you go back to the server and access the web interface, click on printers. The name is big and bold.)This is the format: ipp://server_ip_address/printer/printer_name

Change the ip address and printer name accordingly. Your entry should look like:

Code:

ipp://192.168.1.5/printer/EpsonPrinter

Click continue.

Choose the correct printer, click continue, choose the correct driver, and click continue again. Be sure to configure the printer so that the driver knows what size paper and print quality to use. Finally, click print test page.

Conclusion
For some odd reason, once I added a printer on the client, cups could then see my network printer. Now in the cups configuration screen, it shows two printers: the one I added manually and the one is sees on the server. However, in kde and openoffice.org, it only shows one printer. Bizarre, but it works.

Yep, that looks very cool: a nice succinct howto I am bound to say! But then there are the obscure hiddens and gotchas like: what do you put in the printer URI if you are using a multi-function printer e.g.: HP Officejet R45 that uses hpoj?

Also you refer to the ipp printer path as ipp://server_ip_address/printer/printer_name which unfortunately is not necessarily always the case. Is that printer singular or printers plural and does that have to match the <Location /Printers>tag in the cupsd.conf file?

I am afraid that I am defeated by it all!

Code:

Unable to connect to IPP host

by busbarn on Wed, 2005-07-20 09:22

Good question! Since I don't have a multi-function printer to test, I can offer a big I don't know. My apologies.

However, I do know that the "printer" is singular and the printer_name needs to match the cupsd.conf file on the server machine. I got most of my info from this CUPS System Amdministrator's Guide. That may give you some more info for a muliuse printer.

by username17 on Mon, 2005-07-25 14:51

Good info... but

After installing CUPS, /etc/rc.d/rc.cups is not executable by default.
One needs to "chmod +x /etc/rc.d/rc.cups" then execute it.

Once it is changed to executable, it will start at boot.
If it is not chmodded, you cannot run "/etc/rc.d/rc.cups start" like the tutorial says.
Just a FYI.

by wylie1001 on Sun, 2005-09-04 09:05

Hello all,
This is good info as in most of LQ. I have a printer it is an HP photosmart 2710 with a network connection sitting on my network with an ip of xxx.x.xx.xxx . I have spent numerous hours trying to get it to work. This printer is not connected to any computer on my network. I have cups installed nothing special there. I also removed LPRNG this program conflicts with cups. In cups set up your printer and set it to Device URI: socket://xxx.xx.x.xxx the ip of the printer also set it for the default printer and mine worked like a champ. After doing hours of reading and hunting I could not find info for stand alone printers on a network. I also used the web browser to set up the printer on cups using http://127.0.0.1:631 use your root account and password and configure the printer. Also start up /etc/rc.d/rc.cups . I wanted to share this because printers have been a real sore spot for me for the past years using Linux.
Rick

by ylikone on Wed, 2005-09-07 10:53

I have been running an HP Photosmart 8450 as a stand-alone networked printer... and having no problems printing to it with both my windows and Linux computers.

As a "for example", here are the approximate steps I took to make it work...

You should now see the cups web interface. Go to add a new printer... when you get to the Device URI field, enter the string given previously by the "hp-makeuri" command, which should look something like

hp:/net/Photosmart_8400_series?ip=192.168.0.20

Print a test page and see if it works.

by mitchell1000 on Mon, 2006-09-04 12:10

Very nice article on cups setup.

One error

the ip address of the printer is

ipp://192.168.1.55:631/printers/printer_name

notice that you need the :631 port number
as well as
printers not "printer"

with this correction, the "how to" above for cups works!

Mitchell

by tagore on Wed, 2006-09-13 06:56

This howto is great, thanks.

A usefull extension in a LAN-Enviroment could be to mail pdf-output to the user. (mutt can send multipart-mail in batchmode.)

This procedure does not work for me. When attempting to 'add printer' using localhost:631 am asked to enter User Name and Password for CUPS. Have tried Administrator(root) and password for host and user id & password for client.

Client system is Kubuntu 6.06.

by pietie on Tue, 2006-12-19 03:58

Quote:

Originally Posted by halw

This procedure does not work for me. When attempting to 'add printer' using localhost:631 am asked to enter User Name and Password for CUPS. Have tried Administrator(root) and password for host and user id & password for client.

Client system is Kubuntu 6.06.

neither for me well the root + root passwd... I am running SuSE 10.1

by busbarn on Wed, 2007-01-17 20:20

I know that Ubuntu uses users differently. It may work if you use the sudo command. Just a thought.