Installing Papermerge on Debian Latest

Papermerge is an open-source document management system that allows you to manage your documents in an organized manner. In this tutorial, we will guide you through the steps to install Papermerge on Debian Latest.

Prerequisites

Step 1: Update Debian

Before starting the installation, it's always good to update the server.

sudo apt-get update && sudo apt-get upgrade

Step 2: Install Required Packages

Papermerge requires several packages to run. Use the following command to install them:

sudo apt-get install libjpeg62-turbo-dev libtiff5-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3.6-dev python3-pip postgresql postgresql-contrib nginx supervisor

Step 3: Install Papermerge

Create a virtual environment for Papermerge and activate it.

sudo apt install python3-venv
python3 -m venv /home/papermerge/env
source /home/papermerge/env/bin/activate

Download and extract the Papermerge archive to the /opt/ directory.

cd /opt/
sudo wget https://github.com/ciur/papermerge/archive/refs/tags/v1.5.0.tar.gz
sudo tar -xzf v1.5.0.tar.gz
sudo mv papermerge-1.5.0 papermerge

Install the Papermerge dependencies using pip.

cd /opt/papermerge
pip3 install wheel
pip3 install -r requirements.txt
pip3 install gunicorn
pip3 install papermerge[ocr, redis]

Step 4: Configure Database

Create a new user and database for Papermerge in PostgreSQL.

sudo su postgres
createuser -P papermerge
createdb -O papermerge papermerge

Update the database configuration in /opt/papermerge/papermerge/settings.py file.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'papermerge',
        'USER': 'papermerge',
        'PASSWORD': 'password_here',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}

Step 5: Configure Nginx

Papermerge runs on Nginx web server. Create a new Nginx server block for it.

sudo nano /etc/nginx/sites-available/papermerge

Paste the following server block.

server {
    listen 80;
    server_name papermerge.example.com;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /opt/papermerge/papermerge;
    }

    location / {
        include proxy_params;
        proxy_pass http://127.0.0.1:8000;
    }
}

Save and exit the file.

Step 6: Configure Supervisor

Create and configure a new Supervisor program for Papermerge.

sudo nano /etc/supervisor/conf.d/papermerge.conf

Paste the following program configuration.

[program:papermerge]
directory=/opt/papermerge
command=/opt/papermerge/env/bin/gunicorn --workers 2 --bind unix:/opt/papermerge/papermerge.sock papermerge.wsgi:application

user=papermerge
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true

stdout_logfile=/var/log/supervisor/papermerge.log
stderr_logfile=/var/log/supervisor/papermerge.err.log

Save and exit the file.

Step 7: Start Services

Start the Supervisor service.

sudo systemctl start supervisor

Start the Nginx service.

sudo systemctl start nginx

Step 8: Access Papermerge

Papermerge should now be accessible via your server's domain name or public IP address. Open your web browser and visit http://papermerge.example.com. You should see the Papermerge login page.

Conclusion

You have successfully installed Papermerge on Debian. You can now start using it to manage your documents.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!