Install Bash 5 on Centos 7

In this guide, we want to teach you to Install the latest Bash which is 5 on Centos 7.

Bash (Bourne Again Shell) is the free and enhanced version of the Bourne shell distributed with Linux and GNU operating systems. Bash is similar to the original, but has added features such as command-line editing.

Steps To Install Bash 5 on Centos 7

to install the latest Bash, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Centos 7.

Check Centos 7 Bash Version

The first step is to check your bash version. To do this, you can use the command below:

bash --version

In your output you will see:

Output
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Install the Latest Stable Bash on Centos 7

At this point, you can follow the steps below to install the latest Bash.

First, you need to update your local package index with the following command:

sudo yum update -y

If you have kernel updates, reboot your OS:

sudo reboot

Install Development Tools

When you are logged in back to your server, use the following command to install the development packages on Centos 7:

sudo yum -y groupinstall "Development Tools"

Download Latest Bash

At this point, you need to visit the Bash Release page and get the latest release of it by using the curl command:

sudo curl -O https://ftp.gnu.org/gnu/bash/bash-5.2.15.tar.gz

When your download is completed, extract your file with the following command:

sudo tar xvf bash-5.*.tar.gz

Then, switch to your Bash directory:

cd bash-5.*/

Compile and Build Bash 5.x

At this point, you need to run the configure command from your Bash directory:

sudo ./configure

Then, install Bash by using the commands below:

# sudo make 
# sudo make install

When it is completed, logout from your session by using the command below:

logout

Finally, log in to your server again and verify your new Bash version on Centos 7:

bash --version

In your output, you should see:

Output
GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

You can now build any application that requires a Bash version higher than 4.2. 

Conclusion

At this point, you have learned to Set up or Install the Latest Bash which is 5 on Centos 7.

Hope you enjoy it. You may be like these articles:

Install OpenJDK 19 on Centos 7

Install and Use Mono on Centos 7

Add Swap on Centos 7

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!