From 1d8b1d4e2761f1106e4af874f7925aa559379106 Mon Sep 17 00:00:00 2001 From: Zhang Peng Date: Fri, 12 Jul 2019 15:53:54 +0800 Subject: [PATCH] update scripts --- codes/linux/soft/README.md | 44 ++++++ codes/linux/soft/docker-install.sh | 6 +- codes/linux/soft/fastdfs-install.sh | 149 ++++++++++-------- codes/linux/soft/jdk8-install.sh | 10 +- codes/linux/soft/jenkins-install.sh | 2 +- codes/linux/soft/kafka-install.sh | 45 ++++-- codes/linux/soft/maven-install.sh | 55 +++++-- codes/linux/soft/mongodb-install.sh | 44 ++++-- codes/linux/soft/nacos-install.sh | 2 +- codes/linux/soft/nexus-install.sh | 2 +- codes/linux/soft/nginx-install-by-rpm.sh | 2 +- codes/linux/soft/nginx-install.sh | 55 +++++-- codes/linux/soft/nginx/README.md | 20 --- .../linux/soft/nginx/install-nginx-by-rpm.sh | 17 -- .../linux/soft/nginx/install-nginx-by-yum.sh | 11 -- codes/linux/soft/nodejs-install.sh | 34 ++-- codes/linux/soft/redis-install.sh | 2 +- codes/linux/soft/rocketmq-install.sh | 47 ++++-- codes/linux/soft/sdk/install-sdk.sh | 7 - codes/linux/soft/tomcat8-install.sh | 43 +++-- codes/linux/soft/zookeeper-install.sh | 31 ++-- codes/linux/soft/zsh-install.sh | 10 +- 22 files changed, 395 insertions(+), 243 deletions(-) delete mode 100644 codes/linux/soft/nginx/README.md delete mode 100644 codes/linux/soft/nginx/install-nginx-by-rpm.sh delete mode 100644 codes/linux/soft/nginx/install-nginx-by-yum.sh delete mode 100644 codes/linux/soft/sdk/install-sdk.sh diff --git a/codes/linux/soft/README.md b/codes/linux/soft/README.md index f7930a2..c88708c 100644 --- a/codes/linux/soft/README.md +++ b/codes/linux/soft/README.md @@ -1,5 +1,21 @@ # 服务安装配置 + + +- [oh-my-zsh 安装](#oh-my-zsh-安装) +- [JDK8 安装](#jdk8-安装) +- [Maven 安装配置](#maven-安装配置) +- [Node.js 安装](#nodejs-安装) +- [MongoDB 安装](#mongodb-安装) +- [Redis 安装配置](#redis-安装配置) +- [Tomcat8 安装](#tomcat8-安装) +- [Kafka 安装](#kafka-安装) +- [RocketMQ 安装](#rocketmq-安装) +- [Nacos 安装](#nacos-安装) +- [ZooKeeper 安装](#zookeeper-安装) + + + ## oh-my-zsh 安装 说明: @@ -174,3 +190,31 @@ curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/zoo wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/zookeeper-install.sh | bash ``` +## Nginx 安装 + +说明: + +采用编译方式安装 Nginx + +下载 nginx `1.16.0` 并解压安装到 `/opt/nginx` 路径下。 + +使用方法:执行以下任意命令即可执行脚本。 + +```sh +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nginx-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nginx-install.sh | bash +``` + +## Fastdfs 安装 + +说明: + +采用编译方式安装 Fastdfs + +下载 Fastdfs 并解压安装到 `/opt/fdfs` 路径下。 + +使用方法:执行以下任意命令即可执行脚本。 + +```sh +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/fastdfs-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/fastdfs-install.sh | bash diff --git a/codes/linux/soft/docker-install.sh b/codes/linux/soft/docker-install.sh index 515f770..21af1f6 100644 --- a/codes/linux/soft/docker-install.sh +++ b/codes/linux/soft/docker-install.sh @@ -24,10 +24,10 @@ cat << EOF EOF printf "${RESET}" -printf "${BLUE}>>>>>>>> install jenkins\n${RESET}" +printf "${BLUE}>>>>>>>> install jenkins${RESET}\n" # 下载并解压 jenkins mkdir -p /opt/jenkins -wget -O /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war +curl -o /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war -printf "${GREEN}<<<<<<<< install jenkins\n${RESET}" +printf "${GREEN}<<<<<<<< install jenkins${RESET}\n" diff --git a/codes/linux/soft/fastdfs-install.sh b/codes/linux/soft/fastdfs-install.sh index cbb351a..4ac701b 100644 --- a/codes/linux/soft/fastdfs-install.sh +++ b/codes/linux/soft/fastdfs-install.sh @@ -1,18 +1,18 @@ #!/usr/bin/env bash -############################################################################## -# console color -C_BLACK="\033[1;30m" -C_RED="\033[1;31m" -C_GREEN="\033[1;32m" -C_YELLOW="\033[1;33m" -C_BLUE="\033[1;34m" -C_PURPLE="\033[1;35m" -C_CYAN="\033[1;36m" -C_RESET="$(tput sgr0)" -############################################################################## +################################################################################### +# 控制台颜色 +BLACK="\033[1;30m" +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" +BLUE="\033[1;34m" +PURPLE="\033[1;35m" +CYAN="\033[1;36m" +RESET="$(tput sgr0)" +################################################################################### -printf "${C_PURPLE}" +printf "${BLUE}" cat << EOF ################################################################################### @@ -20,77 +20,84 @@ cat << EOF # FastDFS 会被install到 /opt/fdfs 路径。 # @system: 适用于 CentOS # @author: Zhang Peng +# @ses: https://github.com/happyfish100/fastdfs/wiki ################################################################################### EOF -printf "${C_RESET}" +printf "${RESET}" -command -v yum >/dev/null 2>&1 || { echo >&2 -e "${C_RED}Require yum but it's not installed. Aborting.${C_RESET}"; exit 1; } -command -v git >/dev/null 2>&1 || { echo >&2 -e "${C_RED}Require git but it's not installed. Aborting.${C_RESET}"; exit 1; } +printf "${GREEN}>>>>>>>> install fastdfs begin.${RESET}\n" +command -v yum >/dev/null 2>&1 || { printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; } +command -v git >/dev/null 2>&1 || { printf "${RED}Require git but it's not installed.${RESET}\n"; exit 1; } + +if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then + printf "${PURPLE}[Hint]\n" + printf "\t sh fastdfs-install.sh [path]\n" + printf "\t Example: sh fastdfs-install.sh /opt/fastdfs\n" + printf "${RESET}\n" +fi + +path=/opt/fdfs +if [[ -n $1 ]]; then + path=$1 +fi + +nginx_version=1.16.0 +nginx_path=/opt/nginx + +printf "${GREEN}>>>>>>>> install required libs.${RESET}\n\n" yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y -root=/opt/fdfs -if [[ -n $1 ]]; then - root=$1 +# download and decompression +mkdir -p ${path} +path=/opt/fdfs +mkdir -p ${path}/libfastcommon +curl -o ${path}/libfastcommon.zip http://dunwu.test.upcdn.net/soft/fdfs/libfastcommon.zip +if [[ ! -f ${path}/libfastcommon.zip ]]; then + printf "${RED}[Error]install libfastcommon failed,exit. ${RESET}\n" + exit 1 fi +unzip -o ${path}/libfastcommon.zip -d ${path} -version=1.16.0 -if [[ -n $2 ]]; then - version=$2 -fi -nginx_path=/opt/nginx -if [[ -n $3 ]]; then - root=$3 -fi - -mkdir -p ${root} -root=/opt/fdfs -echo -e "\n${C_GREEN}>>>>>>>>> install libfastcommon${C_RESET}" -mkdir -p ${root}/libfastcommon -curl -o ${root}/libfastcommon.zip http://dunwu.test.upcdn.net/soft/fdfs/libfastcommon.zip -if [[ ! -f ${root}/libfastcommon.zip ]]; then - echo -e "\n${C_RED}>>>>>>>>> install libfastcommon failed,exit. ${C_RESET}" -fi -unzip -o ${root}/libfastcommon.zip -d ${root} -cd ${root}/libfastcommon -chmod +x -R ${root}/libfastcommon/*.sh +cd ${path}/libfastcommon +chmod +x -R ${path}/libfastcommon/*.sh ./make.sh && ./make.sh install -echo -e "\n${C_GREEN}>>>>>>>>> install fastdfs${C_RESET}" -mkdir -p ${root}/fastdfs -curl -o ${root}/fastdfs.zip http://dunwu.test.upcdn.net/soft/fdfs/fastdfs.zip -if [[ ! -f ${root}/fastdfs.zip ]]; then - echo -e "\n${C_RED}>>>>>>>>> install fastdfs failed,exit. ${C_RESET}" +printf "${GREEN}>>>>>>>>> install fastdfs${RESET}" +mkdir -p ${path}/fastdfs +curl -o ${path}/fastdfs.zip http://dunwu.test.upcdn.net/soft/fdfs/fastdfs.zip +if [[ ! -f ${path}/fastdfs.zip ]]; then + printf "${RED}>>>>>>>>> install fastdfs failed,exit. ${RESET}\n" fi -unzip -o ${root}/fastdfs.zip -d ${root} -cd ${root}/fastdfs -chmod +x -R ${root}/fastdfs/*.sh +unzip -o ${path}/fastdfs.zip -d ${path} +cd ${path}/fastdfs +chmod +x -R ${path}/fastdfs/*.sh ./make.sh && ./make.sh install -echo -e "\n${C_GREEN}>>>>>>>>> install fastdfs-nginx-module${C_RESET}" -mkdir -p ${root}/fastdfs-nginx-module -curl -o ${root}/fastdfs-nginx-module.zip http://dunwu.test.upcdn.net/soft/fdfs/fastdfs-nginx-module.zip -if [[ ! -f ${root}/fastdfs-nginx-module.zip ]]; then - echo -e "\n${C_RED}>>>>>>>>> install fastdfs-nginx-module failed,exit. ${C_RESET}" +printf "${GREEN}>>>>>>>>> install fastdfs-nginx-module${RESET}\n" +mkdir -p ${path}/fastdfs-nginx-module +curl -o ${path}/fastdfs-nginx-module.zip http://dunwu.test.upcdn.net/soft/fdfs/fastdfs-nginx-module.zip +if [[ ! -f ${path}/fastdfs-nginx-module.zip ]]; then + printf "${RED}>>>>>>>>> install fastdfs-nginx-module failed,exit. ${RESET}\n" fi -unzip -o ${root}/fastdfs-nginx-module.zip -d ${root} +unzip -o ${path}/fastdfs-nginx-module.zip -d ${path} -echo -e "\n${C_GREEN}>>>>>>>>> install nginx${C_RESET}" +printf "${GREEN}>>>>>>>>> install nginx${RESET}" mkdir -p ${nginx_path} -wget -O ${nginx_path}/nginx-${version}.tar.gz http://nginx.org/download/nginx-${version}.tar.gz -tar zxf ${nginx_path}/nginx-${version}.tar.gz -C ${nginx_path} -cd ${nginx_path}/nginx-${version} -./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre --add-module=${root}/fastdfs-nginx-module/src/ +curl -o ${nginx_path}/nginx-${nginx_version}.tar.gz http://nginx.org/download/nginx-${nginx_version}.tar.gz +tar zxf ${nginx_path}/nginx-${nginx_version}.tar.gz -C ${nginx_path} +cd ${nginx_path}/nginx-${nginx_version} +./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre --add-module=${path}/fastdfs-nginx-module/src/ make && make install -echo -e "\n${C_GREEN}>>>>>>>>> fastdfs 配置文件准备${C_RESET}" +printf "${GREEN}>>>>>>>>> fastdfs 配置文件准备${RESET}\n" # 配置修改参考:https://github.com/happyfish100/fastdfs/wiki -cp ${root}/fastdfs/conf/http.conf /etc/fdfs/ #供nginx访问使用 -cp ${root}/fastdfs/conf/mime.types /etc/fdfs/ #供nginx访问使用 -cp ${root}/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs +cp ${path}/fastdfs/conf/http.conf /etc/fdfs/ #供nginx访问使用 +cp ${path}/fastdfs/conf/mime.types /etc/fdfs/ #供nginx访问使用 +cp ${path}/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/fastdfs/tracker.conf -O /etc/fdfs/tracker.conf wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/fastdfs/storage.conf -O /etc/fdfs/storage.conf wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/fastdfs/client.conf -O /etc/fdfs/client.conf @@ -100,26 +107,26 @@ fdfs_server_port=7001 ip=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}') mkdir -p ${fdfs_store_path} -echo -e "\n${C_GREEN} - 修改 tracker.conf 配置${C_RESET}" +printf "${GREEN} - 修改 tracker.conf 配置${RESET}\n" sed -i "s#^base_path=.*#base_path=${fdfs_store_path}#g" /etc/fdfs/tracker.conf -echo -e "\n${C_GREEN} - 修改 storage.conf 配置${C_RESET}" +printf "${GREEN} - 修改 storage.conf 配置${RESET}\n" sed -i "s#^base_path=.*#base_path=${fdfs_store_path}#g" /etc/fdfs/storage.conf sed -i "s#^store_path0=.*#store_path0=${fdfs_store_path}#g" /etc/fdfs/storage.conf sed -i "s#^tracker_server=.*#tracker_server=${ip}:22122#g" /etc/fdfs/storage.conf sed -i "s#^http.server_port=.*#http.server_port=${fdfs_server_port}#g" /etc/fdfs/storage.conf -echo -e "\n${C_GREEN} - 修改 client.conf 配置${C_RESET}" +printf "${GREEN} - 修改 client.conf 配置${RESET}\n" sed -i "s#^base_path=.*#base_path=${fdfs_store_path}#g" /etc/fdfs/client.conf sed -i "s#^tracker_server=.*#tracker_server=${ip}:22122#g" /etc/fdfs/client.conf -echo -e "\n${C_GREEN} - 修改 mod_fastdfs.conf 配置${C_RESET}" +printf "${GREEN} - 修改 mod_fastdfs.conf 配置${RESET}\n" sed -i "s#^url_have_group_name=.*#url_have_group_name=true#g" /etc/fdfs/mod_fastdfs.conf sed -i "s#^tracker_server=.*#tracker_server=${ip}:22122#g" /etc/fdfs/mod_fastdfs.conf sed -i "s#^store_path0=.*#store_path0=${fdfs_store_path}#g" /etc/fdfs/mod_fastdfs.conf -echo -e "\n${C_GREEN} - 修改 nginx.conf 配置${C_RESET}\n" +printf "${GREEN} - 修改 nginx.conf 配置${RESET}\n" mkdir -p /usr/local/nginx/conf/conf wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/nginx/nginx.conf -O /usr/local/nginx/conf/nginx.conf wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/nginx/conf/fdfs.conf -O /usr/local/nginx/conf/conf/fdfs.conf -echo -e "\n${C_GREEN}>>>>>>>>> 启动 fastdfs ${C_RESET}" +printf "${GREEN}>>>>>>>>> 启动 fastdfs ${RESET}\n" chmod +x /etc/init.d/fdfs_trackerd /etc/init.d/fdfs_trackerd start #启动tracker服务 #/etc/init.d/fdfs_trackerd restart #重启动tracker服务 @@ -142,7 +149,13 @@ systemctl start nginx.service #systemctl restart nginx.service #systemctl stop nginx.service -echo -e "\n>>>>>>>>> add fastdfs port" +printf ">>>>>>>>> add fastdfs port" firewall-cmd --zone=public --add-port=${fdfs_server_port}/tcp --permanent firewall-cmd --zone=public --add-port=22122/tcp --permanent firewall-cmd --reload + +printf "${GREEN}<<<<<<<< install fastdfs end.${RESET}\n" +#touch test.txt +#result=`fdfs_upload_file /etc/fdfs/client.conf test.txt` +#echo ${result} +#rm -f test.txt diff --git a/codes/linux/soft/jdk8-install.sh b/codes/linux/soft/jdk8-install.sh index 9da29d4..2461825 100644 --- a/codes/linux/soft/jdk8-install.sh +++ b/codes/linux/soft/jdk8-install.sh @@ -25,15 +25,11 @@ cat << EOF EOF printf "${RESET}" -printf "${BLUE}>>>>>>>> install jdk8\n${RESET}" +printf "${GREEN}>>>>>>>> install jdk8 begin.${RESET}\n" -command -v yum >/dev/null 2>&1 || { -printf "${RED}Require yum but it's not installed.\n${RESET}" -printf "${RED}Require yum but it's not installed.${RESET}\n"; -exit 1; -} +command -v yum >/dev/null 2>&1 || { printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; } yum -y install java-1.8.0-openjdk-devel.x86_64 java -version -printf "${GREEN}<<<<<<<< install jdk8 finished\n${RESET}" +printf "${GREEN}<<<<<<<< install jdk8 end.${RESET}\n" diff --git a/codes/linux/soft/jenkins-install.sh b/codes/linux/soft/jenkins-install.sh index 722da2d..d2f17a4 100644 --- a/codes/linux/soft/jenkins-install.sh +++ b/codes/linux/soft/jenkins-install.sh @@ -10,4 +10,4 @@ echo -e "\n>>>>>>>>> install jenkins" # 下载并解压 jenkins mkdir -p /opt/jenkins -wget -O /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war +curl -o /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war diff --git a/codes/linux/soft/kafka-install.sh b/codes/linux/soft/kafka-install.sh index b913cc8..d7282d3 100644 --- a/codes/linux/soft/kafka-install.sh +++ b/codes/linux/soft/kafka-install.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +################################################################################### +# 控制台颜色 +BLACK="\033[1;30m" +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" +BLUE="\033[1;34m" +PURPLE="\033[1;35m" +CYAN="\033[1;36m" +RESET="$(tput sgr0)" +################################################################################### + +printf "${BLUE}" cat << EOF ################################################################################### @@ -9,10 +22,17 @@ cat << EOF ################################################################################### EOF +printf "${RESET}" + +printf "${GREEN}>>>>>>>> install kafka begin.${RESET}\n" + +command -v java >/dev/null 2>&1 || { printf "${RED}Require java but it's not installed.${RESET}\n"; exit 1; } if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then - echo "Usage: sh kafka-install.sh [version] [path]" - echo -e "Example: sh kafka-install.sh 2.2.0 /opt/kafka\n" + printf "${PURPLE}[Hint]\n" + printf "\t sh kafka-install.sh [version] [path]\n" + printf "\t Example: sh kafka-install.sh 2.2.0 /opt/kafka\n" + printf "${RESET}\n" fi version=2.2.0 @@ -20,15 +40,20 @@ if [[ -n $1 ]]; then version=$1 fi -root=/opt/kafka +path=/opt/kafka if [[ -n $2 ]]; then - root=$2 + path=$2 fi -echo "Current execution: install kafka ${version} to ${root}" -echo -e "\n>>>>>>>>> download kafka" -mkdir -p ${root} -wget -O ${root}/kafka_2.12-${version}.tgz http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/${version}/kafka_2.12-${version}.tgz +# install info +printf "${PURPLE}[Info]\n" +printf "\t version = ${version}\n" +printf "\t path = ${path}\n" +printf "${RESET}\n" -echo -e "\n>>>>>>>>> install kafka" -tar zxf ${root}/kafka_2.12-${version}.tgz -C ${root} +# download and decompression +mkdir -p ${path} +curl -o ${path}/kafka_2.12-${version}.tgz http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/${version}/kafka_2.12-${version}.tgz +tar zxf ${path}/kafka_2.12-${version}.tgz -C ${path} + +printf "${GREEN}<<<<<<<< install kafka end.${RESET}\n" diff --git a/codes/linux/soft/maven-install.sh b/codes/linux/soft/maven-install.sh index 18be561..f698352 100644 --- a/codes/linux/soft/maven-install.sh +++ b/codes/linux/soft/maven-install.sh @@ -1,6 +1,20 @@ #!/usr/bin/env bash +################################################################################### +# 控制台颜色 +BLACK="\033[1;30m" +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" +BLUE="\033[1;34m" +PURPLE="\033[1;35m" +CYAN="\033[1;36m" +RESET="$(tput sgr0)" +################################################################################### + +printf "${BLUE}" cat << EOF + ################################################################################### # 安装 Maven3 脚本 # Maven 会被安装到 /opt/maven 路径。 @@ -8,13 +22,19 @@ cat << EOF # 注意:Maven 要求必须先安装 JDK # @author: Zhang Peng ################################################################################### -EOF -command -v java >/dev/null 2>&1 || { echo >&2 "Require java but it's not installed."; exit 1; } +EOF +printf "${RESET}" + +printf "${GREEN}>>>>>>>> install maven begin.${RESET}\n" + +command -v java >/dev/null 2>&1 || { printf "${RED}Require java but it's not installed.${RESET}\n"; exit 1; } if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then - echo "Usage: sh maven-install.sh [version] [path]" - echo -e "Example: sh maven-install.sh 3.6.0 /opt/maven\n" + printf "${PURPLE}[Hint]\n" + printf "\t sh maven-install.sh [version] [path]\n" + printf "\t Example: sh maven-install.sh 3.6.0 /opt/maven\n" + printf "${RESET}\n" fi version=3.6.0 @@ -22,31 +42,34 @@ if [[ -n $1 ]]; then version=$1 fi -root=/opt/maven +path=/opt/maven if [[ -n $2 ]]; then - root=$2 + path=$2 fi -echo "Current execution: install maven ${version} to ${root}" +# install info +printf "${PURPLE}[Info]\n" +printf "\t version = ${version}\n" +printf "\t path = ${path}\n" +printf "${RESET}\n" -echo -e "\n>>>>>>>>> download maven" -mkdir -p ${root} -wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" -O ${root}/apache-maven-${version}-bin.tar.gz http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/${version}/binaries/apache-maven-${version}-bin.tar.gz +# download and decompression +mkdir -p ${path} +wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" -O ${path}/apache-maven-${version}-bin.tar.gz http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/${version}/binaries/apache-maven-${version}-bin.tar.gz +tar -zxvf ${path}/apache-maven-${version}-bin.tar.gz -C ${path} -echo -e "\n>>>>>>>>> install maven" -tar -zxvf ${root}/apache-maven-${version}-bin.tar.gz -C ${root} - -path=${root}/apache-maven-${version} -# 设置环境变量 +# setting env +path=${path}/apache-maven-${version} cat >> /etc/profile << EOF export MAVEN_HOME=${path} export PATH=\$MAVEN_HOME/bin:\$PATH EOF source /etc/profile -# 备份并替换 settings.xml,使用 aliyun 镜像加速 maven +# replace mirrors in settings.xml echo -e "\n>>>>>>>>> replace ${path}/conf/settings.xml" cp ${path}/conf/settings.xml ${path}/conf/settings.xml.bak wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/settings-aliyun.xml -O ${path}/conf/settings.xml +printf "${GREEN}<<<<<<<< install maven end.${RESET}\n" mvn -v diff --git a/codes/linux/soft/mongodb-install.sh b/codes/linux/soft/mongodb-install.sh index 45670b5..ad17a63 100644 --- a/codes/linux/soft/mongodb-install.sh +++ b/codes/linux/soft/mongodb-install.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +################################################################################### +# 控制台颜色 +BLACK="\033[1;30m" +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" +BLUE="\033[1;34m" +PURPLE="\033[1;35m" +CYAN="\033[1;36m" +RESET="$(tput sgr0)" +################################################################################### + +printf "${BLUE}" cat << EOF ################################################################################### @@ -9,10 +22,15 @@ cat << EOF ################################################################################### EOF +printf "${RESET}" + +printf "${GREEN}>>>>>>>> install mongodb begin.${RESET}\n" if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then - echo "Usage: sh mongodb-install.sh [version] [path]" - echo -e "Example: sh mongodb-install.sh 4.0.9 /opt/mongodb\n" + printf "${PURPLE}[Hint]\n" + printf "\t sh mongodb-install.sh [version] [path]\n" + printf "\t Example: sh mongodb-install.sh 4.0.9 /opt/mongodb\n" + printf "${RESET}\n" fi version=4.0.9 @@ -20,17 +38,21 @@ if [[ -n $1 ]]; then version=$1 fi -root=/opt/mongodb +path=/opt/mongodb if [[ -n $2 ]]; then - root=$2 + path=$2 fi -echo "Current execution: install mongodb ${version} to ${root}" +# install info +printf "${PURPLE}[Info]\n" +printf "\t version = ${version}\n" +printf "\t path = ${path}\n" +printf "${RESET}\n" -echo -e "\n>>>>>>>>> download mongodb" -mkdir -p ${root} -wget -O ${root}/mongodb-linux-x86_64-${version}.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${version}.tgz - -echo -e "\n>>>>>>>>> install mongodb" -tar zxf ${root}/mongodb-linux-x86_64-${version}.tgz -C ${root} +# download and decompression +mkdir -p ${path} +curl -o ${path}/mongodb-linux-x86_64-${version}.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${version}.tgz +tar zxf ${path}/mongodb-linux-x86_64-${version}.tgz -C ${path} mkdir -p /data/db + +printf "${GREEN}<<<<<<<< install mongodb end.${RESET}\n" diff --git a/codes/linux/soft/nacos-install.sh b/codes/linux/soft/nacos-install.sh index dc17a9a..68bf834 100644 --- a/codes/linux/soft/nacos-install.sh +++ b/codes/linux/soft/nacos-install.sh @@ -33,7 +33,7 @@ echo "Current execution: install nacos ${version} to ${root}" echo -e "\n>>>>>>>>> download nacos" mkdir -p ${root} -wget -O ${root}/nacos-server-${version}.zip https://github.com/alibaba/nacos/releases/download/${version}/nacos-server-${version}.zip +curl -o ${root}/nacos-server-${version}.zip https://github.com/alibaba/nacos/releases/download/${version}/nacos-server-${version}.zip echo -e "\n>>>>>>>>> install nacos" unzip ${root}/nacos-server-${version}.zip -d ${root}/nacos-server-${version} diff --git a/codes/linux/soft/nexus-install.sh b/codes/linux/soft/nexus-install.sh index 193cbd8..1ec2540 100644 --- a/codes/linux/soft/nexus-install.sh +++ b/codes/linux/soft/nexus-install.sh @@ -14,5 +14,5 @@ mkdir -p /opt/maven cd /opt/maven version=3.13.0-01 -wget -O /opt/maven/nexus-unix.tar.gz http://download.sonatype.com/nexus/3/nexus-${version}-unix.tar.gz +curl -o /opt/maven/nexus-unix.tar.gz http://download.sonatype.com/nexus/3/nexus-${version}-unix.tar.gz tar -zxf nexus-unix.tar.gz diff --git a/codes/linux/soft/nginx-install-by-rpm.sh b/codes/linux/soft/nginx-install-by-rpm.sh index 6248e56..07ea083 100644 --- a/codes/linux/soft/nginx-install-by-rpm.sh +++ b/codes/linux/soft/nginx-install-by-rpm.sh @@ -12,6 +12,6 @@ echo -e "\n>>>>>>>>> install nginx" # CentOS6 rpm 地址:http://nginx.org/packages/rhel/6/x86_64/RPMS/ mkdir -p /opt/nginx -wget -O /opt/nginx/nginx.rpm http://nginx.org/packages/rhel/7/x86_64/RPMS/nginx-1.14.0-1.el7_4.ngx.x86_64.rpm +curl -o /opt/nginx/nginx.rpm http://nginx.org/packages/rhel/7/x86_64/RPMS/nginx-1.14.0-1.el7_4.ngx.x86_64.rpm rpm -ivh /opt/nginx/nginx.rpm nginx -v diff --git a/codes/linux/soft/nginx-install.sh b/codes/linux/soft/nginx-install.sh index bbe39f2..fd14790 100644 --- a/codes/linux/soft/nginx-install.sh +++ b/codes/linux/soft/nginx-install.sh @@ -1,21 +1,39 @@ #!/usr/bin/env bash +################################################################################### +# 控制台颜色 +BLACK="\033[1;30m" +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" +BLUE="\033[1;34m" +PURPLE="\033[1;35m" +CYAN="\033[1;36m" +RESET="$(tput sgr0)" +################################################################################### + +printf "${BLUE}" cat << EOF ################################################################################### -# 安装 nginx 脚本 -# nginx 会被安装到 /opt/nginx 路径。 +# 采用编译方式安装 nginx 脚本 +# nginx 会被安装到 /usr/local/nginx 路径。 # @system: 适用于所有 linux 发行版本。 # @author: Zhang Peng ################################################################################### EOF +printf "${RESET}" + +printf "${GREEN}>>>>>>>> install maven begin.${RESET}\n" command -v yum >/dev/null 2>&1 || { printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; } if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then - echo "Usage: sh nginx-install.sh [version] [path]" - echo -e "Example: sh nginx-install.sh 1.16.0 /opt/nginx\n" + printf "${PURPLE}[Hint]\n" + printf "\t sh nginx-install.sh [version] [path]\n" + printf "\t Example: sh nginx-install.sh 1.16.0 /opt/nginx\n" + printf "${RESET}\n" fi version=1.16.0 @@ -23,26 +41,31 @@ if [[ -n $1 ]]; then version=$1 fi -root=/opt/nginx +path=/opt/nginx if [[ -n $2 ]]; then - root=$2 + path=$2 fi -echo "Current execution: install nginx ${version} to ${root}" -echo -e "\n>>>>>>>>> install libs" +# install info +printf "${PURPLE}[Info]\n" +printf "\t version = ${version}\n" +printf "\t path = ${path}\n" +printf "${RESET}\n" + +printf "${GREEN}>>>>>>>> install required libs.${RESET}\n" yum install -y zlib zlib-devel gcc-c++ libtool openssl openssl-devel pcre -echo -e "\n>>>>>>>>> download nginx" -mkdir -p ${root} -wget -O ${root}/nginx-${version}.tar.gz http://nginx.org/download/nginx-${version}.tar.gz +# download and decompression +mkdir -p ${path} +curl -o ${path}/nginx-${version}.tar.gz http://nginx.org/download/nginx-${version}.tar.gz +tar zxf ${path}/nginx-${version}.tar.gz -C ${path} -# 编译 -tar zxf ${root}/nginx-${version}.tar.gz -C ${root} -cd ${root}/nginx-${version} +# configure and makefile +cd ${path}/nginx-${version} ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre make && make install -# 设置 service +# setting service wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/nginx/nginx.service -O /usr/lib/systemd/system/nginx.service chmod +x /usr/lib/systemd/system/nginx.service #设置nginx.service为系统服务 @@ -52,4 +75,4 @@ systemctl start nginx.service #systemctl reload nginx.service #systemctl restart nginx.service #systemctl stop nginx.service -cd - +printf "${GREEN}<<<<<<<< install nginx end.${RESET}\n" diff --git a/codes/linux/soft/nginx/README.md b/codes/linux/soft/nginx/README.md deleted file mode 100644 index ff96dd7..0000000 --- a/codes/linux/soft/nginx/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# 安装 Nginx - -## linux 安装 nginx 通用脚本 - -使用方法: - -```sh -curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nginx/install-nginx.sh | bash -``` - -脚本会下载解压 nginx 到 `/opt/nginx` 路径下。 - -## Centos 安装 nginx 脚本 - -使用方法: - -```sh -curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nginx/install-nginx-by-yum.sh | bash -``` - diff --git a/codes/linux/soft/nginx/install-nginx-by-rpm.sh b/codes/linux/soft/nginx/install-nginx-by-rpm.sh deleted file mode 100644 index 6248e56..0000000 --- a/codes/linux/soft/nginx/install-nginx-by-rpm.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -################################################################################### -# 安装 nginx 脚本 -# 仅适用于 CentOS 发行版本。 -# @author: Zhang Peng -################################################################################### - -echo -e "\n>>>>>>>>> install nginx" - -# Centos7 rpm 地址:http://nginx.org/packages/rhel/7/x86_64/RPMS/ -# CentOS6 rpm 地址:http://nginx.org/packages/rhel/6/x86_64/RPMS/ - -mkdir -p /opt/nginx -wget -O /opt/nginx/nginx.rpm http://nginx.org/packages/rhel/7/x86_64/RPMS/nginx-1.14.0-1.el7_4.ngx.x86_64.rpm -rpm -ivh /opt/nginx/nginx.rpm -nginx -v diff --git a/codes/linux/soft/nginx/install-nginx-by-yum.sh b/codes/linux/soft/nginx/install-nginx-by-yum.sh deleted file mode 100644 index bec957b..0000000 --- a/codes/linux/soft/nginx/install-nginx-by-yum.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -################################################################################### -# 安装 nginx 脚本 -# 仅适用于 CentOS 发行版本。 -# @author: Zhang Peng -################################################################################### - -echo -e "\n>>>>>>>>> install nginx" - -yum -y install make nginx.x86_64 diff --git a/codes/linux/soft/nodejs-install.sh b/codes/linux/soft/nodejs-install.sh index cbe2519..9a84b9b 100644 --- a/codes/linux/soft/nodejs-install.sh +++ b/codes/linux/soft/nodejs-install.sh @@ -16,19 +16,22 @@ printf "${BLUE}" cat << EOF ################################################################################### -# 安装 Nodejs 脚本 +# 通过 nvm 安装 Nodejs 脚本 # @system: 适用于所有 linux 发行版本。 # @author: Zhang Peng +# @see: https://github.com/nvm-sh/nvm ################################################################################### EOF printf "${RESET}" -printf "${BLUE}>>>>>>>> install nodejs\n${RESET}" +printf "${GREEN}>>>>>>>> install nodejs begin.${RESET}\n" if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then - echo "Usage: sh nodejs-install.sh [version] [path]" - echo -e "Example: sh nodejs-install.sh 10.15.2 /opt/nodejs\n" + printf "${PURPLE}[Hint]\n" + printf "\t sh nodejs-install.sh [version]\n" + printf "\t Example: sh nodejs-install.sh 10.15.2\n" + printf "${RESET}\n" fi version=10.15.2 @@ -36,21 +39,22 @@ if [[ -n $1 ]]; then version=$1 fi +# install info +printf "${PURPLE}[Info]\n" +printf "\t version = ${version}\n" +printf "${RESET}\n" + +# install nvm +printf "${GREEN}>>>>>>>> install nvm.${RESET}\n" +rm -rf ~/.nvm +mkdir -p ~/.nvm +curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash . ~/.nvm/nvm.sh nvm --version -execode=$? -if [[ ${execode} != 0 ]]; then - echo -e "\n>>>>>>>>> install nvm" - rm -rf ~/.nvm - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash - . ~/.nvm/nvm.sh - nvm --version -fi -echo "Current execution: install nodejs ${version} to ${root}" -echo -e "\n>>>>>>>>> install nodejs by nvm" +printf "${GREEN}>>>>>>>> install nodejs by nvm.${RESET}\n" nvm install ${version} nvm use ${version} node --version -printf "${GREEN}<<<<<<<< install zsh nodejs\n${RESET}" +printf "${GREEN}<<<<<<<< install nodejs end.${RESET}\n" diff --git a/codes/linux/soft/redis-install.sh b/codes/linux/soft/redis-install.sh index 35d41c6..07c0d43 100644 --- a/codes/linux/soft/redis-install.sh +++ b/codes/linux/soft/redis-install.sh @@ -43,7 +43,7 @@ yum install -y zlib zlib-devel gcc-c++ libtool openssl openssl-devel tcl echo -e "\n>>>>>>>>> download redis" mkdir -p ${root} -wget -O ${root}/redis-${version}.tar.gz http://download.redis.io/releases/redis-${version}.tar.gz +curl -o ${root}/redis-${version}.tar.gz http://download.redis.io/releases/redis-${version}.tar.gz echo -e "\n>>>>>>>>> install redis" path=${root}/redis-${version} diff --git a/codes/linux/soft/rocketmq-install.sh b/codes/linux/soft/rocketmq-install.sh index bc97613..c7fe771 100644 --- a/codes/linux/soft/rocketmq-install.sh +++ b/codes/linux/soft/rocketmq-install.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +################################################################################### +# 控制台颜色 +BLACK="\033[1;30m" +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" +BLUE="\033[1;34m" +PURPLE="\033[1;35m" +CYAN="\033[1;36m" +RESET="$(tput sgr0)" +################################################################################### + +printf "${BLUE}" cat << EOF ################################################################################### @@ -9,10 +22,15 @@ cat << EOF ################################################################################### EOF +printf "${RESET}" + +printf "${GREEN}>>>>>>>> install tomcat begin.${RESET}\n" if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then - echo "Usage: sh rocketmq-install.sh [version] [path]" - echo -e "Example: sh rocketmq-install.sh 4.5.0 /opt/rocketmq\n" + printf "${PURPLE}[Hint]\n" + printf "\t sh rocketmq-install.sh [version] [path]\n" + printf "\t Example: sh rocketmq-install.sh 4.5.0 /opt/rocketmq\n" + printf "${RESET}\n" fi version=4.5.0 @@ -20,17 +38,22 @@ if [[ -n $1 ]]; then version=$1 fi -root=/opt/rocketmq +path=/opt/rocketmq if [[ -n $2 ]]; then - root=$2 + path=$2 fi -echo "Current execution: install rocketmq ${version} to ${root}" -echo -e "\n>>>>>>>>> download rocketmq" -mkdir -p ${root} -wget -O ${root}/rocketmq-all-${version}-bin-release.zip http://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/${version}/rocketmq-all-${version}-bin-release.zip +# install info +printf "${PURPLE}[Info]\n" +printf "\t version = ${version}\n" +printf "\t path = ${path}\n" +printf "${RESET}\n" -echo -e "\n>>>>>>>>> install rocketmq" -unzip -o ${root}/rocketmq-all-${version}-bin-release.zip -d ${root}/rocketmq-all-${version}/ -mv ${root}/rocketmq-all-${version}/rocketmq-all-${version}-bin-release/* ${root}/rocketmq-all-${version} -rm -rf ${root}/rocketmq-all-${version}/rocketmq-all-${version}-bin-release +# download and decompression +mkdir -p ${path} +curl -o ${path}/rocketmq-all-${version}-bin-release.zip http://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/${version}/rocketmq-all-${version}-bin-release.zip +unzip -o ${path}/rocketmq-all-${version}-bin-release.zip -d ${path}/rocketmq-all-${version}/ +mv ${path}/rocketmq-all-${version}/rocketmq-all-${version}-bin-release/* ${path}/rocketmq-all-${version} +rm -rf ${path}/rocketmq-all-${version}/rocketmq-all-${version}-bin-release + +printf "${GREEN}<<<<<<<< install rocketmq end.${RESET}\n" diff --git a/codes/linux/soft/sdk/install-sdk.sh b/codes/linux/soft/sdk/install-sdk.sh deleted file mode 100644 index d22cece..0000000 --- a/codes/linux/soft/sdk/install-sdk.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -echo -e "\n>>>>>>>>> install sdk" - -curl -s "https://get.sdkman.io" | bash -source "$HOME/.sdkman/bin/sdkman-init.sh" -sdk version diff --git a/codes/linux/soft/tomcat8-install.sh b/codes/linux/soft/tomcat8-install.sh index a20e0e8..0980b15 100644 --- a/codes/linux/soft/tomcat8-install.sh +++ b/codes/linux/soft/tomcat8-install.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +################################################################################### +# 控制台颜色 +BLACK="\033[1;30m" +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" +BLUE="\033[1;34m" +PURPLE="\033[1;35m" +CYAN="\033[1;36m" +RESET="$(tput sgr0)" +################################################################################### + +printf "${BLUE}" cat << EOF ################################################################################### @@ -9,10 +22,15 @@ cat << EOF ################################################################################### EOF +printf "${RESET}" + +printf "${GREEN}>>>>>>>> install tomcat begin.${RESET}\n" if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then - echo "Usage: sh tomcat8-install.sh [version] [path]" - echo -e "Example: sh tomcat8-install.sh 8.5.28 /opt/tomcat8\n" + printf "${PURPLE}[Hint]\n" + printf "\t sh tomcat8-install.sh [version] [path]\n" + printf "\t Example: sh tomcat8-install.sh 8.5.28 /opt/tomcat8\n" + printf "${RESET}\n" fi version=8.5.28 @@ -20,15 +38,20 @@ if [[ -n $1 ]]; then version=$1 fi -root=/opt/tomcat +path=/opt/tomcat if [[ -n $2 ]]; then - root=$2 + path=$2 fi -echo "Current execution: install tomcat8 ${version} to ${root}" -echo -e "\n>>>>>>>>> download tomcat" -mkdir -p ${root} -wget -O ${root}/apache-tomcat-${version}.tar.gz https://archive.apache.org/dist/tomcat/tomcat-8/v${version}/bin/apache-tomcat-${version}.tar.gz +# install info +printf "${PURPLE}[Info]\n" +printf "\t version = ${version}\n" +printf "\t path = ${path}\n" +printf "${RESET}\n" -echo -e "\n>>>>>>>>> install tomcat" -tar zxf ${root}/apache-tomcat-${version}.tar.gz -C ${root} +# download and decompression +mkdir -p ${path} +curl -o ${path}/apache-tomcat-${version}.tar.gz https://archive.apache.org/dist/tomcat/tomcat-8/v${version}/bin/apache-tomcat-${version}.tar.gz +tar zxf ${path}/apache-tomcat-${version}.tar.gz -C ${path} + +printf "${GREEN}<<<<<<<< install tomcat end.${RESET}\n" diff --git a/codes/linux/soft/zookeeper-install.sh b/codes/linux/soft/zookeeper-install.sh index 25e71b4..2a8fe8f 100644 --- a/codes/linux/soft/zookeeper-install.sh +++ b/codes/linux/soft/zookeeper-install.sh @@ -16,7 +16,7 @@ printf "${BLUE}" cat << EOF ################################################################################### -# 安装 zookeeper 脚本 +# 安装 ZooKeeper 脚本 # @system: 适用于所有 linux 发行版本。 # @author: Zhang Peng ################################################################################### @@ -24,9 +24,13 @@ cat << EOF EOF printf "${RESET}" +printf "${GREEN}>>>>>>>> install zookeeper begin.${RESET}\n" + if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then - echo "Usage: sh zookeeper-install.sh [version] [path]" - echo -e "Example: sh zookeeper-install.sh 3.4.12 /opt/zookeeper\n" + printf "${PURPLE}[Hint]\n" + printf "\t sh zookeeper-install.sh [version] [path]\n" + printf "\t Example: sh zookeeper-install.sh 3.4.12 /opt/zookeeper\n" + printf "${RESET}\n" fi version=3.4.12 @@ -34,15 +38,20 @@ if [[ -n $1 ]]; then version=$1 fi -root=/opt/zookeeper +path=/opt/zookeeper if [[ -n $2 ]]; then - root=$2 + path=$2 fi -echo "Current execution: install zookeeper ${version} to ${root}" -echo -e "\n>>>>>>>>> download zookeeper" -mkdir -p ${root} -wget -O ${root}/zookeeper-${version}.tar.gz http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-${version}/zookeeper-${version}.tar.gz +# install info +printf "${PURPLE}[Info]\n" +printf "\t version = ${version}\n" +printf "\t path = ${path}\n" +printf "${RESET}\n" -echo -e "\n>>>>>>>>> install zookeeper" -tar zxf ${root}/zookeeper-${version}.tar.gz -C ${root} +# download and decompression +mkdir -p ${path} +curl -o ${path}/zookeeper-${version}.tar.gz http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-${version}/zookeeper-${version}.tar.gz +tar zxf ${path}/zookeeper-${version}.tar.gz -C ${path} + +printf "${GREEN}<<<<<<<< install zookeeper end.${RESET}\n" diff --git a/codes/linux/soft/zsh-install.sh b/codes/linux/soft/zsh-install.sh index 8d4b0cc..0831750 100644 --- a/codes/linux/soft/zsh-install.sh +++ b/codes/linux/soft/zsh-install.sh @@ -25,14 +25,16 @@ cat << EOF EOF printf "${RESET}" -printf "${BLUE}>>>>>>>> install zsh\n${RESET}" +printf "${GREEN}>>>>>>>> install zsh begin.${RESET}\n" command -v yum >/dev/null 2>&1 || { printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; } +command -v git >/dev/null 2>&1 || { printf "${RED}Require git but it's not installed.${RESET}\n"; exit 1; } # install zsh yum install -y zsh +chsh -s /bin/zsh # install oh-my-zsh -wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh +curl -o- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | bash # choose oh-my-zsh theme sed -i "s/^ZSH_THEME=.*/ZSH_THEME=\"ys\"/g" ~/.zshrc # install oh-my-zsh plugins @@ -40,6 +42,6 @@ git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/plug git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting sed -i "s/^plugins=.*/plugins=(git z wd extract zsh-autosuggestions zsh-syntax-highlighting)/g" ~/.zshrc # reload zsh -source ~/.zshrc -printf "${GREEN}<<<<<<<< install zsh finished\n${RESET}" +printf "${GREEN}<<<<<<<< install zsh finished${RESET}\n" +printf "${GREEN}Please reboot to take effect.${RESET}\n"