J2Ji0

## minor fix for BOX9 aka "debian-32GB-J2C.7z"

  systemctl status isc-dhcp-server
  systemctl enable isc-dhcp-server
  systemctl start isc-dhcp-server
  apt update
  apt upgrade
  dpkg-reconfigure keyboard-configuration
  cat /etc/default/keyboard
  apt clean
  dd if=/dev/zero of=biig
  rm biig

## CUPS (local)

  https://gist.github.com/aweijnitz/c9ac7a18880225f12bf0
  
Represented as script

file install_CUPS_all_defaults.sh

  #!/bin/bash

  sudo apt-get -y install cups
  sudo apt-get -y install cups-pdf

  # add pdf printer to cups 
  #   - named files end up in ~/PDF/
  #   - unnamed files are stored in /var/spool/cups-pdf/ANONYMOUS/, 
  #     such as PDF:s created by streaming bytes over an API
   
  sudo lpadmin -p cups-pdf -v cups-pdf:/ -E -P /usr/share/ppd/cups-pdf/CUPS-PDF.ppd

  # Check success

  lpstat -t

  # List printers and which one is the default printer

  lpstat -p -d

  # Print file to named printer (check in ~/PDF for testfile.pdf)

  lp -d PDF testfile.txt

  # Docs
  # Intro/basics: http://www.linuxjournal.com/article/8618

  # Conf tips
  # http://www.debianadmin.com/setup-cups-common-unix-printing-system-server-and-client-in-debian.html

  # Add a printer on the command line -- cups-pdf example
  # http://blog.nguyenvq.com/blog/2011/05/12/cups-pdf-example/

EOF


## CUPS::Remote

Server

1. Add printer

  # lpadmin -p cups-pdf -v cups-pdf:/ -E -P /usr/share/ppd/cups-pdf/CUPS-PDF.ppd
  
2. add user virtu to lpadmin group (BOX9) with:

  # adduser virtu lpadmin
  
3. Add rule to firewall (BOX9, if any)

  # apt-get install iptables-persistent

  # iptables -A INPUT -p udp -m udp --dport 631 -j ACCEPT
  # iptables -A INPUT -p tcp -m tcp --dport 631 -j ACCEPT

  # service netfilter-persistent save
  # service netfilter-persistent reload

4. edit /etc/cups/cupsd.conf

  ..
  # Only listen for connections from the local machine.
  # Listen localhost:631
  #CHANGED TO LISTEN TO LOCAL LAN
  Port 631
  # Restrict access to the server...
  ..
  # Restrict access to the server...
  <Location />
    Order allow,deny
    Allow 10.0.10.*
  </Location>

  # Restrict access to the admin pages...
  <Location /admin>
    Order allow,deny
    Allow 10.0.10.*
  </Location>
  
5. Restart cups daemon.


Client

1. Install cups on client

  # apt-get install cups

2. On client, it's recommended to create file /etc/cups/client.conf

    ServerName 10.0.10.1
    Encryption IfRequested
    User virtu

3. Restart cups daemon.

4. Go to localhost:631 and add network printer, test printing with FireFox,
   transport back generated PDF file with scp.

 
# HELPFUL LINKS:

1. http://blog.pi3g.com/2013/08/using-the-raspberry-pi-as-cups-
     print-server-for-windows-and-apple-mac-airprint/
     
2. http://wiki.linuxquestions.org/wiki/Cups

