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

Installation CentOS Fedora

IcedMango edited this page Jun 28, 2018 · 5 revisions

CentOS 7/Fedora 20+ install guide

Step-by-step to install Nginx, php-fpm, MariaDB, Node.js and Paperwork on a CentOS 7 server with firewalld and SELinux disabled.


Add Repos

rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

Install the dependencies (for Fedora 21 use dnf instead of yum)

yum --enablerepo=remi,remi-php56 -y install curl git mariadb mariadb-server nginx php php-fpm php-gd php-mcrypt php-mysqlnd wget nodejs

Services

systemctl stop httpd.service
systemctl disable httpd.service
systemctl restart nginx.service
systemctl restart php-fpm.service
systemctl restart mariadb.service

Edit www.conf with the following:

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

rm -rf /etc/nginx/nginx.conf
vi /etc/nginx/nginx.conf
---
user  nginx;
worker_processes  2;

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;
}
---

default.conf

vi /etc/nginx/conf.d/default.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;
    }
}
---

MariaDB Config

mysql_secure_installation # Set root password, and other settings as desired

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

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 'paperwork'@'localhost' IDENTIFIED BY 'paperwork' WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit

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

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
 gulp

Cleanup

chown -R nginx:nginx /var/www/html
systemctl restart nginx.service
systemctl restart php-fpm.service
systemctl restart mariadb.service
systemctl enable nginx.service
systemctl enable php-fpm.service
systemctl enable mariadb.service

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

Please Note: If you, when trying to save a note, get an error related to Class 'DOMDocument' not found, please install php-xml and then restart nginx and php-fpm.