diff -r a21f3604f1db -r 523ca1dfd077 elog2labfolder/_build/html/_sources/installation_cups.rst.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/elog2labfolder/_build/html/_sources/installation_cups.rst.txt Tue Mar 27 16:07:14 2018 +0200 @@ -0,0 +1,165 @@ +Printing via CUPS and attaching files to labfolder logbooks +=========================================================== + +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`. + + +.. _section_cups_admin: + +Set up CUPS as labfolder admin +------------------------------ + +First, you need to install CUPS on the virtual machine that runs labfolder:: + + sudo apt-get install cups cups-client cups-bsd + +Next, configure ``/etc/cups/cupsd.conf``:: + + # 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 debug + + # Deactivate CUPS' internal logrotating, as we provide a better one, especially + # LogLevel debug2 gets usable now + MaxLogSize 0 + + # Administrator user group... + SystemGroup lpadmin + ServerAdmin @fhi-berlin.mpg.de + + HostNameLookups On + ServerAlias * + + # Only listen for connections from the local machine. + Listen lftest.rz-berlin.mpg.de:631 + Listen /var/run/cups/cups.sock + + # Show shared printers on the local network. + Browsing Off + BrowseOrder allow,deny + BrowseAllow all + BrowseLocalProtocols CUPS dnssd + BrowseAddress @LOCAL + + # Default authentication type, when authentication is required... + DefaultAuthType Basic + + # Web interface setting... + WebInterface Yes + + # Restrict access to the server... + + Satisfy All + Allow localhost + Allow 141.14.* + Allow 172.16.* + Allow 192.* + Allow all + # Allow shared printing and remote administration... + Order allow,deny + Allow all + + + # Restrict access to the admin pages... + + Order deny,allow + Satisfy All + AuthType Basic + Require user @SYSTEM + Deny All + Allow localhost + Allow 141.14.* + Allow 172.16.* + + + # Restrict access to configuration files... + + Order deny,allow + AuthType Default + Require user @SYSTEM + Satisfy All + Require user root + Deny All + Allow 127.0.0.1 + Allow 141.14.* + Allow 172.16.* + + + # Set the default printer/job policies... + + ... # probably as in the original + + +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``. + +Get the package for creating new printers from git:: + + labfolder@lftest:~$ git clone https://github.molgen.mpg.de/weiher/cupsPrinters + labfolder@lftest:~$ ls + cupsPrinters labfolder + +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:: + + labfolder@lftest:~/cupsPrinters$ sudo ./newPrinter.sh + +To prevent ``DENIED`` errors from apparmor install and set the following and restart the CUPS server:: + + $ sudo apt-get install apparmor-utils apparmor-profiles + $ sudo aa-complain cupsd + $ sudo service cups restart + +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* + +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:: + + $ mysql -u root -p + Enter password: + ... + mysql> use labfolder; + 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'); + + +.. _section_cups_user: + +Printing to labfolder projects +------------------------------ + +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: + +.. image:: _static/create_local_printer01.png + :width: 70 % + :align: center + + +.. image:: _static/create_local_printer02.png + :width: 70 % + :align: center + + +.. image:: _static/create_local_printer03.png + :width: 70 % + :align: center + + +.. image:: _static/create_local_printer04.png + :width: 70 % + :align: center + + +.. image:: _static/create_local_printer05.png + :width: 70 % + :align: center + + +.. image:: _static/create_local_printer06.png + :width: 70 % + :align: center + + +.. image:: _static/create_local_printer07.png + :width: 70 % + :align: center +