Linux源码安装软件流程_make与configure实战说明【教学】

admin 百科 19
Linux源码安装软件的核心流程是configure→make→make install:configure探测系统环境生成定制Makefile,make依据Makefile编译源码,make install将编译结果部署到指定路径。

Linux源码安装软件流程_make与configure实战说明【教学】-第1张图片-佛山资讯网

Linux源码安装软件,核心就是 configure → make → make install 这三步。它不像包管理器(如 apt、yum)一键搞定,但能精准控制编译选项、适配特殊环境、启用/禁用功能模块,是运维和开发人员必须掌握的底层能力。

configure:生成定制化 Makefile

configure 是一个 shell 脚本,通常由 autotools(autoconf)生成,作用是探测当前系统环境(如编译器版本、库路径、头文件是否存在、CPU 架构等),再根据你的参数,生成适配本地的 Makefile

  • 运行前确保已安装基础编译工具:gccmakeautoconfautomakelibtool(部分项目需要)
  • 常见参数示例:
    • --prefix=/usr/local:指定最终安装路径(默认常为 /usr/local
    • --enable-xxx--disable-xxx:开启或关闭某项功能(如 --enable-ssl
    • --with-xxx=PATH:指定外部依赖路径(如 --with-openssl=/opt/openssl
    • --help:查看所有支持选项(强烈建议先执行)
  • 若提示 configure: command not found,说明还没生成 configure 脚本,需先进入源码目录运行 ./autogen.shautoreconf -fiv(前提是你装了 autotools)

make:依据 Makefile 编译源码

configure 成功后,当前目录会生成 Makefile。运行 make 即按规则调用 gcc 等工具编译目标文件、链接成可执行程序或库。

标签: linux python redis nginx app 工具 ssl ai 配置文件 red

发布评论 0条评论)

还木有评论哦,快来抢沙发吧~