How to Install Publify on Debian

Publify is a blogging platform that makes it easy to create and publish content online. In this tutorial, we'll walk you through the steps to install Publify on Debian.

Prerequisites

Before installing Publify, you'll need to make sure that your server meets the following requirements:

Note: If you don't have Ruby, MySQL, PostgreSQL or Git installed on your system, you can install them easily via the package manager.

Step 1: Install Required Packages

First, you need to install the packages required for Publify. Run the following command to install these packages:

sudo apt-get update
sudo apt-get install ruby ruby-dev ruby-bundler build-essential libmysqlclient-dev mysql-server imagemagick

Step 2: Install Node.js and Yarn

Publify requires Node.js and Yarn to be installed on your system. You can install Node.js and Yarn by running the following commands:

curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
sudo apt-get install -y nodejs
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install -y yarn

Step 3: Clone Publify Repository

Next, you need to clone Publify's Git repository. Run the following command to clone the repository into the publify directory on your Debian system:

sudo git clone https://github.com/publify/publify.git publify

Step 4: Install Bundler

Publify uses Bundler to manage its dependencies. Use the following command to install Bundler:

sudo gem install bundler

Step 5: Install Publify Dependencies

Change your working directory to the Publify directory and run the following command to install Publify's dependencies:

cd publify
sudo bundle install --without development test --path vendor/bundle

Step 6: Configure Database

Publify supports both MySQL and PostgreSQL databases. Choose the database that you prefer and create a new database and user with sufficient privileges.

For MySQL:

CREATE DATABASE publify CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'publifyuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON publify.* TO 'publifyuser'@'localhost';
FLUSH PRIVILEGES;

For PostgreSQL:

CREATE DATABASE publify WITH ENCODING='UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8';
CREATE USER publifyuser WITH PASSWORD 'yourpassword';
GRANT ALL PRIVILEGES ON DATABASE publify TO publifyuser;

Copy the default database configuration file:

cp config/database.yml.example config/database.yml

Modify it with the connection information for your database. Be sure to comment out the driver line that you are not using (MySQL or PostgreSQL):

production:
  adapter: mysql2 # comment out if using PostgreSQL
  host: localhost
  username: publifyuser
  password: yourpassword
  database: publify
  port: 3306 # comment out if using PostgreSQL
  # adapter: postgresql # Uncomment if using PostgreSQL
  # encoding: unicode
  # pool: 5
  # username: publifyuser
  # password: yourpassword
  # host: localhost
  # port: 5432

Step 7: Create Publify Database

Use the following command to create the Publify database:

sudo bundle exec rake db:migrate RAILS_ENV=production

Step 8: Compile Assets

Compile the assets by running the following command:

sudo bundle exec rake assets:precompile RAILS_ENV=production

Step 9: Start the Publify Server

Finally, start the Publify server by running the following command:

sudo bundle exec rails server -e production -b 0.0.0.0

That's it! You've successfully installed Publify on Debian. You can now access your Publify installation by going to http://localhost:3000 in a web browser.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!