             Universal'naya Sistema Pechati Unix na FreeBSD

  Chess Griffin

   <chess@chessgriffin.com>

   $FreeBSD: doc/ru_RU.KOI8-R/articles/cups/article.sgml,v 1.4
   2010/08/30 16:58:06 taras Exp $

   FreeBSD `eto zaregistrirovannaya torgovaya marka FreeBSD
   Foundation.

   Mnogie iz oboznachenij, ispol'zuemye proizvoditelyami i prodavcami
   dlya oboznacheniya svoih produktov, zayavlyayutsya v kachestve
   torgovyh marok. Kogda takie oboznacheniya poyavlyayutsya v `etom
   dokumente, i Proektu FreeBSD izvestno o torgovoj marke, k
   oboznacheniyu dobavlyaetsya znak ''(TM)'' ili ''(R)''.

   `Eta stat'ya posvyaschena konfigurirovaniyu Universal'noj Sistemy
   Pechati UNIX (CUPS) na FreeBSD.

     --------------------------------------------------------------

1. Znakomimsya s Universal'noj Sistemoj Pechati UNIX (CUPS)

   Universal'naya Sistema Pechati UNIX (Common Unix Printing System,
   ili sokraschenno CUPS), predostavlyaet perenosimuyu sredu pechati
   dlya UNIX(R) i UNIX-podobnyh operacionnyh sistem. Ona byla
   razrabotana kompaniej Easy Software Products, chtoby predostavit'
   standartnoe reshenie v pechati dlya vseh razrabotchikov i
   pol'zovatelej UNIX.

   Universal'naya Sistema Pechati UNIX ispol'zuet protokol
   mezhsetevoj pechati (Internet Printing Protocol, IPP) kak osnovu
   dlya upravleniya zadaniyami na pechat' i ocheredyami. Takzhe
   chastichno podderzhivayutsya sleduyuschie protokoly: LPD, SMB i
   AppSocket (takzhe izvestnyj kak JetDirect). CUPS daet vozmozhnost'
   obzora setevyh printerov i ispol'zovaniya opcij, baziruyuschihsya
   na PostSkript Opisanii Printerov (PostScript Printer Definition,
   PPD), chtoby podderzhivat' v UNIX obscheprinyatye tradicii
   pechati. V rezul'tate CUPS ideal'no podhodit dlya sovmestnogo
   ispol'zovaniya printerov v smeshannoj srede iz FreeBSD, Linux(R),
   Mac OS(R) X ili Windows(R).

   Oficial'nyj sajt Universal'noj Sistemy Pechati UNIX --
   http://www.cups.org/.

     --------------------------------------------------------------

2. Ustanovka servera pechati CUPS

   CUPS mozhet byt' ustanovlena iz portov ili uzhe sobrannyh paketov.
   CHtoby ustanovit' CUPS iz kollekcii portov, vypolnite s
   privilegiyami pol'zovatelya root sleduyuschuyu komandu:

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

   Dlya ustanovki CUPS ispol'zuya paket, zapustite na vypolnenie
   takuyu komandu:

 # pkg_add -r cups

   Drugie neobyazatel'nye, no rekomenduemye k ustanovke porty ili
   pakety `eto print/gutenprint-cups i print/hplip, kazhdyj iz
   kotoryh dobavlyaet drajvera i utility dlya raznoobraznyh
   printerov. Posle ustanovki fajly konfiguracii CUPS mogut byt'
   najdeny v direktorii /usr/local/etc/cups.

     --------------------------------------------------------------

