diff --git a/README.md b/README.md index 6963a22..fd536cf 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ - [Maven 安装](docs/linux/soft/maven-install.md) - [Nodejs 安装](docs/linux/soft/nodejs-install.md) - 开发工具 - - [Nexus 运维](docs/linux/soft/nexus-install.md) + - [Nexus 运维](docs/linux/soft/nexus-ops.md) - [Gitlab 运维](docs/linux/soft/kafka-install.md) - [Jenkins 运维](docs/linux/soft/jenkins.md) - [Svn 运维](docs/linux/soft/svn-ops.md) diff --git a/codes/linux/soft/config/redis-remote-access.conf b/codes/linux/soft/config/redis-remote-access.conf index 9744238..e77635a 100644 --- a/codes/linux/soft/config/redis-remote-access.conf +++ b/codes/linux/soft/config/redis-remote-access.conf @@ -66,7 +66,7 @@ # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES # JUST COMMENT THE FOLLOWING LINE. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# bind 127.0.0.1 +bind 0.0.0.0 # Protected mode is a layer of security protection, in order to avoid that # Redis instances left open on the internet are accessed and exploited. @@ -499,12 +499,12 @@ replica-priority 100 # # This should stay commented out for backward compatibility and because most # people do not need auth (e.g. they run their own servers). -# +#:q # Warning: since Redis is pretty fast an outside user can try up to # 150k passwords per second against a good box. This means that you should # use a very strong password otherwise it will be very easy to break. # -requirepass 123456 +# requirepass # Command renaming. # diff --git a/codes/linux/soft/nexus-install.sh b/codes/linux/soft/nexus-install.sh index 1ec2540..39d0687 100644 --- a/codes/linux/soft/nexus-install.sh +++ b/codes/linux/soft/nexus-install.sh @@ -1,5 +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 + ################################################################################### # 安装 sonatype nexus(用于搭建 maven 私服) 脚本 # @system: 适用于所有 linux 发行版本。 @@ -8,7 +23,10 @@ # @author: Zhang Peng ################################################################################### -echo -e "\n>>>>>>>>> install sonatype nexus" +EOF +printf "${RESET}" + +printf "${GREEN}>>>>>>>> install nexus begin.${RESET}\n" mkdir -p /opt/maven cd /opt/maven @@ -16,3 +34,5 @@ cd /opt/maven version=3.13.0-01 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 + +printf "${GREEN}<<<<<<<< install nexus end.${RESET}\n" diff --git a/codes/linux/soft/redis-install.sh b/codes/linux/soft/redis-install.sh index 07c0d43..f103325 100644 --- a/codes/linux/soft/redis-install.sh +++ b/codes/linux/soft/redis-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,6 +22,7 @@ cat << EOF ################################################################################### EOF +printf "${RESET}" command -v yum >/dev/null 2>&1 || { printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; } @@ -37,37 +51,41 @@ if [[ -n $4 ]]; then password=$4 fi -echo "Current execution: install redis ${version} to ${root}, service port = ${port}, password = ${password}" -echo -e "\n>>>>>>>>> install libs" +printf "${GREEN}>>>>>>>> install redis begin.${RESET}\n" + +printf "\t${GREEN}Current execution: install redis ${version} to ${root}, service port = ${port}, password = ${password}${RESET}\n" yum install -y zlib zlib-devel gcc-c++ libtool openssl openssl-devel tcl -echo -e "\n>>>>>>>>> download redis" mkdir -p ${root} 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} tar zxf ${root}/redis-${version}.tar.gz -C ${root} cd ${path} make && make install cd - -echo -e "\n>>>>>>>>> config redis" +printf "\n${CYAN}>>>>>>>>> config redis${RESET}\n" cp ${path}/redis.conf ${path}/redis.conf.default wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/redis-remote-access.conf -O ${path}/redis.conf +mkdir -p /etc/redis cp ${path}/redis.conf /etc/redis/${port}.conf sed -i "s/^port 6379/port ${port}/g" /etc/redis/${port}.conf -sed -i "s/^requirepass 123456/requirepass ${password}/g" /etc/redis/${port}.conf +if [[ -n ${password} ]]; then + sed -i "s/^# requirepass/requirepass ${password}/g" /etc/redis/${port}.conf +fi -echo -e "\n>>>>>>>>> add firewall port" +printf "\n${CYAN}>>>>>>>>> add firewall port${RESET}\n" firewall-cmd --zone=public --add-port=${port}/tcp --permanent firewall-cmd --reload -echo -e "\n>>>>>>>>> add redis service" +printf "\n${CYAN}>>>>>>>>> add redis service${RESET}\n" # 注册 redis 服务,并设置开机自启动 -cp ${path}/utils/redis_init_script /etc/init.d/redis_${port} +cp ${path}/utils/redis_init_script /etc/init.d/ +mv /etc/init.d/redis_init_script /etc/init.d/redis_${port} sed -i "s/^REDISPORT=.*/REDISPORT=${port}/g" /etc/init.d/redis_${port} chmod +x /etc/init.d/redis_${port} chkconfig --add redis_${port} service redis_${port} start +printf "\n${GREEN}<<<<<<<< install redis end.${RESET}\n" diff --git a/docs/README.md b/docs/README.md index e41a86b..88ae81f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,7 +17,7 @@ - [Maven 安装](linux/soft/maven-install.md) - [Nodejs 安装](linux/soft/nodejs-install.md) - 开发工具 - - [Nexus 运维](linux/soft/nexus-install.md) + - [Nexus 运维](linux/soft/nexus-ops.md) - [Gitlab 运维](linux/soft/kafka-install.md) - [Jenkins 运维](linux/soft/jenkins.md) - [Svn 运维](linux/soft/svn-ops.md) diff --git a/docs/coverpage.md b/docs/coverpage.md index 6a08035..0de646b 100644 --- a/docs/coverpage.md +++ b/docs/coverpage.md @@ -1,6 +1,6 @@
-# Linux 教程 +# Linux Tutorial > Linux 教程 diff --git a/docs/linux/soft/README.md b/docs/linux/soft/README.md index 80d3683..f9232db 100644 --- a/docs/linux/soft/README.md +++ b/docs/linux/soft/README.md @@ -6,7 +6,7 @@ - [Jenkins 安装](jenkins-install.md) - [Kafka 安装](kafka-install.md) - [Maven 安装](maven-install.md) -- [Nexus 安装](nexus-install.md) +- [Nexus 安装](nexus-ops.md) - [Nodejs 安装](nodejs-install.md) - [RocketMQ 安装](rocketmq-install.md) - [Svn 安装](svn-ops.md) diff --git a/docs/linux/soft/nexus-install.md b/docs/linux/soft/nexus-ops.md similarity index 56% rename from docs/linux/soft/nexus-install.md rename to docs/linux/soft/nexus-ops.md index 5f5337c..ea31a55 100644 --- a/docs/linux/soft/nexus-install.md +++ b/docs/linux/soft/nexus-ops.md @@ -1,5 +1,7 @@ -# 部署并使用 Nexus 作为 Maven 私服 +# Nexus 运维 +> Nexus 是一个强大的 Maven 仓库管理器,可以用来搭建 Maven 私服。 +> > 关键词:maven, nexus > > 部署环境 @@ -10,17 +12,22 @@ -- [下载安装 Nexus](#下载安装-nexus) -- [启动停止 Nexus](#启动停止-nexus) -- [使用 Nexus](#使用-nexus) +- [安装 Nexus](#安装-nexus) +- [启动/停止 Nexus](#启动停止-nexus) +- [使用 Nexus 搭建 Maven 私服](#使用-nexus-搭建-maven-私服) + - [配置仓库](#配置仓库) - [配置 settings.xml](#配置-settingsxml) - [配置 pom.xml](#配置-pomxml) - [执行 maven 构建](#执行-maven-构建) +- [将 Nexus 设置为服务](#将-nexus-设置为服务) +- [Nexus 备份和迁移](#nexus-备份和迁移) + - [备份](#备份) + - [迁移](#迁移) - [参考资料](#参考资料) -## 下载安装 Nexus +## 安装 Nexus 进入[官方下载地址](https://www.sonatype.com/download-oss-sonatype),选择合适版本下载。 @@ -40,7 +47,7 @@ tar -zxf nexus-unix.tar.gz - nexus-3.13.0-01 - 包含了 Nexus 运行所需要的文件。是 Nexus 运行必须的。 - sonatype-work - 包含了 Nexus 生成的配置文件、日志文件、仓库文件等。当我们需要备份 Nexus 的时候默认备份此目录即可。 -## 启动停止 Nexus +## 启动/停止 Nexus 进入 nexus-3.13.0-01/bin 目录,有一个可执行脚本 nexus。 @@ -52,7 +59,8 @@ Usage: ./nexus {start|stop|run|run-redirect|status|restart|force-reload} ``` - 启动 nexus - `./nexus start` -- 停止 nexus - +- 停止 nexus - `./nexus stop` +- 重启 nexus - `./nexus restart` 启动成功后,在浏览器中访问 `http://