Skip to content

Commit 1d8b1d4

Browse files
committed
update scripts
1 parent 45ac298 commit 1d8b1d4

22 files changed

Lines changed: 392 additions & 240 deletions

codes/linux/soft/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# 服务安装配置
22

3+
<!-- TOC depthFrom:2 depthTo:3 -->
4+
5+
- [oh-my-zsh 安装](#oh-my-zsh-安装)
6+
- [JDK8 安装](#jdk8-安装)
7+
- [Maven 安装配置](#maven-安装配置)
8+
- [Node.js 安装](#nodejs-安装)
9+
- [MongoDB 安装](#mongodb-安装)
10+
- [Redis 安装配置](#redis-安装配置)
11+
- [Tomcat8 安装](#tomcat8-安装)
12+
- [Kafka 安装](#kafka-安装)
13+
- [RocketMQ 安装](#rocketmq-安装)
14+
- [Nacos 安装](#nacos-安装)
15+
- [ZooKeeper 安装](#zookeeper-安装)
16+
17+
<!-- /TOC -->
18+
319
## oh-my-zsh 安装
420

521
说明:
@@ -174,3 +190,31 @@ curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/zoo
174190
wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/zookeeper-install.sh | bash
175191
```
176192

193+
## Nginx 安装
194+
195+
说明:
196+
197+
采用编译方式安装 Nginx
198+
199+
下载 nginx `1.16.0` 并解压安装到 `/opt/nginx` 路径下。
200+
201+
使用方法:执行以下任意命令即可执行脚本。
202+
203+
```sh
204+
curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nginx-install.sh | bash
205+
wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nginx-install.sh | bash
206+
```
207+
208+
## Fastdfs 安装
209+
210+
说明:
211+
212+
采用编译方式安装 Fastdfs
213+
214+
下载 Fastdfs 并解压安装到 `/opt/fdfs` 路径下。
215+
216+
使用方法:执行以下任意命令即可执行脚本。
217+
218+
```sh
219+
curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/fastdfs-install.sh | bash
220+
wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/fastdfs-install.sh | bash

codes/linux/soft/docker-install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ cat << EOF
2424
EOF
2525
printf "${RESET}"
2626

27-
printf "${BLUE}>>>>>>>> install jenkins\n${RESET}"
27+
printf "${BLUE}>>>>>>>> install jenkins${RESET}\n"
2828

2929
# 下载并解压 jenkins
3030
mkdir -p /opt/jenkins
31-
wget -O /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war
31+
curl -o /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war
3232

33-
printf "${GREEN}<<<<<<<< install jenkins\n${RESET}"
33+
printf "${GREEN}<<<<<<<< install jenkins${RESET}\n"
Lines changed: 79 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,103 @@
11
#!/usr/bin/env bash
22

3-
##############################################################################
4-
# console color
5-
C_BLACK="\033[1;30m"
6-
C_RED="\033[1;31m"
7-
C_GREEN="\033[1;32m"
8-
C_YELLOW="\033[1;33m"
9-
C_BLUE="\033[1;34m"
10-
C_PURPLE="\033[1;35m"
11-
C_CYAN="\033[1;36m"
12-
C_RESET="$(tput sgr0)"
13-
##############################################################################
14-
15-
printf "${C_PURPLE}"
3+
###################################################################################
4+
# 控制台颜色
5+
BLACK="\033[1;30m"
6+
RED="\033[1;31m"
7+
GREEN="\033[1;32m"
8+
YELLOW="\033[1;33m"
9+
BLUE="\033[1;34m"
10+
PURPLE="\033[1;35m"
11+
CYAN="\033[1;36m"
12+
RESET="$(tput sgr0)"
13+
###################################################################################
14+
15+
printf "${BLUE}"
1616
cat << EOF
1717
1818
###################################################################################
1919
# install FastDFS 脚本
2020
# FastDFS 会被install到 /opt/fdfs 路径。
2121
# @system: 适用于 CentOS
2222
# @author: Zhang Peng
23+
# @ses: https://github.com/happyfish100/fastdfs/wiki
2324
###################################################################################
2425
2526
EOF
26-
printf "${C_RESET}"
27+
printf "${RESET}"
2728

28-
command -v yum >/dev/null 2>&1 || { echo >&2 -e "${C_RED}Require yum but it's not installed. Aborting.${C_RESET}"; exit 1; }
29-
command -v git >/dev/null 2>&1 || { echo >&2 -e "${C_RED}Require git but it's not installed. Aborting.${C_RESET}"; exit 1; }
29+
printf "${GREEN}>>>>>>>> install fastdfs begin.${RESET}\n"
3030

31-
yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y
31+
command -v yum >/dev/null 2>&1 || { printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; }
32+
command -v git >/dev/null 2>&1 || { printf "${RED}Require git but it's not installed.${RESET}\n"; exit 1; }
3233

33-
root=/opt/fdfs
34-
if [[ -n $1 ]]; then
35-
root=$1
34+
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then
35+
printf "${PURPLE}[Hint]\n"
36+
printf "\t sh fastdfs-install.sh [path]\n"
37+
printf "\t Example: sh fastdfs-install.sh /opt/fastdfs\n"
38+
printf "${RESET}\n"
3639
fi
3740

38-
version=1.16.0
39-
if [[ -n $2 ]]; then
40-
version=$2
41+
path=/opt/fdfs
42+
if [[ -n $1 ]]; then
43+
path=$1
4144
fi
4245

46+
nginx_version=1.16.0
4347
nginx_path=/opt/nginx
44-
if [[ -n $3 ]]; then
45-
root=$3
46-
fi
4748

48-
mkdir -p ${root}
49-
root=/opt/fdfs
50-
echo -e "\n${C_GREEN}>>>>>>>>> install libfastcommon${C_RESET}"
51-
mkdir -p ${root}/libfastcommon
52-
curl -o ${root}/libfastcommon.zip http://dunwu.test.upcdn.net/soft/fdfs/libfastcommon.zip
53-
if [[ ! -f ${root}/libfastcommon.zip ]]; then
54-
echo -e "\n${C_RED}>>>>>>>>> install libfastcommon failed,exit. ${C_RESET}"
49+
printf "${GREEN}>>>>>>>> install required libs.${RESET}\n\n"
50+
yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y
51+
52+
# download and decompression
53+
mkdir -p ${path}
54+
path=/opt/fdfs
55+
mkdir -p ${path}/libfastcommon
56+
curl -o ${path}/libfastcommon.zip http://dunwu.test.upcdn.net/soft/fdfs/libfastcommon.zip
57+
if [[ ! -f ${path}/libfastcommon.zip ]]; then
58+
printf "${RED}[Error]install libfastcommon failed,exit. ${RESET}\n"
59+
exit 1
5560
fi
56-
unzip -o ${root}/libfastcommon.zip -d ${root}
57-
cd ${root}/libfastcommon
58-
chmod +x -R ${root}/libfastcommon/*.sh
61+
unzip -o ${path}/libfastcommon.zip -d ${path}
62+
63+
64+
cd ${path}/libfastcommon
65+
chmod +x -R ${path}/libfastcommon/*.sh
5966
./make.sh && ./make.sh install
6067

61-
echo -e "\n${C_GREEN}>>>>>>>>> install fastdfs${C_RESET}"
62-
mkdir -p ${root}/fastdfs
63-
curl -o ${root}/fastdfs.zip http://dunwu.test.upcdn.net/soft/fdfs/fastdfs.zip
64-
if [[ ! -f ${root}/fastdfs.zip ]]; then
65-
echo -e "\n${C_RED}>>>>>>>>> install fastdfs failed,exit. ${C_RESET}"
68+
printf "${GREEN}>>>>>>>>> install fastdfs${RESET}"
69+
mkdir -p ${path}/fastdfs
70+
curl -o ${path}/fastdfs.zip http://dunwu.test.upcdn.net/soft/fdfs/fastdfs.zip
71+
if [[ ! -f ${path}/fastdfs.zip ]]; then
72+
printf "${RED}>>>>>>>>> install fastdfs failed,exit. ${RESET}\n"
6673
fi
67-
unzip -o ${root}/fastdfs.zip -d ${root}
68-
cd ${root}/fastdfs
69-
chmod +x -R ${root}/fastdfs/*.sh
74+
unzip -o ${path}/fastdfs.zip -d ${path}
75+
cd ${path}/fastdfs
76+
chmod +x -R ${path}/fastdfs/*.sh
7077
./make.sh && ./make.sh install
7178

72-
echo -e "\n${C_GREEN}>>>>>>>>> install fastdfs-nginx-module${C_RESET}"
73-
mkdir -p ${root}/fastdfs-nginx-module
74-
curl -o ${root}/fastdfs-nginx-module.zip http://dunwu.test.upcdn.net/soft/fdfs/fastdfs-nginx-module.zip
75-
if [[ ! -f ${root}/fastdfs-nginx-module.zip ]]; then
76-
echo -e "\n${C_RED}>>>>>>>>> install fastdfs-nginx-module failed,exit. ${C_RESET}"
79+
printf "${GREEN}>>>>>>>>> install fastdfs-nginx-module${RESET}\n"
80+
mkdir -p ${path}/fastdfs-nginx-module
81+
curl -o ${path}/fastdfs-nginx-module.zip http://dunwu.test.upcdn.net/soft/fdfs/fastdfs-nginx-module.zip
82+
if [[ ! -f ${path}/fastdfs-nginx-module.zip ]]; then
83+
printf "${RED}>>>>>>>>> install fastdfs-nginx-module failed,exit. ${RESET}\n"
7784
fi
78-
unzip -o ${root}/fastdfs-nginx-module.zip -d ${root}
85+
unzip -o ${path}/fastdfs-nginx-module.zip -d ${path}
7986

80-
echo -e "\n${C_GREEN}>>>>>>>>> install nginx${C_RESET}"
87+
printf "${GREEN}>>>>>>>>> install nginx${RESET}"
8188
mkdir -p ${nginx_path}
82-
wget -O ${nginx_path}/nginx-${version}.tar.gz http://nginx.org/download/nginx-${version}.tar.gz
83-
tar zxf ${nginx_path}/nginx-${version}.tar.gz -C ${nginx_path}
84-
cd ${nginx_path}/nginx-${version}
85-
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre --add-module=${root}/fastdfs-nginx-module/src/
89+
curl -o ${nginx_path}/nginx-${nginx_version}.tar.gz http://nginx.org/download/nginx-${nginx_version}.tar.gz
90+
tar zxf ${nginx_path}/nginx-${nginx_version}.tar.gz -C ${nginx_path}
91+
cd ${nginx_path}/nginx-${nginx_version}
92+
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre --add-module=${path}/fastdfs-nginx-module/src/
8693
make && make install
8794

88-
echo -e "\n${C_GREEN}>>>>>>>>> fastdfs 配置文件准备${C_RESET}"
95+
printf "${GREEN}>>>>>>>>> fastdfs 配置文件准备${RESET}\n"
8996
# 配置修改参考:https://github.com/happyfish100/fastdfs/wiki
9097

91-
cp ${root}/fastdfs/conf/http.conf /etc/fdfs/ #供nginx访问使用
92-
cp ${root}/fastdfs/conf/mime.types /etc/fdfs/ #供nginx访问使用
93-
cp ${root}/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs
98+
cp ${path}/fastdfs/conf/http.conf /etc/fdfs/ #供nginx访问使用
99+
cp ${path}/fastdfs/conf/mime.types /etc/fdfs/ #供nginx访问使用
100+
cp ${path}/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs
94101
wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/fastdfs/tracker.conf -O /etc/fdfs/tracker.conf
95102
wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/fastdfs/storage.conf -O /etc/fdfs/storage.conf
96103
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
100107
ip=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}')
101108

102109
mkdir -p ${fdfs_store_path}
103-
echo -e "\n${C_GREEN} - 修改 tracker.conf 配置${C_RESET}"
110+
printf "${GREEN} - 修改 tracker.conf 配置${RESET}\n"
104111
sed -i "s#^base_path=.*#base_path=${fdfs_store_path}#g" /etc/fdfs/tracker.conf
105-
echo -e "\n${C_GREEN} - 修改 storage.conf 配置${C_RESET}"
112+
printf "${GREEN} - 修改 storage.conf 配置${RESET}\n"
106113
sed -i "s#^base_path=.*#base_path=${fdfs_store_path}#g" /etc/fdfs/storage.conf
107114
sed -i "s#^store_path0=.*#store_path0=${fdfs_store_path}#g" /etc/fdfs/storage.conf
108115
sed -i "s#^tracker_server=.*#tracker_server=${ip}:22122#g" /etc/fdfs/storage.conf
109116
sed -i "s#^http.server_port=.*#http.server_port=${fdfs_server_port}#g" /etc/fdfs/storage.conf
110-
echo -e "\n${C_GREEN} - 修改 client.conf 配置${C_RESET}"
117+
printf "${GREEN} - 修改 client.conf 配置${RESET}\n"
111118
sed -i "s#^base_path=.*#base_path=${fdfs_store_path}#g" /etc/fdfs/client.conf
112119
sed -i "s#^tracker_server=.*#tracker_server=${ip}:22122#g" /etc/fdfs/client.conf
113-
echo -e "\n${C_GREEN} - 修改 mod_fastdfs.conf 配置${C_RESET}"
120+
printf "${GREEN} - 修改 mod_fastdfs.conf 配置${RESET}\n"
114121
sed -i "s#^url_have_group_name=.*#url_have_group_name=true#g" /etc/fdfs/mod_fastdfs.conf
115122
sed -i "s#^tracker_server=.*#tracker_server=${ip}:22122#g" /etc/fdfs/mod_fastdfs.conf
116123
sed -i "s#^store_path0=.*#store_path0=${fdfs_store_path}#g" /etc/fdfs/mod_fastdfs.conf
117-
echo -e "\n${C_GREEN} - 修改 nginx.conf 配置${C_RESET}\n"
124+
printf "${GREEN} - 修改 nginx.conf 配置${RESET}\n"
118125
mkdir -p /usr/local/nginx/conf/conf
119126
wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/nginx/nginx.conf -O /usr/local/nginx/conf/nginx.conf
120127
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
121128

122-
echo -e "\n${C_GREEN}>>>>>>>>> 启动 fastdfs ${C_RESET}"
129+
printf "${GREEN}>>>>>>>>> 启动 fastdfs ${RESET}\n"
123130
chmod +x /etc/init.d/fdfs_trackerd
124131
/etc/init.d/fdfs_trackerd start #启动tracker服务
125132
#/etc/init.d/fdfs_trackerd restart #重启动tracker服务
@@ -142,7 +149,13 @@ systemctl start nginx.service
142149
#systemctl restart nginx.service
143150
#systemctl stop nginx.service
144151

145-
echo -e "\n>>>>>>>>> add fastdfs port"
152+
printf ">>>>>>>>> add fastdfs port"
146153
firewall-cmd --zone=public --add-port=${fdfs_server_port}/tcp --permanent
147154
firewall-cmd --zone=public --add-port=22122/tcp --permanent
148155
firewall-cmd --reload
156+
157+
printf "${GREEN}<<<<<<<< install fastdfs end.${RESET}\n"
158+
#touch test.txt
159+
#result=`fdfs_upload_file /etc/fdfs/client.conf test.txt`
160+
#echo ${result}
161+
#rm -f test.txt

codes/linux/soft/jdk8-install.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@ cat << EOF
2525
EOF
2626
printf "${RESET}"
2727

28-
printf "${BLUE}>>>>>>>> install jdk8\n${RESET}"
28+
printf "${GREEN}>>>>>>>> install jdk8 begin.${RESET}\n"
2929

30-
command -v yum >/dev/null 2>&1 || {
31-
printf "${RED}Require yum but it's not installed.\n${RESET}"
32-
printf "${RED}Require yum but it's not installed.${RESET}\n";
33-
exit 1;
34-
}
30+
command -v yum >/dev/null 2>&1 || { printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; }
3531

3632
yum -y install java-1.8.0-openjdk-devel.x86_64
3733
java -version
3834

39-
printf "${GREEN}<<<<<<<< install jdk8 finished\n${RESET}"
35+
printf "${GREEN}<<<<<<<< install jdk8 end.${RESET}\n"

codes/linux/soft/jenkins-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ echo -e "\n>>>>>>>>> install jenkins"
1010

1111
# 下载并解压 jenkins
1212
mkdir -p /opt/jenkins
13-
wget -O /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war
13+
curl -o /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war

codes/linux/soft/kafka-install.sh

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
#!/usr/bin/env bash
22

3+
###################################################################################
4+
# 控制台颜色
5+
BLACK="\033[1;30m"
6+
RED="\033[1;31m"
7+
GREEN="\033[1;32m"
8+
YELLOW="\033[1;33m"
9+
BLUE="\033[1;34m"
10+
PURPLE="\033[1;35m"
11+
CYAN="\033[1;36m"
12+
RESET="$(tput sgr0)"
13+
###################################################################################
14+
15+
printf "${BLUE}"
316
cat << EOF
417
518
###################################################################################
@@ -9,26 +22,38 @@ cat << EOF
922
###################################################################################
1023
1124
EOF
25+
printf "${RESET}"
26+
27+
printf "${GREEN}>>>>>>>> install kafka begin.${RESET}\n"
28+
29+
command -v java >/dev/null 2>&1 || { printf "${RED}Require java but it's not installed.${RESET}\n"; exit 1; }
1230

1331
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then
14-
echo "Usage: sh kafka-install.sh [version] [path]"
15-
echo -e "Example: sh kafka-install.sh 2.2.0 /opt/kafka\n"
32+
printf "${PURPLE}[Hint]\n"
33+
printf "\t sh kafka-install.sh [version] [path]\n"
34+
printf "\t Example: sh kafka-install.sh 2.2.0 /opt/kafka\n"
35+
printf "${RESET}\n"
1636
fi
1737

1838
version=2.2.0
1939
if [[ -n $1 ]]; then
2040
version=$1
2141
fi
2242

23-
root=/opt/kafka
43+
path=/opt/kafka
2444
if [[ -n $2 ]]; then
25-
root=$2
45+
path=$2
2646
fi
2747

28-
echo "Current execution: install kafka ${version} to ${root}"
29-
echo -e "\n>>>>>>>>> download kafka"
30-
mkdir -p ${root}
31-
wget -O ${root}/kafka_2.12-${version}.tgz http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/${version}/kafka_2.12-${version}.tgz
48+
# install info
49+
printf "${PURPLE}[Info]\n"
50+
printf "\t version = ${version}\n"
51+
printf "\t path = ${path}\n"
52+
printf "${RESET}\n"
53+
54+
# download and decompression
55+
mkdir -p ${path}
56+
curl -o ${path}/kafka_2.12-${version}.tgz http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/${version}/kafka_2.12-${version}.tgz
57+
tar zxf ${path}/kafka_2.12-${version}.tgz -C ${path}
3258

33-
echo -e "\n>>>>>>>>> install kafka"
34-
tar zxf ${root}/kafka_2.12-${version}.tgz -C ${root}
59+
printf "${GREEN}<<<<<<<< install kafka end.${RESET}\n"

0 commit comments

Comments
 (0)