准备:
从官网下载好httpd、mysql、PHP软件源码包(也可以直接使用wget命令下载。前提是需要配置好网络和yum源)。这里可以参考我另外几篇博客,有记载:https://www.cnblogs.com/HeiDi-BoKe/p/11788558.html
源码编译安装需要配置好环境,比如安装pcre,gc等环境
步骤:
- 安装apache web服务
- 通过wget下载httpd软件,解压,进入安装目录,配置configure,编译make,编译安装make install
- 安装MySQL DB服务
- 同上
- 安装PHP服务
- 同上
- 整合LAMP架构并启动服务
脚本内容:
[root@rhel8 shell]# cat auto_lamp.sh
#!/bin/bash
# auto make instal LAMP
# by autors tanbaobao 2020/06/08
# Httpd define path variable
H_FILES=httpd-2.4.43.tar.bz2
H_FILES_DIR=httpd-2.4.43
H_URL=https://mirror.bit.edu.cn/apache//httpd/
H_PREFIX=/usr/local/apache2/
# apr
APR_URL=https://mirror.bit.edu.cn/apache//apr/
APR_FILES=apr-1.7.0.tar.gz
APR_FILES_DIR=apr-1.7.0
APR_PREFIX=/usr/local/apr
# apr-util
APRU_URL=https://mirror.bit.edu.cn/apache//apr/
APRU_FILES=apr-util-1.6.1.tar.gz
APRU_FILES_DIR=apr-util-1.6.1
APRU_PREFIX=/usr/local/apr-util
# pcre
PCRE_URL=https://sourceforge.net/projects/pcre/files/pcre/8.44/
PCRE_FILES=pcre-8.44.tar.gz
PCRE_FILES_DIR=pcre-8.44
PCRE_PREFIX=/usr/local/pcre
# https://sourceforge.net/projects/pcre/files/pcre/8.44/pcre-8.44.tar.gz/download
# MySQL define path variable
M_URL=http://mirrors.sohu.com/mysql/MySQL-8.0/
M_FILES=mysql-8.0.11.tar.gz
M_FILES_DIR=mysql-8.0.11
M_PREFIX=/usr/local/mysql
# PHP define path variable
P_URL=http://mirrors.sohu.com/php/
P_FILES=php-7.4.6.tar.gz
P_FILES_DIR=php-7.4.6
P_PREFIX=/usr/local/php
# LICONV
LICONV_URL=http://ftp.gnu.org/gnu/libiconv/
LICONV_FILES=libiconv-1.16.tar.gz
LICONV_FILES_DIR=libiconv-1.16
LICONV_PREFIX=/usr/local/libiconv1.16
# define LAMP Select Install Menu
if [ -z "$1" ];then
echo -e "