首页 技术 正文
技术 2022年11月16日
0 收藏 998 点赞 4,207 浏览 4418 个字

工作需要,为一台空白服务器安装apache,小白程序员,搞了一个下午,惭愧!

工具需要,也可以自己到apache下载

http://httpd.apache.org/download.cgi

Apache安装,亲测成功

遇到的bug

apr-1.5.1.tar.gz

apr-util.1.5.4.tar.gz

都是不是最新版本的,因为我用最新版安装,总是make install失败。所以放弃了

1.第一步  准备工作,先安装gcc C++ (百度有些文档是最后安装,我这里先安装了,这里需要root权限)

[root@localhost /]# yum install gcc-c++2. 第二步  1.下载安装包,需要下面3个安装包,把安装包用ftp拉到对应的目录下去。

[root@bes2 apache]# ll-rw-r–r–. 1 root root 1020833 9月  18 17:47 apr-1.5.1.tar.gz-rw-r–r–. 1 root root  874462 9月  18 17:48 apr-util-1.5.3.tar.gz-rw-r–r–. 1 root root 6820719 9月  18 17:40 httpd-2.4.10.tar.gz [apps@app-srm-dev-1 ~]$ cd svr
[apps@app-srm-dev-1 svr]$ ll
total 11832
drwxr-xr-x 28 apps apps    4096 Feb 28 17:58 apr-1.5.1
-rw-rw-r–  1 apps apps 1020833 Feb 28 17:52 apr-1.5.1.tar.gz
drwxr-xr-x 20 apps apps    4096 Feb 28 18:02 apr-util-1.5.4
-rw-rw-r–  1 apps apps  874044 Feb 28 18:00 apr-util-1.5.4.tar.gz
drwxrwxr-x  4 apps apps    4096 Mar  1 15:45 gsc
drwxr-xr-x 12 apps apps    4096 Feb 28 18:13 httpd-2.4.29
-rw-rw-r–  1 apps apps 8638793 Feb 28 18:04 httpd-2.4.29.tar.gz
drwxr-xr-x  8 apps apps    4096 Jul  5  2016 jdk1.8.0_91
drwxrwxr-x  6 apps apps    4096 Feb 28 18:09 local
drwxr-xr-x  8 apps apps    4096 Feb 28 18:11 pcre-8.20
-rw-rw-r–  1 apps apps 1539766 Feb 28 18:09 pcre-8.20.tar.gz
drwxrwxr-x  3 apps apps    4096 Mar  1 17:04 software
[apps@app-srm-dev-1 svr]$

 对应svr目录解压就ok了,解压以后对应的目录下图所示tar -zxvf apr-1.5.1.tar.gzApache安装,亲测成功

2.建立安装目录/apps/svr/local

Apache安装,亲测成功

3.命令安装

试安装apache

在目录下执行命令

[apps@app-srm-dev-1 apr-1.5.1]$ cd ../httpd-2.4.29
[apps@app-srm-dev-1 httpd-2.4.29]$ ^C
[apps@app-srm-dev-1 httpd-2.4.29]$
[apps@app-srm-dev-1 httpd-2.4.29]$
[apps@app-srm-dev-1 httpd-2.4.29]$
[apps@app-srm-dev-1 httpd-2.4.29]$ pwd
/apps/svr/httpd-2.4.29
[apps@app-srm-dev-1 httpd-2.4.29]$
[apps@app-srm-dev-1 httpd-2.4.29]$ ./configure –prefix=/apps/svr/local/httpd

估计会报错

checking for APR... no
configure: error: APR not found. Please read the documentation.
这个信息就是需要安装apr,apr-util下面是安装apr,apr-util
进入刚刚解压的目录
[apps@app-srm-dev-1 svr]$ cd apr-1.5.1
[apps@app-srm-dev-1 apr-1.5.1]$ pwd
/apps/svr/apr-1.5.1
[apps@app-srm-dev-1 apr-1.5.1]$
./configure --prefix=/apps/svr/local/apr//--http://blog.csdn.net/u013835877/article/details/39555345

