安装apache

实在太菜,本来打算用一个脚本安装,但是中途报出的依赖完全不知道这么解决,搞了半天,特此记录_

1.安装apache httpd

用wget下载然后解压,再配置安装路径,多个命令组合成脚本
有些别的请勿在意

#!/bin/sh
#一键源码安装脚本, 先分解脚本的各个功能
InstallApache(){
    echo "\033[36m -------------------------------installApache-------------------------------------------\033[0m"
    local URL=http://mirrors.tuna.tsinghua.edu.cn/apache//httpd
    local FILE_DIR=httpd-2.4.41
    local FILE=httpd-2.4.41.tar.bz2
    local PREFIX=/usr/local/apache2/
    wget -c $URL/$FILE&&tar -jxvf$FILE&&cd $FILE_DIR&&./configure --prefix=$PREFIX
    if [ $? -eq 0 ] 
    then
        make&&make install
        echo "\033[32The $FILES_DIR Server Install Success !\033[0m"
        return 0
    else
        echo "\033[31mThe $FILES_DIR Make or Make install ERROR,Please Check......\033[0m" 
        return 1
    fi
}

InstallMysql(){
    echo "\033[36m -------------------------------installMysql-------------------------------------------\033[0m"
}

InstallPHP(){
    echo "\033[36m -------------------------------installPHP-------------------------------------------\033[0m"
}

InstallLAMP(){
    echo "\033[36m -------------------------------installLAMP-------------------------------------------\033[1m"
}
MenuFun(){
    echo 1)安装 apache WEB服务器
    echo 2)安装 Mysql DB 服务器
    echo 3)安装 PHP 服务器
    echo 4)整合 LAMP架构并启动服务
    read choose
    return $choose
}
MenuFun
choose=$?
echo choose $choose 

case $choose in
    "1")
        InstallApache
        if [ 0 -eq $? ] 
        then
            echo "Apache install sucess"
            exit 0
        else
            echo "Apache install false"
            exit 1
        fi;;
    "2")
        InstallMysql
        if [ 0 -eq $? ] 
        then
            echo "Mysql install sucess"
            exit 0
        else
            echo "Mysql install false"
            exit 1
        fi;;
    "3")
        InstallPHP
        if [ 0 -eq $? ] 
        then
            echo "PHP install sucess"
            exit 0
        else
            echo "PHP install false"
            exit 1
        fi;;
    "4")
        InstallLAMP
        if [ 0 -eq $? ] 
        then
            echo "LAMP install sucess"
            exit 0
        else
            echo "LAMP install false"
            exit 1
        fi;;
esac

然后报错


configure: error: APR not found. Please read the documentation.

直接使用help命令来查看错误原因



经百度需要安装依赖组件

2.安装apr,ap-util,PCRE包

截止目前为止,APR and APR-Util的最新版本如下,下载地址

PCRE包
截止目前为止,PCRE最新的包为8.33,下载地址

你可能感兴趣的:(安装apache)