Skip to content

Commit 78a9ebf

Browse files
committed
更新脚本
1 parent 0e20618 commit 78a9ebf

16 files changed

Lines changed: 228 additions & 1 deletion

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@
5858
| [Svn 安装](docs/linux/soft/svn.md) | Svn 是 Subversion 的简称,是一个开放源代码的版本控制系统,它采用了分支管理系统。 |
5959
| [Tomcat 安装](docs/linux/soft/tomcat.md) | Java 应用服务器 |
6060
| [Zookeeper 安装](docs/linux/soft/zookeeper.md) | 分布式系统协调软件 |
61+
| [Nacos 安装](linux/soft/nacos.md) | 微服务发现、管理 |
6162

6263
## [Docker](docs/docker)

codes/linux/ops/soft/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,19 @@ curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/lin
148148
wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/ops/soft/rocketmq-install.sh | bash
149149
```
150150

151+
## Nacos 安装
152+
153+
说明:
154+
155+
下载 Nacos `1.0.0` 并解压安装到 `/opt/nacos` 路径下。
156+
157+
使用方法:执行以下任意命令即可执行脚本。
158+
159+
```sh
160+
curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/ops/soft/nacos-install.sh | bash
161+
wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/ops/soft/nacos-install.sh | bash
162+
```
163+
151164
## ZooKeeper 安装
152165

153166
说明:

codes/linux/ops/soft/jdk8-install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ cat << EOF
1111
1212
EOF
1313

14+
command -v yum >/dev/null 2>&1 || { echo >&2 "Require yum but it's not installed. Aborting."; exit 1; }
15+
1416
echo -e "\n>>>>>>>>> install jdk8"
1517

1618
yum -y install java-1.8.0-openjdk.x86_64

codes/linux/ops/soft/kafka-install.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ cat << EOF
1010
1111
EOF
1212

13+
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"
16+
fi
17+
1318
version=2.2.0
1419
if [[ -n $1 ]]; then
1520
version=$1
@@ -20,6 +25,7 @@ if [[ -n $2 ]]; then
2025
root=$2
2126
fi
2227

28+
echo "Current execution: install kafka ${version} to ${root}"
2329
echo -e "\n>>>>>>>>> download kafka"
2430
mkdir -p ${root}
2531
wget -O ${root}/kafka_2.12-${version}.tgz http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/${version}/kafka_2.12-${version}.tgz

codes/linux/ops/soft/maven-install.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ cat << EOF
1010
###################################################################################
1111
EOF
1212

13+
command -v java >/dev/null 2>&1 || { echo >&2 "Require java but it's not installed. Aborting."; exit 1; }
14+
15+
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then
16+
echo "Usage: sh maven-install.sh [version] [path]"
17+
echo -e "Example: sh maven-install.sh 3.6.0 /opt/maven\n"
18+
fi
19+
1320
version=3.6.0
1421
if [[ -n $1 ]]; then
1522
version=$1
@@ -20,6 +27,8 @@ if [[ -n $2 ]]; then
2027
root=$2
2128
fi
2229

30+
echo "Current execution: install maven ${version} to ${root}"
31+
2332
echo -e "\n>>>>>>>>> download maven"
2433
mkdir -p ${root}
2534
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

codes/linux/ops/soft/mongodb-install.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ cat << EOF
1010
1111
EOF
1212

13+
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then
14+
echo "Usage: sh mongodb-install.sh [version] [path]"
15+
echo -e "Example: sh mongodb-install.sh 4.0.9 /opt/mongodb\n"
16+
fi
17+
1318
version=4.0.9
1419
if [[ -n $1 ]]; then
1520
version=$1
@@ -20,6 +25,8 @@ if [[ -n $2 ]]; then
2025
root=$2
2126
fi
2227

28+
echo "Current execution: install mongodb ${version} to ${root}"
29+
2330
echo -e "\n>>>>>>>>> download mongodb"
2431
mkdir -p ${root}
2532
wget -O ${root}/mongodb-linux-x86_64-${version}.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${version}.tgz
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
cat << EOF
4+
5+
###################################################################################
6+
# 安装 nacos 脚本
7+
# 需要提前安装 jdk、maven
8+
# @system: 适用于所有 linux 发行版本。
9+
# @author: Zhang Peng
10+
###################################################################################
11+
12+
EOF
13+
14+
command -v java >/dev/null 2>&1 || { echo >&2 "Require java but it's not installed. Aborting."; exit 1; }
15+
command -v mvn >/dev/null 2>&1 || { echo >&2 "Require mvn but it's not installed. Aborting."; exit 1; }
16+
17+
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then
18+
echo "Usage: sh nacos-install.sh [version] [path]"
19+
printf "Example: sh nacos-install.sh 1.0.0 /opt/nacos\n"
20+
fi
21+
22+
version=1.0.0
23+
if [[ -n $1 ]]; then
24+
version=$1
25+
fi
26+
27+
root=/opt/nacos
28+
if [[ -n $2 ]]; then
29+
root=$2
30+
fi
31+
32+
echo "Current execution: install nacos ${version} to ${root}"
33+
34+
echo -e "\n>>>>>>>>> download nacos"
35+
mkdir -p ${root}
36+
wget -O ${root}/nacos-server-${version}.zip https://github.com/alibaba/nacos/releases/download/${version}/nacos-server-${version}.zip
37+
38+
echo -e "\n>>>>>>>>> install nacos"
39+
unzip ${root}/nacos-server-${version}.zip -d ${root}/nacos-server-${version}
40+
mv ${root}/nacos-server-${version}/nacos/* ${root}/nacos-server-${version}
41+
rm -rf ${root}/nacos-server-${version}/nacos

codes/linux/ops/soft/nginx-install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ cat << EOF
1111
1212
EOF
1313

14+
command -v yum >/dev/null 2>&1 || { echo >&2 "Require yum but it's not installed. Aborting."; exit 1; }
15+
16+
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then
17+
echo "Usage: sh nginx-install.sh [version] [path]"
18+
echo -e "Example: sh nginx-install.sh 1.16.0 /opt/nginx\n"
19+
fi
20+
1421
version=1.16.0
1522
if [[ -n $1 ]]; then
1623
version=$1
@@ -21,6 +28,7 @@ if [[ -n $2 ]]; then
2128
root=$2
2229
fi
2330

31+
echo "Current execution: install nginx ${version} to ${root}"
2432
echo -e "\n>>>>>>>>> install libs"
2533
yum install -y zlib zlib-devel gcc-c++ libtool openssl openssl-devel pcre
2634

codes/linux/ops/soft/nodejs-install.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ cat << EOF
1010
1111
EOF
1212

13+
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then
14+
echo "Usage: sh nodejs-install.sh [version] [path]"
15+
echo -e "Example: sh nodejs-install.sh 10.15.2 /opt/nodejs\n"
16+
fi
17+
1318
version=10.15.2
1419
if [[ -n $1 ]]; then
1520
version=$1
@@ -26,6 +31,7 @@ if [[ ${execode} != 0 ]]; then
2631
nvm --version
2732
fi
2833

34+
echo "Current execution: install nodejs ${version} to ${root}"
2935
echo -e "\n>>>>>>>>> install nodejs by nvm"
3036
nvm install ${version}
3137
nvm use ${version}

codes/linux/ops/soft/redis-install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ cat << EOF
1010
1111
EOF
1212

13+
command -v yum >/dev/null 2>&1 || { echo >&2 "Require yum but it's not installed. Aborting."; exit 1; }
14+
15+
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]] || [[ $# -lt 3 ]] || [[ $# -lt 4 ]];then
16+
echo "Usage: sh redis-install.sh [version] [path] [port] [password]"
17+
echo -e "Example: sh redis-install.sh 5.0.4 /opt/redis 6379 123456\n"
18+
fi
19+
1320
version=5.0.4
1421
if [[ -n $1 ]]; then
1522
version=$1
@@ -30,6 +37,7 @@ if [[ -n $4 ]]; then
3037
path=$4
3138
fi
3239

40+
echo "Current execution: install redis ${version} to ${root}, service port = ${port}, password = ${password}"
3341
echo -e "\n>>>>>>>>> install libs"
3442
yum install -y zlib zlib-devel gcc-c++ libtool openssl openssl-devel tcl
3543

0 commit comments

Comments
 (0)