报错:config.status: executing libtool commands
rm: cannot remove `libtoolT’: No such file or directory
config.status: executing default commands
解决方法:[root@bes2 apr-1.5.1]# yum install libtool   ——安装libtool  — 需要root权限完成后,重新执行配置apr命令,接着又出现下面错误config.status: executing libtool commands
rm: cannot remove `libtoolT’: No such file or directory
config.status: executing default commands
config.status: include/apr.h is unchanged
config.status: include/arch/unix/apr_private.h is unchanged
解决方法:直接打开/usr/local/src/apr-1.5.1/configure  把 $RM “$cfgfile” 那行删除掉 $RM “$cfgfile”  大约在 42302 行然后再重新运行  ./configure  –prefix=/usr/local/apr  就可以了[root@bes2 apr-1.5.1]# make            ——编译[root@bes2 apr-1.5.1]# make install               ——安装

//–http://blog.csdn.net/u013835877/article/details/39555345


安装完毕的时候,/apps/svr/local/apr这个目录是有bin目录的

Apache安装,亲测成功

4.安装apr-util也是对应的解压目录下执行命令[apps@app-srm-dev-1 httpd-2.4.29]$ cd ../apr-util-1.5.4
[apps@app-srm-dev-1 apr-util-1.5.4]$./configure –prefix=/apps/svr/local/apr-util –with-apr=/apps/svr/local/apr/bin/apr-1-configmake

make install

//–http://blog.csdn.net/u013835877/article/details/39555345[root@bes2 apr-1.5.1]# cd ../apr-util-1.5.4[root@bes2 apr-util-1.5.3]# ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr   ——配置[root@bes2 apr-util-1.5.3]# make     ——编译[root@bes2 apr-util-1.5.3]# make install          ——安装//–http://blog.csdn.net/u013835877/article/details/39555345 5.安装httpd也是对应的解压目录 [apps@app-srm-dev-1 apr-1.5.1]$ cd ../httpd-2.4.29
[apps@app-srm-dev-1 httpd-2.4.29]$./configure –prefix=/apps/svr/local/httpd  –with-apr=/apps/svr/local/apr –with-apr-util=/apps/svr/local/apr-util
报错:checking for pcre-config… false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/解决方法:安装pcre,安装完成后重新执行上述配置命令[root@bes1 pcre-8.35]#  ./configure –prefix=/apps/svr/local/pcremake make install 当apr,apr-util,pcre都安装完了,就可以重新安装httpd了命令是[apps@app-srm-dev-1 httpd-2.4.29]$
[apps@app-srm-dev-1 httpd-2.4.29]$ ./configure –prefix=/apps/svr/local/httpd –with-pcre=/apps/svr/local/pcre –with-apr=/apps/svr/local/apr –with-apr-util=/apps/svr/local/apr-util makemake install 

启动apache

在启动apache的命令之前,我们最好需要查看下配置文件,我的是在/usr/local/apache2/conf/httpd.conf,,如下:

2个地方需要改

ServerName

Listen
Apache安装,亲测成功

我们需要在这里servername做些修改,修改成你linux的ip,端口号就用默认的。

好了,真正启动Linux吧


/usr/local/apache2/bin/apachectl start
  • 1
  • 2

现在你就只需要在浏览器中输入ip地址即可访问。

注意:如果访问不了,可能需要关闭你的防火墙,命令如下:


service iptables stop
  • 1
  • 2

Ok,基本到这里就没问题了。

[apps@app-srm-dev-2 bin]$ ./apachectl stop
[apps@app-srm-dev-2 bin]$
[apps@app-srm-dev-2 bin]$
[apps@app-srm-dev-2 bin]$ ./apachectl start
[apps@app-srm-dev-2 bin]$ ps -ef|grep httpd

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,023
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,513
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,360
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,143
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,774
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,852