pavement

CUPS

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
(KDE Setup)
 
(16 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
CUPS (Common Unix Printing System)
 
CUPS (Common Unix Printing System)
This makes it easy to add printers to your system and programs such as firefox will pick up the printer list automatically.
+
This makes it easy to add printers to your system and programs such as firefox will pick up the printer list automatically. For information about printing systems and about modern printing on CUPS, see [[Printing, about]].
  
 
==Installing CUPS==
 
==Installing CUPS==
 +
Make sure CUPS supports your printer.
 +
 +
To install:
 
  # pkg_add -r cups
 
  # pkg_add -r cups
  
Line 9: Line 12:
 
  # cd /usr/ports/print/cups
 
  # cd /usr/ports/print/cups
 
  # make install clean
 
  # make install clean
 +
 +
The CUPS daemon can now be started.
 +
 +
# export cupsd_enable="YES"
 +
# /usr/local/etc/rc.d/cupsd start
 +
 +
If you want CUPS to start at boot time, add the line ''cupsd_enable="YES"'' to /etc/rc.conf. The Cups configuration file is at ''/usr/local/etc/cups/cupsd.conf''.
 +
 +
Note that the port installed by sysinstall (for FreeBSD 6.2 at least) is cups-base and much functionality is missing so you may want to add the above port even if you installed cups when you installed FreeBSD. As well, cups-base (and perhaps cups) does not create a directory for CUPS log files. They can be very handy for debugging so create one this way:
 +
 +
# mkdir /var/log/cups
 +
 +
==Install a Parallel Printer==
 +
 +
If you use an old parallel printer then you need to do the following before you add the printer through cups:
 +
 +
# chown root:cups /dev/lpt0
 +
# chmod 0660 /dev/lpt0
 +
 +
Now add these lines to /etc/devfs.conf so that the permissions are set during boot time
 +
 +
own    /dev/lpt0    root:cups
 +
perm  /dev/lpt0    0660
 +
 +
Turn on your printer and let it boot up. You should also make sure that it is "On Line". Now go back into the cups setup http://localhost:631 and add your printer, you will notice that there is now a Parallel device present.
 +
 +
After installing a printer try printing a test page. If you are using a non-Postscript printer you may get the error:
 +
 +
Unsupported format 'application/postscript'
 +
 +
In this case, add the port cups-pstoraster or the cups meta-port.
 +
 +
# pkg_add -r cups-pstoraster
 +
 +
or
 +
 +
# pkg_add -r cups
 +
 +
Now open /usr/local/etc/cups/mime.convs in an editor as root and add or uncomment the line linking pstoraster to the mime type application/postscript.
 +
 +
application/vnd.cups-postscript application/vnd.cups-raster    100    pstoraster
 +
 +
Restart the cups daemon
 +
 +
# /usr/local/etc/rc.d/cupsd restart
 +
 +
and try to print a test page.
 +
 +
==Installing a PCL printer==
 +
 +
If you have a printer which handles PCL but not PS then you need to install the 'hpijs' port
 +
 +
# portinstall -P hpijs
 +
 +
Now you will have a huge list of HP printers to select from, if you have a basic B&W laser printer which accepts PCL then use the 'HP LaserJet 5L Foomatic/hpijs' driver and you shouldn't have a problem.
 +
 +
==Printing from Windows XP to a FreeBSD CUPs server==
 +
You don't require samba to print from an XP client through a FreeBSD CUPS server to your printer.  It's easier to do this without samba actually.  It doesn't matter if you have samba installed though.
 +
 +
Simply get your printers working under CUPs and on the local server and test these.  Then on the windows box add a new network printer and point that printer to your server by using the URL section of the wizard.
 +
 +
For example
 +
http://<server>:631/printers/<printer name>
 +
 +
Then you will be able to have full rights of that printer on each windows box.
  
 
==KDE Setup==
 
==KDE Setup==
Line 36: Line 104:
 
  # pkg_add -r cups-lpr
 
  # pkg_add -r cups-lpr
  
==CUPS Troubleshooting==
+
==Accessing and configuring==
 +
Type ''http://127.0.0.1:631/'' or ''http://localhost:631'' into your browser. Here you can configure your printers and printing status.
  
 +
==Troubleshooting==
 
===CUPS with proxy===
 
===CUPS with proxy===
 
Make sure if you run a proxy to set localhost in the exceptions of your browser.
 
Make sure if you run a proxy to set localhost in the exceptions of your browser.
Should now be able to connect to http://localhost:631
+
It should now be able to connect to http://localhost:631
  
 
===CUPS and KDE Error===
 
===CUPS and KDE Error===
Line 55: Line 125:
  
 
===CUPS and Gnome Warning===
 
===CUPS and Gnome Warning===
I've installed CUPS on a few machines and found everytime I do I cannot print though any gnome based application.  If you like to use gnome applications to print your work, don't install CUPS just use LPD.
+
In order to have CUPS work with Gnome applications and Firefox3, you will need to add 'WITH_CUPS="YES"' to your /etc/make.conf and recompile libgnomeprint and gtk20.  You can do that with the commands:
 
+
# echo 'WITH_CUPS="YES"' >> /etc/make.conf
programs which crashed right out when printing were:
+
# cd /usr/ports/print/libgnomeprint && make deinstall && make configure && make install
gedit, abiword, gnumeric, inkscape.
+
# cd /usr/ports/x11-toolkits/gtk20 && make deinstall && make configure && make install
 
+
<b>Error you will get</b>
+
<pre>
+
(gdb) run
+
Starting program: /usr/X11R6/bin/gnumeric
+
 
+
Program received signal SIGBUS, Bus error.
+
[Switching to Thread 3 (LWP 100326)]
+
0x29dfd450 in ippWriteIO (dst=0x8542000, cb=0x29dfa3bc <httpWrite>,
+
    blocking=1, parent=0x0, ipp=0x8517880) at ipp.c:1418
+
1418    ipp.c: No such file or directory.
+
        in ipp.c
+
</pre>
+
 
+
==links==
+
http://forums.bsdnexus.com/viewtopic.php?id=36
+
  
  
 
[[Category:Ports and Packages]]
 
[[Category:Ports and Packages]]
 +
[[Category:Common Tasks]]

Latest revision as of 18:31, 21 June 2021

CUPS (Common Unix Printing System) This makes it easy to add printers to your system and programs such as firefox will pick up the printer list automatically. For information about printing systems and about modern printing on CUPS, see Printing, about.

Contents

[edit] Installing CUPS

Make sure CUPS supports your printer.

To install:

# pkg_add -r cups

or

# cd /usr/ports/print/cups
# make install clean

The CUPS daemon can now be started.

# export cupsd_enable="YES"
# /usr/local/etc/rc.d/cupsd start

If you want CUPS to start at boot time, add the line cupsd_enable="YES" to /etc/rc.conf. The Cups configuration file is at /usr/local/etc/cups/cupsd.conf.

Note that the port installed by sysinstall (for FreeBSD 6.2 at least) is cups-base and much functionality is missing so you may want to add the above port even if you installed cups when you installed FreeBSD. As well, cups-base (and perhaps cups) does not create a directory for CUPS log files. They can be very handy for debugging so create one this way:

# mkdir /var/log/cups

[edit] Install a Parallel Printer

If you use an old parallel printer then you need to do the following before you add the printer through cups:

# chown root:cups /dev/lpt0
# chmod 0660 /dev/lpt0

Now add these lines to /etc/devfs.conf so that the permissions are set during boot time

own    /dev/lpt0    root:cups
perm   /dev/lpt0    0660

Turn on your printer and let it boot up. You should also make sure that it is "On Line". Now go back into the cups setup http://localhost:631 and add your printer, you will notice that there is now a Parallel device present.

After installing a printer try printing a test page. If you are using a non-Postscript printer you may get the error:

Unsupported format 'application/postscript'

In this case, add the port cups-pstoraster or the cups meta-port.

# pkg_add -r cups-pstoraster

or

# pkg_add -r cups

Now open /usr/local/etc/cups/mime.convs in an editor as root and add or uncomment the line linking pstoraster to the mime type application/postscript.

application/vnd.cups-postscript application/vnd.cups-raster     100     pstoraster

Restart the cups daemon

# /usr/local/etc/rc.d/cupsd restart

and try to print a test page.

[edit] Installing a PCL printer

If you have a printer which handles PCL but not PS then you need to install the 'hpijs' port

# portinstall -P hpijs

Now you will have a huge list of HP printers to select from, if you have a basic B&W laser printer which accepts PCL then use the 'HP LaserJet 5L Foomatic/hpijs' driver and you shouldn't have a problem.

[edit] Printing from Windows XP to a FreeBSD CUPs server

You don't require samba to print from an XP client through a FreeBSD CUPS server to your printer. It's easier to do this without samba actually. It doesn't matter if you have samba installed though.

Simply get your printers working under CUPs and on the local server and test these. Then on the windows box add a new network printer and point that printer to your server by using the URL section of the wizard.

For example

http://<server>:631/printers/<printer name>

Then you will be able to have full rights of that printer on each windows box.

[edit] KDE Setup

You can setup any non KDE applications such as Openoffice to use the KDE printer dialogue by setting up the default printer of that applications as:

kprinter -stdin


[edit] Openoffice

Change the default printer in openoffice spadmin program


[edit] xpdf

Add the following to /usr/X11R6/etc/xpdfrc config file.

psFile                  "|kprinter -stdin"

[edit] CUPS to PDF

CUPS can also be used to print directly from any program to a PDF file.

# pkg_add -r cups-pdf


[edit] CUPS mimics lpr

If you have old programs which use lpr to print then you should install CUPS-lpr

# pkg_add -r cups-lpr

[edit] Accessing and configuring

Type http://127.0.0.1:631/ or http://localhost:631 into your browser. Here you can configure your printers and printing status.

[edit] Troubleshooting

[edit] CUPS with proxy

Make sure if you run a proxy to set localhost in the exceptions of your browser. It should now be able to connect to http://localhost:631

[edit] CUPS and KDE Error

If you get an error in KDE print manager such as: cups host not found.

Then change the host from host: /var/run/cups.sock to host: localhost



[edit] CUPS and Gnome Warning

In order to have CUPS work with Gnome applications and Firefox3, you will need to add 'WITH_CUPS="YES"' to your /etc/make.conf and recompile libgnomeprint and gtk20. You can do that with the commands:

# echo 'WITH_CUPS="YES"' >> /etc/make.conf
# cd /usr/ports/print/libgnomeprint && make deinstall && make configure && make install
# cd /usr/ports/x11-toolkits/gtk20 && make deinstall && make configure && make install
Personal tools