{"id":18536,"date":"2016-01-31T15:14:39","date_gmt":"2016-01-31T21:14:39","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=18536"},"modified":"2022-06-03T03:43:51","modified_gmt":"2022-06-03T08:43:51","slug":"install-publify-on-an-ubuntu-14-04","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/install-publify-on-an-ubuntu-14-04\/","title":{"rendered":"Install Publify on Ubuntu 14.04"},"content":{"rendered":"
In this tutorial, we will explain how to install Publify on an Ubuntu 14.04 VPS with MariaDB, Puma and Nginx. Publify is a simple but full featured open source web publishing software. Publify is built on Ruby on Rails framework and it is the oldest Rails open source project alive. This guide should work on other Linux VPS<\/a> systems as well but was tested and written for Ubuntu 14.04 VPS<\/a>. When the installation is complete, run the following command to secure your installation:<\/p>\n Next, we need to create a database for our Publify installation:<\/p>\n Create a new system user for Publify.<\/p>\n The following commands are run as publify user.<\/p>\n To start using RVM run the following command:<\/p>\n To verify everything is done correctly, use the command Clone the latest release of Publify from github using the following command:<\/p>\n Copy database.yml.mysql as database.yml<\/p>\n Open the Create a new Puma configuration file.<\/p>\n Install Gems<\/p>\n Prepare the database and compile the assets<\/p>\n You can now start your Publify service with :<\/p>\n The latest version of Nginx 1.8 is not available via the default Ubuntu repositories, so we will add the “nginx\/stable” PPA, update the system and install the nginx package.<\/p>\n Create a new Nginx server block with the following content<\/p>\n Activate the server block by creating a symbolic link and restart Nginx:<\/p>\n That’s it. You have successfully installed Publify on your Ubuntu VPS<\/a>. For more information about Publify, please refer to the Publify website.<\/p>\n Of course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting<\/a> 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.<\/p>\n PS<\/span><\/strong>. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" In this tutorial, we will explain how to install Publify on an Ubuntu 14.04 VPS with MariaDB, Puma and Nginx. … <\/p>\n
\n<\/p>\nLogin to your VPS via SSH<\/h4>\n
ssh user@vps<\/pre>\n
Update the system and install necessary packages<\/h4>\n
[user]# sudo apt-get update && sudo apt-get -y upgrade\r\n[user]# sudo apt-get install software-properties-common imagemagick build-essential git openssl nano<\/pre>\n
Install MariaDB 10.1<\/h4>\n
[user]# sudo apt-key adv --recv-keys --keyserver hkp:\/\/keyserver.ubuntu.com:80 0xcbcb082a1bb943db\r\n[user]# sudo add-apt-repository 'deb [arch=amd64,i386] http:\/\/mirrors.accretive-networks.net\/mariadb\/repo\/10.1\/ubuntu trusty main'\r\n[user]# sudo apt-get update\r\n[user]# sudo apt-get install mariadb-server libmariadbclient-dev<\/pre>\n
[user]# sudo mysql_secure_installation<\/pre>\n
[user]# mysql -uroot -p \r\nMariaDB [(none)]> CREATE DATABASE publify CHARACTER SET utf8; \r\nMariaDB [(none)]> GRANT ALL PRIVILEGES ON publify.* TO 'publify'@'localhost' IDENTIFIED BY 'publify_passwd'; \r\nMariaDB [(none)]> FLUSH PRIVILEGES; \r\nMariaDB [(none)]> \\q<\/pre>\n
Publify user<\/h4>\n
[user]# sudo adduser --home \/opt\/publify --shell \/bin\/bash --gecos 'Publify publishing software' publify\r\n[user]# sudo install -d -m 755 -o publify -g publify \/opt\/publify\r\n[user]# sudo usermod -a -G sudo publify\r\n[user]# sudo su - publify\r\n<\/pre>\n
Install Ruby using RVM<\/h4>\n
[publify]# cd\r\n[publify]# curl -sSL https:\/\/rvm.io\/mpapis.asc | gpg --import -\r\n[publify]# curl -sSL https:\/\/get.rvm.io | bash -s stable --ruby\r\n[publify]# rvm install ruby-2.1.5<\/pre>\n
[publify]# source ~\/.rvm\/scripts\/rvm<\/pre>\n
ruby --version<\/code>.
\nThe output should be similar to the following:<\/p>\n[publify]# ruby --version\r\nruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]<\/pre>\n
Install Publify<\/h4>\n
[publify]# cd && git clone https:\/\/github.com\/publify\/publify.git<\/pre>\n
[publify]# git checkout v8.2.0<\/pre>\n
[publify]# cp ~\/publify\/config\/database.yml.mysql ~\/publify\/config\/database.yml<\/pre>\n
database.yml<\/code> file and update username\/password<\/p>\n
[publify]# vim ~\/publify\/config\/database.yml<\/pre>\n
production:\r\nlogin: &login\r\n adapter: mysql2\r\n host: localhost\r\n username: publify\r\n password: publify_passwd\r\n<\/pre>\n
[publify]# nano ~\/publify\/config\/puma.rb<\/pre>\n
#!\/usr\/bin\/env puma\r\n\r\napplication_path = '\/opt\/publify\/publify'\r\ndirectory application_path\r\nenvironment 'production'\r\ndaemonize true\r\npidfile \"#{application_path}\/tmp\/pids\/puma.pid\"\r\nstate_path \"#{application_path}\/tmp\/pids\/puma.state\"\r\nstdout_redirect \"#{application_path}\/log\/puma.stdout.log\", \"#{application_path}\/log\/puma.stderr.log\"\r\nbind \"unix:\/\/#{application_path}\/tmp\/sockets\/publify.sock\"<\/pre>\n
[publify]# mkdir -p ~\/publify\/tmp\/{pids,log,sockets}<\/pre>\n
[publify]# cd ~\/publify\r\n[publify]# echo \"gem 'puma'\" >> Gemfile\r\n[publify]# echo \"gem: --no-ri --no-rdoc\" >> ~\/.gemrc \r\n[publify]# RAILS_ENV=production bundle install --without development test postgresql sqlite<\/pre>\n
[publify]# RAILS_ENV=production rake db:setup\r\n[publify]# RAILS_ENV=production rake db:migrate\r\n[publify]# RAILS_ENV=production rake db:seed\r\n[publify]# RAILS_ENV=production rake assets:precompile<\/pre>\n
Create an Upstart script<\/h4>\n
[publify]# sudo nano \/etc\/init\/publify.conf<\/pre>\n
description \"Puma Publify Service\"\r\n \r\nstart on filesystem or runlevel [2345]\r\nstop on runlevel [!2345]\r\n \r\nsetuid publify\r\nsetgid publify\r\n \r\nrespawn\r\nrespawn limit 3 30\r\n\r\nscript\r\nexec \/bin\/bash << EOT\r\nsource \/opt\/publify\/.rvm\/scripts\/rvm\r\ncd \/opt\/publify\/publify\r\nexec puma -C config\/puma.rb\r\nEOT\r\nend script\r\n<\/pre>\n
[publify]# sudo service publify start<\/pre>\n
Install and Configure Nginx<\/h4>\n
[user]$ sudo add-apt-repository ppa:nginx\/stable\r\n[user]$ sudo apt-get update\r\n[user]$ sudo apt-get install nginx<\/pre>\n
[publify]# sudo nano \/etc\/nginx\/sites-available\/publify.domain.com<\/pre>\n
upstream publify {\r\n server unix:\/opt\/publify\/publify\/tmp\/sockets\/publify.sock;\r\n}\r\n\r\nserver {\r\n server_name publify.domain.com;\r\n root \/opt\/publify\/publify;\r\n\r\n location \/ {\r\n try_files $uri @ruby;\r\n }\r\n\r\n location @ruby {\r\n proxy_set_header X-Real-IP $remote_addr;\r\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n proxy_set_header Host $http_host;\r\n proxy_redirect off;\r\n proxy_read_timeout 300;\r\n proxy_pass http:\/\/publify;\r\n }\r\n}\r\n<\/pre>\n
[user]# sudo ln -s \/etc\/nginx\/sites-available\/publify.domain.com \/etc\/nginx\/sites-enabled\/publify.domain.com\r\n[user]# sudo service nginx restart\r\n<\/pre>\n
\n