update codes
parent
1d8b1d4e27
commit
8edc990d02
|
@ -1,27 +1,43 @@
|
|||
#!/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 "${BLUE}"
|
||||
cat << EOF
|
||||
|
||||
###################################################################################
|
||||
# linux-tutorial 运维脚本工具集下载脚本
|
||||
# 下载 https://github.com/dunwu/linux-tutorial 中的所有脚本到当前服务器的
|
||||
# /home/scripts/linux-tutorial 目录下
|
||||
# @system: 适用于 CentOS
|
||||
# @author: Zhang Peng
|
||||
# See: https://github.com/dunwu/linux-tutorial
|
||||
###################################################################################
|
||||
|
||||
EOF
|
||||
printf "${RESET}"
|
||||
|
||||
path=/home/scripts/linux-tutorial
|
||||
printf "\n${C_BLUE}>>>>>>>> Downloading linux-tutorial to ${path}.${C_RESET}\n"
|
||||
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_YELLOW}Not detected git. Install git.${C_RESET}"; yum -y install git; }
|
||||
printf "\n${GREEN}>>>>>>>> Download linux-tutorial to ${path} begin.${RESET}\n"
|
||||
command -v yum >/dev/null 2>&1 || { printf "${RED}Not detected yum.${RESET}"; exit 1; }
|
||||
command -v git >/dev/null 2>&1 || { printf "${YELLOW}Not detected git. Install git.${RESET}\n"; yum -y install git; }
|
||||
|
||||
if [[ -d ${path} ]]; then
|
||||
cd ${path}
|
||||
git pull
|
||||
else
|
||||
mkdir -p ${path}
|
||||
git clone --no-checkout https://gitee.com/turnon/linux-tutorial.git ${path}
|
||||
git clone https://gitee.com/turnon/linux-tutorial.git ${path}
|
||||
fi
|
||||
printf "\n${C_GREEN}<<<<<<<< Download linux-tutorial to ${path} ok.${C_RESET}\n"
|
||||
chmod +x -R ${path}
|
||||
printf "\n${GREEN}<<<<<<<< Download linux-tutorial to ${path} end.${RESET}\n"
|
||||
|
|
|
@ -1,7 +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)"
|
||||
###################################################################################
|
||||
|
||||
# 打印头部信息
|
||||
printHeadInfo() {
|
||||
printf "${BLUE}"
|
||||
cat << EOF
|
||||
|
||||
***********************************************************************************
|
||||
|
@ -10,10 +23,12 @@ cat << EOF
|
|||
***********************************************************************************
|
||||
|
||||
EOF
|
||||
printf "${RESET}"
|
||||
}
|
||||
|
||||
# 打印尾部信息
|
||||
printFootInfo() {
|
||||
printf "${BLUE}"
|
||||
cat << EOF
|
||||
|
||||
***********************************************************************************
|
||||
|
@ -21,6 +36,7 @@ cat << EOF
|
|||
***********************************************************************************
|
||||
|
||||
EOF
|
||||
printf "${RESET}"
|
||||
}
|
||||
|
||||
# 检查操作系统环境
|
||||
|
|
|
@ -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}\n"
|
||||
cat << EOF
|
||||
|
||||
***********************************************************************************
|
||||
|
@ -9,23 +22,24 @@ cat << EOF
|
|||
|
||||
EOF
|
||||
|
||||
menus=("git" "zsh" "jdk8" "maven" "nodejs" "mongodb" "redis" "tomcat8" "kafka" "rocketmq" "zookeeper")
|
||||
printMenu() {
|
||||
# print menu
|
||||
printf "${PURPLE}"
|
||||
menus=(docker fastdfs gitlab jdk8 jenkins kafka maven mongodb mysql nacos nexus nginx nodejs redis rocketmq tomcat8
|
||||
zookeeper zsh exit)
|
||||
for i in "${!menus[@]}"; do
|
||||
index=`expr ${i} + 1`
|
||||
val=`expr ${index} % 2`
|
||||
printf "(%02d) %-20s" "${index}" "${menus[$i]}"
|
||||
printf "[%02d] %-20s" "${index}" "${menus[$i]}"
|
||||
if [[ ${val} -eq 0 ]]; then
|
||||
printf "\n"
|
||||
fi
|
||||
done
|
||||
printf "\n请输入需要安装的软件编号:\n"
|
||||
}
|
||||
printf "\n${RESET}请输入需要安装的软件编号:\n"
|
||||
|
||||
|
||||
main() {
|
||||
# exec shell to install soft
|
||||
doInstall() {
|
||||
read -t 30 index
|
||||
if [[ -n $index ]]; then
|
||||
if [[ -n ${index} ]]; then
|
||||
no=`expr ${index} - 1`
|
||||
len=${#menus[*]}
|
||||
if [[ ${index} -gt ${len} ]]; then
|
||||
|
@ -33,14 +47,14 @@ if [[ -n $index ]]; then
|
|||
exit -1
|
||||
fi
|
||||
key=${menus[$no]}
|
||||
if [[ key == 'exit' ]]; then
|
||||
exit 0
|
||||
fi
|
||||
curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/${key}-install.sh | bash
|
||||
doInstall
|
||||
else
|
||||
echo "输入项不支持!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
######################################## MAIN ########################################
|
||||
printMenu
|
||||
main
|
||||
doInstall
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
- [RocketMQ 安装](#rocketmq-安装)
|
||||
- [Nacos 安装](#nacos-安装)
|
||||
- [ZooKeeper 安装](#zookeeper-安装)
|
||||
- [Nginx 安装](#nginx-安装)
|
||||
- [Fastdfs 安装](#fastdfs-安装)
|
||||
- [Docker 安装](#docker-安装)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
||||
|
@ -218,3 +221,15 @@ wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/ng
|
|||
```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
|
||||
```
|
||||
|
||||
## Docker 安装
|
||||
|
||||
说明:
|
||||
|
||||
使用方法:执行以下任意命令即可执行脚本。
|
||||
|
||||
```sh
|
||||
curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/docker-install.sh | bash
|
||||
wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/docker-install.sh | bash
|
||||
```
|
||||
|
|
|
@ -16,7 +16,7 @@ printf "${BLUE}"
|
|||
cat << EOF
|
||||
|
||||
###################################################################################
|
||||
# 安装 Jenkins 脚本
|
||||
# 安装 Docker 脚本
|
||||
# 适用于所有 linux 发行版本。
|
||||
# @author: Zhang Peng
|
||||
###################################################################################
|
||||
|
@ -24,10 +24,25 @@ cat << EOF
|
|||
EOF
|
||||
printf "${RESET}"
|
||||
|
||||
printf "${BLUE}>>>>>>>> install jenkins${RESET}\n"
|
||||
|
||||
# 下载并解压 jenkins
|
||||
mkdir -p /opt/jenkins
|
||||
curl -o /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war
|
||||
|
||||
printf "${GREEN}<<<<<<<< install jenkins${RESET}\n"
|
||||
printf "${GREEN}>>>>>>>> install docker begin.${RESET}\n"
|
||||
# uninstall old version docker
|
||||
sudo yum remove docker \
|
||||
docker-client \
|
||||
docker-client-latest \
|
||||
docker-common \
|
||||
docker-latest \
|
||||
docker-latest-logrotate \
|
||||
docker-logrotate \
|
||||
docker-selinux \
|
||||
docker-engine-selinux \
|
||||
docker-engine
|
||||
# install required libs
|
||||
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
|
||||
# add docker yum repo
|
||||
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
|
||||
sudo yum makecache fast
|
||||
# install docker
|
||||
sudo yum -y install docker-ce
|
||||
sudo systemctl start docker
|
||||
docker version
|
||||
printf "${GREEN}<<<<<<<< install docker end.${RESET}\n"
|
||||
|
|
|
@ -1,6 +1,45 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
|
||||
###################################################################################
|
||||
# 控制台颜色
|
||||
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
|
||||
|
||||
###################################################################################
|
||||
# 安装 mysql 脚本
|
||||
# @system: 适用于 Centos7 发行版本。
|
||||
# @author: Zhang Peng
|
||||
###################################################################################
|
||||
|
||||
EOF
|
||||
printf "${RESET}"
|
||||
|
||||
printf "${GREEN}>>>>>>>> install mysql begin.${RESET}\n"
|
||||
|
||||
command -v wget >/dev/null 2>&1 || { printf "${RED}Require wget but it's not installed.${RESET}\n"; exit 1; }
|
||||
command -v rpm >/dev/null 2>&1 || { printf "${RED}Require rpm 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; }
|
||||
|
||||
# 使用 rpm 安装 mysql
|
||||
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
|
||||
sudo rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
|
||||
sudo yum install mysql-community-server
|
||||
|
||||
# 设置开机启动
|
||||
systemctl enable mysqld
|
||||
systemctl daemon-reload
|
||||
|
||||
password=$(grep "password" /var/log/mysqld.log | awk '{print $NF}')
|
||||
printf "临时密码为:${PURPLE}${password}${RESET},请登录 mysql 后重置新密码\n"
|
||||
|
||||
printf "${GREEN}<<<<<<<< install mysql end.${RESET}\n"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#输出特效格式控制
|
||||
#${C_RESET} 关闭所有属性
|
||||
#${RESET} 关闭所有属性
|
||||
#\033[1m 设置高亮度
|
||||
#\03[4m 下划线
|
||||
#\033[5m 闪烁
|
||||
|
@ -54,60 +54,61 @@
|
|||
# 46 设置青色背景
|
||||
# 47 设置白色背景
|
||||
# 49 设置缺省黑色背景
|
||||
#特效可以叠加,需要使用“;”隔开,例如:闪烁+下划线+白底色+黑字为 \033[5;4;47;30m闪烁+下划线+白底色+黑字为${C_RESET}
|
||||
#特效可以叠加,需要使用“;”隔开,例如:闪烁+下划线+白底色+黑字为 \033[5;4;47;30m闪烁+下划线+白底色+黑字为${RESET}
|
||||
|
||||
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"
|
||||
WHITE="\033[1;37m"
|
||||
|
||||
C_RESET="$(tput sgr0)"
|
||||
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_WHITE="\033[1;37m"
|
||||
# 示例:
|
||||
echo -e "${C_BLACK} 黑色字 ${C_RESET}"
|
||||
echo -e "${C_RED} 红色字 ${C_RESET}"
|
||||
echo -e "${C_GREEN} 绿色字 ${C_RESET}"
|
||||
echo -e "${C_YELLOW} 黄色字 ${C_RESET}"
|
||||
echo -e "${C_BLUE} 蓝色字 ${C_RESET}"
|
||||
echo -e "${C_PURPLE} 紫色字 ${C_RESET}"
|
||||
echo -e "${C_CYAN} 天蓝字 ${C_RESET}"
|
||||
echo -e "${C_WHITE} 白色字 ${C_RESET}"
|
||||
echo -e "${BLACK} 黑色字 ${RESET}"
|
||||
echo -e "${RED} 红色字 ${RESET}"
|
||||
echo -e "${GREEN} 绿色字 ${RESET}"
|
||||
echo -e "${YELLOW} 黄色字 ${RESET}"
|
||||
echo -e "${BLUE} 蓝色字 ${RESET}"
|
||||
echo -e "${PURPLE} 紫色字 ${RESET}"
|
||||
echo -e "${CYAN} 天蓝字 ${RESET}"
|
||||
echo -e "${WHITE} 白色字 ${RESET}"
|
||||
# 字背景颜色范围:40-47
|
||||
echo -e "\033[40;37m 黑底白字 ${C_RESET}"
|
||||
echo -e "\033[41;30m 红底黑字 ${C_RESET}"
|
||||
echo -e "\033[42;34m 绿底蓝字 ${C_RESET}"
|
||||
echo -e "\033[43;34m 黄底蓝字 ${C_RESET}"
|
||||
echo -e "\033[44;30m 蓝底黑字 ${C_RESET}"
|
||||
echo -e "\033[45;30m 紫底黑字 ${C_RESET}"
|
||||
echo -e "\033[46;30m 天蓝底黑字 ${C_RESET}"
|
||||
echo -e "\033[47;34m 白底蓝字 ${C_RESET}"
|
||||
echo -e "\033[40;37m 黑底白字 ${RESET}"
|
||||
echo -e "\033[41;30m 红底黑字 ${RESET}"
|
||||
echo -e "\033[42;34m 绿底蓝字 ${RESET}"
|
||||
echo -e "\033[43;34m 黄底蓝字 ${RESET}"
|
||||
echo -e "\033[44;30m 蓝底黑字 ${RESET}"
|
||||
echo -e "\033[45;30m 紫底黑字 ${RESET}"
|
||||
echo -e "\033[46;30m 天蓝底黑字 ${RESET}"
|
||||
echo -e "\033[47;34m 白底蓝字 ${RESET}"
|
||||
|
||||
#控制选项说明
|
||||
#${C_RESET} 关闭所有属性
|
||||
#${RESET} 关闭所有属性
|
||||
#\033[1m 设置高亮度
|
||||
#\033[4m 下划线
|
||||
echo -e "\033[4;31m 下划线红字 ${C_RESET}"
|
||||
echo -e "\033[4;31m 下划线红字 ${RESET}"
|
||||
#闪烁
|
||||
echo -e "\033[5;34m 红字在闪烁 ${C_RESET}"
|
||||
echo -e "\033[5;34m 红字在闪烁 ${RESET}"
|
||||
#反影
|
||||
echo -e "\033[8m 消隐 ${C_RESET} "
|
||||
echo -e "\033[8m 消隐 ${RESET} "
|
||||
|
||||
#\033[30m-\033[37m 设置前景色
|
||||
#\033[40m-\033[47m 设置背景色
|
||||
#\033[nA光标上移n行
|
||||
#\033[nB光标下移n行
|
||||
echo -e "\033[4A 光标上移4行 ${C_RESET}"
|
||||
echo -e "\033[4A 光标上移4行 ${RESET}"
|
||||
#\033[nC光标右移n行
|
||||
#\033[nD光标左移n行
|
||||
#\033[y;xH设置光标位置
|
||||
#\033[2J清屏
|
||||
#\033[K清除从光标到行尾的内容
|
||||
echo -e "\033[K 清除光标到行尾的内容 ${C_RESET}"
|
||||
echo -e "\033[K 清除光标到行尾的内容 ${RESET}"
|
||||
#\033[s 保存光标位置
|
||||
#\033[u 恢复光标位置
|
||||
#\033[?25| 隐藏光标
|
||||
#\033[?25h 显示光标
|
||||
echo -e "\033[?25l 隐藏光标 ${C_RESET}"
|
||||
echo -e "\033[?25h 显示光标 ${C_RESET}"
|
||||
echo -e "\033[?25l 隐藏光标 ${RESET}"
|
||||
echo -e "\033[?25h 显示光标 ${RESET}"
|
||||
|
|
Loading…
Reference in New Issue