elog2labfolder/_build/html/_sources/installation_cups.rst.txt
author weiher
Tue, 27 Mar 2018 16:07:14 +0200
changeset 15 523ca1dfd077
child 18 57431f642e82
permissions -rw-r--r--
added new chapter on installation of CUPS printers
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
     1
Printing via CUPS and attaching files to labfolder logbooks
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
     2
===========================================================
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
     3
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
     4
Follow this guide to set up CUPS virtual printers to be able to print webpages and pictures/files (PDF, PNG, JPG, PS) to one of labfolder's logbooks, thus, creating a new entry with an attachment. If you are an admin of the labfolder VM read the section :ref:`section_cups_admin`. Users of labfolder read the section :ref:`section_cups_user`.
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
     5
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
     6
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
     7
.. _section_cups_admin:
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
     8
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
     9
Set up CUPS as labfolder admin
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    10
------------------------------
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    11
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    12
First, you need to install CUPS on the virtual machine that runs labfolder::
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    13
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    14
	sudo apt-get install cups cups-client cups-bsd
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    16
Next, configure ``/etc/cups/cupsd.conf``::
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    17
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    18
	# Sample configuration file for the CUPS scheduler.  See "man cupsd.conf" for a
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    19
	# complete description of this file.
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    20
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    21
	# Log general information in error_log - change "warn" to "debug"
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    22
	# for troubleshooting...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    23
	LogLevel debug
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    24
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    25
	# Deactivate CUPS' internal logrotating, as we provide a better one, especially
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    26
	# LogLevel debug2 gets usable now
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    27
	MaxLogSize 0
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    28
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    29
	# Administrator user group...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    30
	SystemGroup lpadmin
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    31
	ServerAdmin <name>@fhi-berlin.mpg.de
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    32
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    33
	HostNameLookups On
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    34
	ServerAlias *
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    35
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    36
	# Only listen for connections from the local machine.
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    37
	Listen lftest.rz-berlin.mpg.de:631
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    38
	Listen /var/run/cups/cups.sock
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    39
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    40
	# Show shared printers on the local network.
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    41
	Browsing Off
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    42
	BrowseOrder allow,deny
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    43
	BrowseAllow all
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    44
	BrowseLocalProtocols CUPS dnssd
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    45
	BrowseAddress @LOCAL
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    46
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    47
	# Default authentication type, when authentication is required...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    48
	DefaultAuthType Basic
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    49
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    50
	# Web interface setting...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    51
	WebInterface Yes
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    52
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    53
	# Restrict access to the server...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    54
	<Location />
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    55
	  Satisfy All
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    56
	  Allow localhost
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    57
	  Allow 141.14.*
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    58
	  Allow 172.16.*
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    59
	  Allow 192.*
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    60
	  Allow all
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    61
	  # Allow shared printing and remote administration...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    62
	  Order allow,deny
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    63
	  Allow all
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    64
	</Location>
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    65
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    66
	# Restrict access to the admin pages...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    67
	<Location /admin>
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    68
	  Order deny,allow
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    69
	  Satisfy All
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    70
	  AuthType Basic
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    71
	  Require user @SYSTEM
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    72
	  Deny All
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    73
	  Allow localhost
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    74
	  Allow 141.14.*
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    75
	  Allow 172.16.*
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    76
	</Location>
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    77
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    78
	# Restrict access to configuration files...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    79
	<Location /admin/conf>
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    80
	  Order deny,allow
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    81
	  AuthType Default
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    82
	  Require user @SYSTEM
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    83
	  Satisfy All
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    84
	  Require user root
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    85
	  Deny All
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    86
	  Allow 127.0.0.1
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    87
	  Allow 141.14.*
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    88
	  Allow 172.16.*
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    89
	</Location>
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    90
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    91
	# Set the default printer/job policies...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    92
	<Policy default>
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    93
	  ... # probably as in the original
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    94
	</Policy>
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    95
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    96
Change the *Server Admin*'s e-mail address and the server that shall be listened to (see the ``Listen`` statement). Set ``FileDevice Yes`` in ``/etc/cups/cups-files.conf``. Now, create a directory where all printers will go, e.g. ``/usr/local/labfolder/printers``.
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    97
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    98
Get the package for creating new printers from git::
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
    99
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   100
	labfolder@lftest:~$ git clone https://github.molgen.mpg.de/weiher/cupsPrinters
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   101
	labfolder@lftest:~$ ls
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   102
	cupsPrinters  labfolder
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   103
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   104
The only file you need to adapt is ``newPrinter.sh``. It is not a must but it is suggested to name the printers like the projects. For example, the FEL projects *operating* and *installation* could be placed at ``.../printers/FEL/operating`` and ``.../printers/FEL/installation``. Execute the script with sudo rights::
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   105
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   106
	labfolder@lftest:~/cupsPrinters$ sudo ./newPrinter.sh
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   107
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   108
To prevent ``DENIED`` errors from apparmor install and set the following and restart the CUPS server::
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   109
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   110
	$ sudo apt-get install apparmor-utils apparmor-profiles
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   111
	$ sudo aa-complain cupsd
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   112
	$ sudo service cups restart
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   113
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   114
In case you need to debug some logfiles can be found here: */var/log/syslog*, */var/log/cups/error_log* and */var/log/cups/acces_log*
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   115
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   116
One last change is that you need to once add a user named *Printer Print* (firstname lastname) to the labfolder database. This can be done manually inside the DB by this command::
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   117
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   118
	$ mysql -u root -p
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   119
	Enter password:
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   120
	...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   121
	mysql> use labfolder;
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   122
	mysql> INSERT INTO user (email, password, firstname, lastname, signupTimestamp, maxStorage) VALUES ('printer@fhi-berlin.mpg.de', '91a13f2aba4a35b00c35dfacadd1d75f4a5171dfa7a465fca9c40e6b007ce982', 'Printer', 'Print', '2018-03-21 10:54:00', '10000000');
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   123
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   124
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   125
.. _section_cups_user:
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   126
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   127
Printing to labfolder projects
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   128
------------------------------
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   129
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   130
The last thing you need to do is to set up a printer *operating* on your local machine. In Ubuntu Gnome hit Alt+F2 keys and enter ``system-config-printer``. In this printer config interface add a new printer *operating* as follows:
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   131
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   132
.. image:: _static/create_local_printer01.png
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   133
   :width: 70 %
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   134
   :align: center
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   135
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   136
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   137
.. image:: _static/create_local_printer02.png   
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   138
   :width: 70 %
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   139
   :align: center
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   140
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   141
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   142
.. image:: _static/create_local_printer03.png
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   143
   :width: 70 %
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   144
   :align: center
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   145
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   146
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   147
.. image:: _static/create_local_printer04.png
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   148
   :width: 70 %
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   149
   :align: center
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   150
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   151
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   152
.. image:: _static/create_local_printer05.png
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   153
   :width: 70 %
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   154
   :align: center
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   155
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   156
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   157
.. image:: _static/create_local_printer06.png
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   158
   :width: 70 %
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   159
   :align: center
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   160
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   161
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   162
.. image:: _static/create_local_printer07.png
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   163
   :width: 70 %
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   164
   :align: center
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents:
diff changeset
   165