当前位置:首页 » 编程软件 » centosapache编译安装

centosapache编译安装

发布时间: 2023-07-24 20:32:01

❶ Centos 下Apache(httpd) 安装过程

其实,网上这块的部署文章非常多 。随便搜索,都有 。

这篇文章,老徐帮大家挑选几个比较重点的过程 & 命令 。

1. 有些 linux 版本中已经预置了有Apache,并且已经是服务了,所有首先检查系统中是否已经存在httpd的服务

1)先检查 服务器 上是否已经启动了此服务 。

命令如下

ps -ef|grep httpd

2)查看linux系统服务中有没有httpd

chkconfig --list | grep httpd

3)如果有服务存在,那么需要先关闭httpd服务自启动
命令 chkconfig httpd off

4)停止httpd服务
命令 service httpd stop

5)再次查看,是否有进程存在
命令 ps -ef|grep httpd

6)如果有进程存在,关闭进程
命令 kill -9 pid

1)先检查 安装包 的名字

命令 rpm -qa|grep httpd

<pre style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">[root@istester]~# rpm -qa|grep httpd
httpd-2.2.15-69.el6.centos.x86_64
httpd-tools-2.2.15-69.el6.centos.x86_64</pre>

2)根据安装包名字删除包

rpm -e httpd-tools-2.2.15-69.el6.centos.x86_64

rpm -e httpd-2.2.15-69.el6.centos.x86_64

3)删除httpd.conf文件

<pre class="prettyprint" style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">#先检查文件在哪
find / -name httpd.conf

rm /xxx/xxx/httpd.conf</pre>

3. 准备事项已完成,剩下的就是常规安装了 。

注:我们通过yum的方式,在线安装,非常简单 。

1)检查是否存在httpd包

<pre style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">[www@istester ~]$ yum list httpd
Loaded plugins: security
base | 3.7 kB 00:00
epel | 4.7 kB 00:00
epel/primary_db | 6.0 MB 00:00
extras | 3.4 kB 00:00
extras/primary_db | 28 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.2 MB 00:00
Available Packages
httpd.x86_64 2.2.15-69.el6.centos base</pre>

2、安装Apache
yum install httpd

<pre style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Total 20 MB/s | 932 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 1/4
Updating : httpd-tools-2.2.15-69.el6.centos.x86_64 2/4
Installing : httpd-2.2.15-69.el6.centos.x86_64 3/4
Cleanup : httpd-tools-2.2.15-53.el6.centos.x86_64 4/4
Verifying : httpd-tools-2.2.15-69.el6.centos.x86_64 1/4
Verifying : httpd-2.2.15-69.el6.centos.x86_64 2/4
Verifying : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 3/4
Verifying : httpd-tools-2.2.15-53.el6.centos.x86_64 4/4

Installed:
httpd.x86_64 0:2.2.15-69.el6.centos

Dependency Installed:
apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1

Dependency Updated:
httpd-tools.x86_64 0:2.2.15-69.el6.centos

Complete!</pre>

安装过程,不用理会,如果看到如上提示,说明安装成功了。

3、设置Apache服务的启动级别
chkconfig --levels 235 httpd on
Apache是一个服务,所以,可以通过设置服务的启动级别来让它启动。

4、启动服务

两种方式,

1)如下 /etc/init.d/httpd start

2)如下

service httpd start

5、查看服务是否正常启动

两种方式,

1)查看服务状态

<pre style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">[root@istester www]# service httpd status
httpd (pid 10339) is running...</pre>

2)查看进程

<pre style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">[root@istester www]# ps -ef|grep httpd | grep -v grep
root 10339 1 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10341 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10342 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10343 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10344 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10345 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10346 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10347 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10348 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd</pre>

补充,

1)停止服务

service httpd stop

2)重启服务

service httpd restart

6、安装之后的说明:

1)验证是否安装成功
现在打开 http://ip 地址,看看有没有Apache的默认页面出来了?如果有就对了。

2)安装目录说明
Apache默认将网站的根目录指向 /var/www/html
默认的主配置文件是 /etc/httpd/conf/httpd.conf
配置存储在的/etc/httpd/conf.d/目录

End

文 / IDO老徐

❷ linux怎么安装apache

这是CentOS7编译安装方法(或者你也可以yum安装,这种安装方法版本较低):
CentOS 下编译安装Apache
卸载原有的apache
首先从 http://httpd.apache.or 下载apache源码包httpd-2.4.4.tar.gz
然后从 http://apr.apache.org 下载apr-1.4.6.tar.gz和apr-util-1.5.1.tar.gz
然后从 http://sourceforge.net/ 下载pcre-8.32.tar.gz和pcre-devel-8.32.tar.gz
先装gcc和make
yum -y install gcc
yum -y install make
yum -y install gcc-c++ 没有这个gcc-c++一会编译不prce
切到下载好的源码包目录,本人是~/Download

安装apr:
tar -zvxf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install

安装apr-util
tar -zvxf apr-util-1.5.1.tar.gz
cd apr-util-1.5.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

安装pcre
tar -zvxf pcre-8.32.tar.gz
cd pcre-8.32
./configure
make && make install

安装pcre-devel
如果已经安装好了pcre 一定要安装
tar –zxvf pcre-devel-8.32.tar.gz
cd pcre-devel-8.32
./configure
make && make install

安装apache 一定要先装上面那三个不然编译不了
tar -zvxf httpd-2.4.4.tar.gz
cd httpd-2.4.4
./configure --prefix=/usr/local/apache –with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install

