Difference between revisions of "CUPS (Polski)"

From ArchWiki
Jump to navigation Jump to search
(use i18n template)
(Blanked the page)
Line 1: Line 1:
[[Category:Printers Polski)]]
 
[[Category:HOWTOs (Polski)]]
 
{{i18n|CUPS}}
 
  
'''artykuł w trakcie tłumaczenia'''
 
 
=Wstęp=
 
 
==Czym jest CUPS?==
 
 
Prosto ze strony CUPS: "The Common UNIX Printing System ("CUPS") - {Powszechny UNIXowy System Drukowania}  jest wieloplatformowym sposobem drukowania dla wszystkich UNIX'ych środowisk. Opiera się głównie na "Internet Printing Protocol"- {Internetowym Protokole Drukowania} i dostarcza kompletne usługi drukowania do większości Postscriptowych i rastrowych drukarek. CUPS jest dostarczany pod licencją GNU GPL..."  Pomimo tego, że są również inne systemy drukowania takie jak LPRNG, CUPS jest całkiem popularny i stosunkowo łatwy do użycia.  Jest to domyślny system drukowania dla Arch Linux zarówno jak dla wielu innych dystrybucji Linuksa.
 
 
==Rozwiązywanie problemów z CUPS i komponentami==
 
 
Najlepszym sposobem aby drukowanie działało jest ustawienie 'LogLevel' w '/etc/cups/cupsd.conf' na:
 
<pre>
 
LogLevel debug2
 
</pre>
 
A następnie obejrzenie pliku '/var/log/cups/error_log' przez wydanie polecenia:
 
<pre>
 
tail -n 100 -f /var/log/cups/error_log
 
</pre>
 
Znaki znajdujące się po lewej stronie kodu wyjściowego oznaczają:
 
<pre>
 
D = Debug {Odpluskwianie}
 
E = Error {Błąd}
 
I = Information {Informacja}
 
etc...
 
</pre>
 
Te pliki również mogą okazać się użyteczne.
 
<pre>
 
/var/log/cups/page_log 'dodaje nowy wpis za każdym razem gdy drukowanie się powiedzie.'
 
/var/log/cups/access_log 'lists all cupsd http1.1 server activity'
 
</pre>
 
 
Oczywiście ważne jest aby wiedzieć jak działa CUPS jeśli chcesz rozwiązać jakiś problem:
 
 
# Program wysyła plik .ps (PostScript, język skryptowy opisujący wygląd strony) do CUPS gdy wybierzesz 'drukuj' (99% procent aplikacji tak robi).
 
# CUPS sprawdza wtedy plik PPD (plik opisujący drukarkę) i dobiera odpowiednie filtry aby przekonwertować plik .ps na język zrozumiały dla drukarki (jak PJL,PCL). Zazwyczaj potrzebuje ghostscript.
 
# GhostScript odbiera wynik i ustawia filtry na te, które powinny być użyte, następnie konwertuje plik .ps do formatu zrozumianego przez drukarkę.
 
# Potem odsyłany jest do backenda. Na przykład, jeśli masz drukarkę połączoną przez port USB, używa USB jako backend.
 
 
Wydrukuj dokument i sprawdź 'error_log' aby poznać więcej informacji i poprawić proces drukowania.
 
 
=Instalowanie CUPS=
 
 
==Paczki==
 
 
Będziesz potrzebować CUPS i Ghostscript dla pewności:
 
# pacman -S cups ghostscript
 
 
* <b>cups</b> - aktualna wersja CUPS
 
* <b>ghostscript</b> - Interpreter dla języka Postscript
 
 
 
Pewne przydatne paczki, w zależności od posiadanej drukarki. Jeśli nei jesteś pewny, zainstaluj gutenprint.
 
 
* <b>gutenprint</b> - Kolekcja wysokiej jakości sterowników dla drukarek: Canon, Epson, Lexmark, Sony, Olympus, and PCL printers używanych z Ghostscript, CUPS, Foomatic, i Gimp.
 
* <b>foomatic</b>, <b>foomatic-db</b>, <b>foomatic-db-engine</b>, <b>foomatic-db-ppd</b> and <b>foomatic-filters</b> - Foomatic is a database-driven system for integrating free software printer drivers with common spoolers under Unix
 
