linux命令:编译安装软件包(举例安装tengine nginx)

简介:

 编译安装的步骤:

   1、下载源码包

   2、解压缩下载的源码包

   3、进入解压缩目录    *必须进入到解压缩目录中

   4、./configure 软件配置与检查

      1)定义需要的功能选项

      2)检测系统环境是否符合安装要求

      3)把定义好的功能选项和检测系统环境的信息都写入makefile文件,用于后续的编辑。

      4)make编译  4.1)make clean清空编译文件

      5)make install 编译安装

   步骤:./configure --prefix=/usr/local/squid   --prefix指定软件安装位置

        --sysconfdir=/PATH/TO/CONFFILE_PATH  --sysconfdir指定配置文件路径

        --config-path=/PATH/TO/CONFFILE_PATH  指定配置文件路径

        --help 获取配置帮助文件

       make  编译    如有报错,执行make clean 删除编译临时文件         

       make install 编译安装

 Usage: 编译安装squid    

    1、首先现在squid源码包

    2、解压下载的源码包

    3、进入源码包的解压缩目录

    4、./configure --prefix=/usr/local/squid  指定安装路径

    5、make 编译生成makefile文件   6、make install 编译安装完成 

编译安装完成后必须注意的几个问题:

注:

  1、修改PATH环境变量,以便能够识别此程序的二进制文件路径即把程序的执行程序的路径加入到PATH变量中 在/etc/profile 中添加PATH=$PATH:/usr/local/tengine/sbin

  2、默认情况下,系统搜索哭文件的路径/lib,/usr/lib,要增加额外搜寻路径

     在/etc/ld.so.conf.d/中创建以.conf为后缀名的文件,而后把要增添的路径直接写入至此      文件中;

     #领导config通知系统重新搜寻库文件

        -v:显示重新搜寻库的过程

  3、头文件,输出给系统

       默认:/usr/include

       增添头文件搜寻路径,使用链接进行

    /usr/local/tengine/include/   /usr/include/

    两种方式:

     ln -s /usr/local/tengine/include/* /usr/include/ 

或者 ln -s /usr/local/tengine/include /usr/include/tengine

  4、man文件路径:安装在--prefix指定的目录下的man目录下;

    两种方式:

      1、man -M /PATH/TO/MAN_DIR  把生成的man文件加入到默认帮助文档中

      2、在/etc/man.conf文档中添加MANPATH /PATH/TO/MAN_DIR

 

执行编译安装前提必须安装编译环境:(开发工具和开发函数库最好安装系统时选择安装)

必须安装有“Development Tools”和“Development Libraries”开发工具组和开发函数库

  yum groupinstall "Development Tools"

  yum groupinstall "Development Libraries"

实例:编译安装tengine

#tar xf tengine-1.5.1.tar.gz

#cd tegnine-1.5.1

#./configure -prefix=/usr/local/tengine --conf-path=/etc/tengine/tengine.con

#make

#make install

#/usr/local/tengine/sbin/nginx 执行程序

  #tar zxvf tengine-1.5.1.tar.gz

[root@xuelinux ~]# cd tengine-1.5.1

[root@xuelinux tengine-1.5.1]# ls

AUTHORS.te  CHANGES.cn  conf       docs     Makefile  README           tests

auto        CHANGES.ru  configure  html     man       README.markdown  THANKS.te

CHANGES     CHANGES.te  contrib    LICENSE  objs      src

[root@xuelinux tengine-1.5.1]# ./configure --prefix=/usr/local/tengine-1.5.1

checking for OS

 + Linux 2.6.32-431.el6.i686 i686

checking for C compiler ... found

 + using GNU C compiler

 + gcc version: 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) 

checking for gcc -pipe switch ... found

checking for gcc builtin atomic operations ... found

checking for C99 variadic macros ... found

checking for PCRE library in /opt/local/ ... not found


./configure: error: the HTTP rewrite module requires the PCRE library. #提示缺少pcre报错

You can either disable the module by using --without-http_rewrite_module

option, or install the PCRE library into the system, or build the PCRE library

statically from the source with nginx by using --with-pcre=<path> option.


[root@xuelinux tengine-1.5.1]# yum install pcre-devel  安装相应的pcre函数库后再进行编译

Installed:

  pcre-devel.i686 0:7.8-6.el6                                                              

Complete!

[root@xuelinux tengine-1.5.1]# ./configure --prefix=/usr/local/tengine-1.5.1 指定安装路径

checking for OS

 + Linux 2.6.32-431.el6.i686 i686

checking for C compiler ... found

 nginx http uwsgi temporary files: "uwsgi_temp"

  nginx http scgi temporary files: "scgi_temp"


[root@xuelinux tengine-1.5.1]# make  进行编译

make -f objs/Makefile

make[1]: Entering directory `/root/tengine-1.5.1' 

make[1]: Entering directory `/root/tengine-1.5.1'

sed -e "s|%%PREFIX%%|/usr/local/tengine-1.5.1|" \

-e "s|%%PID_PATH%%|/usr/local/tengine-1.5.1/logs/nginx.pid|" \

-e "s|%%CONF_PATH%%|/usr/local/tengine-1.5.1/conf/nginx.conf|" \

-e "s|%%ERROR_LOG_PATH%%|/usr/local/tengine-1.5.1/logs/error.log|" \

< man/nginx.8 > objs/nginx.8

make[1]: Leaving directory `/root/tengine-1.5.1'    编译完成

[root@xuelinux tengine-1.5.1]# make install   执行编译安装

make -f objs/Makefile install

make[1]: Entering directory `/root/tengine-1.5.1'

cp objs/dso_tool '/usr/local/tengine-1.5.1/sbin/dso_tool'

chmod 0755 '/usr/local/tengine-1.5.1/sbin/dso_tool'

make[1]: Leaving directory `/root/tengine-1.5.1'    至此编译安装tengine完成

[root@xuelinux sbin]# nginx      执行该程序

-bash: nginx: command not found    提示没有找到命令因为环境变量未添加该执行程序路径

[root@xuelinux sbin]# vim /etc/profile  编辑环境变量配置文件把该路径添加进去


PATH=$PATH:/usr/local/tengine-1.5.1/sbin   添加该行

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

[root@xuelinux sbin]# source /etc/profile   重新读取该配置文件,使得修改生效

[root@xuelinux sbin]# nginx   执行后正常

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] still could not bind()  提示端口被占用

[root@xuelinux sbin]# fuser -n tcp 80   查看被占用端口的进程

80/tcp:              20340 20341

[root@xuelinux sbin]# kill -9 20340  终止占用端口的进程

[root@xuelinux sbin]# kill -9 20341  终止占用端口的进程

[root@xuelinux sbin]# nginx

[root@xuelinux sbin]# nginx

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] still could not bind()

[root@xuelinux sbin]# netstat -tlnp  查看监听端口

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   

tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1235/rpcbind        

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      20340/nginx          已经取用了nginx

tcp        0      0 192.168.122.1:53            0.0.0.0:*                   LISTEN      1797/d

然后就可通过ip地址访问该地址了。













本文转自wang650108151CTO博客,原文链接: http://blog.51cto.com/woyaoxuelinux/1878174,如需转载请自行联系原作者


相关文章
|
7月前
|
Linux 应用服务中间件 Shell
二、Linux文本处理与文件操作核心命令
熟悉了Linux的基本“行走”后,就该拿起真正的“工具”干活了。用grep这个“放大镜”在文件里搜索内容,用find这个“探测器”在系统中寻找文件,再用tar把东西打包带走。最关键的是要学会使用管道符|,它像一条流水线,能把这些命令串联起来,让简单工具组合出强大的功能,比如 ps -ef | grep 'nginx' 就能快速找出nginx进程。
791 1
二、Linux文本处理与文件操作核心命令
|
7月前
|
Linux
linux命令—stat
`stat` 是 Linux 系统中用于查看文件或文件系统详细状态信息的命令。相比 `ls -l`,它提供更全面的信息,包括文件大小、权限、所有者、时间戳(最后访问、修改、状态变更时间)、inode 号、设备信息等。其常用选项包括 `-f` 查看文件系统状态、`-t` 以简洁格式输出、`-L` 跟踪符号链接,以及 `-c` 或 `--format` 自定义输出格式。通过这些选项,用户可以灵活获取所需信息,适用于系统调试、权限检查、磁盘管理等场景。
460 137
|
7月前
|
安全 Ubuntu Unix
一、初识 Linux 与基本命令
玩转Linux命令行,就像探索一座新城市。首先要熟悉它的“地图”,也就是/根目录下/etc(放配置)、/home(住家)这些核心区域。然后掌握几个“生存口令”:用ls看周围,cd去别处,mkdir建新房,cp/mv搬东西,再用cat或tail看文件内容。最后,别忘了随时按Tab键,它能帮你自动补全命令和路径,是提高效率的第一神器。
1237 58
|
6月前
|
存储 安全 Linux
Linux卡在emergency mode怎么办?xfs_repair 命令轻松解决
Linux虚拟机遇紧急模式?别慌!多因磁盘挂载失败。本文教你通过日志定位问题,用`xfs_repair`等工具修复文件系统,三步快速恢复。掌握查日志、修磁盘、验重启,轻松应对紧急模式,保障系统稳定运行。
1122 2
|
7月前
|
缓存 监控 Linux
Linux内存问题排查命令详解
Linux服务器卡顿?可能是内存问题。掌握free、vmstat、sar三大命令,快速排查内存使用情况。free查看实时内存,vmstat诊断系统整体性能瓶颈,sar实现长期监控,三者结合,高效定位并解决内存问题。
644 0
Linux内存问题排查命令详解
|
7月前
|
Unix Linux 程序员
Linux文本搜索工具grep命令使用指南
以上就是对Linux环境下强大工具 `grep` 的基础到进阶功能介绍。它不仅能够执行简单文字查询任务还能够处理复杂文字处理任务,并且支持强大而灵活地正则表达规范来增加查询精度与效率。无论您是程序员、数据分析师还是系统管理员,在日常工作中熟练运用该命令都将极大提升您处理和分析数据效率。
567 16
|
8月前
|
Linux 网络安全 开发工具
技术栈:这50条最常用的 Linux 命令你一定要会!
建议多在终端中实践,遇到不懂的命令就用 man 或 --help 了解详情!
1334 0
|
tengine 应用服务中间件 nginx
Tengine – Nginx衍生版
Tengine – Nginx衍生版 2013-09-05 Posted by yeho Tengine是淘宝在Nginx基础上开发的一个衍生版。官方的简介说针对大访问量网站的需求,添加了很多高级功能和特性。
1817 0
|
tengine 关系型数据库 MySQL
Tengine、Nginx安装MySQL数据库命令教程
本指南详细介绍了在Linux系统上安装与配置MySQL数据库的步骤。首先通过下载并安装MySQL社区版本,接着启动MySQL服务,使用`systemctl start mysqld.service`命令。若启动失败,可尝试使用`sudo /etc/init.d/mysqld start`。利用`systemctl status mysqld.service`检查MySQL的服务状态,确保其处于运行中。通过日志文件获取初始密码,使用该密码登录数据库,并按要求更改初始密码以增强安全性。随后创建一个名为`tengine`的数据库,最后验证数据库创建是否成功以及完成整个设置流程。
|
tengine 应用服务中间件 Linux
Tengine、Nginx安装PHP命令教程
要在阿里云Linux上安装PHP,请先更新YUM源并启用PHP 8.0仓库,然后安装PHP及相关扩展。通过`php -v`命令验证安装成功后,需修改Nginx配置文件以支持PHP,并重启服务。最后,创建`phpinfo.php`文件测试安装是否成功。对于CentOS系统,还需安装EPEL源和Remi仓库,其余步骤类似。完成上述操作后,可通过浏览器访问`http://IP地址/phpinfo.php`测试安装结果。