You are viewing an old revision of this post, from January 2, 2018 @ 18:36:57. See below for differences between this version and the current revision.

Centos – How to Install The Latest Apache Server

By default of Centos, you only can install Apache version 2.4.6, because Centos uses Security Backporting Practice to apply most recent fixes to older versions of a software package. As a result, it doesn’t mean that an older version provided by default repositories is vulnerable. But I need the latest version of Apache so that I can speed up my website. There is a great custom repo created by these guys CodeIT It provides latest versions of web servers (Apache & Nginx).

Before setting up the CodeIT repository, you need to enable the EPEL. It satisfies some dependencies required by the CodeIT repo.

sudo yum install -y epel-release
cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo

Then verify the Apache package version again, and you should see something like that.

yum info httpd

Now you should have everything set up to install the latest Apache package.

yum install httpd
systemctl start httpd

Finally, tell systemd to start the Apache service automatically at boot.

systemctl enable httpd

That’s all if you have any troubles, please feel free to leave comments below.

Hope it is useful to you 🙂

Revisions

Revision Differences

January 2, 2018 @ 18:36:57Current Revision
Content
 Added: By default of Centos, you only can install Apache version 2.4.6, because Centos uses <a href="https:/ /access.redhat.com/security/ updates/backporting/">Security Backporting Practice</a> to apply most recent fixes to older versions of a software package. As a result, it doesn’t mean that an older version provided by default repositories is vulnerable. But I need the latest version of Apache so that I can speed up my website.
Deleted: Apache is the most widely used web server software for serving web applications and it is an essential part of any server. To have the latest version installed means that your software package will probably have more new features and known bugs fixes.Added: There is a great custom repo created by these guys <a class="article- content__link" href="https:/ /codeit.guru/en_US/" rel="noopener" >CodeIT</a> It provides latest versions of web servers (Apache &amp; Nginx).
Deleted: <h3>Introduction</h3> 
Deleted: In this tutorial, I am going to describe simple steps to install the latest Apache (httpd) version on your Centos 7 system. 
Deleted: By default Centos 7 has few predefined repositories for installing packages, but unfortunately, a lot of packages are out of date there. 
 Added: <p class="article- content__paragraph">Before setting up the CodeIT repository, you need to enable the <a class="article- content__link" href="https:/ /fedoraproject.org/wiki/EPEL" rel="noopener">EPEL</a>. It satisfies some dependencies required by the CodeIT repo.</p>
Deleted: <h2>Step 1 — Find out the Apache version in default repos</h2>Added: <pre>sudo yum install -y epel-release</pre>
Deleted: In order to check the current version of <strong>httpd< /strong> package available in repositories – type the following command: 
Deleted: <table> 
Deleted: <tbody> 
Deleted: <tr> 
Deleted: <td> 
Deleted: <pre></pre> 
Deleted: </td> 
Deleted: <td> 
Deleted: <pre>yum info httpd 
 Added: <div class="highlighted-source native bash">
 Added: <pre><span class="nb">cd</span> /etc/yum.repos.d <span class="o">&amp; &amp;</span> wget <a class="vglnk" href="https:/ /repo.codeit.guru/codeit.el" rel="nofollow" >https://repo.codeit.guru/ codeit.el</a><span class="sb">`</span>rpm -q --qf <span class="s2">"%{VERSION}"</span> <span class="k">$(</span>rpm -q --whatprovides redhat-release<span class="k">)</span><span class="sb">`</span>.repo
