Skip to content

Instantly share code, notes, and snippets.

@rempargo
Forked from aweijnitz/install_CUPS_all_defaults.sh
Last active December 8, 2018 15:25
Show Gist options
  • Save rempargo/fc698cadb98e8fd24dec7b2f182a6611 to your computer and use it in GitHub Desktop.
Save rempargo/fc698cadb98e8fd24dec7b2f182a6611 to your computer and use it in GitHub Desktop.
Installing CUPS printer on Debian and add PDF printer
#!/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 whcih one is teh 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/
# Make sure you have access in CUPS and add your username to the admin
sudo nano /etc/cups/cups-files.conf
# If this is a local machine (intranet), makes sure the machine is available for other computers, not just localhost.
sudo nano /etc/cups/cupsd.conf
sudo service cups restart
sudo systemctl restart cups
or
sudo /etc/init.d/cups restart
# on public available servers, make sure the `avahi-daemon` is disabled, or you will get a warning from the German Federal Office for Information Security (BSI) that your server acts as an mDNS/DNS-SD service.
# You can check this with:
systemctl is-active avahi-daemon.service
# Disable with
systemctl disable avahi-daemon.socket
systemctl disable avahi-daemon.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment