Skip to content
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.

Installing Paperwork on Ubuntu 16.04 LTS

Liongold edited this page Mar 8, 2018 · 2 revisions

This will walk you through step by step how to install a LEMP server and Paperwork. This guide is a modified version of Installing Paperwork on Ubuntu 14.10 for Ubuntu 16.04 LTS. If you don't use the user root some commands require the sudo command.

Install the dependencies

apt-get update
apt-get install npm zip mysql-server php7.0-mysql  nginx php7.0-fpm curl wget git php7.0-cli php7.0-gd php7.0-mcrypt nodejs nodejs-legacy php-xml

If you are planning on using MySQL it is recommended that you set it up securely:

/usr/bin/mysql_secure_installation

Install composer

curl -sS https://getcomposer.org/installer | php

This will allow us to run composer without specifying the path

mv composer.phar /usr/local/bin/composer

CD into it the webserver directory:

cd /var/www/html/

Download Paperwork using git:

git clone -b 1 https://github.com/twostairs/paperwork.git

Enter the front end directory:

 cd ./paperwork/frontend/

Run "composer install" and/or "composer update". This will install all the needed dependencies.

composer install

Now, you should put your MySQL credentials into "frontend/app/storage/config/default_database.json". For simple local installation you can setup a paperwork database that works with the default configuration:

DROP DATABASE IF EXISTS paperwork;
CREATE DATABASE IF NOT EXISTS paperwork DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON paperwork.* TO 'paperwork'@'localhost' IDENTIFIED BY 'paperwork' WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit

After completing these steps, run the migration jobs, that fill the database:

php artisan migrate

Change ownership of the Paperwork web-directory to the user nginx is running under:

chown www-data:www-data -R /var/www/html/

Edit the default site configuration to match the following: /etc/nginx/sites-available/default

server {
        listen   80;
        # listen 443 ssl;

        root /var/www/html/paperwork/frontend/public;
        index index.php index.html index.htm;

        server_name example.com;

        # server_name example.com;
        # ssl_certificate /etc/nginx/ssl/server.crt;
        # ssl_certificate_key /etc/nginx/ssl/server.key;

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

        error_page 404 /404.html;

        # pass the PHP scripts to FastCGI server listening on the php-fpm socket
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;

        }

}

Install gulp and bower:

npm install -g gulp bower

And then npm dependencies inside project

npm install

Then you install bower dependencies and just run the default task

bower install --allow-root
gulp

Restart Nginx and php

service nginx restart
service php7.0-fpm restart

Congrats! Paperwork should now be installed and available at your IP address.

Now just follow the instructions on screen to set up a admin account.