Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Distribution dependent package installation script
I’ve been searching the webs for a solution to my issue and have not come across something solid that works for me. Any help is appreciated.
I would like to install a package (In this case openconnect) using a script that will install it on any linux distribution depending on the OS type.
I know in Debian derivatives I can issue
apt-get install openconnect
I know in RHEL derivatives I can issue
yum install openconnect
In Fedora I can issue
dnf install openconnect
However, I’d like my script to identify the distribution it is running on and use the appropriate package management tool to install it. I do not want my script to work on every distribution, just Debian, Kali, Ubuntu, Fedora, and CentOS.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×