This guide is for installing Paperwork on a fresh CentOS 7 server. Paperwork is a FOSS (Free and Open Source Software) note-taking & archiving solution. In short, it's a free, self-hosted alternative to Evernote, OneNote, etc. I came across this product within the last few days, and was immediately interested.
Please note that this project is in the early stages, and is functional, but not complete. This project is written in PHP and based on laravel 4, and uses MySQL/MariaDB for the backend. If you want to contribute to the project, you can find it on GitHub.
This install guide will guide you through installing Paperwork using Nginx, PHP-FPM, and MariaDB on CentOS 7.
For simplicity sake, I will be installing as root, running Nginx/PHP-FPM as nginx, disabling SELinux, and disabling the firewall (Firewalld). Obviously, it is not recommended to do this in a production environment, so tweak to your needs.
Let's Get Started!
0.) Disable SELinux and Disable FirewallD:
systemctl disable firewalld.service
sed -i /etc/selinux/config -r -e 's/^SELINUX=.*/SELINUX=disabled/g'
systemctl reboot
1.) Requisites:
Install stuff and update:
yum -y install epel-release
yum -y install curl git mariadb-server nginx nodejs php php-fpm php-gd php-mcrypt php-mbstring php-mysqlnd php-xml wget
yum -y update && reboot
Start services:
systemctl restart nginx.service && systemctl restart php-fpm.service && systemctl restart mariadb.service
2.) Edit configs:
www.conf
vi /etc/php-fpm.d/www.conf
---
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx ; SOCKS permission
listen.group = nginx ; SOCKS permission
listen.mode = 0660 ; SOCKS permission
user = nginx ; PHP-FPM running user
group = nginx ; PHP-FPM running group
---
nginx.conf
mkdir /var/run/php-fpm
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
vi /etc/nginx/nginx.conf
---
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
index index.html index.htm;
}
---
paperwork.conf
vi /etc/nginx/conf.d/paperwork.conf
---
server {
listen 80;
server_name localhost;
set $root_path '/var/www/html/paperwork/frontend/public';
root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
---
3.) MariaDB Config:
mysql_secure_installation # Set root password, and other settings as desired
4.) Install Paperwork
mkdir -p /var/www/html && cd /var/www/html
git clone https://github.com/twostairs/paperwork.git
cd /var/www/html/paperwork/frontend
curl -sS https://getcomposer.org/installer | php
php composer.phar install
5.) Configure Database
mysql -u root -p # Enter root password
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 'paperworkuser'@'localhost' IDENTIFIED BY 'paperworkpass' WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit
Now we need to update Paperwork's database config
vi /var/www/html/paperwork/frontend/app/storage/db_settings
---
mysql, localhost, 3306, paperworkuser, paperworkpass
---
Update database schema
cd /var/www/html/paperwork/frontend
php artisan migrate # Type yes
Install npm
wget https://www.npmjs.org/install.sh
bash ./install.sh
npm install -g gulp bower
npm install
bower install --allow-root
gulp
6.) Cleanup
rm -rf /var/www/html/paperwork/frontend/app/storage/setup
chown -R nginx:nginx /var/www/html
systemctl enable nginx.service && systemctl enable php-fpm.service && systemctl enable mariadb.service
systemctl reboot
[OPTIONAL] Reverse Proxy configs
I'm throwing this out there primarily for myself, but if you decide you want to run Paperwork behind a reverse proxy (such as Nginx, like I do) with HTTPS enabled on the reverse proxy (but not on your Paperwork install), then there is 2 lines you need to add to a config file to make things work. Add them to the top of the file, but inside the PHP tag.
vi /var/www/html/paperwork/frontend/app/routes.php
---
URL::forceRootUrl('https://notes.domain.com');
URL::forceSchema('https');
---
systemctl reboot
Install isn't too bad, and seems to work well on CentOS 7 with Nginx. Browse to http://(SERVER_IP) to create an account, and sign in. Again, this project is still a work in progress, but it works nicely.
Hope you enjoyed, and please contact me if you have any feedback!