CentOSLinuxTutorials

How To Install Phoenix Framework on CentOS 7

Install Phoenix Framework on CentOS 7

In this tutorial, we will show you how to install Phoenix Framework on your CentOS 7 server. For those of you who didn’t know, For those of you who didn’t know, Phoenix is an emerging Elixir-based web development framework. It is intended to supply high development productivity, rich features, and strong runtime functionality.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Phoenix Framework on a CentOS 7.

Prerequisites

  • A server running one of the following operating systems: CentOS 7.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Phoenix Framework on CentOS 7

Step 1. First, let’s start by ensuring your system is up-to-date.

yum clean all
yum -y install epel-release
yum -y update

Step 2. Installing Required Packages.

Install the necessary packages:

yum install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel wxBase.x86_64

Step 3. Installing Erlang.

First, Add the Erlang official repository to install the latest Erlang:

wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm

Install Erlang using the command:

yum update
yum install erlang

Verify whether Erlang is installed or not by using the following command:

erl

Step 3. Installing Elixir.

First, Git clone to the Elixir repository:

git clone https://github.com/elixir-lang/elixir.git

Next, Go to the elixir directory:

cd elixir/
make clean test

Now, It is highly recommended to add Elixir’s bin path to your PATH environment variable:

export PATH="$PATH:/root/elixir/bin"

Verify whether Elixir is installed or not by using the following command:

iex

Step 4. Installing Phoenix Framework.

Use the following command to install Phoenix:

mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

Step 5. Installing PostgreSQL.

You can install PostgreSQL using YUM:

yum install -y postgresql-server
postgresql-setup initdb

Start the PostgreSQL service:

systemctl start postgresql.service
systemctl enable postgresql.service

Set a password for the default PostgreSQL user “postgres”:

sudo -u postgres psql

Setup the database user authentication method:

nano /var/lib/pgsql/data/pg_hba.conf

Find the following section:

# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident

Modify the authentication method of IPv4 local connections to md5:

# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all

Restart the PostgreSQL service to take effect:

systemctl restart postgresql.service

Step 6. Installing Inotify-tools.

Use the following command to install a required component “inotify-tools“:

yum install inotify-tools

Step 7. Create a Phoenix application.

Assume that you want to create a Phoenix application in the directory ~/idroot_project_1:

mix phoenix.new ~/idroot_project_1

This command will create the application directory ~/idroot_project_1 for you. Get into the directory and create a database:

cd ~/idroot_project_1
mix ecto.create

Fire up your application with the following command:

mix phoenix.server

Step 8. Accessing Phoenix Framework.

Phoenix Framework will be available on HTTP port 4000 by default. Open your favorite browser and navigate to http://your-domain.com:4000/ or http://your-server-ip:4000 and complete the required steps to finish the installation.

Congratulations! You have successfully installed Phoenix Framework. Thanks for using this tutorial for installing Phoenix Framework on CentOS 7 systems. For additional help or useful information, we recommend you to check the official Phoenix Framework website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button