loading...
Cover image for Installing Forem on Ubuntu 18.04 (Part 1 - Ruby on Rails)

Installing Forem on Ubuntu 18.04 (Part 1 - Ruby on Rails)

avalerionv profile image Dawood Khan Masood Updated on ・2 min read

I am new to Forem so expect me to make mistakes. I am only writing this article so it could help newbies like me in the future. If there is anything you would like me to change, please comment. :)

This guide will be divided into series of articles so it is easier for me to make corrections. In case if you want to install Forem using Docker follow this guide by Akhil Naidu.

Alt text is cancer

Installing Ruby Version Manager (rbenv)

Ruby relies on several packages which you can install through your package manager. Once those are installed, you can install rbenv and use it to install Ruby.

$ sudo apt update
$ sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev -y

Next step is to clone 'rbenv' from the source repository into "~/.rbenv" and add it to path.

$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ source ~/.bashrc

To verify rbenv is installed run the following command:

$ type rbenv

This will be the output:

rbenv is a function
rbenv ()
{
    local command;
    command="${1:-}";
    if [ "$#" -gt 0 ]; then
        shift;
    fi;
    case "$command" in
        rehash | shell)
            eval "$(rbenv "sh-$command" "$@")"
        ;;
        *)
            command rbenv "$command" "$@"
        ;;
    esac
}

To install ruby-build plugin run the following command:

$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

You have both rbenv and ruby-build installed. Good job!

Installing Ruby

Now as per the requirement of Forem, you will need to install Ruby version 2.7.1.

$ rbenv install 2.7.1

Once it’s done installing, set it as your default version.

$ rbenv global 2.7.1

Verify Ruby is installed by running the following command:

$ ruby -v

The output will be something like this:

ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]

Discussion

markdown guide
 

Thank you for writing this guide. Were you able to deploy this software on a domain of yours individually? If yes, please share the URL. I have been trying to deploy the software but I always hit a snag despite following all the steps.

 

What seems to be the problem? I was able to host the software on a seperate server with no issue. I will be migrating from Ghost to Forem on my original website (hackhex.com) within few days. When it is ready, I will let you know.

In the meantime follow the exact steps in this guide and let me know if there's any problem. :)

 

I feel I'm near. I'm trying Passenger + NGINX for the production deployment. I've spent a couple of hours and here are my latest errors in NGINX logs:

The client either needs a valid 'client_id'/'client_secret' pair or an 'access_token'! (ArgumentError)

And I feel this error is caused by missing env values. I'll get all the needed API keys tomorrow and I'll try once more. I feel I'll be able to deploy it.

 

I spent a couple of hours and I feel I'm close. I am trying Passenger + NGINX and here is the latest error. I've fixed other errors related to the database and so on and now I feel I just need to provide all the needed credentials in env file:

The client either needs a valid 'client_id'/'client_secret' pair or an 'access_token'! (ArgumentError)

I'll get all the needed API keys tomorrow and I'll give it a try. I feel I'll be able to deploy it in production mode tomorrow :) I'll keep you posted.

That's wonderful news! Keep me updated with your progress. :)

 

Thank you :) Previously, I followed the docker instructions. I gave the official documentation a try again today and it worked like a charm. I didn't face any issues installing the development environment on an Ubuntu VM from AWS. Now looking to deploy it using NGINX. I feel I'll hit snags and I'll visit your tutorials to see how you deal with the live deployment of the web app.

 

Hey Dawood, so I successfully deployed Forem in production mode. Thank you so much. @jdoss also helped me a lot. I'll share the URL of the community here once I complete the remaining stuff.

 

Awesome! Sorry for not being able to reply to your previous comments about the "client_id" and "client_secret" warning. For some reason Forem was having issue with the cache so no notifications or updates were being shown. I am sure you figured it out by now. Forem requires OAuth for production environment, hence the warning was shown.

 

Hey, I really like to know how you used Passenger + Nginx to have a production in your VPS. I would like to check it in my own VPS. If possible guide me through it.

 

Hello @akhil , sorry for replying late. Although I've deployed it in production mode at rehmat.works but I still don't feel confident. I'd rather wait for a final (and production-ready) release of Forem before starting using the CMS to manage content. To get this working with NGINX and Passenger, you need to build NGINX using Passenger. The guide is available at Passenger official website. The important thing to keep in mind is that you need to set all environmental variables for Passenger in NGINX configuration otherwise Forem will crash. If you need any specific help, I can post the NGINX configuration file here.