Unchanged: </pre>Unchanged: </pre>
Deleted: </td> 
Deleted: </tr> 
Deleted: </tbody> 
Deleted: </table> 
Deleted: If you have default installation, you will most likely see similar output. 
Deleted: <table> 
Deleted: <tbody> 
Deleted: <tr> 
Deleted: <td> 
Deleted: <pre> 
Deleted: </pre> 
Deleted: </td> 
Deleted: <td> 
Deleted: <pre>[root@crosp ~]# yum info httpd 
Deleted: Loaded plugins: fastestmirror 
Deleted: epel/x86_64/metalink | 19 kB 00:00 
Deleted: epel | 4.3 kB 00:00 
Deleted: (1/3): epel/x86_64/group_gz | 170 kB 00:00 
Deleted: (2/3): epel/x86_64/primary_db | 4.6 MB 00:00 
Deleted: (3/3): epel/x86_64/updateinfo | 780 kB 00:00 
Deleted: Loading mirror speeds from cached hostfile 
Deleted: * base: mirrors.ircam.fr 
Deleted: * epel: mirrors.ircam.fr 
Deleted: * extras: centos.mirror.fr.planethoster.net 
Deleted: * updates: centos.mirror.fr.planethoster.net 
Deleted: Available Packages 
Deleted: Name : httpd 
Deleted: Arch : x86_64 
Deleted: Version : 2.4.6 
Deleted: Release : 45.el7.centos.4 
Deleted: Size : 2.7 M 
Deleted: Repo : updates/7/x86_64 
Deleted: Summary : Apache HTTP Server 
Deleted: URL : http://httpd.apache.org/ 
Deleted: License : ASL 2.0 
Deleted: Description : The Apache HTTP Server is a powerful, efficient, and extensible 
Deleted: : web server. 
Deleted: </pre> 
Deleted: </td> 
Deleted: </tr> 
Deleted: </tbody> 
Deleted: </table> 
Deleted: As you can see from the output above, there is only 2.4.6 Apache version available in default repos. 
Deleted: <strong>Please note:</strong> 
Deleted: Centos uses <a href="https:/ /access.redhat.com/security/ updates/backporting/" target="_blank" rel="noopener">Security Backporting Practice</a> in order to apply most recent fixes to older versions of a software package, as a result it doesn’t mean that an older version provided by default repositories is vulnerable. But in my case I didn’t have a required update. 
Deleted: You can see a changelog using these commands : 
Deleted: <table> 
Deleted: <tbody> 
Deleted: <tr> 
Deleted: <td> 
Deleted: <pre></pre> 
Deleted: </td> 
Deleted: <td> 
Deleted: <pre>sudo yum install yum-changelog 
Deleted: yum changelog httpd 
Deleted: </pre> 
Deleted: </td> 
Deleted: </tr> 
Deleted: </tbody> 
Deleted: </table> 
Deleted: <h2>Step 2 — Set up CodeIT repositories</h2> 
Deleted: There is a great custom repo created by these guys <a href="https:/ /codeit.guru/en_US/" target="_blank" rel="noopener" >CodeIT</a> It provides latest versions of web servers (Apache &amp; Nginx).Added: <p class="article- content__paragraph">Then verify the Apache package version again, and you should see something like that.</p>
Deleted: Before setting up the CodeIT repository first of all you need to enable the <a href="https:/ /fedoraproject.org/wiki/EPEL" target="_blank" rel="noopener">EPEL</a>. It satisfies some dependencies required by the CodeIT repo. 
Deleted: <table> 
Deleted: <tbody> 
Deleted: <tr> 
Deleted: <td> 
Deleted: <pre></pre> 
Deleted: </td> 
Deleted: <td> 
Deleted: <pre>sudo yum install -y epel-release 
Deleted: </pre> 
Deleted: </td> 
Deleted: </tr> 
Deleted: </tbody> 
Deleted: </table> 
Deleted: Finally enable the CodeIT repository. 
Deleted: <table> 
Deleted: <tbody> 
Deleted: <tr> 
Deleted: <td> 
Deleted: <pre></pre> 
Deleted: </td> 
Deleted: <td> 
Deleted: <pre>cd /etc/yum.repos.d &amp;&amp; wget https://repo.codeit.guru/ codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo 
Deleted: </pre> 
Deleted: </td> 
Deleted: </tr> 
Deleted: </tbody> 
Deleted: </table> 
Deleted: Then verify the Apache package version again and you should see something like that. 
Deleted: <table> 
Deleted: <tbody> 
Deleted: <tr> 
Deleted: <td> 
Deleted: <pre></pre> 
Deleted: </td> 
Deleted: <td> 
Deleted: <pre>[root@crosp ~]# yum info httpd 
Deleted: Loaded plugins: changelog, fastestmirror 
Deleted: Loading mirror speeds from cached hostfile 
Deleted: * base: centos.crazyfrogs.org 
Deleted: * epel: mirror.23media.de 
Deleted: * extras: mirrors.ircam.fr 
Deleted: * updates: centos.mirror.fr.planethoster.net 
Deleted: Available Packages 
Deleted: Name : httpd 
Deleted: Arch : x86_64 
Deleted: Version : 2.4.25 
Deleted: Release : 3.el7.codeit 
Deleted: Size : 1.4 M 
Deleted: Repo : CodeIT/x86_64 
Deleted: Summary : Apache HTTP Server 
Deleted: URL : http://httpd.apache.org/ 
Deleted: License : ASL 2.0 
Deleted: Description : The Apache HTTP Server is a powerful, efficient, and extensible 
Deleted: : web server. 
Deleted: </pre> 
Deleted: </td> 
Deleted: </tr> 
Deleted: </tbody> 
Deleted: </table> 
Deleted: <h2>Step 3 — Install the Apache web-server</h2> 
Deleted: Now you should have everything set up to install the latest Apache package. 
Deleted: <table> 
Deleted: <tbody> 
Deleted: <tr> 
Deleted: <td> 
Deleted: <pre></pre> 
Deleted: </td> 
Deleted: <td> 
Deleted: <pre>yum install httpd Added: <pre>yum info httpd
Deleted: </pre> 
Deleted: </td> 
Deleted: </tr> 
Deleted: </tbody> 
Deleted: </table> 
Deleted: Once Apache is installed, let’s start it and test whether it is working. 
Deleted: <table> 
Deleted: <tbody> 
Deleted: <tr> 
Deleted: <td> 
Deleted: <pre></pre> 
Deleted: </td> 
Deleted: <td> 
Deleted: <pre>[root@crosp ~]# systemctl start httpd 
Unchanged: </pre>Unchanged: </pre>
 Added: <p class="article- content__paragraph">Now you should have everything set up to install the latest Apache package.</p>
