Install Paperwork on Ubuntu

install paperwork

In this article, we will explain how to install Paperwork on an Ubuntu 16.04 VPS with MariaDB, PHP-FPM and Nginx. Paperwork is an open-source, self-hosted alternative to services like Evernote, Microsoft OneNote or Google Keep and it is built on top of Laravel 4.2. This guide should work on other Linux VPS systems as well but was tested and written for an Ubuntu 16.04 VPS.

1. Login to your VPS via SSH

ssh user@vps_IP

2. Update the system and install necessary packages

[user]$ sudo apt-get update && sudo apt-get -y upgrade
[user]$ sudo apt-get install software-properties-common git nano curl

3. Install MariaDB 10.1

To add the MariaDB repository to your sources list and install the latest MariaDB 10.1 server, run the following commands:

[user]$ sudo apt-key adv --recv-keys --keyserver hkp:// 0xF1656F24C74CD1D8
[user]$ sudo add-apt-repository 'deb [arch=amd64,i386] xenial main'
s[user]$ sudo apt-get update
[user]$ sudo apt-get install -y mariadb-server

4. Secure the Installation

When the installation is complete, run the following command to secure your installation:

[user]$ mysql_secure_installation

5. Create a New Database

Next, we need to create a database for the Paperwork installation.

[user]$ myswl -uroot -p
MariaDB [(none)]> CREATE DATABASE paperwork;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON paperwork.* TO 'paperwork'@'localhost' IDENTIFIED BY 'strong_password';
MariaDB [(none)]> \q

6. Install PHP, Composer and required PHP modules

To install the latest stable version of PHP version 7.0 and all necessary modules, run:

[user]$ sudo apt-get -y install php-fpm php-cli php-json php-curl php-gd php-mysql php-mcrypt php-mbstring

The following commands will set the PHP memory limit to 512MB, change the values of upload_max_filesize and post_max_size to 200M and set the timezone to UTC.

[user]$ sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.0/fpm/php.ini
[user]$ sudo sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.0/fpm/php.ini
[user]$ sudo sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=1/" /etc/php/7.0/fpm/php.ini
[user]$ sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 200M/" /etc/php/7.0/fpm/php.ini
[user]$ sudo sed -i "s/post_max_size = .*/post_max_size = 200M/" /etc/php/7.0/fpm/php.ini

Composer is a dependency manager for PHP with which you can install packages. Composer will pull in all the required libraries and dependencies you need for your project.

[user]$ curl -sS | php
[user]$ sudo mv composer.phar /usr/local/bin/composer

Create a new PHP-FPM pool for your user:

[user]$ sudo nano /etc/php/7.0/fpm/pool.d/your_user.conf
user = your_user
group = your_user
listen = /run/php/php7.0-your_user.sock
listen.owner = your_user = your_user
listen.mode = 0666
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
pm.max_requests = 200
chdir = /

Do not forget to change your_user with your username.
Restart PHP-FPM:

[user]$ sudo service php7.0-fpm restart

7. Install Node.Js

We will install the latest nodejs package from the nodesource repository.

[user]$ curl -sL | sudo -E bash -
[user]$ sudo apt-get install -y nodejs

Once Node is installed, install the gulp and bower packages globally using NPM.

[user]$ sudo npm install -g gulp bower

8. Install Paperwork

Create a root directory for your Paperwork using the following command:

[user]$ mkdir -p ~/

Clone the project repository from GitHub:

[user]$ git clone ~/

Change to public_html the directory:

[user]$ cd  ~/

9. Install all PHP dependencies

Install all PHP dependencies using composer

[user]$ composer install

Create a “database.json” file by copying the “default_database.json” file:

[user]$ cp app/storage/config/default_database.json app/storage/config/database.json

Enter your MySQL credentials into the database.json file:

[user]$ nano  app/storage/config/database.json
    "driver": "mysql",
    "database": "paperwork",
    "host": "localhost",
    "username": "paperwork",
    "password": "strong_password",
    "port": 3306

and run the following command to migrate the database:

[user]$ php artisan migrate

install all npm dependencies

[user]$ npm install

install bower dependencies and run gulp to build the assets

[user]$ bower install
[user]$ gulp

10. Install and configure Nginx

To install the latest stable version of Nginx available on the Ubuntu repositories, run:

[user]$ sudo apt-get -y install nginx

Generate a self signed ssl certificate:

[user]$ sudo mkdir -p /etc/nginx/ssl
[user]$ cd /etc/nginx/ssl
[user]$ sudo openssl genrsa -des3 -passout pass:x -out paperwork.pass.key 2048
[user]$ sudo openssl rsa -passin pass:x -in paperwork.pass.key -out paperwork.key
[user]$ sudo rm paperwork.pass.key
[user]$ sudo openssl req -new -key paperwork.key -out paperwork.csr
[user]$ sudo openssl x509 -req -days 365 -in paperwork.csr -signkey paperwork.key -out paperwork.crt

[user]$ sudo openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
If you don’t want to get warnings associated with self-signed SSL Certificates, you can purchase a trusted SSL certificate.

Next, create a new Nginx server block:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer

Now just $43 .99

[user]$ sudo nano /etc/nginx/sites-available/
server {
    listen 443 ssl http2;
    root /home/your_user/;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php;

    ssl on;
    ssl_certificate     /etc/nginx/ssl/paperwork.crt;
    ssl_certificate_key /etc/nginx/ssl/paperwork.key;
    ssl_dhparam  /etc/nginx/ssl/dhparam.pem;

    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    access_log  /var/log/nginx/paperwork.access.log;
    error_log   /var/log/nginx/paperwork.error.log;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php7.0-fpm-your_user.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;

    location ~ /\.ht {
        deny all;

server {
    listen      80;

    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^ https://$server_name$request_uri? permanent;

Do not forget to change your_user with your username.

Activate the server block by creating a symbolic link :

[user]$ sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

11. Restart Web Server and Test

Test the Nginx configuration and restart nginx:

[user]$ sudo nginx -t
[user]$ sudo service nginx restart

Open in your favorite web browser and you should see the Paperwork install screen. On this page you’ll need to enter the database details you created earlier, and create an admin user.

That’s it. You have successfully installed Paperwork on your Ubuntu 16.04 VPS.

Of course you don’t have to do any of this if you use one of our VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on how to Install Paperwork on Ubuntu,  please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment