How do I install bash shell in my Alpine Linux LXD (Linux Container) virtual machine (VM)?
Alpine Linux comes with BusyBox. It is described as, “The Swiss Army Knife of Embedded Linux.” BusyBox combines tiny versions of many common UNIX utilities into a single small executable including /bin/sh. By default, bash is not included with BusyBox and Alpine Linux. This page shows how to install bash shell in Alpine Linux using the apk command.
How do I install bash shell in Alpine Linux?
It is easy to have bash installed but this does not mean the symlinks to busybox are gone. The syntax is as follows with apk command # apk update # apk upgrade # apk add bash Sample outputs:
To install bash documentation, enter: # apk add bash-doc To install bash automatic command line completion install, run: # apk add bash-completion Sample session:
How to set bash as login shell
To use bash as a shell just type bash: $ bash To login to alpine Linux LXD vm from host, enter: $ lxc exec alpine-lxd-vm-name-here bash One can change root shell to bash shell using the following method: # vi /etc/passwd Find user name and the default shell such as /bin/ash:
Replace it with /bin/bash:
Customize bash shell
Here is a sample file: cat ~/.bashrc Sample outputs:
The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.