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 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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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).
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
Once installed, you need to start the cups daemon (this command will be different if you aren't using Slackware):
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:
You can uncomment one of these lines or just add your own. It needs to look like this:
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:
Deny From All
Allow From 127.0.0.1
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):
Deny From All
Allow From 127.0.0.1
Allow From 192.168.1.*
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.
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:
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:
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.
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!