elog2labfolder/installation_cups.rst
author weiher
Mon, 04 Jun 2018 16:38:36 +0200
changeset 18 57431f642e82
parent 17 02a3741242b2
permissions -rw-r--r--
Minor additions for comprehension and changes in the document structure
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
     1
Printing via CUPS and attaching files to labfolder logbooks
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
     2
===========================================================
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
     3
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
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: 13
diff changeset
     5
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
     6
18
57431f642e82 Minor additions for comprehension and changes in the document structure
weiher
parents: 17
diff changeset
     7
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
     8
.. _section_cups_admin:
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
     9
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
    10
Set up CUPS as labfolder admin
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
    11
------------------------------
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
    12
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
    13
First, you need to install CUPS on the virtual machine that runs labfolder::
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    14
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    15
	sudo apt-get install cups cups-client cups-bsd
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    16
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
    17
Next, configure ``/etc/cups/cupsd.conf``::
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    18
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    19
	# Sample configuration file for the CUPS scheduler.  See "man cupsd.conf" for a
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    20
	# complete description of this file.
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    21
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    22
	# Log general information in error_log - change "warn" to "debug"
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    23
	# for troubleshooting...
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    24
	LogLevel debug
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    25
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    26
	# Deactivate CUPS' internal logrotating, as we provide a better one, especially
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    27
	# LogLevel debug2 gets usable now
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    28
	MaxLogSize 0
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    29
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    30
	# Administrator user group...
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    31
	SystemGroup lpadmin
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
    32
	ServerAdmin <name>@fhi-berlin.mpg.de
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    33
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    34
	HostNameLookups On
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    35
	ServerAlias *
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    36
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    37
	# Only listen for connections from the local machine.
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    38
	Listen lftest.rz-berlin.mpg.de:631
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    39
	Listen /var/run/cups/cups.sock
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    40
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    41
	# Show shared printers on the local network.
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    42
	Browsing Off
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    43
	BrowseOrder allow,deny
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    44
	BrowseAllow all
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    45
	BrowseLocalProtocols CUPS dnssd
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    46
	BrowseAddress @LOCAL
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    47
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    48
	# Default authentication type, when authentication is required...
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    49
	DefaultAuthType Basic
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    50
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    51
	# Web interface setting...
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    52
	WebInterface Yes
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    53
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    54
	# Restrict access to the server...
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    55
	<Location />
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    56
	  Satisfy All
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    57
	  Allow localhost
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    58
	  Allow 141.14.*
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    59
	  Allow 172.16.*
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    60
	  Allow 192.*
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    61
	  Allow all
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    62
	  # Allow shared printing and remote administration...
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    63
	  Order allow,deny
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    64
	  Allow all
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    65
	</Location>
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    66
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    67
	# Restrict access to the admin pages...
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    68
	<Location /admin>
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    69
	  Order deny,allow
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    70
	  Satisfy All
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    71
	  AuthType Basic
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    72
	  Require user @SYSTEM
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    73
	  Deny All
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    74
	  Allow localhost
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    75
	  Allow 141.14.*
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    76
	  Allow 172.16.*
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    77
	</Location>
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    78
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    79
	# Restrict access to configuration files...
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    80
	<Location /admin/conf>
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    81
	  Order deny,allow
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    82
	  AuthType Default
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    83
	  Require user @SYSTEM
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    84
	  Satisfy All
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    85
	  Require user root
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    86
	  Deny All
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    87
	  Allow 127.0.0.1
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    88
	  Allow 141.14.*
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    89
	  Allow 172.16.*
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    90
	</Location>
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    91
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    92
	# Set the default printer/job policies...
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    93
	<Policy default>
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    94
	  ... # probably as in the original
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    95
	</Policy>
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    96
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
    97
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``.
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
    98
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
    99
Get the package for creating new printers from git::
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   100
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   101
	labfolder@lftest:~$ git clone https://github.molgen.mpg.de/weiher/cupsPrinters
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   102
	labfolder@lftest:~$ ls
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   103
	cupsPrinters  labfolder
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   104
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   105
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::
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   106
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   107
	labfolder@lftest:~/cupsPrinters$ sudo ./newPrinter.sh
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   108
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   109
To prevent ``DENIED`` errors from apparmor install and set the following and restart the CUPS server::
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   110
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   111
	$ sudo apt-get install apparmor-utils apparmor-profiles
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   112
	$ sudo aa-complain cupsd
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   113
	$ sudo service cups restart
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   114
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   115
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: 13
diff changeset
   116
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   117
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::
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   118
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   119
	$ mysql -u root -p
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   120
	Enter password:
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   121
	...
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   122
	mysql> use labfolder;
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   123
	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');
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   124
18
57431f642e82 Minor additions for comprehension and changes in the document structure
weiher
parents: 17
diff changeset
   125
Das Passwort steht für "test1234". Der entsprechende Hash-Wert im MySQL-Kommando wurde von Florian Hauer (labfolder) erstellt.
57431f642e82 Minor additions for comprehension and changes in the document structure
weiher
parents: 17
diff changeset
   126
57431f642e82 Minor additions for comprehension and changes in the document structure
weiher
parents: 17
diff changeset
   127
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   128
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   129
.. _section_cups_user:
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   130
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   131
Printing to labfolder projects
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   132
------------------------------
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   133
18
57431f642e82 Minor additions for comprehension and changes in the document structure
weiher
parents: 17
diff changeset
   134
The last thing you need to do is to set up a printer, for example, *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:
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   135
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   136
.. image:: _static/create_local_printer01.png
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   137
   :width: 70 %
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   138
   :align: center
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   139
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   140
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   141
.. image:: _static/create_local_printer02.png   
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   142
   :width: 70 %
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   143
   :align: center
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   144
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   145
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   146
.. image:: _static/create_local_printer03.png
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   147
   :width: 70 %
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   148
   :align: center
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   149
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   150
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   151
.. image:: _static/create_local_printer04.png
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   152
   :width: 70 %
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   153
   :align: center
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   154
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   155
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   156
.. image:: _static/create_local_printer05.png
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   157
   :width: 70 %
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   158
   :align: center
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   159
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   160
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   161
.. image:: _static/create_local_printer06.png
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   162
   :width: 70 %
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   163
   :align: center
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   164
15
523ca1dfd077 added new chapter on installation of CUPS printers
weiher
parents: 13
diff changeset
   165
13
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   166
.. image:: _static/create_local_printer07.png
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   167
   :width: 70 %
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   168
   :align: center
a21f3604f1db Added new chapter about CUPS printers
weiher
parents:
diff changeset
   169
18
57431f642e82 Minor additions for comprehension and changes in the document structure
weiher
parents: 17
diff changeset
   170
Now, just select this printer when printing a webpage or a picture to a labfolder project.
57431f642e82 Minor additions for comprehension and changes in the document structure
weiher
parents: 17
diff changeset
   171