基于编译安装实现LAMP

4 篇文章 0 订阅
3 篇文章 0 订阅

基于编译安装实现LAMP

实验环境:分别在官网下载所需要的源码包,在本文中用到的分别是:
   apr-1.6.2.tar.gz
   apr-util-1.6.0.tar.gz
   httpd-2.4.27.tar.bz2
   mariadb-10.2.9-linux-x86_64.tar.gz
   php-7.1.10.tar.xz
   wordpress-4.8.1-zh_CN.tar.gz
   其中mariadb数据库是二进制安装,其余都是源码编译。
实验主机:centos7主机
1、编译安装http2.4
  前提:编译HTTP2.4首先要先实现apr和apr-util,所以我们要先编译apr-1.6.2.tar.gz 和apr-util-1.6.0.tar.gz
[root@centos7-2 httpd24]# tar xvf apr-1.6.2.tar.gz 
[root@centos7-2 httpd24]# tar xvf apr-util-1.6.0.tar.gz 
[root@centos7-2 httpd24]# tar xvf httpd-2.4.27.tar.bz2 
[root@centos7-2 httpd24]# cp -r apr-1.6.2 httpd-2.4.27/srclib/apr
[root@centos7-2 httpd24]# cp -r apr-util-1.6.0 httpd-2.4.27/srclib/apr-util
[root@centos7-2 httpd24]# cd httpd-2.4.27/
[root@centos7-2 httpd24]# ./configure --prefix=/app/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
[root@centos7-2 httpd24]# make -j 4 && make install
[root@centos7-2 httpd24]# ll /app/http24/

这里写图片描述
这里写图片描述
这里写图片描述

【注意】
  启动服务时的提示并不是错误提示,而是域名解析的问题,解决这一问题,可以修改httpd24的配置文件:

这里写图片描述

再次启动就不会提示:

这里写图片描述

2、二进制格式安装mariadb-10.2.9
[root@centos7-2 mysql]# tar xvf mariadb-10.2.9-linux-x86_64.tar.gz  -C /usr/local/    ---->  这里的目录时固定的,不能随意指定

这里写图片描述

[root@centos7-2 mysql]# useradd -r -m -d /app/mysqldb -s /sbin/nologin mysql  ----> 创建mysql用户
[root@centos7-2 mysql]# vim /etc/mysql/my.cnf 

这里写图片描述

这里写图片描述

这里写图片描述

剩下的为了方便,将mysql服务加入PATH变量就可以了;

这里写图片描述

为了数据库使用安全,需要执行mysql_secure_installation 脚本:

这里写图片描述
这里写图片描述
这里写图片描述

设置完成,可以尝试使用root来登陆:

这里写图片描述
这里写图片描述

3 、源码编译安装Php
[root@centos7-2 src]# tar xvf php-7.1.10.tar.xz 

编译php会有依赖的包,这里可以提前安装好
[root@centos7-2 src]# yum install libxml2-devel bzip2-devel libmcrypt-devel

这里写图片描述
这里写图片描述

编译完成后需要进行一些php的设置:
将解压文件中的配置文件复制到/etc/目录下:
[root@centos7-2 php-7.1.10]# cp php.ini-production /etc/php.ini
修改httpd的配置文件,加入几行内容,用来支持php模块:

这里写图片描述
这里写图片描述
这里写图片描述

重启httpd服务
[root@centos7-2 php-7.1.10]# apachectl restart
4、测试php和mariadb连接
编译一个php脚本来测试:

这里写图片描述

这里写图片描述

5、配置wordpress
[root@centos7-2 src]# tar xvf wordpress-4.8.1-zh_CN.tar.gz -C /app/httpd24/htdocs

这里写图片描述
这里写图片描述

修改完以后就可以在网页上查看了:

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这样整个实验,基于源码编译安装实验的LAMP个人博客网站搭建就实现啦~~~~
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值