3. Nastrojka servera pechati CUPS

   CHtoby nastroit' server CUPS neobhodimo otredaktirovat' neskol'ko
   konfiguracionnyh fajlov. Dlya nachala sozdajte ili isprav'te fajl
   /etc/devfs.rules i dobav'te sleduyuschuyu informaciyu dlya togo,
   chtoby ustanovit' sootvetstvuyuschie prava na vse potencial'nye
   fajly ustrojstv printerov i svyazat' printery s gruppoj
   pol'zovatelej cups:

 [system=10]
 add path 'unlpt*' mode 0660 group cups
 add path 'ulpt*' mode 0660 group cups
 add path 'lpt*' mode 0660 group cups
 add path 'usb/X.Y.Z' mode 0660 group cups

     Zamechanie: Zamenite X, Y i Z nomerami sootvetstvuyuschego
     printeru celevogo ustrojstva USB, otobrazhaemogo v kataloge
     /dev/usb. CHtoby najti trebuemye znacheniya, prosmotrite vyvod
     dmesg(8) i najdite svyazannoe s vashim printerom imya
     special'nogo ustrojstva ugenX.Y, poslednee budet simvolicheskoj
     ssylkoj na iskomoe ustrojstvo v kataloge /dev/usb.

   Zatem, dobav'te sleduyuschie dve zapisi v /etc/rc.conf:

 cupsd_enable="YES"
 devfs_system_ruleset="system"

   `Eti dve zapisi budut zapuskat' server pechati CUPS vo vremya
   zagruzki sistemy i primenyat' lokal'noe pravilo devfs, sozdannoe
   vyshe.

   Dlya togo, chtoby pechat' CUPS stala dostupna dlya nekotoryh
   Microsoft(R) Windows klientov, neobhodimo raskommentirovat'
   sleduyuschuyu zapis' v /usr/local/etc/cups/mime.types i
   /usr/local/etc/cups/mime.convs:

 application/octet-stream

   Po okonchaniyu vneseniya izmenenij sluzhby devfs(8) i CUPS
   neobhodimo perezapustit', dlya chego perezagruzite operacionnuyu
   sistemu ili vypolnite ot pol'zovatelya root sleduyuschie dve
   komandy:

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

     --------------------------------------------------------------

4. Nastrojka printerov na servere pechati CUPS

   Posle togo, kak sistema CUPS byla ustanovlena i skonfigurirovana,
   sistemnyj administrator mozhet nachat' konfigurirovanie lokal'nyh
   printerov, podklyuchennyh k serveru pechati CUPS. `Eta chast'
   processa ochen' pohozha, esli ne identichna nastrojke printerov
   CUPS v drugih UNIX-podobnyh operacionnyh sistemah, takih kak
   distributivy Linux.

   Osnovnym sposobom upravleniya i administrirovaniya servera CUPS
   yavlyaetsya veb-interfejs, na kotoryj mozhno popast' zapustiv
   veb-brauzer i nabrav http://localhost:631 v ego adresnoj stroke.
   Esli server CUPS nahoditsya na drugoj mashine v seti, zamenite
   localhost na IP adres servera. Veb-interfejs CUPS dostatochno
   ocheviden, tam est' razdely dlya upravleniya printerami i
   zadaniyami na pechat', avtorizaciej pol'zovatelej i t.p. Krome
   togo, v pravoj chasti stranicy administrirovaniya est' neskol'ko
   flazhkov (check-box), dayuschih udobnyj dostup k chasto menyaemym
   ustanovkam, takim kak razreshenie publichnogo dostupa k
   podklyuchennym k sisteme printeram, predostavlenie udalennogo
   upravleniya serverom CUPS, izmenenie urovnya dostupa pol'zovatelej
   k printeram i ih zadaniyam na pechat'.

   Dobavlenie printera v obschem takoe zhe prostoe, kak nazhatie
   ''Add Printer'' na stranice administrirovaniya veb-interfejsa
   servera CUPS ili kak nazhatie odnoj iz knopok ''New Printers
   Found'' na toj zhe stranice administrirovaniya. Kogda pered vami
   predstanet vypadayuschij spisok ''Device'', prosto vyberite
   trebuemyj lokal'no podklyuchennyj printer, a dal'she sledujte
   podskazkam interfejsa. V sluchae esli byli ustanovleny porty ili
   pakety print/gutenprint-cups ili print/hplip, kak ukazyvalos'
   vyshe, dopolnitel'nye drajvera pechati budut dostupny na
   posleduyuschih stranicah, chto mozhet obespechit' bol'shuyu
   nadezhnost' i rasshirennye vozmozhnosti.

     --------------------------------------------------------------