Deleted: </td> Added: </div>
Deleted: </tr> 
Deleted: </tbody> 
Deleted: </table> 
Deleted: The output should be similar to the following:Added: <pre>yum install httpd</pre>
Deleted: <table> 
Deleted: <tbody> 
Deleted: <tr> 
Deleted: <td> 
Deleted: <pre></pre> 
Deleted: </td> 
Deleted: <td> 
Deleted: <pre>[root@crosp ~]# curl localhostAdded: <pre>systemctl start httpd
Deleted: &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/ TR/xhtml11/DTD/ xhtml11.dtd"&gt; 
Deleted: &lt;html xmlns="http:/ /www.w3.org/1999/xhtml" xml:lang="en"&gt; 
Deleted: &lt;head&gt; 
Deleted: &lt;title&gt;Test Page for the Apache HTTP Server on CentOS&lt;/title&gt; 
Deleted: &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; 
Deleted: ... 
Unchanged: </pre>Unchanged: </pre>
Deleted: </td> 
Deleted: </tr> 
Deleted: </tbody> 
Deleted: </table> 
Deleted: Finally, tell <strong> systemd</strong> to start the Apache service automatically at boot. Added: <p class="article- content__paragraph">Finally, tell <strong> systemd</strong> to start the Apache service automatically at boot.</p>
Deleted: <table> 
Deleted: <tbody> 
Deleted: <tr> 
Deleted: <td> 
Deleted: <pre></pre> 
Deleted: </td> 
Deleted: <td> 
Deleted: <pre>[root@crosp ~]# systemctl enable httpd Added: <pre>systemctl enable httpd
Unchanged: </pre>Unchanged: </pre>
Deleted: </td> 
Deleted: </tr> 
Deleted: </tbody> 
Deleted: </table> 
 Added: <div class="article-content">
Deleted: That’s all, if you have any troubles please feel free to leave comments below. Added: <p class="article- content__paragraph">That’s all if you have any troubles, please feel free to leave comments below.</p>
 Added: Hope it is useful to you :)</div>

Note: Spaces may be added to comparison text to allow better line wrapping.

No comments yet.

Leave a Reply