CentOS编译安装Busybox

CentOS编译安装Busybox

 

1.下载busybox

wget -N -P /opt https://busybox.net/downloads/busybox-1.31.0.tar.bz2 -C /opt

2.安装依赖包

yum -y install gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel zlib-devel libmcrypt-devel glibc-static ncurses-devel

3.加压并编译安装

复制代码
# cd /opt
# tar -jxvf busybox-1.31.0.tar.bz2 &&  cd busybox-*
# make menuconfig
选择settings-->Build static binary (no shared libs)选择,保存退出
# make
# l.             //此时在此目录下多出了一个.config的文件
.config  .config.old  .indent.pro .tmp_versions

# ./busybox ls   //编译完成,测试
bin    data   etc    lib    media  opt    root   sbin   sys    usr
boot   dev    home   lib64  mnt    proc   run    srv    tmp    var

# make install
复制代码

注:使用make install后生成一个_install文件夹,里面存放各种软链接,指向为busybox,将_install移走就能使用了

问题:在Linux环境make menuconfig的时候出现一下错误。

In file included from scripts/kconfig/lxdialog/checklist.c:24:0:
scripts/kconfig/lxdialog/dialog.h:32:20: fatal error: curses.h: No such file or directory
compilation terminated.
make[1]: *** [scripts/kconfig/lxdialog/checklist.o] Error 1
make: *** [menuconfig] Error 2

解决办法:

 

红帽或者FC的安装ncurses-devel

sudo yum install ncurses-devel

Ubuntu的需要安装libncurses5-dev

sudo apt-get install libncurses5-dev

一入运维深似海,从此不见彼岸花
posted @ 2022-05-01 17:55  Janus2003  阅读(685)  评论(0编辑  收藏  举报