当前位置: 首页 > news >正文

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,如需转载请自行联系原作者


相关文章:

  • 总结之:CentOS 6.5 HTTPD服务的全面解读及配置详解(1)
  • 什么是内存(一):存储器层次结构
  • 我经常使用的DOS命令參考
  • IE8 默认以Web Standards模式显示网页 全面遵循Web标准
  • 用For循环加cat按顺序合并文件
  • 完美搞定《DOCKER IN ACTION》第二章示例
  • webservice 原理
  • 检查点(Checkpoint)速度控制参数
  • grep
  • CentOS6.6+Puppet3.7.4分布式部署Nagios监控系统
  • SCVMM2012SP1异构虚拟化ID 22723问题解决
  • 时空日期审核错误修正
  • 一个java写的弹球小游戏
  • python 之浅谈接口的定义和抽象类以及抽象方法
  • Kickstart无人值守安装
  • .pyc 想到的一些问题
  • [nginx文档翻译系列] 控制nginx
  • emacs初体验
  • ES6之路之模块详解
  • iOS 系统授权开发
  • js操作时间(持续更新)
  • Objective-C 中关联引用的概念
  • python_bomb----数据类型总结
  • React的组件模式
  • Redash本地开发环境搭建
  • vue+element后台管理系统,从后端获取路由表,并正常渲染
  • 闭包--闭包作用之保存(一)
  • 番外篇1:在Windows环境下安装JDK
  • 关于 Linux 进程的 UID、EUID、GID 和 EGID
  • 和 || 运算
  • 后端_MYSQL
  • 快速体验 Sentinel 集群限流功能,只需简单几步
  • 巧用 TypeScript (一)
  • 如何优雅的使用vue+Dcloud(Hbuild)开发混合app
  • 实现简单的正则表达式引擎
  • 使用阿里云发布分布式网站,开发时候应该注意什么?
  • 世界上最简单的无等待算法(getAndIncrement)
  • 适配iPhoneX、iPhoneXs、iPhoneXs Max、iPhoneXr 屏幕尺寸及安全区域
  • 树莓派 - 使用须知
  • ​渐进式Web应用PWA的未来
  • #NOIP 2014# day.2 T2 寻找道路
  • #pragma预处理命令
  • (04)Hive的相关概念——order by 、sort by、distribute by 、cluster by
  • (1)常见O(n^2)排序算法解析
  • (16)UiBot:智能化软件机器人(以头歌抓取课程数据为例)
  • (Forward) Music Player: From UI Proposal to Code
  • (NO.00004)iOS实现打砖块游戏(十二):伸缩自如,我是如意金箍棒(上)!
  • (二)【Jmeter】专栏实战项目靶场drupal部署
  • (附源码)spring boot北京冬奥会志愿者报名系统 毕业设计 150947
  • (九十四)函数和二维数组
  • (转)Linux NTP配置详解 (Network Time Protocol)
  • .Net MVC + EF搭建学生管理系统
  • .Net调用Java编写的WebServices返回值为Null的解决方法(SoapUI工具测试有返回值)
  • [android] 练习PopupWindow实现对话框
  • [Angularjs]asp.net mvc+angularjs+web api单页应用