5. Konfigurirovanie klientov CUPS

   Posle togo, kak server CUPS byl nastroen, printery dobavleny i
   sdelany dostupnymi v seti, sleduyuschij shag -- `eto nastrojka
   klientov ili mashin, kotorye budut imet' dostup k serveru CUPS.
   Esli u vas edinstvennyj nastol'nyj komp'yuter, kotoryj rabotaet
   odnovremenno i serverom i klientom, to v bol'shinstve `etoj
   informacii vy ne nuzhdaetes'.

     --------------------------------------------------------------

  5.1. UNIX(R) klienty

   Na UNIX klientah takzhe potrebuetsya ustanovit' CUPS. Posle
   ustanovki sistemy pechati na kliente, CUPS-printery,
   prisutstvuyuschie v seti, chasche vsego avtomaticheski nahodyatsya
   menedzherami printerov raznyh graficheskih obolochek, takih kak
   GNOME ili KDE. V kachestve al'ternativy, vy mozhete
   vospol'zovat'sya veb-interfejsom CUPS na klientskoj mashine po
   adresu http://localhost:631 i na stranice administrirovaniya
   vybrat' ''Add Printer''. Kogda pered vami predstanet vypadayuschij
   spisok ''Device'', prosto vyberite setevoj CUPS printer, esli on
   byl obnaruzhen avtomaticheski, ili vyberite ipp ili http i vvedite
   IPP ili HTTP adres (URI) setevogo CUPS printera:

 ipp://server-name-or-ip/printers/printername

 http://server-name-or-ip:631/printers/printername

   Esli CUPS klient ne nahodit v seti printery, dostupnye cherez
   server CUPS, to inogda pomogaet sozdanie ili izmenenie fajla
   /usr/local/etc/cups/client.conf s dobavleniem edinstvennoj zapisi,
   podobnoj sleduyuschej:

 ServerName server-ip

   V `etom sluchae server-ip neobhodimo zamenit' na IP adres servera
   CUPS v seti.

     --------------------------------------------------------------

  5.2. Windows(R)-klienty

   Versii Windows, predshestvuyuschie XP, ne imeli vstroennoj
   podderzhki protokola IPP. Odnako Windows XP i bolee pozdnie versii
   uzhe obladayut takoj vozmozhnost'yu. Sledovatel'no, dobavit' CUPS
   printer v `etih versiyah Windows dovol'no prosto. V bol'shinstve
   sluchaev, administratoru Windows potrebuetsya zapustit' mastera
   ustanovki printera (Add Printer) vybrat' setevoj printer (Network
   Printer), a zatem vvesti URI sleduyuschego formata:

 http://server-name-or-ip:631/printers/printername

   Esli ispol'zuetsya versiya Windows bez podderzhki protokola IPP,
   to obschim sluchaem podklyucheniya k CUPS-printeru budet
   sovmestnoe ispol'zovanie CUPS i net/samba3. Opisanie `etoj
   vozmozhnosti vyhodit za ramki dannoj stat'i.

     --------------------------------------------------------------

