Install and Use supervisor on Ubuntu 24.04

By Raman Kumar

Updated on Jun 09, 2025

In this tutorial, we'll learn how to install and use supervisor on Ubuntu 24.04 server to manage process.

Managing background processes efficiently is essential for any stable Linux server environment—especially if you’re running multiple web applications, APIs, or custom daemons. As a web hosting provider, you often need a reliable way to keep services alive, auto-restart them if they crash, and control them without relying on screen or nohup.

That’s where Supervisor comes in—a lightweight yet powerful process control system that lets you monitor and manage background services like Gunicorn, Celery, Node.js apps, Laravel queues, and more.

In this guide, you’ll learn how to install, configure, and use Supervisor on Ubuntu to manage your services like a pro.

🛠 What is Supervisor?

Supervisor is a Python-based process control system that allows you to run and monitor processes in the background. Unlike systemd, which is tied closely to your OS, Supervisor is user-space driven and easier to configure on a per-project basis—perfect for developers and hosting providers.

Key features:

  • Automatically restart processes on failure
  • Simple configuration files
  • Log stdout and stderr output
  • Web UI and CLI for management
  • Works great with Python, PHP, Node.js, and more

Prerequisites

Before starting, make sure our new Ubuntu server is ready. The following components should be installed and configured:

Install and Use supervisor on Ubuntu Server

✅ Step 1: Install Supervisor on Ubuntu

Ubuntu's default package manager makes installing Supervisor simple.

sudo apt update
sudo apt install supervisor -y

After installation, the Supervisor service should start automatically.

Check its status:

sudo systemctl status supervisor

If it's not running, start it:

sudo systemctl start supervisor

Enable it on boot:

sudo systemctl enable supervisor

📁 Step 2: Understand Supervisor's File Structure

By default, Supervisor stores its configuration files in:

Main config: /etc/supervisor/supervisord.conf
Program configs: /etc/supervisor/conf.d/

Each service (program) you want to monitor will have its own .conf file inside /etc/supervisor/conf.d/.

Supervisor will read all .conf files in that directory and manage the processes accordingly.

⚙️ Step 3: Create a Supervisor Config for a Sample App

Let’s say you have a Python app or Node.js server script located at:

/var/www/myapp/app.py

Here’s how to create a Supervisor config to run and manage this app.

Create a new file:

sudo nano /etc/supervisor/conf.d/myapp.conf

Add the following content:

[program:myapp]
command=python3 /var/www/myapp/app.py
directory=/var/www/myapp
autostart=true
autorestart=true
stderr_logfile=/var/log/myapp.err.log
stdout_logfile=/var/log/myapp.out.log
user=www-data
environment=ENVIRONMENT="production",PORT="8000"

Explanation of Key Options:

  • command: The command to start your app
  • directory: Directory to run the command from
  • autostart: Start on Supervisor startup
  • autorestart: Restart if the process exits unexpectedly
  • user: System user to run the process
  • environment: Optional ENV variables
  • stderr_logfile & stdout_logfile: Log output paths

Save and exit the file.

🔄 Step 4: Reload Supervisor and Start the Process

Once your config file is in place:

Update Supervisor to recognize the new config:

sudo supervisorctl reread
sudo supervisorctl update

Then, start your new service:

sudo supervisorctl start myapp

You can check its status:

sudo supervisorctl status myapp

To stop it:

sudo supervisorctl stop myapp

To restart:

sudo supervisorctl restart myapp

📊 Step 5: Tail the Logs

Logs help with debugging and tracking performance.

To see stdout:

tail -f /var/log/myapp.out.log

To see stderr (errors):

tail -f /var/log/myapp.err.log

This logging is extremely helpful for troubleshooting when apps crash or misbehave.

🌐 Optional: Enable Supervisor Web Interface

Supervisor also has a built-in Web UI.

Edit the main config:

sudo nano /etc/supervisor/supervisord.conf

Add the following at the bottom if it doesn’t exist:

[inet_http_server]
port=*:9001
username=admin
password=securepass

Restart Supervisor:

sudo systemctl restart supervisor

Open your browser and go to:

http://your-server-ip:9001

Login with the username and password you set.

⚠️ Security Tip: Never expose this interface to the public without using a firewall or reverse proxy with authentication.

🧼 Common Troubleshooting

Error: no such file or command not found
→ Ensure absolute paths are used in the command and directory fields.

App crashes instantly
→ Check stderr_logfile for stack traces or misconfigured environment variables.

Supervisor not starting new configs
→ Run: sudo supervisorctl reread && sudo supervisorctl update

✅ Wrapping Up

In this tutorial, we've learnt how to install and use supervisor on Ubuntu 24.04 server to manage process. Supervisor is a powerful ally in the Linux ecosystem. It gives you control, reliability, and visibility over your background processes—without the overhead of systemd units or manual interventions.

For developers, sysadmins, or hosting providers managing multiple services across various stacks, Supervisor is a practical and efficient choice for ensuring uptime.

Use it to your advantage, and you’ll have one less thing to worry about when scaling your hosting business or deploying client applications.

If you're managing hosting for clients, integrating Supervisor into your standard deployment workflow can save hours of debugging and ensure peace of mind for long-term reliability.