Compiling bash-4.1 on Ubuntu

From FVue
Jump to: navigation, search

Here's how I'm compiling bash-4.1 on Ubuntu-10.04 (Lucid Lynx), with the latest patches:


$ cd ~/src/bash
$ wget{,.sig}
$     # Import public key of bash author, Chet Ramey
$ wget -O- | gpg --import
$     # Verify signature
$ gpg bash-4.1.tar.gz.sig
$     # Download and verify patches and signatures
$ for i in {1..999}; do
>     wget$(printf "%03d" $i){,.sig} || break
>     gpg bash41-$(printf "%03d" $i).sig || exit
> done
$     # Untar bash
$ tar xvzf bash-4.1.tar.gz
$     # Apply patches
$ cd bash-4.1
$ cat ../bash41-??? | patch -p0

If it's the first time you're compiling, you might need these additional packages:

sudo apt-get install bison    # For yacc
sudo apt-get install texinfo  # For makeinfo


Choose if you want to:

  1. Replace the current version of bash
  2. Install alongside the current version of bash

Replace current version of bash

$     # Compile
$ ./configure
$ make
$ sudo checkinstall
$     # If /bin/bash is gone, symlink it to /usr/local/bin/bash
$ [ -f /bin/bash ] || sudo ln -s /usr/local/bin/bash /bin/bash

Bash is now installed as /usr/local/bin/bash.

Install alongside current version of bash

$     # Compile
$ ./configure --prefix=/opt/bash-4
$ make
$ make install

Bash is now installed as /opt/bash-4/bin/bash.

See also

Installing bash 4.0 alongside bash 3.x
How to install bash-4 into a separate directory /opt/bash-4/bin/bash
Download Page for bash_3.2-5ubuntu1_i386.deb on Intel x86 machines
In case something goes wrong, here you can download the original bash-package and install it with sudo dpkg -i <package>



If you receive warnings like this:

configure:1924: error: C compiler cannot create executables
configure: exit 77

Make sure you have the latest version of the compiler installed:

sudo apt-get install libc6-dev g++ gcc


blog comments powered by Disqus