How VPS - How to use/setup VPS
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System CentOS

How to Install the Phoenix Framework on CentOS 7

How VPS by How VPS
October 1, 2019
in CentOS
0
0
SHARES
14
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Using a Different System?
  2. Prerequisites
  3. Step 1: Update the system
  4. Step 2: Install Erlang
  5. Step 3: Install Elixir
  6. Step 4: Install Phoenix
  7. Step 5: Install Node.js (optional)
  8. Step 6: Install PostgreSQL
  9. Step 7: Install inotify-tools
  10. Step 8: Create a Phoenix application
  11. Want to contribute?

Using a Different System?

  • How to Install Elixir and Phoenix Framework on Ubuntu 16.04

Are we missing a guide for your target system? Request one, or submit your own!


Phoenix is an emerging Elixir-based web development framework. It is designed to provide high development productivity, rich features, and powerful runtime performance.

This tutorial will show you how to install Phoenix on a Vultr CentOS 7 server instance for development purposes.

Prerequisites

Before proceeding, I assume that you have:

  • Deployed a new Vultr CentOS 7 server instance.
  • Logged into this CentOS 7 system as a non-root sudo user.

Step 1: Update the system

sudo yum install epel-release
sudo yum update
sudo reboot

Step 2: Install Erlang

First of all, you need to install Erlang on your system. Phoenix is a framework written in the Elixir programming language, and any Elixir-based application has to be compiled to Erlang byte code before it can be executed.

cd ~
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
sudo yum install erlang

You can confirm your installation of Erlang with:

erl

This command will take you into the Erlang shell. When starting the Erlang shell, you will see the following output.

Erlang/OTP 18 [erts-7.3] [source-d2a6d81] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
1>

Press Ctrl+C twice to exit the Erlang shell.

Step 3: Install Elixir

Because the version of Elixir in the CentOS 7 system YUM repository is rather dated, you should use the official pre-compiled Elixir archive to install the latest version of Elixir.

Download and unzip the latest Elixir precompiled archive:

cd /usr/bin
sudo mkdir elixir
cd /usr/bin/elixir
sudo wget https://github.com/elixir-lang/elixir/releases/download/v1.2.5/Precompiled.zip
sudo yum install unzip
sudo unzip Precompiled.zip

Elixir is now installed on your system. You can run Elixir commands by specifying the path of each Elixir-related command, such as:

/usr/bin/elixir/bin/elixir -v

This command will tell you the version of Elixir on your system.

As a matter of convenience, you can add Elixir’s bin path (along with to-be-installed node.js bin path) to your PATH environment variable:

sudo vi /etc/profile

Append the following line to the end of the file:

export PATH="$PATH:/usr/bin/elixir/bin:/usr/bin/node-v6.1.0-linux-x64/bin"

Save and quit:

:wq

Reload the profile:

source /etc/profile

From now on, you can run an Elixir-related command without specifying its complete path, such as:

elixir -v

Now, install the Hex package manager by running the mix command in the same fashion:

cd ~
mix local.hex

Answer Y during the installation process.

Step 4: Install Phoenix

Use the following command to install Phoenix:

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

Answer Y during the installation process.

Step 5: Install Node.js (optional)

If you want to use brunch.io, the default building tool of Phoenix, to compile static assets (javascript, css, etc.), you need to install Node.js (>= 5.0.0):

cd ~
wget https://nodejs.org/dist/v6.1.0/node-v6.1.0-linux-x64.tar.xz
sudo yum install xz
xz -d node-v6.1.0-linux-x64.tar.xz
tar -xvf node-v6.1.0-linux-x64.tar
sudo mv ~/node-v6.1.0-linux-x64 /usr/bin/

Remember, the Node.js path was added into the PATH environment variable in step 3. You can test the Node.js installation with this command:

node -v

Step 6: Install PostgreSQL

By default, Phoenix uses PostgreSQL to configure applications. On CentOS 7, You can install PostgreSQL using YUM:

sudo yum install -y postgresql-server
sudo postgresql-setup initdb

Start the postgresql service:

sudo systemctl start postgresql.service
sudo systemctl enable postgresql.service

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

sudo -u postgres psql

In the PostgreSQL shell (after the prompt turns into postgres=#), set a password for “postgres”:

/password postgres

Enter the password postgres twice, which is the preferred one of Phoenix.

Finally, use the following command to quit the PostgreSQL shell.

/q

Setup the database user authentication method:

sudo vi /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             all             ::1/128                 md5

Save and quit:

:wq

Restart the postgresql service:

sudo systemctl restart postgresql.service

Step 7: Install inotify-tools

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

sudo yum install inotify-tools

Step 8: Create a Phoenix application

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

mix phoenix.new ~/phoenix_project_1

Answer Y during the process to fetch and install dependencies.

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

cd ~/phoenix_project_1
mix ecto.create

Answer Y to install “rebar” during the first database creation.

Fire up your application with the following command:

mix phoenix.server

While keeping the current SSH connection alive, initiate another SSH connection and modify the firewall rules to grant access to your application:

sudo firewall-cmd --zone=public --permanent --add-port=4000/tcp
sudo firewall-cmd --reload

Finally, use a web browser to visit your application from:

http://[your-server-IP]:4000

That concludes our tutorial. Welcome to Phoenix!

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
How VPS

How VPS

Related Posts

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Install BoltWire CMS on CentOS 7
CentOS

How to Install BoltWire CMS on CentOS 7

February 14, 2020
Showterm.io – A Terminal/Shell Recording, Upload and Share Tool for Linux
CentOS

Setup HTTP Authentication With Nginx on CentOS 7

February 14, 2020
Next Post

How to Install and Configure OTRS on CentOS 7

How to Install Cuberite on a CentOS 6 or 7 Server

How to Add a CentOS 7 Sensu Client

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Follow Us

  • 121 Followers
  • 87.2k Followers

Recommended

How to Install NodeBB forum on Fedora 28

3 years ago

How to Install phpRedisAdmin on CentOS 7

3 years ago
How-to: Install LAMP stack on your Linux VPS

How-to: Install LAMP stack on your Linux VPS

4 years ago

Setting Up A Half Life 2 Server On CentOS 6

3 years ago

Instagram

    Please install/update and activate JNews Instagram plugin.

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

Topics

Apache Web Server Bluehost Review 2019 Bluehost Review 2020 Bluehost Review 2021 Centmin Mod CentminMod centos install htop fsck htop install HTTP DoS attack Install Snort on an Ubuntu install Zabbix on CentOS install Zabbix on CentOS 7 Linux Commands linux guide linux install htop linux vps setup guide MariaDB MariaDB Error Mysql mysqld error optimize MariaDB optimize Mysql snort Ubuntu
No Result
View All Result

Highlights

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Webmin Reviews

Virtualmin Reviews

CentOS Web Panel Reviews

Ajenti Reviews

ISPConfig Reviews

Trending

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

by How VPS
February 25, 2022
0

I tried to update some extensions by use yum on centOs which I specified in Dockerfile. After...

How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020
Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

February 17, 2020
Webmin Reviews

Webmin Reviews

February 17, 2020
How VPS – How to use/setup VPS

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Visit our landing page to see all features & demos.
LEARN MORE »

Recent News

  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8 February 25, 2022
  • How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”? November 17, 2020
  • How to optimize Mysql or MariaDB November 3, 2020

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

[mc4wp_form]

© 2018 JNews - City News Magazine WordPress theme. All rights belong to their respective owners.
JNews is a top selling 2018 WordPress News, Blog, Newspaper & Magazine Theme.

No Result
View All Result
  • Home

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.