{"id":1384,"date":"2021-01-27T02:28:54","date_gmt":"2021-01-27T01:28:54","guid":{"rendered":"http:\/\/hobbykeller.spdns.de\/?p=1384"},"modified":"2021-01-27T02:28:54","modified_gmt":"2021-01-27T01:28:54","slug":"installing-mayan-edms-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=1384","title":{"rendered":"Installing Mayan EDMS on Ubuntu 20.04"},"content":{"rendered":"\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/docs.mayan-edms.com\/chapters\/deploying.html\" type=\"URL\" id=\"https:\/\/docs.mayan-edms.com\/chapters\/deploying.html\" target=\"_blank\" class=\"broken_link\">The Mayan EDMS documentation<\/a> offers two ways for the installation on a Ubuntu 20.04 LTS machine: The first one is via Docker, the second one is the direct installation. I went for the second (direct) option on a Raspberry Pi 4 running a Ubuntu 20.04 headless server. For the installation to succeed, you have to do some slight amendments to the installation instructions given in the Mayan EDMS.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installation error while building Python wheel for <code>gevent (PEP 517)<\/code><\/h2>\n\n\n\n<p>When I tried to install the Mayan EDMS from PyPi according to step 7 of the documentation I got the following error when the Python Wheel for gevent was built:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Building wheels for collected packages: gevent\n  Building wheel for gevent (PEP 517) ... error\n  ERROR: Command errored out with exit status 1:\n   command: \/opt\/mayan-edms\/bin\/python \/opt\/mayan-edms\/lib\/python3.8\/site-packages\/pip\/_vendor\/pep517\/_in_process.py build_wheel \/tmp\/tmpjf61jtxv\n       cwd: \/tmp\/pip-install-4o2pfult\/gevent_ca6fdc0ed0854e36bd21af7af5a2ba5c\n  Complete output (342 lines):\n[...]\n  ----------------------------------------\n  ERROR: Failed building wheel for gevent\nFailed to build gevent\nERROR: Could not build wheels for gevent which use PEP 517 and cannot be installed directly<\/pre><\/div>\n\n\n\n<p>The solution to the issue can be found in the <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/gevent\/gevent\/issues\/1567\" data-type=\"URL\" data-id=\"https:\/\/github.com\/gevent\/gevent\/issues\/1567\" target=\"_blank\">github issues section for gevent<\/a>. For building the Python wheel, we need <code>make<\/code>, so the simple solution is to install <code>make<\/code> to your Ubuntu system (<code>sudo apt install make<\/code>) or to add it to the list of requirements that are installed in step one of the documentation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Initialization of project<\/h2>\n\n\n\n<p>When running the following command in step 10, be aware that it will take some time until you get a response in the command window. I first made the error and thought that the multiline shell command was incomplete. So I hit Crtl-C and ran directly into the trouble the documentation warned of, that I lost my admin user.<\/p>\n\n\n\n<p>If you happen to have the same problem, you have to delete your mayan postgresql database and drop the mayan user and then repeat step 9:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>ubuntu@mayan:~$ sudo -u postgres psql -c &quot;DROP DATABASE mayan&quot;\nubuntu@mayan:~$ sudo -u postgres psql -c &quot;DROP USER mayan&quot;\n<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Further questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">How can I access my Mayan?<\/h3>\n\n\n\n<p>After successfully installing everything, the main question was: How the heck can I access my Mayan installation? Fact is that the installation does not run on port 80. Using <code>sudo netstat -plunt<\/code> I found out that <strong>port 8000<\/strong> is listening to the outside world. And that will take your browser to the initial login page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Is the <code>mayan<\/code> user set up during installation also the Mayan admin?<\/h3>\n\n\n\n<p>The answer is: no. During installation of your mayan system, you set up a couple of users that ran &#8220;under the hood&#8221;:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>the <code>mayan<\/code> <strong>system user<\/strong> in the Ubuntu OS (without password and login options; can only be used with <code>sudo -U mayan<\/code>)<\/li><li>the <code>mayan<\/code> user in your <strong>PostgreSQL<\/strong> database (which has a password)<\/li><li>the mayan user in your Redis<\/li><\/ul>\n\n\n\n<p>None of those users is exposed through Mayan&#8217;s web UI &#8211; the lead user who holds all privileges in the web UI is admin, and you have to set its password when you access Mayan&#8217;s web interface for the first time after installation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Is there no way to run Mayan over HTTPS?<\/h3>\n\n\n\n<p>No &#8211; at least not directly. Here&#8217;s a <a href=\"https:\/\/forum.mayan-edms.com\/viewtopic.php?t=1112\" type=\"URL\" id=\"https:\/\/forum.mayan-edms.com\/viewtopic.php?t=1112\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"broken_link\">statement<\/a> from the Mayan developer:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>We don&#8217;t include any native way in Mayan to do this because there are many way to configure SSL and that is something best left for deployment tools. We recommend using a reverse proxy.<\/p><p>You can use nginx, apache or Traefik.<\/p><\/blockquote>\n\n\n\n<p>Okeydoke &#8211; we&#8217;ll set up an nginx as a reverse-proxy then. What we need is&#8230;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Install and setup <code>ddclient<\/code> to regularly update the DynDNS record for our outside address. (Not shown in this post)<\/li><li>Install nginx itself and set it up as a reverse proxy. Outside communication is to be sent through https.<\/li><li>Set up a Let&#8217;s encrypt certificate to identify and encrypt our site.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Install nginx and setup as reverse proxy<\/h3>\n\n\n\n<p>The key challenge is to come up with a configuration file for the nginx reverse proxy and have Certbot produce a certificate for that nginx instance. The way that worked for me was:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Use the nginx default template with just dummy page. Run it under the dyndns domain will later run as the domain for the reverse proxy. All you need is a bare bone nginx server that runs on port 80 with your local network firewall opened for that port. Then run Certbot to produce your certificate.<\/li><li>After you have your certificate, create a new file \/etc\/nginx\/sites-available\/edms.myddns.org and put the certificate paths as parameters for ssl_certificate and ssl_certificate_key in the server config. My config file finally looked like this:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>server {\n        # SSL configuration\n        server_name edms.myddns.org;\n\n\n        access_log            \/var\/log\/nginx\/mayan.access.log;\n        error_log             \/var\/log\/nginx\/mayan.error.log;\n\n        listen [::]:443 ssl ipv6only=on; # managed by Certbot\n        listen 443 ssl; # managed by Certbot\n        ssl_certificate \/etc\/letsencrypt\/live\/edms.myddns.org\/fullchain.pem; # managed by Certbot\n        ssl_certificate_key \/etc\/letsencrypt\/live\/edms.myddns.org\/privkey.pem; # managed by Certbot\n        include \/etc\/letsencrypt\/options-ssl-nginx.conf; # managed by Certbot\n        ssl_dhparam \/etc\/letsencrypt\/ssl-dhparams.pem; # managed by Certbot\n\n        location \/ {\n                include \/etc\/nginx\/proxy_params;\n                proxy_pass          http:\/\/localhost:8000;\n                proxy_read_timeout  90;\n                # Fix potential &quot;It appears that your reverse proxy setup is broken&quot; error\n                proxy_redirect      http:\/\/localhost:8000 https:\/\/edms.myddns.org;\n        }\n}\n\n<\/pre><\/div>\n\n\n\n<p>Save the file into <code>\/etc\/nginx\/sites-available<\/code>. Then set a symlink into <code>\/etc\/nginx\/sites-enabled\/<\/code>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>sudo ln -s \/etc\/nginx\/sites-available\/edms.myddns.org \/etc\/nginx\/sites-enabled\/<\/pre><\/div>\n\n\n\n<p>Disable the default virtual host:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>sudo unlink \/etc\/nginx\/sites-enabled\/default<\/pre><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Mayan EDMS documentation offers two ways for the installation on a Ubuntu 20.04 LTS machine: The first one is via Docker, the second one is the direct installation. I<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=1384\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Installing Mayan EDMS on Ubuntu 20.04<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64,254,237],"tags":[289,132],"class_list":["post-1384","post","type-post","status-publish","format-standard","hentry","category-linux","category-python","category-raspberry","tag-mayan-edms","tag-python"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1384","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1384"}],"version-history":[{"count":10,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1384\/revisions"}],"predecessor-version":[{"id":1397,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1384\/revisions\/1397"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}