Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. Bash also incorporates useful features from the Korn and C shells (ksh and csh). This tutorial will show Linux users how to install Bash 5.1 on CentOS 7.

The version of Bash available on a CentOS 7|RHEL 7 Linux machine is 4.2. This can be confirmed by running the command bash –version in the terminal.

$ bash --version
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 Bash 5.2 on CentOS 7|RHEL 7

As of this article update the latest stable release of Bash is 5. This release is not available in default upstream repositories. We’ll need to build it from source.

Step 1: Update System

Update your CentOS 7 machine.

sudo yum -y update

If you have kernel updates reboot the OS.

sudo reboot

Step 2: Install Development tools

Install Developer tools on CentOS / RHEL 7 system.

sudo yum -y install curl
sudo yum -y groupinstall "Development Tools"

Download latest stable release of Bash 5.x tar file.

curl -O http://ftp.gnu.org/gnu/bash/bash-5.2.tar.gz

Step 3: Install Bash 5.x on CentOS 7|RHEL 7

Extract downloaded archive.

tar xvf bash-5.*.tar.gz

Configure

cd bash-5.*/
./configure

Confirm there is no error in the command execution output:

.....
config.status: creating Makefile
config.status: creating builtins/Makefile
config.status: creating lib/readline/Makefile
config.status: creating lib/glob/Makefile
config.status: creating lib/intl/Makefile
config.status: creating lib/malloc/Makefile
config.status: creating lib/sh/Makefile
config.status: creating lib/termcap/Makefile
config.status: creating lib/tilde/Makefile
config.status: creating doc/Makefile
config.status: creating support/Makefile
config.status: creating po/Makefile.in
config.status: creating examples/loadables/Makefile
config.status: creating examples/loadables/Makefile.inc
config.status: creating examples/loadables/perl/Makefile
config.status: creating support/bash.pc
config.status: creating support/bashbug.sh
config.status: creating config.h
config.status: executing default-1 commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
config.status: executing default commands

Install Bash 5 on CentOS 7 / RHEL 7 by running the commands below:

make
sudo make install

Logout of your current session:

$ logout

Login and confirm current version of Bash on CentOS 7:

$ bash --version
GNU bash, version 5.2.0(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 Bash version higher than 4.2. We hope this guide was helpful to you.

Other guides:

LEAVE A REPLY

Please enter your comment!
Please enter your name here