Tuesday, January 27, 2015

Solaris 11: Setup Printer server using CUPS and Windows 7 x64

Now that Solaris 11.1 now comes with cups v1.4.5 I thought I would replace our old Solaris 10 lpd server with a cups set up. The printer server is used by many clients, MacOS, Windows and Solaris. Note: Solaris SRU 11.1.8.4.0 fixed a few problems with Cups. 

Steps:
  • Create Solaris zone (printsrv)
  • Setup cups server and printers
  • Setup Windows 7 clients

     Create Solaris zone (printsrv)

    • A normal Solaris zone is required and nothing special here.
    sudo zonecfg -z printsrv export
    create -b
    set brand=solaris
    set zonepath=/zones/printsrv
    set autoboot=true
    set bootargs="-m verbose"
    set limitpriv=default,sys_time
    set ip-type=exclusive
    add anet
    set linkname=net0
    set lower-link=auto
    set allowed-address=193.60.2.46/24
    set defrouter=193.60.2.245
    set link-protection=mac-nospoof
    set configure-allowed-address=true
    set mac-address=random
    end 
    sudo zoneadm -z printsrv  install 
    sudo zoneadm -z printsrv boot
    sudo zlogin -C -e\@ printsrv

    Setup cups server and printers

    • Install cups packages
     sudo pkg install print/cups print/cups/filter/foomatic-db print/cups/filter/foomatic-db-engine print/cups/hal-cups-utils print/cups/system-config-printer
    •  Install cups libraries
    sudo pkg install library/print/cups-libs library/desktop/gtk2/gtk-backend-cups library/python-2/pycups library/python-2/pycups-26 library/python-2/pycups-27
    • Install print filters
    sudo pkg install print/filter/ghostscript print/filter/gutenprint print/filter/hplip print/lp/filter/foomatic-rip print/lp/filter/foomatic-ppds
    • Start printer services
    sudo svcadm enable cups/scheduler
    sudo svcadm enable cups/in-lpd
    sudo svcs "*cups*"
    STATE          STIME    FMRI
    online         May_24   svc:/application/cups/scheduler:default
    online         May_24   svc:/application/cups/in-lpd:default
    •  Allow remote administration of cups. Edit /etc/cups/cupsd.conf and change some of the others:
     Listen 631
    ...
     
      # Allow shared printing and remote administration...
      Order allow,deny
      Allow @LOCAL
    ...

      # Allow remote administration...
      Order allow,deny
      Allow @LOCAL
    ...

      AuthType Default
      Require user @SYSTEM
      # Allow remote access to the configuration files...
      Order allow,deny
      Allow @LOCAL
    • Restart the services and the URL should work.
     sudo svcadm restart svc:/application/cups/scheduler:default
    http://printsrv:631
    • Now you can add a printer. The GUI is straight forward so it is just a matter of finding the printer interfaces. Also, alter the some of the server administration options.
    • Here are the command line way of doing it.
    • We have a lot of HP LaserJet P4515x printer and I am using a PS PPD file that came with print/filter/hplip since I had problems with the cups (hpcups) software.
    # lpadmin -p cork -E -v socket://cork:9100 -P /usr/share/ppd/SUNWhpijs/HP/hp-laserjet_p4515x-ps.ppd.gz
    lpadmin -p cork   -L"Printer Room" -D"HP Laserjet 4515"
    lpstat -l -p cork
    printer cork is idle.  enabled since Thu Oct 17 21:36:46 2013
            Form mounted:
            Content types: any
            Printer types: unknown
            Description: HP Laserjet 4515
            Alerts: none
            Location: Printer Room
            Connection: direct
            Interface: /etc/cups/ppd/cork.ppd
            On fault: no alert
            After fault: continue
            Users allowed:
                    (all)
            Forms allowed:
                    (none)
            Banner required
            Charset sets:
                    (none)
            Default pitch:
            Default page size:
            Default port settings:
    • Add Printer options: Duplex, A4
    #  lpoptions -p cork -o PageSize=A4 -o Duplex=DuplexNoTumble -o HPOption_Duplexer=True
    • Display all possible printer options available to you. (I have highlighted the ones alter with the command above)
    lpoptions -p cork -l
    HPPrinterModel/Printer Model: *Zorro ZorroLite Toronado
    HPCollateSupported/Collation in Printer: True288 *False288
    HPOption_Tray3/Tray 3: Tray3_500 Tray3_1500 *False
    HPOption_Tray4/Tray 4: Tray4_500 Tray4_1500 *False
    HPOption_Tray5/Tray 5: Tray5_500 Tray5_1500 *False
    HPOption_Tray6/Tray 6: Tray6_500 Tray6_1500 *False
    HPOption_Duplexer/Duplex Unit: *True False
    HPOption_Disk/Printer Disk: True *False
    HPOption_Envelope_Feeder/Optional Envelope Feeder: True *False
    HPOption_MBM_Mixed/Accessory Output Bins: *Standard HP5BinMB_Mailbox HP5BinMB_Stacker HP5BinMB_Separator HP5BinMB_Collator MBMStaplerStacker MBMStacker
    HPPaperPolicy/Fit to Page: *PromptUser NearestSizeAdjust NearestSizeNoAdjust
    HPServicesWeb/Services on the Web: *SupportAndTroubleshooting ProductManuals OrderSupplies ShowMeHow
    HPServicesUtility/Device Maintenance: StatusOfMyPrinter *DeviceAndSuppliesStatus
    HPJobRetentionOption/Mode: HPJobRetentionQuickCopy HPJobRetentionProof HPJobRetentionStoreJob HPJobRetentionPersonal *HPJobRetentionOff
    HPUsePINToPrint/Use PIN to Print: *False True
    HPDuplicateJobMode/If Job Name Exists: *Unique Overwrite
    HPUserName/User Name: *FileSharingName Set
    HPJobName/Job Name: *DocName Set
    HPManualDuplexSwitch/Manual Duplex: True *False
    HPManualDuplexPrintGuide/Print Reinsertion Guide: True *False
    HPManualDuplexOrientation/Binding: *DuplexNoTumble DuplexTumble
    HPBookletFilter/Format Output As Booklet: True *False
    HPBookletBackCover/Last Page Is Back Cover: True *False
    HPBookletPageOrder/Page Order: *Normal Asian
    HPBookletScaling/Scaling: *Proportional FitPage
    HPBookletPageSize/Paper For Booklet: *Letter Legal Executive HalfLetter w612h935 A4 A5 A6 B5 w553h765 w522h737 w558h774 Postcard DoublePostcard
    OutputBin/Output Bin: *PrinterDefault Bin1 Bin2 Bin3 Bin4 Bin5
    HPStaplerOptions/Stapling Options: *None 1Angled_Max15
    HPRotate180/Rotate Page 180 deg: *False True
    MirrorPrint/Mirror Image: True *False
    MediaType/Media Type: *Unspecified Plain Light6074 Bond Recycled Card_Stock176220 Monotransparency Labels Letterhead Envelope Preprinted Prepunched Colored Rough
    HPStraightPaperPath/Use Straight Paper Path: True *False
    Duplex/2-Sided Printing: None *DuplexNoTumble DuplexTumble
    Collate/Collate: True *False
    PageSize/Page Size: Letter Legal Executive HalfLetter w612h935 *A4 A5 A6 B5 w553h765 w522h737 w558h774 Postcard DoublePostcard Env10 EnvMonarch EnvISOB5 EnvC5 EnvDL Custom.WIDTHxHEIGHT
    InputSlot/Paper Source: *Auto Tray1 Tray2 Tray3 Tray4 Tray5 Tray6 Tray1_Man EnvelopeFeeder
    Resolution/Printer Resolution: 1200x1200dpi 1200dpi *600x600dpi
    Smoothing/Resolution Enhancement: *PrinterDefault On Off
    HPEconoMode/EconoMode: *PrinterDefault True False
    HPHalftone/Levels of Gray: *PrinterDefault Enhanced Standard
    HPwmSwitch/Mode: *Off Watermark Overlay
    HPwmPages/Pages: *AllPages FirstPage
    HPwmTextMessage/Text: *Draft CompanyConfidential CompanyProprietary CompanyPrivate Confidential Copy Copyright FileCopy Final ForInternalUse Preliminary Proof ReviewCopy Sample TopSecret Urgent Set
    HPwmFontName/Font: CourierB *HelveticaB TimesB
    HPwmFontSize/Size: pt24 pt30 pt36 pt42 *pt48 pt54 pt60 pt66 pt72 pt78 pt84 pt90
    HPwmTextAngle/Angle: Deg90 Deg75 Deg60 *Deg45 Deg30 Deg15 Deg0 DegN15 DegN30 DegN45 DegN60 DegN75 DegN90
    HPwmTextStyle/Style: Thin *Medium Thick Halo Fill
    HPwmBrightness/Intensity: Darkest Darker Dark MediumDark *Medium MediumLight Light Lighter Lightest
    • Test that your printer works.
    • If all OK now you want to setup your Windows Clients

     

    Setup Windows 7 clients

    I had a lot of problems with Windows 7 x64 and printers drivers, but I got it to all work with using the CUPS driver above and the "HP Universal Driver PS"
    •  Install the "HP Universal Driver PS" drive
    C:\Temp\HPPSdrivers\Install.exe /dm /q
    •  Create printer cork which connects via out printer on the server
    C:\Windows\SysWOW64\Rundll32.exe printui.dll,PrintUIEntry  /ga /x /n "cork"  /if /r "http://printsrv:631/printers/cork" /m "HP Universal Printing PS" /h x64 /b "cork"
    •   After you have set any default options using the Printer Wizard on Windows 7 i.e. Duplex, Location and other features you can save it for future deployment.
    C:\Windows\SysWOW64\Rundll32.exe printui.dll,PrintUIEntry /Ss /n "cork" /a "C:\Temp\setcork.dat"
    •   You can then use the following command to deploy your Windows 7 options to other PCs
    C:\Windows\SysWOW64\Rundll32.exe printui.dll,PrintUIEntry /Sr /n "cork" /a "C:\Temp\setcork.dat" d u g 2

     That it! Hope it helps.

    No comments:

    Post a Comment