Project

General

Profile

Support #795

Install Wallabag on FreeBSD

Added by Daniel Curtis almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Web Server
Target version:
Start date:
04/10/2016
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:

Description

This is a guide for setting up a self-hosted wallabag instance on an nginx web server using postgresql on FreeBSD 10.

Prepare the Environment

  • Before installation of the components, make sure everything is up to date using the following command:
    pkg update -f && pkg upgrade
    
  • Install some dependencies:
    pkg install portmaster gmake
    

Install Nginx

  • Install Nginx
    pkg install nginx
    
  • Start and enable nginx at boot:
    echo 'nginx_enable="YES"' >> /etc/rc.conf
    service nginx start
    
  • Create a configuration directory to make managing individual server blocks easier
    mkdir /usr/local/etc/nginx/conf.d
    
  • Edit the main nginx config file:
    vi /usr/local/etc/nginx/nginx.conf
    
    • And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
      worker_processes  1;
      error_log  /var/log/nginx-error.log;
      
      events {
          worker_connections  1024;
      }
      
      http {
          include       mime.types;
          default_type  application/octet-stream;
          sendfile        on;
          keepalive_timeout  65;
      
          # Load config files from the /etc/nginx/conf.d directory
          include /usr/local/etc/nginx/conf.d/*.conf;
      }
      

Install PostgreSQL 9.4

  • Install PostgreSQL:
    pkg install postgresql94-{server,client}
    
  • Enable PostgreSQL at boot:
    echo 'postgresql_enable="YES"' >> /etc/rc.conf
    
  • Initialize the database:
    service postgresql initdb
    
  • Start PostgreSQL:
    service postgresql start
    
  • Edit the postgres config file:
    vi /usr/local/pgsql/data/postgresql.conf
    
    • And modify the following:
      listen_addresses = '*'
      
  • Edit the pg_hba config file:
    vi /usr/local/etc/pgsql/data/pg_hba.conf
    
    • And modify the following:
      # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD only
      
      # Local connections
      local   all         all                               trust
      
      # IPv4 local connections:
      host    all         all         127.0.0.1/32          trust
      
      # IPv6 local connections:
      host    all         all         ::1/128               trust
      
      # IPv4 connections:
      host    all         all         192.168.10.0/24       md5
      
      # IPv6 local connections:
      host    all         all         1234::abcd/64         md5
      
  • And wrap up by restarting the nginx and postgresql servers:
    service nginx restart
    service postgresql restart
    
  • Switch to the pgsql user:
    su pgsql
    
    • Create the wallabagdb database:
      createdb wallabagdb
      
    • Then create the wallabaguser user:
      createuser -Pl --interactive wallabaguser
      
    • Grant all privileges to wallabagdb to wallabaguser:
      psql template1
      GRANT ALL PRIVILEGES ON DATABASE "wallabagdb" to wallabaguser;
      \q
      
  • Exit from the pgsql user
    exit
    

Install PHP

  • Install PHP 5.6 and other supporting packages:
    pkg install php56 php56-session php56-ctype php56-dom php56-filter php56-hash php56-simplexml php56-json php56-gd php56-mbstring php56-xml php56-tidy php56-iconv php56-curl php56-gettext php56-tokenizer php56-pdo_pgsql php-composer
    
  • Configure the default PHP settings
    cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
    
  • Edit the php config file:
    vi /usr/local/etc/php.ini
    
    • And modify the memory limit to 2GB:
      memory_limit = 2G
      
  • Edit /usr/local/etc/php-fpm.conf:
    vi /usr/local/etc/php-fpm.conf
    
    • Make the following changes:
      listen = /var/run/php-fpm.sock
      listen.owner = www
      listen.group = www
      listen.mode = 0660
      
  • Start and enable PHP-FPM at boot:
    echo 'php_fpm_enable="YES"' >> /etc/rc.conf
    service php-fpm start
    
  • Restart nginx:
    service nginx restart
    

Install Wallabag

  • Clone the latest wallabag version from GitHub:
    cd /usr/local/www
    git clone -b v2 https://github.com/wallabag/wallabag.git
    cd wallabag
    
  • Then run the two installation commands:
    gmake install
    
    • NOTE: Make sure to NO when prompted to reset the database
  • Add a wallabag.example.com server block:
    vi /usr/local/etc/nginx/conf.d/wallabag.example.com.conf
    
    • Add the following:
      server {
          listen       80;
          server_name  wallabag.example.com;
          root         /usr/local/www/wallabag.example.com/web;
          access_log   /var/log/wallabag.example.com-access.log;
          error_log    /var/log/wallabag.example.com-error.log;
      
          location / {
              try_files $uri /app.php$is_args$args
          }
      
          # For all PHP requests, pass them on to PHP-FPM via FastCGI
          location ~ ^/app\.php(/|$) {
              fastcgi_pass unix:/var/run/php-fpm.sock;
              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
              fastcgi_param DOCUMENT_FILENAME $document_root;
              fastcgi_param PATH_INFO $fastcgi_script_name;
              include fastcgi_params;
          }
      
          # Block all other PHP files
          location ~ \.php$ {
              return 404;
          }
      }
      

Upgrading Wallabag

  • Pull the latest commit from GitHub:
    cd /usr/local/www/wallabag.example.com/
    git pull
    
  • And update the modules:
    gmake install
    

Import From v1

  • Download the exported .json file from the wallabag v1 site and copy it over to the new wallabag directory
  • Import the .json file:
    SYMFONY_ENV=prod php bin/console wallabag:import-v1 2 wallabag-export-1-2016-03-31.json
    
    • NOTE: Make sure to replace the number 2 with the proper user id number

Resources

#1

Updated by Daniel Curtis almost 8 years ago

  • Description updated (diff)
#2

Updated by Daniel Curtis almost 8 years ago

  • Description updated (diff)
#3

Updated by Daniel Curtis almost 8 years ago

  • Description updated (diff)
  • Status changed from New to Resolved
  • % Done changed from 0 to 100
#4

Updated by Daniel Curtis almost 8 years ago

  • Description updated (diff)
#5

Updated by Daniel Curtis almost 8 years ago

  • Description updated (diff)
#6

Updated by Daniel Curtis almost 8 years ago

  • Description updated (diff)
#7

Updated by Daniel Curtis almost 8 years ago

  • Status changed from Resolved to Closed
#8

Updated by Daniel Curtis over 7 years ago

  • Description updated (diff)

Also available in: Atom PDF