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