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.0 on CentOS 7.

The version of Bash available on a CentOS 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 

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

As of this article update the latest stable release of Bash is 5.0. 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 on CentOS 7

Install Developer tools on CentOS 7.

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

Download Bash 5.0 tar file.

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

Step 3: Install Bash 5.0 on CentOS 7

Extract downloaded archive.

tar xvf bash-5.0.tar.gz

Configure

cd bash-5.0
./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
[[email protected] bash-5.0]# 

Install Bash 5.0 on CentOS 7:

make
sudo make install

Confirm current version of Bash on CentOS 7:

$ bash --version
GNU bash, version 5.0.0(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3 : GNU GPL version 3 or later 

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.

Other guides:

Install git 2 on CentOS 7

Install Python 3.8 on CentOS 7