如何在Centos7下升级Apache至最新版本
2018-02-20 07:16
525 查看
原文:https://crosp.net/blog/administration/install-latest-apache-server-centos-7/
Apache是使用最广泛的应用部署软件。并且它也是所有服务器的必要组成部分。安装最新版本的apache意味着拥有更多最新的功能和修复了已知的BUG。
默认情况下, Centos7为软件设置了一些预定义的软件库。不幸的是,这些预定义软件库上的很多软件已近过时了。
Loaded plugins: fastestmirror
epel/x86_64/metalink | 19 kB 00:00
epel | 4.3 kB 00:00
(1/3): epel/x86_64/group_gz | 170 kB 00:00
(2/3): epel/x86_64/primary_db | 4.6 MB 00:00
(3/3): epel/x86_64/updateinfo | 780 kB 00:00
Loading mirror speeds from cached hostfile
* base: mirrors.ircam.fr
* epel: mirrors.ircam.fr
* extras: centos.mirror.fr.planethoster.net
* updates: centos.mirror.fr.planethoster.net
Available Packages
Name : httpd
Arch : x86_64
Version : 2.4.6
Release : 45.el7.centos.4
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.正如你从上面的输出结果中看到,默认软件库中只有2.4.6版本的apache。
注意:
Centos使用 向后修复安全实践 来将新的软件修复应用到更早期的版本。所以,默认库中的早期版本软件不意味着就更脆弱。不过对于我来说,并不算是个满足需求的更新。
你可以使用changelog来查看版本更新:sudo yum install yum-changelog
yum changelog httpd
在安装CodeIT库之前,你需要开启 EPEL 。EPEL提供了CodeIT库需要的依赖。sudo yum install -y epel-release最后,我们来安装CodeIT库cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo接下来,我们再次确认Apache的包版本,你应该会看到类似下面的输出[root@crosp ~]# yum info httpd
Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.crazyfrogs.org
* epel: mirror.23media.de
* extras: mirrors.ircam.fr
* updates: centos.mirror.fr.planethoster.net
Available Packages
Name : httpd
Arch : x86_64
Version : 2.4.25
Release : 3.el7.codeit
Size : 1.4 M
Repo : CodeIT/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.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test Page for the Apache HTTP Server on CentOS</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
...最后,让systemctl将Apache设置为开机自启动:[root@crosp ~]# systemctl enable httpd大功告成!
Apache是使用最广泛的应用部署软件。并且它也是所有服务器的必要组成部分。安装最新版本的apache意味着拥有更多最新的功能和修复了已知的BUG。
介绍
在这篇教程里面,我将会介绍在Centos7下安装最新版Apache的几个简单步骤。默认情况下, Centos7为软件设置了一些预定义的软件库。不幸的是,这些预定义软件库上的很多软件已近过时了。
第一步:找出默认软件库上的Apache版本
为了查找Centos上软件库里的Apache版本,在命令行下输入以下指令:yum info httpd如果你的centos保持着默认的配置的话,你很可能会按到类似的结果:[root@crosp ~]# yum info httpdLoaded plugins: fastestmirror
epel/x86_64/metalink | 19 kB 00:00
epel | 4.3 kB 00:00
(1/3): epel/x86_64/group_gz | 170 kB 00:00
(2/3): epel/x86_64/primary_db | 4.6 MB 00:00
(3/3): epel/x86_64/updateinfo | 780 kB 00:00
Loading mirror speeds from cached hostfile
* base: mirrors.ircam.fr
* epel: mirrors.ircam.fr
* extras: centos.mirror.fr.planethoster.net
* updates: centos.mirror.fr.planethoster.net
Available Packages
Name : httpd
Arch : x86_64
Version : 2.4.6
Release : 45.el7.centos.4
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.正如你从上面的输出结果中看到,默认软件库中只有2.4.6版本的apache。
注意:
Centos使用 向后修复安全实践 来将新的软件修复应用到更早期的版本。所以,默认库中的早期版本软件不意味着就更脆弱。不过对于我来说,并不算是个满足需求的更新。
你可以使用changelog来查看版本更新:sudo yum install yum-changelog
yum changelog httpd
第二步:安装CodeIT库
CodeIT的人提供了一个很好的自定义库。这个库提供了最新版本的服务器软件(Apache & Nginx)。在安装CodeIT库之前,你需要开启 EPEL 。EPEL提供了CodeIT库需要的依赖。sudo yum install -y epel-release最后,我们来安装CodeIT库cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo接下来,我们再次确认Apache的包版本,你应该会看到类似下面的输出[root@crosp ~]# yum info httpd
Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.crazyfrogs.org
* epel: mirror.23media.de
* extras: mirrors.ircam.fr
* updates: centos.mirror.fr.planethoster.net
Available Packages
Name : httpd
Arch : x86_64
Version : 2.4.25
Release : 3.el7.codeit
Size : 1.4 M
Repo : CodeIT/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.
第三步:安装Apache
现在你应该有了安装最新版apache所需要的所有东西:yum install httpd一旦Apache安装好,我们就可以测试apache是否正常工作:[root@crosp ~]# systemctl start httpd输出应该是类似下图:[root@crosp ~]# curl localhost<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test Page for the Apache HTTP Server on CentOS</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
...最后,让systemctl将Apache设置为开机自启动:[root@crosp ~]# systemctl enable httpd大功告成!
相关文章推荐
- centos7.2如何升级到centos7.3最新版本
- CentOs如何将SVN、GIT升级到最新版本
- 如何升级centos到最新版本
- Centos系统Python2.6升级最新版本
- CentOS 6.6 升级GCC G++ (当前最新版本为v6.1.0) (完整)
- CentOS 7 升级最新版本git
- c/s程序版本自动升级的问题,如何判断client端版本号是否最新,然后从指定ftp服务器down
- CentOS 6.6升级OpenSSH到最新版本7.5.p1
- centos7 mariaDb5.5 升级到最新版本
- 将CentOS系统默认的python手动升级最新到2.7.13版本
- CentOS/RHEL 5.5通过YUM升级PHP到最新版本
- 如何把win7 旗舰版升级到sp1最新版本
- 详解如何在 CentOS 7 中安装或升级最新的内核
- ubuntu系统如何将firefox升级到最新版本
- centos7下如何隐藏nginx的版本号
- centos 升级内核到最新版本
- [转]CentOS 5.3通过yum升级php到最新版本的方法
- CentOS7 升级Docker 最新的版本
- 升级centos内核到最新版本
- 如何在线升级Linux mint 14至最新版本的Linux mint 15