Installing Supervisor On Amazon Linux 2023

Hafiq Iqmal - Oct 6 - - Dev Community

Original Article -> https://medium.com/aws-in-plain-english/installing-supervisor-on-amazon-linux-2023-697b65901457

Amazon Linux 2023 stands as a reliable choice for developers and system administrators. However, users may face a hiccup: Supervisor, is absent from the default RPM packages. This omission poses a challenge for efficiently managing and monitoring processes on Amazon Linux instances.

But fret not! This guide will walk you through the steps to effortlessly install Supervisor on Amazon Linux 2023 using Pip, ensuring smooth sailing for your process management needs.

Understanding the Challenge

AL2023 is RPM-based and includes components sourced from multiple versions of Fedora and other distributions, such as CentOS 9 Stream. The Amazon Linux kernel is sourced from the long-term support (LTS) releases directly from kernel.org, chosen independently from other distributions.

BUT, the absence of Supervisor (Refer Here) in the default package repository complicates matters for users reliant on its intuitive process management capabilities. Supervisor streamlines the task of controlling and monitoring processes, making it indispensable for system administrators and developers. Without it, overseeing complex applications and services becomes significantly more cumbersome.

Installing Supervisor on Amazon Linux 2023 with Pip:

Step 1: Prerequisites:

Before proceeding, ensure your instance has Python and Pip installed. You can verify their presence by running the following commands:



sudo dnf install python3 python3-pip


Enter fullscreen mode Exit fullscreen mode

Step 2: Install Supervisor

Once Python and Pip are available, installing Supervisor becomes a breeze. Execute the following command to install Supervisor using Pip:



sudo pip install supervisor


Enter fullscreen mode Exit fullscreen mode

Step 3: Generate Supervisor Configuration File

After installation, generate the default configuration file for Supervisor using the following command:



echo_supervisord_conf > /etc/supervisor/supervisord.conf


Enter fullscreen mode Exit fullscreen mode

Step 4: Customize Configuration (Optional)

Feel free to customize the generated configuration file according to your specific requirements. You can edit /etc/supervisor/supervisord.conf using your preferred text editor.

I would suggest to create the conf.d folder inside the /etc/supervisor/ and modify the supervisord.conf to include the folders.



[include]
files = /etc/supervisor/conf.d/*.conf


Enter fullscreen mode Exit fullscreen mode

Step 5: Start Supervisor Service

With Supervisor installed and configured, start the Supervisor service using the following command:



sudo supervisord -c /etc/supervisor/supervisord.conf


Enter fullscreen mode Exit fullscreen mode

We might want to auto start this supervisor service once reboot or on start server. Create a service called “supervisord.service”



sudo vim /usr/lib/systemd/system/supervisord.service


Enter fullscreen mode Exit fullscreen mode

and paste this script inside the file



[Unit]
Description=Process Monitoring and Control Daemon
After=rc-local.service nss-user-lookup.target

[Service]
Type=forking
ExecStart=/usr/local/bin/supervisord -c /etc/supervisor/supervisord.conf

[Install]
WantedBy=multi-user.target


Enter fullscreen mode Exit fullscreen mode

You might need to reload the daemon as it new script is created



sudo systemctl daemon-reload


Enter fullscreen mode Exit fullscreen mode

Step 6: Verify Installation

Confirm that Supervisor is up and running by checking its status:



sudo systemctl enable supervisord
sudo systemctl start supervisord
sudo systemctl status supervisord


Enter fullscreen mode Exit fullscreen mode

Sample
Now you are good to go to create your own application supervisor config.

Conclusion

While Supervisor may not come pre-packaged with Amazon Linux 2023, installing it via Pip is a simple process that enhances your ability to manage processes effectively. By following the steps outlined in this guide, you can equip your Amazon Linux instances with Supervisor, empowering you to streamline process control and monitoring. Whether you’re overseeing intricate applications or managing critical services, Supervisor on Amazon Linux 2023 ensures smooth operation in the ever-evolving landscape of cloud computing.


Thank you for reading! Don’t forget to subscribe to stay informed about the latest updates in system design and e-commerce innovations. Happy designing!

If you found this article insightful and want to stay updated with more content on system design and technology trends, be sure to follow me on :-

Twitter: https://twitter.com/hafiqdotcom
LinkedIn: https://www.linkedin.com/in/hafiq93
Buy Me Coffee: https://paypal.me/mhi9388 /
https://buymeacoffee.com/mhitech
Medium: https://medium.com/@hafiqiqmal93

. . . . .
Terabox Video Player