lamp平台构建(Apache、MySQL、PHP)

环境说明:

系统平台 IP 需要安装的服务
redhat 192.168.102.128 httpd-2.4
mysql-5.7
php
php-mysql

lamp平台软件安装次序:http–>mysql–>php
注意:PHP要求httpd使用prefork MPM

1. 安装httpd

注意:先将网络源配好。

1.1 安装开发工具包

[root@server ~]# yum -y install epel-release
[root@server ~]# yum groups mark install 'Development Tools'
已加载插件:product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
base                                             | 3.6 kB     00:00     
centosplus                                       | 3.4 kB     00:00     
extras                                           | 3.4 kB     00:00     
updates                                          | 3.4 kB     00:00     
(1/5): centosplus/x86_64/primary_db                | 2.9 MB   00:04     
(2/5): base/x86_64/primary_db                      | 5.9 MB   00:05     
(3/5): base/x86_64/group_gz                        | 166 kB   00:05     
(4/5): extras/x86_64/primary_db                    | 187 kB   00:05     
(5/5): updates/x86_64/primary_db                   | 5.2 MB   00:07     
Marked install: Development Tools

1.2 创建apache服务的用户和组

[root@server ~]# groupadd -r apache
[root@server ~]# useradd -r -M -s /sbin/nologin -g apache apache

1.3安装依赖包

[root@server ~]# yum -y install openssl-devel pcre-devel expat-devel libtool
#安装过程略···

1.4下载和安装apr以及apr-util

[root@server ~]# cd /usr/src/
[root@server src]# wget http://mirrors.shu.edu.cn/apache//apr/apr-1.6.5.tar.bz2
#过程略···
[root@server src]# wget http://mirrors.shu.edu.cn/apache//apr/apr-util-1.6.1.tar.bz2
#过程略···
[root@server src]# ls
apr-1.6.5.tar.bz2  apr-util-1.6.1.tar.bz2  debug  kernels
[root@server src]# yum -y install bzip2    //安装bzip2
#解压两个包
[root@server src]# tar xf apr-1.6.5.tar.bz2 
[root@server src]# tar xf apr-util-1.6.1.tar.bz2 
[root@server src]# ls
apr-1.6.5          apr-util-1.6.1          debug
apr-1.6.5.tar.bz2  apr-util-1.6.1.tar.bz2  kernels
[root@server src]# cd apr-1.6.5/
[root@server apr-1.6.5]# vim configure
    cfgfile=${ofile}T
    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
#   $RM "$cfgfile"                      //加上注释或者删掉
[root@server apr-1.6.5]# ./configure --prefix=/usr/local/apr
#配置过程略···
[root@server apr-1.6.5]# make && make install
#编译安装过程略···
[root@server apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#配置过程略···
[root@server apr-util-1.6.1]# make && make install
编译安装过程略···

1.5编译安装httpd

[root@server ~]#  wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.34.tar.bz2                //下载软件包(如果包没有了,请根据包前面的网址自行获取包)
[root@server ~]# ls
anaconda-ks.cfg  httpd-2.4.34.tar.bz2
[root@server ~]# tar xf httpd-2.4.34.tar.bz2 
[root@server ~]# ls
anaconda-ks.cfg  httpd-2.4.34  httpd-2.4.34.tar.bz2
[root@server ~]# cd httpd-2.4.34/
[root@server httpd-2.4.34]# ./configure --prefix=/usr/local/apache \
> --sysconfdir=/etc/httpd24 \
> --enable-so \
> --enable-ssl \
> --enable-cgi \
> --enable-rewrite \
> --with-zlib \
> --with-pcre \
> --with-apr=/usr/local/apr \
> --with-apr-util=/usr/local/apr-util/ \
> --enable-modules=most \
> --enable-mpms-shared=a

你可能感兴趣的:(lamp,Linux,MySQL,PHP,Apache)