Skip to content
Home » Linux » How to Install Newest LAMP on CentOS 7 Minimal (2/3) - Apache

How to Install Newest LAMP on CentOS 7 Minimal (2/3) - Apache

Since the version of Apache HTTP Server provided by CentOS 7 is pretty new (2.4.6), so we use it as our httpd version of LAMP.

  1. Check what version of httpd we can have.
  2. [root@primary01 ~]# yum info httpd
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror01.idc.hinet.net
     * extras: mirror01.idc.hinet.net
     * updates: mirror01.idc.hinet.net
    Available Packages
    Name        : httpd
    Arch        : x86_64
    Version     : 2.4.6
    Release     : 18.el7.centos
    Size        : 2.7 M
    Repo        : updates/7/x86_64
    Summary     : Apache HTTP Server
    URL         : http://httpd.apache.org/
    License     : ASL 2.0
    Description : The Apache HTTP Server is a powerful, efficient, and extensible
                : web server.
  3. Install httpd 2.4.6.
  4. [root@primary01 ~]# yum -y install httpd
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror01.idc.hinet.net
     * extras: mirror01.idc.hinet.net
     * updates: mirror01.idc.hinet.net
    Resolving Dependencies
    --> Running transaction check
    ---> Package httpd.x86_64 0:2.4.6-18.el7.centos will be installed
    --> Processing Dependency: httpd-tools = 2.4.6-18.el7.centos for package: httpd-2.4.6-18.el7.centos.x86_64
    --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-18.el7.centos.x86_64
    --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-18.el7.centos.x86_64
    --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-18.el7.centos.x86_64
    --> Running transaction check
    ---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
    ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
    ---> Package httpd-tools.x86_64 0:2.4.6-18.el7.centos will be installed
    ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
    --> Finished Dependency Resolution

    Dependencies Resolved

    ================================================================================
     Package           Arch         Version                     Repository     Size
    ================================================================================
    Installing:
     httpd             x86_64       2.4.6-18.el7.centos         updates       2.7 M
    Installing for dependencies:
     apr               x86_64       1.4.8-3.el7                 base          103 k
     apr-util          x86_64       1.5.2-6.el7                 base           92 k
     httpd-tools       x86_64       2.4.6-18.el7.centos         updates        77 k
     mailcap           noarch       2.1.41-2.el7                base           31 k

    Transaction Summary
    ================================================================================
    Install  1 Package (+4 Dependent packages)

    Total download size: 3.0 M
    Installed size: 10 M
    Downloading packages:
    (1/5): apr-util-1.5.2-6.el7.x86_64.rpm                     |  92 kB   00:01
    (2/5): httpd-tools-2.4.6-18.el7.centos.x86_64.rpm          |  77 kB   00:01
    (3/5): mailcap-2.1.41-2.el7.noarch.rpm                     |  31 kB   00:02
    (4/5): apr-1.4.8-3.el7.x86_64.rpm                          | 103 kB   00:07
    (5/5): httpd-2.4.6-18.el7.centos.x86_64.rpm                | 2.7 MB   00:10
    --------------------------------------------------------------------------------
    Total                                              281 kB/s | 3.0 MB  00:10
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : apr-1.4.8-3.el7.x86_64                                       1/5
      Installing : apr-util-1.5.2-6.el7.x86_64                                  2/5
      Installing : httpd-tools-2.4.6-18.el7.centos.x86_64                       3/5
      Installing : mailcap-2.1.41-2.el7.noarch                                  4/5
      Installing : httpd-2.4.6-18.el7.centos.x86_64                             5/5
      Verifying  : mailcap-2.1.41-2.el7.noarch                                  1/5
      Verifying  : httpd-tools-2.4.6-18.el7.centos.x86_64                       2/5
      Verifying  : apr-util-1.5.2-6.el7.x86_64                                  3/5
      Verifying  : apr-1.4.8-3.el7.x86_64                                       4/5
      Verifying  : httpd-2.4.6-18.el7.centos.x86_64                             5/5

    Installed:
      httpd.x86_64 0:2.4.6-18.el7.centos

    Dependency Installed:
      apr.x86_64 0:1.4.8-3.el7                     apr-util.x86_64 0:1.5.2-6.el7
      httpd-tools.x86_64 0:2.4.6-18.el7.centos     mailcap.noarch 0:2.1.41-2.el7

    Complete!
  5. Open port 80 for public to access.
  6. [root@primary01 ~]# firewall-cmd --zone=public --add-port=80/tcp
    success
    [root@primary01 ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp
    success
  7. Enable httpd service and start it.
  8. [root@primary01 ~]# systemctl status httpd
    httpd.service - The Apache HTTP Server
       Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
       Active: inactive (dead)

    [root@primary01 ~]# systemctl enable httpd
    ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
    [root@primary01 ~]# systemctl start httpd

Now, we have installed the newest Apache HTTP server on CentOS 7.

Leave a Reply

Your email address will not be published. Required fields are marked *