1 Star 0 Fork 0

Fahoud/Common-script

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
install_script.sh 2.73 KB
一键复制 编辑 原始数据 按行查看 历史
Fahoud 提交于 2021-03-25 11:56 . update command
#!/bin/bash
# Java Version:16
# MySQL Version:8.0.23
# Git follow yum
# Nginx Version:1.17.10
# Maven Version:3.6.3
MAVEN_HOME='/opt/maven'
JAVA_HOME='/usr/local/java'
NGINX_HOME='/usr/local/nginx'
MYSQL_HOME='/usr/local/mysql'
PROFILE='/etc/profile'
LOCAL='/usr/local'
MAVEN_DOWN='https://repo.huaweicloud.com/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz'
JAVA_DOWN='https://download.oracle.com/otn-pub/java/jdk/16+36/7863447f0ab643c585b9bdebf67c69db/jdk-16_linux-x64_bin.tar.gz?AuthParam=1616321188_11da00fa390ef7f4a064de80e2ca90fd'
NGINX_DOWN='https://repo.huaweicloud.com/nginx/nginx-1.17.10.tar.gz'
MYSQL_DOWN='https://repo.huaweicloud.com/mysql/Downloads/MySQL-8.0/mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz'
read -p "install what?" env
if [ $env = 'git' ];then
yum install git
elif [ $env = 'java' ];then
cd ${LOCAL}
mkdir java
cd java
wget -O jdk-16_linux-x64_bin.tar.gz ${JAVA_DOWN}
mkdir jdk16 && tar -zxvf jdk-16_linux-x64_bin.tar.gz -C ./jdk16 --skrip-components 1
echo 'JAVA_HOME=/usr/local/java/jdk1.8.0_161' >> ${PROFILE}
echo 'CLASSPATH=$JAVA_HOME/lib/' >> ${PROFILE}
echo 'PATH=$PATH:$JAVA_HOME/bin' >> ${PROFILE}
echo 'export PATH JAVA_HOME CLASSPATH' >> ${PROFILE}
source ${PROFILE}
javac
elif [ $env = 'nginx' ];then
cd ${LOCAL}
mkdir nginx
cd nginx
wget -O nginx-1.17.10.tar.gz ${NGINX_DOWN}
mkdir nginx && tar -zxvf nginx-1.17.10.tar.gz -C ./nginx --skrip-components 1
cd nginx
yum -y install pcre-devel
yum -y install openssl openssl-devel
./configure
make && make install
echo 'export NGINX_HOME=/usr/local/nginx' >> ${PROFILE}
echo 'export PATH=$NGINX_HOME/sbin:$PATH' >> ${PROFILE}
source ${PROFILE}
nginx
elif [ $env = 'mysql' ];then
cd ${LOCAL}
mkdir mysql
chmod 777 mysql
cd mysql
wget -O mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz ${MYSQL_DOWN}
mkdir mysql-8.0.23 && tar -zxvf mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz -C ./mysql-8.0.23 --skrip-components 1
groupadd mysql
useradd -g mysql mysql
mkdir ${LOCAL}/mysql/data
chmod 777 ${MYSQL_HOME}/data
chown -R mysql:mysql ./
# 后续需要手动(
elif [ $env = 'maven' ];then
mkdir /opt/maven
cd /opt/maven
wget -O apache-maven-3.6.3-bin.tar.gz ${MAVEN_DOWN}
mkdir maven-3.6.3 && tar -xvf apache-maven-3.6.3-bin.tar.gz -C ./maven-3.6.3 --skrip-components 1
# 解压完成后自行更改maven国内源
# 编辑/opt/maven/maven-3.6.3/conf/setting.xml中<mirrors></mirrors>标签下内容
echo 'export MAVEN_HOME=/opt/maven/maven-3.6.3' >> ${PROFILE}
echo 'export PATH=$MAVEN_HOME/bin:$PATH' >> ${PROFILE}
source ${PROFILE}
else
echo "请键入正确命令"
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/Fahoud/common-script.git
git@gitee.com:Fahoud/common-script.git
Fahoud
common-script
Common-script
master

搜索帮助