* Installing <b>foomatic-filters</b> should solve your problems if the cups error.log is reporting "stopped with status 22!"
 
* <b>hplip</b> - HP Linux inkjet driver. Provides support for DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet printer models.
 
* <b>cups-pdf</b> - A nice package that allows one to setup a virtual PDF Printer that generates a PDF out of anything sent to it.
 
 
 
If your system is connected to a networked printer using the samba protocol or if the system is to be a print server for Windows clients:
 
# pacman -S samba
 
 
==Ściągnij PPD dla swojej drukarki==
 
Zależnie od drukarki jakiej posiadasz, ten krok jest opcjonalny i najprawdopodobniej zbędny ponieważ standardowa instalacja CUPS zawiera całkiem sporo PPD (Postscript Printer Description). Również paczki ''foomatic-filters'', ''gimp-print'' i ''hplip'' zawierają PPD, które zostaną automatycznie wykryte przez CUPS.
 
 
Dla każdej drukarki PostScripowej producent dostarcza plik PPD, który zawiera wszystkie informacje o tym szczególnym modelu drukarki.
 
 
Aby pobrać plik PPD dla swojej drukarki należy udać się na stronę [http://www.linuxprinting.org/printer_list.cgi OpenPrinting database], wybrać producenta i model posiadanej drukarki. Teraz trzeba skopiować pobrany plik PPD do folderu <code>/usr/share/cups/model/</code>.
 
 
Jeżeli nie możesz znaleźć swojej drukarki na stronie, możesz spróbować z podobnym modelem lub standardowym sterownikiem.
 
 
=Configuring Cups=
 
 
==Options==
 
 
Now that you have cups installed, you have a variety of options on how to setup CUPS.  You can always use the tried and true command line.  Likewise, various desktop environments such as Gnome and KDE have useful programs that can help you manage your printers.  However, in order to make this process easy for the largest amount of users, we will use the web interface provided by CUPS.
 
 
Please note that if you are planning on connecting to a network printer, rather than one that is directly connected to your computer, you may wish to jump to the Printer Sharing section first.  Linux to Linux printer sharing is quite easy and involves very little configuration.  Windows to Linux and vice-versa requires a little bit more effort, but is relatively easy as well.
 
 
==Kernel Modules==
 
 
Before we can use the CUPS web interface, we must install the appropriate kernel modules. The following are steps that I got from the Gentoo Printing Guide.
 
===USB printers===
 
If you want to use a USB printer with a 2.6.x kernel, use the following command:
 
 
<pre>
 
# modprobe usblp
 
</pre>
 
 
If you are using a USB printer and a 2.4.x kernel, use the following command:
 
 
<pre>
 
# modprobe printer
 
</pre>
 
 
Note, this assumes that you are using the stock kernels from Arch Linux.  If you custom-rolled your own, you may need to run this first:
 
 
<pre>
 
# modprobe usbcore
 
</pre>
 
 
Once you have the modules installed, you should plug in your printer and check if the kernel detected it by running the following:
 
 
<pre>
 
# tail /var/log/messages.log
 
</pre>
 
 
or
 
 
<pre>
 
# dmesg
 
</pre>
 
 
 
You should see something like this:
 
 
<pre>
 
Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional
 
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E
 
Feb 19 20:17:11 kernel: usb.c: usblp driver claimed interface cfef3920
 
Feb 19 20:17:11 kernel: printer.c: v0.13: USB Printer Device Class driver
 
</pre>
 
 
===Parallel port printers===
 
If you plan on using a parallel port printer, the configuration is pretty much the same.  Kernel 2.6.x users have to first type in:
 
 
<pre>
 
# modprobe lp
 
</pre>
 
 
And then both 2.4.x and 2.6.x kernel users can enter in:
 
 
<pre>
 
# modprobe parport
 
# modprobe parport_pc
 
</pre>
 
 
Once again, you can check your setup by running:
 
# tail /var/log/messages.log
 
You should see something like this:
 
 
<pre>
 
# lp0: using parport0 (polling).
 
</pre>
 
 
 
Note: Installing my Brother HL 1250 i found that permissions for the device don't let cups to write on the device, so pratically it doesn't print. To fix it:
 
 
<pre>
 
[root@mihal usb]# cd /dev/usb/
 
[root@mihal usb]# ls
 
lp0
 
[root@mihal usb]# chgrp lp lp0
 
 
</pre>
 
 
===Auto-loading===
 
You may also want to have the system automatically load the kernel module every time the computer starts up.  To do this use your favorite text editor to open up <code>/etc/rc.conf</code>  and add the appropriate module to the <i>MODULES=()</i> line.  Here's a portion of the text from my <code>rc.conf</code> file:
 
 
<pre>
 
MODULES=(!usbserial scsi_mod sd_mod snd-ymfpci snd-pcm-oss lp parport parport_pc ide-scsi)
 
</pre>
 
 
==CUPS Daemon==
 
 
With the kernel modules installed, you are now ready to start the actual CUPS daemon.  To do this, simply run this command:
 
 
<pre>
 
# /etc/rc.d/cups start
 
</pre>
 
 
If you want to have cups start up automatically every time you start your computer, than you need to add it to your DAEMONS=() line in the <i>/etc/rc.conf</i> file.  For example:
 
 
<pre>
 
# DAEMONS=(pcmcia syslogd klogd !fam esd mono network autofs cups crond gdm)
 
</pre>
 
 
==Web Interface and tool kit.==
 
 
Once the daemon is running, if a web interface is available.  Open up your browser and go to:
 
 
<i>http://localhost:631</i>
 
 
or install "Gnome Cups Manager" GUI frontend (see Appendix: A.1 [http://wiki.archlinux.org/index.php/CUPS#Alternative_CUPS_Interfaces Alternative CUPS Interfaces])
 
 
From here, all you have to do is follow the various wizards to add your printer.  To setup my Samsung ML-1250 printer, I started out by click on <i>Manage Printers</i>, and then <i>Add Printer</i>.  I was then prompted for a username and password.  I just logged in as root.  I entered in ml1250 for my printer name, My Room for location and then Peter's Samsung ML-1250 Laster Printer for description.  Next you will select the device.  Since my printer is a USB device, I just selected <i>USB Printer #1</i>.  The name of my printer also showed up next to the label <i>USB Printer #1</i>, so look for that.  Next, I simply chose the appropriate drivers and the installation was complete.
 
 
Once the installation is complete, you can test your configuration by pressing the Print Test Page button.
 
 
=Printer Sharing=
 
 
==Linux to Linux==
 
 
Udostępnianie drukarki w sieci pomiędzy dwoma systemami Linux jest dość prostą czynnością. Istnieje kilka możliwości konfiguracji tutaj zajmiemy się konfiguracją ręczną. Na komputerze który stanowi serwer (ten który zarządza i ma bezpośrednie połączenie z drukarką) musimy wy edytować plik <i>/etc/cups/cupsd.conf</i> i dopisać w linii <i>Allow From</i> adresy IP komputerów, które będą miały pozwolenie na korzystanie z drukarki. Na przykład:
 
 
<pre>
 
<Location />
 
  Order Deny,Allow
 
  Deny From All
 
  Allow From 127.0.0.1
 
  Allow From 10.0.0.*
 
</Location>
 
</pre>
 
 
You will also need to make sure the server is listening on the IP address your client will be addressing.  Add the following line after "Listen localhost:631":
 
 
<pre>
 
Listen 10.0.0.1:631
 
</pre>
 
 
using your server's IP address instead of 10.0.0.1.
 
 
Add the IP address of the client computer by doing Allow From client_ip_address.  After you make your modifications, you will want to restart CUPS by doing:
 
 
<pre>
 
# /etc/rc.d/cups restart
 
</pre>
 
 
On the client side, open up <i>/etc/cups/client.conf</i> and edit the ServerName option to match the ip address or the name of your server.  For instance I named my server beast and have entry in my hosts file to point to it.  So in my <i>client.conf</i> file, I just editted this line:
 
 
<pre>
 
ServerName beast
 
</pre>
 
 
Next, run the following command to update the client computer:
 
 
<pre>
 
# lpq
 
</pre>
 
 
You should see something like this:
 
 
<pre>
 
ml1250 is ready
 
no entries
 
</pre>
 
 
There are more configuartion possibilities including an automatic configuration which are described in detail on http://localhost:631/sam.html#CLIENT_SETUP (this link works on your printer server).
 
 
when prompted for username and password use root to access
 
then follow the instructions from here
 
http://www.digitalhermit.com/linux/printing/
 
if its a TCP/IP printer use Jetdirect
 
 
That's it for Linux to Linux printer sharing.
 
 
==Linux to Windows==
 
 
If you are connected to a Windows print server (or any other Samba capable print server), you can skip the section about kernel modules and such.  All you have to do is start the CUPS daemon and complete the web interface as specified in section 3.3 and 3.4.  Before this, you need to activate the Samba CUPS backend.  You can do this by entering the following command:
 
 
<pre>
 
# ln -s `which smbspool` /usr/lib/cups/backend/smb
 
</pre>
 
 
Note that the symbol before is ` (underneath the ~ on a standard US keyboard) and not '.  After this, you will have to restart CUPS using the command specified in the previous section.  Next, simply login into the CUPS web interface and choose to add a new printer.  For device, there should be an option that says something to the effect Windows Printer Via Samba near the button of the device list.  For the device location enter:
 
 
<pre>
 
smb://username:password@hostname/printer_name
 
</pre>
 
 
Or without a password:
 
 
<pre>
 
smb://username@hostname/printer_name
 
</pre>
 
 
Make sure that the user actually has access to the printer on Windows computer.  Select the appropriate drivers and that's about it. If the computer is located on a domain, make sure the username includes the domain:
 
smb://username:password@domain/hostname/printer_name
 
 
Note: if your network contains many printers use "lpoptions -d your_desired_default_printer_name" to set your preferred printer
 
 
Note: I, thepizzaking, was having 'NT_STATUS_ACCESS_DENIED' errors and to fix them I needed to use a slightly different syntax:
 
<pre>
 
smb://workgroup/username:password@hostname/printer_name
 
</pre>
 
 
==Windows to Linux==
 
 
Sometimes, you might want to allow a Windows computer to connect to your computer.  There are a few ways to do this, and the one I am most familiar with is using Samba.  In order to do this, you will have to edit your <i>/etc/samba/smb.conf</i> file to allow access to your printers.  Your smb.conf can look something like this:
 
 
<pre>
 
[global]
 
workgroup = Heroes
 
server string = Arch Linux Print Server
 
security = user
 
 
[printers]
 
    comment = All Printers
 
    path = /var/spool/samba
 
    browseable = yes
 
    # to allow user 'guest account' to print.
 
    guest ok = no
 
    writable = no
 
    printable = yes
 
    create mode = 0700
 
    write list = @adm root neocephas
 
</pre>
 
 
That should be enough to share your printer, but you just might want to add an individual printer entry:
 
 
<pre>
 
[ML1250]
 
    comment = Samsung ML-1250 Laser Printer
 
    printer=ml1250
 
    path = /var/spool/samba
 
    printing = cups
 
    printable = yes
 
    printer admin = @admin root neocephas
 
    user client driver = yes
 
    # to allow user 'guest account' to print.
 
    guest ok = no
 
    writable = no
 
    write list = @adm root neocephas
 
    valid users = @adm root neocephas
 
</pre>
 
 
Please note that in my configuration I made it so that users must have a valid account to access the printer.  To have a public printer, set guest ok to yes, and remove the valid users line.  To add accounts, you must setup a regular Linux account and then setup a Samba password on the server.  For instance:
 
 
<pre>
 
# useradd neocephas
 
# smbpasswd -a neocephas
 
</pre>
 
 
After setting up any user accounts that you need, you will also need to set up the samba spool folder:
 
 
<pre>
 
# mkdir /var/spool/samba
 
# chmod 777 /var/spool/samba
 
</pre>
 
 
The next items that need changing are /etc/cups/mime.convs and /etc/cups/mime.types:
 
 
mime.convs:
 
<pre>
 
# The following line is found at near the end of the file. Uncomment it.
 
application/octet-stream        application/vnd.cups-raw        0      -
 
</pre>
 
 
mime.types:
 
<pre>
 
# Again near the end of the file.
 
application/octet-stream
 
</pre>
 
 
The changes to mime.convs and mime.types are needed to make CUPS print Microsoft Office document files. Many people seem to need that.
 
 
After this restart your Samba daemon:
 
 
<pre>
 
# /etc/rc.d/samba restart
 
</pre>
 
 
Obvious, there are a lot of tweaks and customization that can be done with setting up a Samba print server, so I advise you to look at the Samba and CUPS documentation for more help.  The <i>smb.conf.example</i> file also has some good samples to that you might want to look at.
 
 
==Windows 2000 and Windows XP to Linux==
 
 
For the most modern flavours of Windows an alternative way of connecting to your Linux printer server is to use the CUPS protocol directly.  The Windows client will need to be using Windows 2000 or Windows XP.  Make sure you allows the clients to access the print server by editing the location settings as specified in section 4.1.
 
 
On the Windows computer, go to the printer control panel and choose to Add a New Printer.  Next, choose to give an url.  For the url type in the location of your printer:
 
 
<i>http://host_ip_address:631/printers/printer_name</i>
 
 
where host_ip_address is the Linux server's IP address and printer_name is the name of the printer you are connecting to.  After this, install the printer drivers for the Windows computer.  If you setup the CUPS server to use its own printer drivers, then you can just select a generic postscript printer for the Windows client.  You can then test your print setup by printing a test page.
 
 
==Others to Linux, Linux to others==
 
 
More information on interfacing CUPS with other printing systems can be found in the CUPS manual, e.g. on http://localhost:631/sam.html#PRINTING_OTHER
 
 
=Appendix=
 
 
==Alternative CUPS Interfaces==
 
 
If you are a GNOME user, you can manage and configure your printer by using the gnome-cups-manager.
 
 
Update: this package is now available through pacman if you have the "community" repository uncommented in /etc/pacman.conf
 
 
pacman -S gnome-cups-manager
 
 
The package is also still available from the [http://aur.archlinux.org/packages.php?do_Details=1&ID=66&O=0&L=0&C=0&K=cups&SB=&SO=&PP=25&do_MyPackages=0&do_Orphans=0&SeB=nd AUR].
 
 
KDE users can modify their printers from the Control Center.  Both should refer the those desktop environments' documentation for more information on how to use the interfaces.
 
 
There is also gtklp. It is in the "extra" repository.
 
 
pacman -S gtklp
 
 
==PDF Virtual Printer==
 
 
A nice little package that I submitted to the incoming folder (ftp://ftp.archlinux.org/incoming) is CUPS-PDF.  This package allows one to setup a virtual printer that will generate a PDF from anything sent to it.  For example, I wrote this document in AbiWord and then printed it to the Virtual Printer which generated a pdf in my <i>/var/spool/cups-pdf/neocephas</i> folder.  Obviously, this package is not necessary, but it can be quite useful.  After downloading the package from the ftp server and installing it, you can set it up as you would for any other printer in the web interface.  Select Virtual PDF Printer as the device and choose Postscript -> Postscript Color Printer for the drivers.
 
 
==Online Resources==
 
 
Here is a listing of websites that may be of use to you:
 
 
* <b>Official CUPS documentation on your computer</b> http://localhost:631/documentation.html
 
* <b>Official CUPS Website</b> - http://www.cups.org/
 
* <b>Linux Printing</b> - http://www.linuxprinting.org/
 
* <b>Tips and Suggestions on common CUPS problems</b> - http://home.nyc.rr.com/computertaijutsu/cups.html
 
* <b>Gentoo's Printing Guide</b> - http://www.gentoo.org/doc/en/printing-howto.xml
 
* <b>Arch Linux User Forums</b> - http://bbs.archlinux.org/
 
 
==Specialized Cases==
 
 
This section is dedicated to specific problems and their solutions. If you managed to get some <i>unusual</i> printer working, please put the solution here.
 
 
===Printing does not work/aborts with the HP Deskjet 700 Series Printers.===
 
 
*The solution is to install <b>pnm2ppa</b> printer filter for the HP Deskjet 700 series. Without this the print jobs will be aborted by the system.  A [[ABS - The Arch Build System | PKGBUILD]] for pnm2ppa can be found in [http://aur.archlinux.org/packages.php?do_Details=1&ID=696&O=0&L=0&C=0&K=pnm&SB=n&SO=a&PP=25&do_MyPackages=0&do_Orphans=0 AUR].
 
 
===Getting HP LaserJet 1010 to work===
 
I had to compile ghostscript myself because ESP gs in rep was 7.07 and had not fixed some bugs like ESP 8.15.1 had. I never downloaded 'foomatic' in rep. I think that is an old package.
 
 
kris|~/temp$ P -Qs cups a2ps psutils foo ghost
 
local/cups 1.1.23-3
 
    The CUPS Printing System
 
local/a2ps 4.13b-3
 
    a2ps is an Any to PostScript filter
 
local/psutils p17-3
 
    A set of postscript utilities.
 
local/foomatic-db 3.0.2-1
 
    Foomatic is a system for using free software printer drivers with common
 
    spoolers on Unix
 
local/foomatic-db-engine 3.0.2-1
 
    Foomatic is a system for using free software printer drivers with common
 
    spoolers on Unix
 
local/foomatic-db-ppd 3.0.2-1
 
    Foomatic is a system for using free software printer drivers with common
 
    spoolers on Unix
 
local/foomatic-filters 3.0.2-1
 
    Foomatic is a system for using free software printer drivers with common
 
    spoolers on Unix
 
local/espgs 8.15.1-1
 
    ESP Ghostscript
 
 
I also had to set LogLevel in /etc/cups/cupsd.conf to debug2 before i saw that I missed some "Nimbus" fonts. Then I had to rename & put them where the log told me to. Some fancy google searching had to be applied, example: http://www.google.com/search?q=n019003l+filetype%3Apfb since the fonts turned out to be propriatory(i'm sure windows comes with these default). Nevertheless after downloading them(about 7 fonts) and putting them in the correct folder printing started working.
 
 
Before that i were getting all the errors said here: http://linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_1010 'Unsupport PCL' etc...
 
 
I'm sure it could have worked with ESP gs 7.07 too(in rep) if i was smart enough to turn on DebugLevel2 sooner :/ UPDATE: yeah it did... maybe this info is useful for someone else though.. sorry for the inconvienice
 
 
===Getting HP LaserJet 1020 to work===
 
After a lot of tries with hplib and gutenprint I finally found the solution to get my printer HP Laserjet 1020 printing.
 
 
First of all you only need to install cups and ghostscript. Then follow the link on http://www.linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_1020 to the http://foo2zjs.rkkda.com/ printer driver page and follow the install instructions. Log in as root. After you downloaded the package and extracted the archive, change into the foo2zjs directory. Now you can follow the original installation instructions with a minor modification to change the userid for printing:<br />
 
 
$ make
 
$ ./getweb 1020
 
 
Open the ''Makeinstall''
 
$ nano Makeinstall
 
and search for the line
 
# LPuid=-olp
 
and modify it to
 
# LPuid=-oroot
 
then continue with the script
 
$ make install
 
$ make install-hotplug
 
$ make cups
 
 
As a last step add and configure the printer in the CUPS manager. The printer should be recognized automatically. It works fine for root and all users. When booting the operating system, the printer is initialized and indicates its working.
 
 
==Another Source for Printer Drivers==
 
 
On <i>http://www.turboprint.de/english.html</i> is a really good printer driver for many printers not yet supported by Linux (especially Canon i*). The only problem is that high-quality-prints are either marked with a turboprint-logo or you have to pay for it... It's not Open-Source.
 
 
{{Wikipedia|Common_Unix_Printing_System}}
 
 
=Troubleshooting=
 
==As a result of upgrade==
 
 
After updating, if you get something like :
 
  /usr/sbin/cupsd: error while loading shared libraries: libgnutls.so.13: cannot open shared object file: No such file or directory
 
 
You need to update gnutls:
 
 
  pacman -S gnutls
 
 
In addition, in /etc/cups, there will be a file named cupsd.conf.pacnew.  Rename it cupsd.conf.
 

Revision as of 06:00, 13 July 2010