CentOS7 编码编译安装或卸载http2.4.25 一键脚本
待完善
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
CentOS7 编码编译安装或卸载http2.4.25 一键脚本的更多相关文章
- centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展
centos7.6编译安装php7..11及redis/memcached/rabbitmq/openssl/curl等常见扩展 获取Php的编译参数方法: [root@eus-api-cms-bac ...
- CentOS7.6编译安装openssl-1.1.1c
卸载旧版本OpenSSL # which openssl/usr/bin/openssl# mv openssl openssl.oldrm -rf /etc/ssl #删除配置文件 CentOS7. ...
- linux服务器上,yum、rpm、源码编译安装及卸载
源码的编译安装及卸载 源码安装三部曲 1.生成makefile编译文件./configure 一般安装包下面都有一个configure文件,用来生成makefile编译文件常用的参数: --prefi ...
- ./configure && make && make install 编译安装和卸载 (Linux)
./configure && make && make install 编译安装和卸载 (Linux) 正常的编译安装/卸载: 源码的安装一般由3个步骤组成:配置( ...
- centos7下编译安装php-7.0.15(PHP-FPM)
centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...
- Linux Centos7.2 编译安装PHP7.0.2
操作环境: 1.系统:Centos7.2 2.服务:Nginx 1.下载PHP7.0.2的安装包解压,编译,安装: $ cd /usr/src/ $ wget http://cn2.php.net/d ...
- CentOS7.6编译安装Python-3.7.4
安装步骤 1. 下载安装包.wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz<说明>如果报SSL/TSL错误,则加 ...
- CentOS7下编译安装redis-5.0.9
CentOS7下编译安装redis-5.0.9 本文地址http://yangjianyong.cn/?p=171转载无需经过作者本人授权 下载redis #code start wget https ...
- CentOS7 下编译安装 Samba,什么是 SMB/CIFS 协议
目录 一.关于 Samba 1. SMB 2. Samba 二.yum 安装 Samba 1. 安装 Samba 2. 查看版本 3. 查看配置文件 4. 启动服务 5. 本地客户端验证 6. Win ...
随机推荐
- 解决 canvas 将图片转为base64报错: Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasEleme...
问题描述 当用户点击分享按钮时,生成一张海报,可以保存图片分享到朋友圈,用户的图片是存储在阿里云的OSS,当海报完成后,执行.canvas.toDataURL("image/png" ...
- luogu P2210 Haywire
[返回模拟退火略解] 题目描述 一数轴上有 nnn 个点,有 nnn 个环,求一种组合方案,使得所有边长度和最小. Solution 2210\text{Solution 2210}Solution ...
- [HDU2294] Pendant - 矩阵加速递推
Pendant Time Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Sub ...
- 小白学 Python(6):基础运算符(下)
人生苦短,我选Python 前文传送门 小白学 Python(1):开篇 小白学 Python(2):基础数据类型(上) 小白学 Python(3):基础数据类型(下) 小白学 Python(4):变 ...
- 16.Nginx HTTPS实践
1.不做任何修改实现http跳转https(协议间的跳转): return [root@web01 conf.d]# cat url.cheng.com.conf server { listen 80 ...
- 19.Linux进程管理概述
1.进程基本概述 当我们运行一个程序,那么我们将运行的程序叫进程. PS1: 当程序运行为进程后,系统会为该进程分配内存,以及进程运行的身份和权限. PS2: 在进程运行的过程中,服务器上会有各种状态 ...
- MongoDB-系统时钟跳变引发的风波
目录 背景 一. 对 oplog 的影响 oplog 原理 二.主备倒换 小结 声明:本文同步发表于 MongoDB 中文社区,传送门: http://www.mongoing.com/archive ...
- Hadoop 在 windows 7 64位的配置(二)|非cygwin
第一次使用需要 hdfs namenode -format 一键启动和关闭hadoop 新建文本文档 然后改名 start-hadoop.cmd 里面的内容 @echo off cd /d %HADO ...
- bash_history文件怎么删除
Bash shell在“~/.bash_history”(“~/”表示用户目录)文件中保存了500条使用过的命令,这样可以使你输入使用过的长命令变得容易.每个在系统中拥有账号的用户在他的目录下都有一个 ...
- 【ASP.NET Core学习】Razor页面
准备工作 初始化空的项目(终端输入:dotnet new web -n=Razor) Nuget添加Microsoft.EntityFrameworkCore.SqlServer 和 Microsof ...