6. Ustranenie nepoladok s CUPS

   Problemy c CUPS chasto voznikayut iz-za nevernyh prav dostupa.
   Snachala dvazhdy prover'te prava dostupa v devfs(8) (sver'tes' s
   uzhe opisannymi vyshe). Zatem, prover'te real'nye prava ustrojstv,
   sozdannyh v fajlovoj sisteme. Takzhe byvaet poleznym
   udostoverit'sya, chto vash pol'zovatel' vhodit v gruppu cups. Esli
   u vas skladyvaetsya vpechatlenie, chto flazhki prav dostupa na
   stranice administrirovaniya veb-interfejsa CUPS ne rabotayut, to
   inym resheniem mozhet byt' rezervnoe kopirovanie konfiguracionnogo
   fajla /usr/local/etc/cups/cupsd.conf i redaktirovanie raznyh opcij
   konfiguracii s podborom ih kombinacij. Nizhe privedeno soderzhimoe
   testovogo fajla konfiguracii /usr/local/etc/cups/cupsd.conf.
   Pozhalujsta, obratite vnimanie na to, chto bezopasnost' v `etom
   primere cupsd.conf byla pozhertvovana v ugodu prostote nastrojki;
   kak tol'ko administrator uspeshno podsoedinitsya k serveru CUPS i
   skonfiguriruet klientov, rekomenduetsya peresmotret' dannuyu
   konfiguraciyu i dobavit' razgranichenie dostupa.

 # Log general information in error_log - change "info" to "debug" for
 # troubleshooting...
 LogLevel info

 # Administrator user group...
 SystemGroup wheel

 # Listen for connections on Port 631.
 Port 631
 #Listen localhost:631
 Listen /var/run/cups.sock

 # Show shared printers on the local network.
 Browsing On
 BrowseOrder allow,deny
 #BrowseAllow @LOCAL
 BrowseAllow 192.168.1.* # change to local LAN settings
 BrowseAddress 192.168.1.* # change to local LAN settings

 # Default authentication type, when authentication is required...
 DefaultAuthType Basic
 DefaultEncryption Never # comment this line to allow encryption

 # Allow access to the server from any machine on the LAN
 <Location />
   Order allow,deny
   #Allow localhost
   Allow 192.168.1.* # change to local LAN settings
 </Location>

 # Allow access to the admin pages from any machine on the LAN
 <Location /admin>
   #Encryption Required
   Order allow,deny
   #Allow localhost
   Allow 192.168.1.* # change to local LAN settings
 </Location>

 # Allow access to configuration files from any machine on the LAN
 <Location /admin/conf>
   AuthType Basic
   Require user @SYSTEM
   Order allow,deny
   #Allow localhost
   Allow 192.168.1.* # change to local LAN settings
 </Location>

 # Set the default printer/job policies...
 <Policy default>
   # Job-related operations must be done by the owner or an adminstrator...
   <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs \
 Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription \
 Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job \
 CUPS-Move-Job>
     Require user @OWNER @SYSTEM
     Order deny,allow
   </Limit>

   # All administration operations require an adminstrator to authenticate...
   <Limit Pause-Printer Resume-Printer Set-Printer-Attributes Enable-Printer \
 Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs \
 Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer \
 Promote-Job Schedule-Job-After CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class \
 CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
     AuthType Basic
     Require user @SYSTEM
     Order deny,allow
   </Limit>

   # Only the owner or an administrator can cancel or authenticate a job...
   <Limit Cancel-Job CUPS-Authenticate-Job>
     Require user @OWNER @SYSTEM
     Order deny,allow
   </Limit>

   <Limit All>
     Order deny,allow
   </Limit>
 </Policy>

     --------------------------------------------------------------

7. Nastrojka portov ispol'zuyuschih CUPS

   Esli CUPS budet sluzhit' v kachestve osnovnoj sistemy pechati, to
   mozhno po zhelaniyu dobavit' neskol'ko zapisej v /etc/make.conf,
   kotorye vydelyat CUPS sredi drugih sistem. Vot nekotorye iz nih:

 WITH_CUPS=YES
 CUPS_OVERWRITE_BASE=YES
 WITHOUT_LPR=YES

   Pervaya peremennaya, WITH_CUPS, dobavlyaet podderzhku CUPS k
   portam, v kotoryh predusmotrena takaya vozmozhnost'. Vtoraya
   zapis', CUPS_OVERWRITE_BASE, ispravit nekotorye simvolicheskie
   ssylki i puti, kotorye inache privodili-by k sisteme pechati
   FreeBSD po umolchaniyu -- LPR. Takzhe ona predotvratit otkat `etih
   izmenenij vo vremya sleduyuschego obnovleniya sistemy posredstvom
   buildworld. Tret'ya peremennaya, WITHOUT_LPR, predotvratit
   vklyuchenie podderzhki LPR v portah, potencial'no ee
   ispol'zuyuschih.

     --------------------------------------------------------------

            `Etot, i drugie dokumenty, mogut byt' skachany s
                ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

  Po voprosam, svyazannym s FreeBSD, prochitajte dokumentaciyu prezhde
                 chem pisat' v <questions@FreeBSD.org>.
         Po voprosam, svyazannym s `etoj dokumentaciej, pishite
                           <doc@FreeBSD.org>.
  Po voprosam, svyazannym s russkim perevodom dokumentacii, pishite v
                    rassylku <frdp@FreeBSD.org.ua>.
  Informaciya po podpiske na `etu rassylku nahoditsya na sajte proekta
                               perevoda.
