待完善

CentOS 7测试

哈哈

#!/bin/bash
#**************************************************************
#Author: dsadas
#QQ: 68**67321
#Date: 2019-08-08
#FileName: install_httpd.sh
#URL: https://jd.com
#Description: The test script
#Copyright (C): 2019 Copyright © 站点名称 版权所有
#************************************************************
#set -e
RED="\033[0;31m"
GREEN="\033[0;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}'`
J=$((${CPUS}*${CORE})) # 判断是不是root
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.bz2
wget https://ftp.bit.nl/apache/httpd-2.4.25.tar.bz2
if [ ! "$?" -eq 0 ];then
echo "download failed!"
exit 1
fi
} # 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

最新文章

  1. Lucene学习笔记
  2. Construct Bounding Sphere
  3. SSL 通信及 java keystore 工具介绍
  4. 均价 和 最新价格 是啥意思 什么是MACD DIFF DEA 指标?
  5. CentOS 6.5下Percona Xtrabackup的安装错误解决方案
  6. uboot相关命令及用法
  7. Python中列表的常用操作
  8. Unity3D合并着色器
  9. codeforces 665B Shopping
  10. ARP攻击之Kali Linux局域网断网攻击
  11. python的进程与线程(一)
  12. Archive & Backup 概念
  13. sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError)
  14. [Notepad++]Notepad++怎么实现双视图/双窗口?
  15. docker学习记录
  16. centos7下安装docker(15.3跨主机网络-macvlan)
  17. ubuntu14.04 放开串口权限
  18. 证券化代币的时代已经到来,STO将引爆区块链经济
  19. The POM for XXX is invalid, transitive dependencies (if any) will not be available解决方案
  20. UrlUtils工具类,Java URL工具类,Java URL链接工具类

热门文章

  1. CSP-S 初赛内容整理
  2. CF991D Bishwock
  3. 《如何学习基于ARM嵌入式系统》笔记整理
  4. MyBatis 概念
  5. 从零开始把项目发布到Nuget仓库中心
  6. 微服务架构 ------ Day01 微服务架构优缺点
  7. [解决]Hadoop 2.4.1 UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0
  8. day03课堂练习
  9. Java基础(二十)集合(2)Collection接口
  10. 设计模式C++描述----17.备忘录(Memento)模式