编译安装httpd

               1 将 httpd-2.4.25.tar.bz2下载 到  centos7的 /app目录下

                [root@localhost app]# ls
                httpd-2.4.25.tar.bz2

              2 将该文件解压

              [root@localhost app]# tar -xvf httpd-2.4.25.tar.bz2 

              [root@localhost app]# ls

              httpd-2.4.25  httpd-2.4.25.tar.bz2

              3 安装开发包组

             [root@localhost httpd-2.4.25]# cd /app/httpd-2.4.25
             [root@localhost httpd-2.4.25]# yum groupinstall “Development tools”

             4 

              [root@localhost httpd-2.4.25]# ./configure –prefix=/app/httpd –sysconfdir=/etc/httpd/

            5 报错, 根据提示还得装下面这些包

              yum install apr-devel
             yum install apr-util-devel
             yum install pcre-devel

             6

            make 

             7

           make install
            8
         [root@localhost bin]# cd /app/httpd/bin

            9  开启服务器并启动端口

           [root@localhost bin]# apachectl start

          [root@localhost bin]# netstat -tnl

         Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN     
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6011          0.0.0.0:*               LISTEN     
tcp6       0      0 :::111                  :::*                    LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN     
tcp6       0      0 :::21                   :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 ::1:25                  :::*                    LISTEN     
tcp6       0      0 ::1:6010                :::*                    LISTEN     
tcp6       0      0 ::1:6011                :::*                    LISTEN     

           10  查看本机IP地址

    [root@localhost bin]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.130  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::f36e:9e00:5218:4cbb  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:1c:1c:10  txqueuelen 1000  (Ethernet)
        RX packets 39129  bytes 44634625 (42.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13242  bytes 2208017 (2.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 28  bytes 2408 (2.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 28  bytes 2408 (2.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:a0:c6:47  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

            

        11  在浏览器中输入 http://192.168.1.130/          就可以看到 IT,s work 页面

        

         12 如果 想不在 /app/httpd/bin 目录下就可以启动http服务器则需要 在/etc/profile.d/httpd.sh 文件中加入一行 PATH=$PATH:/app/httpd/bin

         [root@localhost ~]# cd /etc/profile.d/

         [root@localhost profile.d]# vim httpd.sh 

      #! /bin/bash

      PATH=$PATH:/app/httpd/bin


        [root@localhost profile.d]# cd /root
        [root@localhost ~]# apachectl start

        [root@localhost ~]# netstat -tnl

       Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN     
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6011          0.0.0.0:*               LISTEN     
tcp6       0      0 :::111                  :::*                    LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN     
tcp6       0      0 :::21                   :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 ::1:25                  :::*                    LISTEN     
tcp6       0      0 ::1:6010                :::*                    LISTEN     

tcp6       0      0 ::1:6011                :::*                    LISTEN     

        

          

原创文章,作者:fsy,如若转载,请注明出处:http://www.178linux.com/74118

赞 (0)
fsyfsy
上一篇 2017-04-24 21:23
下一篇 2017-04-24 21:35

相关推荐

  • 磁盘配额、阵列与逻辑卷

    一、磁盘配额 在内核中执行以文件系统为单位启用对不同组或者用户的策略不同 根据块或者节点进行限制执行软限制(soft limit)硬限制(hard limit) 步骤一:获得文件系统支持临时有效:mount -o remount,usrquota,grpquota {mount_point|device}永久有效:写入配置文件 /etc/fstab 中检查文…

    Linux干货 2016-08-29
  • 程序包管理rpm

    Linux程序包管理      API:Application Program Interface      ABI:Application Binary Interface         Unix…

    Linux干货 2016-08-23
  • rpm包管理

    一、概述 RPM 是RPM Package Manager(RPM软件包管理器)的缩写。由redhat公司的Redhat package manager改名而来,成了RedHat的工业标准 二、rpm的命名格式: rpm包的命名格式:name-version-relase.arch.rpm version: major.minor.release,同源代码 …

    Linux干货 2015-10-07
  • N22-第十二周作业

    1、请描述一次完整的http请求处理过程; (1)建立或处理连接:接受请求或拒绝请求 (2)接收请求:接收来自于网络上的主机请求报文中对某特定资源的一次请求的过程 (3)处理请求:对请求报文进行解析,获取客户端请求的资源及请求方法等相关信息 (4)访问资源:获取请求报文中请求的资源 (5)构建响应报文 (6)发送响应报文 (7)记录日志:访问日志和错误日志 …

    Linux干货 2016-11-04
  • Linux磁盘、文件系统管理

    对Linux而言,其哲学思想之一就是一切皆文件,因此Linux之上所有设备的操作都是通过文件接口来实现的,也就是说在访问设备的时候就如同访问一个文件一样,因为他们使用的都是文件系统接口。  设备也分种类,如:     1、块设备:block 其存取单位是“块”,如硬盘    &n…

    Linux干货 2016-08-29
  • Linux系统grep正则表达式

    一、grep命令的使用 首先,我们来了解grep命令,grep (global search regular expression and printing),全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。Linux中的grep命令包括、grep, egrep和fgrep 。egrep是grep…

    Linux干货 2017-04-23

评论列表(1条)

  • renjin
    renjin 2017-04-28 11:32

    对编译安装httpd进行了流程式的介绍,内容总结的很详细,需要注意排版。把执行的代码放入到”插入程序代码”中去