Paperless-ngx is a self-hosted document manager that allows you to store, organize, and search your documents. This tutorial will guide you through the installation process of Paperless-ngx on OpenBSD.
Before you begin, make sure you have the following:
First, update the system packages by running the following command:
sudo pkg_add -u
Next, install the required dependencies by executing the following command:
sudo pkg_add python-3.7.9p1 py3-pip git postgresql-server postgresql-client nginx
Create a directory where you want to store the Paperless-ngx files and then clone the repository by running the following:
sudo mkdir /opt/paperless-ngx
sudo chown -R username:username /opt/paperless-ngx
cd /opt/paperless-ngx
git clone https://github.com/jonaswinkler/paperless-ng.git paperless-ngx
cd paperless-ngx
Make sure to replace username
with your non-root user account.
Install the Python dependencies using pip
by executing the following command:
sudo pip3 install -r requirements.txt
Initialize the PostgreSQL database using the following commands:
sudo rcctl enable postgresql
sudo rcctl start postgresql
sudo su - _postgresql -c "initdb -D /var/postgresql/data -U _postgresql"
sudo sed -Ei "s/(.*ssl.*)/#\1/" /var/postgresql/data/postgresql.conf
Next, create a user and database for Paperless-ngx:
sudo su - _postgresql -c "createuser -SDRP paperless"
sudo su - _postgresql -c "createdb -O paperless paperless"
Finally, configure PostgreSQL to listen on all IP addresses:
sudo echo "listen_addresses = '*'" >> /var/postgresql/data/postgresql.conf
sudo rcctl restart postgresql
Rename the sample configuration file and replace the settings with your own:
cd /opt/paperless-ngx/paperless-ngx
cp paperless.conf.dist paperless.conf
nano paperless.conf
Make sure to update the following settings:
POSTGRES_DB
: Enter paperless
as the value.POSTGRES_USER
: Enter paperless
as the value.POSTGRES_PASSWORD
: Set a strong password for the paperless
user.SECRET_KEY
: Set a long and random string for the secret key.Save and close the file.
Create a new Nginx configuration file:
sudo nano /etc/nginx/nginx.conf
And paste the following:
worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream paperless {
server 127.0.0.1:8000;
}
server {
listen 80 default_server;
server_name example.com;
location / {
proxy_pass http://paperless;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /static/ {
alias /opt/paperless-ngx/paperless-ngx/static/;
}
}
}
Make sure to replace example.com
with your website domain name.
Run the following command to start the Paperless-ngx server:
cd /opt/paperless-ngx/paperless-ngx
./manage.py migrate
./manage.py createsuperuser
./manage.py collectstatic
./manage.py runserver
Point your browser to http://example.com
to launch Paperless-ngx.
This tutorial has shown you how to install Paperless-ngx on OpenBSD. You can now start organizing and managing your documents using Paperless-ngx. Happy document managing!
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!