RedHat离线安装htop源码包
- 在htop官网下载源码包,下载地址如下(本人下载的是2.0.2):
http://hisham.hm/htop/releases/ - 用工具上传到需要安装的服务器上,本人使用的是WinSCP
- 在服务器上解压源码包:tar -zxvf htop-2.0.2.tar.gz
- 跳转到源码包目录:cd htop-2.0.2
- 生成Makefile文件并指定后续安装时的安装路径:./configure –prefix=/usr/local/htop-2.0.2/
- 编译源代码:make
- 安装:make install
- 跳转到安装的目录的bin目录:cd /usr/local/htop-2.0.2/bin
- 试运行htop:./htop
- 编辑profile文件:vi /etc/profile
- 移动到文件末尾,按Insert键进入编辑模式,增加以下内容:
export PATH=$PATH:/usr/local/htop-2.0.2/bin - 按Esc退出编辑模式,输入:wq保存并退出编辑器
- 使修改后的profile文件生效:source /etc/profile
- 查看系统当前PATH变量的值:echo $PATH
- 运行htop:htop
安装期间遇到的问题
使用configure生成Makefile文件失败,报错信息如下(只截取错误部分):
checking for addnwstr in -lncursesw6... no
checking for addnwstr in -lncursesw... no
checking for addnwstr in -lncurses... no
configure: error: You may want to use --disable-unicode or install libncursesw.
- 显示尝试configure增加–disable-unicode参数:./configure –prefix=/usr/local/htop-2.0.2/ –disable-unicode
如果出现以下报错信息,需要安装libncurses:
configure: error: missing libraries: libncurses
- libncurses的下载地址如下,安装过程可以参考这次离线安装(如果是无法连接互联网的环境):http://ftp.gnu.org/gnu/ncurses/
安装之后如果依然提示:
configure: error: You may want to use --disable-unicode or install libncursesw.
- 可以尝试步骤1增加–disable-unicode参数
总结
虽然是一次在RedHat上离线安装htop的源码包,但是其实并未使用RedHat上特有的指令,也适用于其他Linux/Unix系统上离线安装源码包。
还没有评论,来说两句吧...