代码拉取完成,页面将自动刷新
#!/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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。