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.
Alpine Linux附带BusyBox。 它被描述为“嵌入式Linux的瑞士军刀。”BusyBox将许多常见UNIX实用程序的微小版本组合成一个小的可执行文件,包括/ bin/sh,但是默认情况下,BusyBox和Alpine Linux不包含bash,我们需要执行安装来使用。
Alpine Linux附带BusyBox。 它被描述为“嵌入式Linux的瑞士军刀。”BusyBox将许多常见UNIX实用程序的微小版本组合成一个小的可执行文件,包括/ bin/sh,但是默认情况下,BusyBox和Alpine Linux不包含bash,我们需要执行安装来使用。
安装:
安装bash很容易,但是在安装前我们需要更新下我们当前系统,语法是:
apk update
apk upgrade
apk upgrade
然后执行安装:
apk add --no-cache bash
提示如下:
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/5) Installing ncurses-terminfo-base (6.1-r0)
(2/5) Installing ncurses-terminfo (6.1-r0)
(3/5) Installing ncurses-libs (6.1-r0)
(4/5) Installing readline (7.0.003-r0)
(5/5) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
Executing busybox-1.28.4-r1.trigger
OK: 21 MiB in 35 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/5) Installing ncurses-terminfo-base (6.1-r0)
(2/5) Installing ncurses-terminfo (6.1-r0)
(3/5) Installing ncurses-libs (6.1-r0)
(4/5) Installing readline (7.0.003-r0)
(5/5) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
Executing busybox-1.28.4-r1.trigger
OK: 21 MiB in 35 packages
安装完成后需要安装bash文档:
apk add bash-doc
如果需要安装bash自动命令行:
apk add bash-completion
改变当前环境为bash执行:
bash
改变root用户默认环境ash到bash:
vi /etc/passwd
root:x:0:0:root:/root:/bin/ash //ash改为bash即可
root:x:0:0:root:/root:/bin/ash //ash改为bash即可