Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS7 script one-click source code compilation, installation or uninstallation of http2.4.25

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

To be improved

CentOS 7 Test

Ha ha

#! / bin/bash

# * *

# Author: Hello

# QQ: × × ×

# Date: 2019-08-08

# FileName: install_httpd.sh

# URL: https://blog.51cto.com/14012942

# Description: The test script

# Copyright (C): 2019 Copyright ©site name. All rights reserved.

# *

# set-e

RED= "\ 033 [0ter31m"

GREEN= "\ 033 [0x 32m"

NO_COLOR= "\ 033 [0m"

PREFIX=/apps/httpd24

SYSCONFDIR=/etc/httpd

SRC=/usr/src

FLAG=$1

CPUS=cat / proc/cpuinfo | grep "physical id" | sort | uniq | wc-l

CORE=cat / proc/cpuinfo | grep "cpu cores" | uniq | awk'{print $4}'

Junk $(${CPUS} * ${CORE}))

Judge whether it is root or not.

Judge_root () {

[$(id-u)! = "0"] & & {echo-e "${RED} Error:$ {NO_COLOR} You must be root to run this script."; exit 1;}

}

Download

Download_source () {

Cd

Yum install wget-y

# wget http://archive.apache.org/dist/httpd/httpd-2.4.25.tar.bz2

Wget https://ftp.osuosl.org/pub/blfs/conglomeration/httpd/httpd-2.4.25.tar.bz2wget https://ftp.bit.nl/apache/httpd-2.4.25.tar.bz2if [! "$?"-eq 0]; then echo "download failed!" Exit 1fi

}

Install

Install () {

Wget-O / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

Yum install gcc openssl-devel pcre-devel apr-devel apr-util-devel libnghttp2-devel ncurses-devel lbzip2 bzip2-y

Tar xf httpd-2.4.25.tar.bz2-C ${SRC} /

Cd ${SRC} / httpd-2.4.25

. / configure\

-- prefix=$ {PREFIX}\

-- sysconfdir=$ {SYSCONFDIR}\

-- enable-http2\

-- disable-auth-basic\

-- enable-ssl\

-- enable-so

Make-j ${J}

Make install

Echo "PATH=$ {PREFIX} / bin:$PATH" > > / etc/profile.d/env.sh

Source / etc/profile.d/env.sh

}

Test_web

Test_web () {

Apachectl start

Ss-ltn | grep-Q: 80

["$?"-eq 0] & & echo-e "${GREEN} May be web server is ok!\ n If not ok,please check selinux and firewalld status.$ {NO_COLOR}" | |

Echo-e "${RED} ERROR,Please check the web server.$ {NO_COLOR}"

}

Remove_httpd () {

Source / etc/profile.d/env.sh

Apachectl stop

Rm-rf ${PREFIX} ${SYSCONFDIR} ${SRC} / httpd-2.4.25

Sed-I'/ ^ PATH/d' / etc/profile.d/env.sh

}

Judge_uninstall () {

If ["$FLAG" = "uninstall"]; then

Remove_httpd

Exit 0

Fi

}

Main () {

Judge_uninstall

Judge_root

Download_source

Install

Test_web

}

Main

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report