LinuxQuestions.org
Visit Jeremy's Blog.

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have access 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.

Are you new to LinuxQuestions.org? Visit the following links:
Site Howto | Site FAQ | Sitemap | Register Now

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.

Go Back   LinuxQuestions.org > Linux Answers > Networking
User Name
Password

By busbarn at 2005-07-02 21:42
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.conf
WARNING: 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:
Code:
root# cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.backup
Once your backup is created, open the cupsd.conf file using your favorite text editor (vi, nano, emacs, etc.):
Code:
root# nano /etc/cups/cupsd.conf
You will me making only small modifications to this file. First and foremost, look for the line that looks something like this:


Code:
#ServerName myhost.domain.com
If it isn't there, add it!
Note the #. Delete this to uncomment the line. You may either put in your hostname or the static ip address you assigned earlier. The line should look like this:
Code:
ServerName 192.168.1.5
Note: For simplicity sake, I personally chose ip address (if you couldn't already tell!). That way if I modify my hostname or anything, the ip can stay the same.

The second adjustment you will make is to the line that looks like this(once again if it isn't there, add it):
Code:
#BrowseAddress x.y.z.255
#BrowseAddress x.y.255.255
#BrowseAddress x.255.255.255
#BrowseAddress 255.255.255.255
#BrowseAddress @LOCAL
#BrowseAddress @IF(name)
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.

That's it, your finished. Congratulations and enjoy the network printer!
12 comments

read full thread



Add LQ To Your Yahoo Add LQ To Your Google Add LQ To Your MSN Add LQ To Your Blog
All times are GMT -5. The time now is 04:22 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Open Source Consulting | Domain Registration