How to install cups printer server on ubuntu - remote server

  • Posted on: 29 January 2018
  • By: jmu

This blog is about how to install Common UNIX Printing System (CUPS) on AWS remote server Ubuntu 14.04. At the end of this blog, I will point out some solutions about how to solve ERR_CONNECTION_TIMED_OUT & "bad request" error. 


sudo apt update
sudo apt install cups


For troubleshooting purposes, you can access CUPS server errors via the error log file at: /var/log/cups/error_log. Find LogLevel warn to LogLevel debug for troubleshooting in /etc/cups/cupsd.conf file.

sudo cat /var/log/cups/error_log



sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.original
sudo chmod a-w /etc/cups/cupsd.conf.original


You will need to setup the hostname you like to use. (You can find more description from the official installing instruction.) Here is an example:

Listen           # existing loopback Listen
Listen /var/run/cups/cups.sock # existing socket Listen


I would like to reprint my document if the printer was shut down. Therefore, I set some retry configuration. In case you need the same function, I will list my major configuration below. DefaultEncryption Never is for disable the security requirement (be careful to use this). If you would like to use the webpage to manage your CUPS, please make sure allow the right person to access the interface. Here, I just simply allow all. You can always only allow the people from localhost or any specific IP address. 

DefaultEncryption Never
# Show troubleshooting information in error_log.
LogLevel debug
MaxLogSize 0
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
Browsing Off
BrowseLocalProtocols dnssd
DefaultAuthType Basic
WebInterface Yes
JobRetryInterval 2m
JobRetryLimit 250
PreserveJobHistory 1w
ServerAlias *

# Sample configuration file for the CUPS scheduler.  See "man cupsd.conf" for a
# complete description of this file.

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

# Deactivate CUPS' internal logrotating, as we provide a better one, especially
# LogLevel debug2 gets usable now
#MaxLogSize 0

# Only listen for connections from the local machine.
#Listen localhost:631
#Listen /var/run/cups/cups.sock

# Show shared printers on the local network.
#Browsing Off
#BrowseLocalProtocols dnssd

# Default authentication type, when authentication is required...
#DefaultAuthType Basic # Web interface setting...
#WebInterface Yes 

# Restrict access to the server...
<Location />
  Order allow,deny
  Allow all

# Restrict access to the admin pages...
<Location /admin>
  Order allow,deny
  Allow all

# Restrict access to configuration files...
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow all


Don't forget to restart your cup server.

sudo service cups restart




Solution: If you are an AWS user and got this error, please check your security group to see if you set Inbound for 631 port. I spent a lot of time to find the solution. Hope can save your time~

2. bad request Error

Solution: Add ServerAlias * in your /etc/cups/cupsd.conf file.

REFERENCES: OFFICIAL install instruction(


Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Enter the characters shown in the image.