ubuntu下安装apache http server
2015-04-14 15:20
148 查看
在ubuntu下。下载了apache http server直接编译安装的话,configure时会出现“APR not found ”的错误,是因为其所依赖的软件包没有安装。安装过程一步步理清依赖关系,正确使用命令行选项,安装apache
http server会变得很简单。
PS:Apache http server 需要依赖 apr、apr-util、pcre,所以要先下载和安装这三个东东。而apr-util和pcre又依赖apr,所以要先安装apr。
步骤:
1、 下载apr、apr-util、pcre、Apache httpserver
地址如下:
apr/ apr-util: http://apr.apache.org/download.cgi
pcre: http://www.pcre.org/
apache http server: http://httpd.apache.org/download.cgi#apache24
2.分别解压四个文件
例如解压到当前目录:
解压apr : tar –vxf apr-1.5.0.tar.gz(在source目录下会多出一个目录apr-1.5.0)
解压apr : tar –vxf apr-util-1.5.3.tar.gz(在source目录下会多出一个目录apr-util-1.5.3)
解压pcre : tar –vxf pcre-8.33.tar.gz(在source目录下会多出一个目录pcre-8.33)
解压Apache http server:tar –vxf httpd-2.4.9.tar.gz(在source目录下会多出一个目录httpd-2.4.9)
PS:注意,我下载的都是tar.gz格式的,如果是其他格式的,请参考linux关于解压方面的相关命令。
3、 安装apr
切换到apr-1.5.0文件夹下,依次执行命令:
(1)./configure--prefix=/usr/mytest /soft/apr (该命令的意思是配置安装文件,指定安装路径为绝对路径)
(2)make (编译)
(3)make install(安装)
4、 安装apr-util
切换到apr-util-1.5.3文件夹下,依次执行命令:
(1)./configure--prefix=/usr/mytest /soft/apr-util --with-apr=/usr/mytest
/soft/apr/bin/apr-1-config
(该命令的意思是配置安装文件,指定安装路径为绝对路径;且需要依赖apr,否则将会出错)
(2)make (编译)
(3)make install(安装)
5、 安装pcre
切换到pcre-8.33文件夹下,依次执行命令:
(1)./configure--prefix=/usr/mytest /soft/pcre --with-apr=/usr/mytest
/soft/apr/bin/apr-1-config
(该命令的意思是配置安装文件,指定安装路径为绝对路径;且需要依赖apr,否则将会出错)
(2)make (编译)
(3)make install(安装)
6、 安装Apache httpserver
切换到httpd-2.4.9文件夹下,依次执行命令:
(1)./configure--prefix=/usr/mytest /soft/httpd
--with-apr=/usr/mytest/soft/apr/bin/apr-1-config --with-apr-util=/usr/mytest/soft/apr-util/bin/apu-1-config
--with-pcre=/usr/mytest /soft/pcre/bin/pcre-config
(该命令的意思是配置安装文件,指定安装路径为绝对路径;且需要依赖apr/apr-util/pcre,否则将会出错)
(2)make (编译)
(3)make install(安装)
至此安装完成!
7、 启动测试:
(1) 需要首先修改配置文件:(/usr/mytest /soft/httpd/conf/httpd.conf)
ServerName (如127.0.0.1:1025)
Listener (如127.0.0.1:1025)
PS:如果配置文件中Listen定义的是默认的80端口(或1024以下),那么启动Apache将需要root权限以将它绑定在特权端口上。
参考网址:http://www.jinbuguo.com/apache/menu22/invoking.html
(2) 切换到/usr/mytest /soft/httpd/bin目录下,
执行:./apachectl –k start
(3) 到浏览器中输入ServerName配置的属性值,得到:It works!
8、 共享服务器使用说明:
在httpd/htdocs 目录下面增加目录、文件等,浏览器中即可查看。
http server会变得很简单。
PS:Apache http server 需要依赖 apr、apr-util、pcre,所以要先下载和安装这三个东东。而apr-util和pcre又依赖apr,所以要先安装apr。
步骤:
1、 下载apr、apr-util、pcre、Apache httpserver
地址如下:
apr/ apr-util: http://apr.apache.org/download.cgi
pcre: http://www.pcre.org/
apache http server: http://httpd.apache.org/download.cgi#apache24
2.分别解压四个文件
例如解压到当前目录:
解压apr : tar –vxf apr-1.5.0.tar.gz(在source目录下会多出一个目录apr-1.5.0)
解压apr : tar –vxf apr-util-1.5.3.tar.gz(在source目录下会多出一个目录apr-util-1.5.3)
解压pcre : tar –vxf pcre-8.33.tar.gz(在source目录下会多出一个目录pcre-8.33)
解压Apache http server:tar –vxf httpd-2.4.9.tar.gz(在source目录下会多出一个目录httpd-2.4.9)
PS:注意,我下载的都是tar.gz格式的,如果是其他格式的,请参考linux关于解压方面的相关命令。
3、 安装apr
切换到apr-1.5.0文件夹下,依次执行命令:
(1)./configure--prefix=/usr/mytest /soft/apr (该命令的意思是配置安装文件,指定安装路径为绝对路径)
(2)make (编译)
(3)make install(安装)
4、 安装apr-util
切换到apr-util-1.5.3文件夹下,依次执行命令:
(1)./configure--prefix=/usr/mytest /soft/apr-util --with-apr=/usr/mytest
/soft/apr/bin/apr-1-config
(该命令的意思是配置安装文件,指定安装路径为绝对路径;且需要依赖apr,否则将会出错)
(2)make (编译)
(3)make install(安装)
5、 安装pcre
切换到pcre-8.33文件夹下,依次执行命令:
(1)./configure--prefix=/usr/mytest /soft/pcre --with-apr=/usr/mytest
/soft/apr/bin/apr-1-config
(该命令的意思是配置安装文件,指定安装路径为绝对路径;且需要依赖apr,否则将会出错)
(2)make (编译)
(3)make install(安装)
6、 安装Apache httpserver
切换到httpd-2.4.9文件夹下,依次执行命令:
(1)./configure--prefix=/usr/mytest /soft/httpd
--with-apr=/usr/mytest/soft/apr/bin/apr-1-config --with-apr-util=/usr/mytest/soft/apr-util/bin/apu-1-config
--with-pcre=/usr/mytest /soft/pcre/bin/pcre-config
(该命令的意思是配置安装文件,指定安装路径为绝对路径;且需要依赖apr/apr-util/pcre,否则将会出错)
(2)make (编译)
(3)make install(安装)
至此安装完成!
7、 启动测试:
(1) 需要首先修改配置文件:(/usr/mytest /soft/httpd/conf/httpd.conf)
ServerName (如127.0.0.1:1025)
Listener (如127.0.0.1:1025)
PS:如果配置文件中Listen定义的是默认的80端口(或1024以下),那么启动Apache将需要root权限以将它绑定在特权端口上。
参考网址:http://www.jinbuguo.com/apache/menu22/invoking.html
(2) 切换到/usr/mytest /soft/httpd/bin目录下,
执行:./apachectl –k start
(3) 到浏览器中输入ServerName配置的属性值,得到:It works!
8、 共享服务器使用说明:
在httpd/htdocs 目录下面增加目录、文件等,浏览器中即可查看。
相关文章推荐
- Ubuntu下安装配置Apache http server
- [置顶] Ubuntu 14.04 安装svn server和Apache
- 源码安装Apache http server
- 马哥Linux培训学习――编译安装Apache HTTP Server 2.4.10
- 在测试环境安装使用Apache Http Server
- Linux下编译安装Apache Http Server
- ubuntu-server下apache安装配置以及优化
- Windows 下 Apache HTTP Server 安装、配置以及与 Tomcat 的整合(附图)
- CentOS7安装配置Apache HTTP Server
- 下载安装Apache HTTP Server 2.4
- Apache http server2.4 64位绿色解压版的安装、部署、启动和使用说明
- Apache Trac SVN Mercurial 安装笔记 (Ubuntu Server 8.04)
- Windows 下 Apache HTTP Server 安装、配置以及与 Tomcat 的整合(附图)
- Windows XP 环境下安装 Apache HTTP Server 2.2.8
- Apache HTTP Server 2.4版本的源码安装配置及实现
- Windows XP 环境下安装 Apache HTTP Server 2.2.8
- apache http server 安装与搭建
- Ubuntu Server安装Apache Hadoop
- Apache HTTP Server 2.4 绿色版 安装成系统服务