配置/usr/local/apache/conf下的http.conf文件(先备份)。
1、服务器
#ServerName www.example.com:80 前的#号删除。
2、目录访问权限
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all #修改为此样
</Directory>
3、默认字符集
AddDefaultCharset utf-8 #指定默认字符集

4、启动httpd
cd bin/
./apachectl start | restart | stop

将httpd添加为系统服务
cp apachectl /etc/init.d/httpd
/etc/init.d/

编辑httpd,在第二行加入如下信息:
# chkconfig: 345 85 15
# description: Activates/Deactivates Apache Web Server
以上两句必须添加,否则会提示“httpd服务不支持”;第一行3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(85);关闭序号(15)。

添加启动信息(Ubuntu与CentOS有区别)
chkconfig –add httpd
查看是否添加成功
chkconfig --list

服务器控制
service httpd start | restart | stop

❸ centos安装apache mysql php用YUM安装与编译安装有什么区别

YUM安装:需要连接网络,依赖库可以自动补全;
编译安装:自己下载安装包,依赖包要自己补

❹ centos安装apache mysql php用YUM安装与编译安装有什么区别

yum安装方便,内容固定。
编译安装内容定制灵活,但手续稍复杂。

❺ 如何在CentOS6下实现Apache+PHP+MySQL的快速安装

LAMP是一个免费、开源的解决方案,代表了Linux、Apache、MySQL、PHP,主要用作建立可行的通用的web服务器。那么如何在CentOS6下实现安装Apache+php+Mysql的快速安装?其具体安装配置步骤可以如下进行:
1.准备工作
使用yum进行安装,为了提高速度,最好先是修改为中国CentOS镜像服务器。目前国内有三个镜像可以选择,分别是:中国科学技术大学、163和Sohu的镜像,建议教育网用户选择中科大,电信用户选择163
下面命令是备份CentOS-Base.repo文件,并修改使用163镜像作为yum源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.save
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS6-Base-163.repo /etc/yum.repos.d/CentOS-Base.repo

2.更新系统内核
yum -y update

3.安装Apahce、Mysql、PHP
yum -y install httpd php mysql mysql-server

默认情况下,mysql数据目录位于/var/lib/mysql
4.安装相关组件:
yum install php-mysql php-gd php-imap php-ldap php-odbc
php-pear php-xml php-xmlrpc

5.安装MySQL管理工具phpMyAdmin
yum -y install phpMyAdmin
6.配置Apache随系统启动
chkconfig --levels 235 httpd on
/etc/init.d/httpd start

7.配置MySQL随系统启动
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

8.设置数据库root密码
/usr/bin/mysqladmin -u root password 'New+Password#www.yupengyan.com'

9.测试PHP是否安装成功
在 CentOS 中 Apache 的默认根目录是 /var/www/html,配置文件 /etc/httpd/conf/httpd.conf。其他配置存储在 /etc/httpd/conf.d/ 目录。

❻ 如何在linux centos中安装apache

Apache在Linux系统中,其实叫“httpd”,它“无耻的”占据了官方名义!
CentOS可以使用yum命令,非常简单和容易的安装Apache,下面演示一下步骤:

1、安装Apache
yum install httpd

2、设置Apache服务的启动级别
chkconfig --levels 235 httpd on
Apache是一个服务,所以,可以通过设置服务的启动级别来让它启动。2,3,5三个级别分别表示什么意思就不用我多说了吧。

3、现在就启动它
/etc/init.d/httpd start

安装之后的说明:

1、验证是否安装成功
现在打开http://ip地址,看看有没有Apache的默认页面出来了?如果有就对了。

2、安装目录介绍
Apache默认将网站的根目录指向/var/www/html 目录
默认的主配置文件是/etc/httpd/conf/httpd.conf
配置存储在的/etc/httpd/conf.d/目录

❼ centos编译安装php7怎么加入apache

centos编译安装php7怎么加入apache
可以直接下载PHP7.0.2的安装包解压,编译,安装:
下载php7,并解压
$ cd /usr/src/
$ wget http://cn2.php.net/distributions/php-7.0.2.tar.gz
#解压
$ tar -xzxvf php-7.0.2.tar.gz
$ cd php-7.0.2
解压完后先不要编译,请检查是否安装了gcc ,没有的话执行yum install gcc
检查是否安装了libxml2 ,没有的话执行yum install libxml2
检查是否安装了libxml2-devel,没有的话执行yum install libxml2-devel
注:因为改为用nginx了,所以编译参数中的--with-apxs2=/usr/bin/apxs去掉了,如果要配置apache用,安装PHP前,请先安装apache。

热点内容
263会议视频密码是多少 发布:2025-02-06 07:09:59 浏览:707
uc小说浏览器缓存 发布:2025-02-06 07:05:05 浏览:467
wifi路由手机怎么设置密码 发布:2025-02-06 07:00:57 浏览:985
nsurlsession上传 发布:2025-02-06 06:55:18 浏览:336
亚洲十帅exo访问 发布:2025-02-06 06:51:40 浏览:98
编程一首诗 发布:2025-02-06 06:45:04 浏览:528
惊声尖笑5下载ftp 发布:2025-02-06 06:33:16 浏览:528
共享文件夹让输入密码 发布:2025-02-06 06:32:28 浏览:970
收银服务器响应出错什么意思 发布:2025-02-06 06:24:43 浏览:607
sql用户授权 发布:2025-02-06 06:24:42 浏览:677