deep in安装系统后的初始化环境脚本

#初始化deep in系统的开发环境脚本

因为调整了敏感词,所以导致当前脚本不能用,原始脚本点击下载

脚本用来初始化deep in的基础环境,包括:jdk,mАVen,zookeeper,node,IDE,webstorm

脚本需要使用root泉限执行,尽量使用root身份执行,而不是sudoer。

脚本需要会将原始文件存放在/data/download/init目录下面,且安装完成后,保留安装包。

所有的文件都会安装在/usr/local目录下。

#!/bin/bash
:<>/dev/null;echo $?)
if [ $jАVa_env_exist -gt 0 ]
  then 
    echo "
#JАVA_SETTINGS@JPANDA
export JАVA_HOME=/usr/local/jАVa
export JRE_HOME=\${JАVA_HOME}/jre 
export CLASSPATH=.:\${JАVA_HOME}/lib:\${JRE_HOME}/lib 
export PATH=\${JАVA_HOME}/bin:\$PATH
#JАVA
">>/etc/profile
fi
source /etc/profile
# 修改sudoers执行脚本目录
# sed -i 's/\(^Defaults\s\+secure_path\s\+=\s\+.*\)/\1:/usr/local/jАVa/bin/g' /etc/sudoers
ln -s /usr/local/jАVa/bin /usr/local/bin/jАVa
echo "jАVa development environment is complated... "
jАVa -version
}
#
# 安装node
#
functiоn installNode(){
echo "
 ************************************************************
 ****    will install the node development environment   ****
 ************************************************************
"
wget -nc https://nodejs.org/dist/v10.6.0/node-v10.6.0-linux-x⑥4.tar.xz
if [ $? -gt 0 ]
  then 
    echo "the node file download fail...";
    exit 2
fi
#安装基础环境
apt-get install -y g++ ibssl-dev
#
tar -xvf node-v10.6.0-linux-x⑥4.tar.xz
mv node-v10.6.0-linux-x⑥4 /usr/local/node
ln -s /usr/local/node/bin/node /usr/local/bin/node
ln -s /usr/local/node/bin/npm /usr/local/bin/npm
#安装nrm
npm install -g nrm
}
#
# 安装mАVen
#
functiоn installMАVen(){
echo "
 ************************************************************
 ****             will install the mАVen                 ****
 ************************************************************
"
wget -nc http://mirror.bit.edu.cn/apache/mАVen/mАVen-3/3.5.4/binaries/apache-mАVen-3.5.4-bin.tar.gz
if [ $? -gt 0 ]
  then 
    echo "the mАVen file download fail...";
    exit 2
fi
tar -zxvf apache-mАVen-3.5.4-bin.tar.gz
mv apache-mАVen-3.5.4 /usr/local/mАVen
#配置环境变量
mАVen_env_exist=$(awk '{print}' /etc/profile |grep "#MАVEN_SETTINGS@JPANDA" &>>/dev/null;echo $?)
if [ $mАVen_env_exist -gt 0 ]
  then 
    echo "
#MАVEN_SETTINGS@JPANDA
export M2_HOME=/usr/local/mАVen
export PATH=\$M2_HOME/bin:\$PATH
#MАVEN
">>/etc/profile
fi
ln -s /usr/local/mАVen/bin /usr/local/bin/mАVen
source /etc/profile
}
#
#安装Zookeeper
#
functiоn installZookeeper(){
echo "
 ************************************************************
 ****             will install the zookeeper             ****
 ************************************************************
"
wget -nc http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz
tar -zxvf zookeeper-3.4.13.tar.gz
mv  zookeeper-3.4.13 /usr/local/zookeeper
#配置环境变量
mАVen_env_exist=$(awk '{print}' /etc/profile |grep "#ZOOKEEPER_SETTINGS@JPANDA" &>>/dev/null;echo $?)
if [ $mАVen_env_exist -gt 0 ]
  then 
    echo "
#ZOOKEEPER_SETTINGS@JPANDA
export ZOOKEEPER_HOME=/usr/local/zookeeper/
export PATH=\$ZOOKEEPER_HOME/bin:\$PATH
export PATH
#ZOOKEEPER END
">>/etc/profile
fi
}

#
#安装IDEA
#
functiоn installIDEA(){
echo "
 ************************************************************
 ****             will install the IDEA             ****
 ************************************************************
"
wget -nc https://download.jetbrains.com/idea/ideaIU-2018.1.6.tar.gz
tar -zxvf ideaIU-2018.1.6.tar.gz
mv idea-IU-181.5540.7 /usr/local/idea
nohup /usr/local/idea/bin/idea.sh &
}

#
#安装Webstorm
#
functiоn installWebstorm(){
echo "
 ************************************************************
 ****             will install the webstorm             ****
 ************************************************************
"
wget -nc https://download.jetbrains.com/webstorm/WebStorm-2018.1.5.tar.gz
tar -zxvf WebStorm-2018.1.5.tar.gz
mv WebStorm-181.5281.31 /usr/local/webstorm
nohup /usr/local/webstorm/bin/webstorm.sh &
}
#************************************************************
#  			     START
#************************************************************
#校验是否以root身份运行
echo "Script permission check..."
if [ `id -u` -gt 0 ];
  then 
    echo 'please use  the root user to execute this script';
    exit 2;
fi

# 校验/data/download/init
echo "directory permission check..."
dirExist=$(ls /data/download/init &>/dev/null; echo $?);
if [ $dirExist -gt 0 ]
  then 
    echo "create /data/download/init...";
    mkdir -p /data/download/init;
    chmod -R 4755 /data
fi

# 进入脚本执行目录
cd $downloadDir

# 备份profile文件
echo "Backup profile ... "
cp /etc/profile /data/download/init/profile.backup
source /etc/profile
# 安装JDK
jАVa_exist=$(jАVa -version &>/dev/null;echo $?)
if [ $jАVa_exist -gt 0 ]
  then 
    echo "install jdk...";
    installJАVa;
else
  echo "jdk already installed...skip..."
fi

# 安装NODE和NPM
node_exist=$(node -v &>/dev/null;echo $?)
if [ $node_exist -gt 0 ]
  then 
    echo "install node and npm...skip...";
    installNode;
else
  echo "node and npm already installed...skip..."
fi

# 安装mАVen
mАVen_exist=$(mvn -v &>/dev/null;echo $?)
if [ $mАVen_exist -gt 0 ]
  then 
    echo "installmАVen...";
    installMАVen;
else
  echo "mАVen alrady installed...skip..."
fi

# 安装zookeeper
zookeeper_exist=$(zkEnv.sh &>/dev/null;echo $?)
if [ $zookeeper_exist -gt 0 ]
  then 
    echo "install zookeeper...";
    installZookeeper;
else
  echo "zookeeper already installed...skip..."
fi

# 安装IDEA
idea_exist=$(ls /usr/local/bin/idea &>/dev/null;echo $?)
if [ $idea_exist -gt 0 ]
  then 
    echo "install IDEA...";
    installIDEA;
else
  echo "IDEA already installed...skip..."
fi

# 安装Webstorm
webstorm_exist=$(ls /usr/local/bin/webstorm &>/dev/null;echo $?)
if [ $webstorm_exist -gt 0 ]
  then 
    echo "install Webstorm...";
    installWebstorm;
else
  echo "Webstorm already installed...skip..."
fi
echo "complated..."

转载于:https://my.oschina.net/u/3101282/blog/1858979

你可能感兴趣的:(java,大数据,开发工具)