Docs / Programming & Development / Setting Up Elixir and Phoenix Framework

Setting Up Elixir and Phoenix Framework

By Admin · Apr 6, 2026 · Updated Apr 23, 2026 · 3 views · 4 min read

Setting Up Elixir and Phoenix Framework is a common requirement for VPS administrators. This guide provides practical instructions that you can follow on Ubuntu 22.04/24.04 or Debian 12, though most steps apply to other distributions as well.

Prerequisites

  • A VPS running Ubuntu 22.04 or later (2GB+ RAM recommended)
  • Git installed on the server
  • The relevant programming language runtime installed
  • Basic familiarity with the Linux command line
  • Root or sudo access to the server

Environment Setup

After applying these changes, monitor the server's resource usage for at least 24 hours to ensure stability. Tools like htop, iostat, and vmstat can provide real-time insights into system performance.


# Set up the development environment
sudo apt update
sudo apt install -y build-essential curl git

# Install the runtime
curl -fsSL https://get.elixir.org | bash
elixir --version

Make sure to restart the service after applying these changes. Some settings require a full restart rather than a reload to take effect.

Advanced Settings

It's recommended to test this configuration in a staging environment before deploying to production. This helps identify potential compatibility issues and allows you to benchmark performance differences.

Project Configuration

It's recommended to test this configuration in a staging environment before deploying to production. This helps identify potential compatibility issues and allows you to benchmark performance differences.


# Create a systemd service for the application
sudo tee /etc/systemd/system/myapp.service << 'EOF'
[Unit]
Description=My Application
After=network.target

[Service]
User=deploy
WorkingDirectory=/opt/myapp
ExecStart=/usr/bin/elixir /opt/myapp/server.js
Restart=always
Environment=NODE_ENV=production
Environment=PORT=3000

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable myapp
sudo systemctl start myapp

These commands should be run as root or with sudo privileges. If you're using a non-root user, prefix each command with sudo.

  • Review log files weekly for anomalies
  • Keep your system packages updated regularly
  • Monitor disk space usage and set up alerts
  • Test your backup restore procedure monthly
  • Enable automatic security updates for critical patches

Deployment Process

The phoenix component plays a crucial role in the overall architecture. Understanding how it interacts with elixir will help you make better configuration decisions.


# Set up the development environment
sudo apt update
sudo apt install -y build-essential curl git

# Install the runtime
curl -fsSL https://get.elixir.org | bash
elixir --version

These commands should be run as root or with sudo privileges. If you're using a non-root user, prefix each command with sudo.

Important Notes

Regular maintenance is essential for keeping your elixir installation running smoothly. Schedule periodic reviews of log files, disk usage, and security updates to prevent issues before they occur.

  • Use SSH keys instead of password authentication
  • Enable firewall and allow only necessary ports
  • Keep all software components up to date
  • Use strong, unique passwords for all services

Process Management

Security should be a primary consideration when configuring elixir. Always use strong passwords, keep software updated, and restrict network access to only the necessary ports and IP addresses.


# Create a systemd service for the application
sudo tee /etc/systemd/system/myapp.service << 'EOF'
[Unit]
Description=My Application
After=network.target

[Service]
User=deploy
WorkingDirectory=/opt/myapp
ExecStart=/usr/bin/elixir /opt/myapp/server.js
Restart=always
Environment=NODE_ENV=production
Environment=PORT=3000

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable myapp
sudo systemctl start myapp

Make sure to restart the service after applying these changes. Some settings require a full restart rather than a reload to take effect.

Wrapping Up

Following this guide, your elixir setup should be production-ready. Keep an eye on resource usage as your traffic grows and don't forget to test your backup and recovery procedures periodically.

Was this article helpful?