From 446670523501341f71b47bbc4eae763ed9b19cb8 Mon Sep 17 00:00:00 2001 From: Zhang Peng Date: Sun, 26 Apr 2020 10:34:55 +0800 Subject: [PATCH] update docs and scripts --- codes/linux/soft/gitlab-install.sh | 24 ++- codes/linux/soft/gitlab/gitlab-backup.sh | 46 +++++ codes/linux/soft/gitlab/gitlab.sh | 191 +++++++++++++++++++ codes/linux/soft/lib/mysql.sh | 18 +- codes/linux/soft/mysql-install.sh | 6 +- codes/linux/soft/nexus-install.sh | 158 +++++++++++++--- codes/shell/输入和输出/免密码传输.sh | 19 ++ docs/linux/ops/firewalld.md | 2 +- docs/linux/soft/gitlab-ops.md | 83 +++++++- docs/linux/soft/nexus-ops.md | 229 +++++++++++++++-------- docs/linux/soft/svn-ops.md | 58 +++--- 11 files changed, 672 insertions(+), 162 deletions(-) create mode 100644 codes/linux/soft/gitlab/gitlab-backup.sh create mode 100644 codes/linux/soft/gitlab/gitlab.sh create mode 100644 codes/shell/输入和输出/免密码传输.sh diff --git a/codes/linux/soft/gitlab-install.sh b/codes/linux/soft/gitlab-install.sh index b3ce9f7..971a3a4 100644 --- a/codes/linux/soft/gitlab-install.sh +++ b/codes/linux/soft/gitlab-install.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash # ----------------------------------------------------------------------------------------------------- -# 安装 Gitlab 脚本 +# Gitlab 安装脚本 # 仅适用于 CentOS7 发行版本 +# 官方安裝參考:https://about.gitlab.com/install/#centos-7 # @author: Zhang Peng # ----------------------------------------------------------------------------------------------------- @@ -37,11 +38,6 @@ export ENV_FAILED=1 # ------------------------------------------------------------------------------ functions -# 显示打印日志的时间 -SHELL_LOG_TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S") -# 那个用户在操作 -USER=$(whoami) - redOutput() { echo -e "${ENV_COLOR_RED} $@${ENV_COLOR_RESET}" } @@ -95,18 +91,20 @@ callAndLog () { # ------------------------------------------------------------------------------ main -printInfo ">>>> 安装 gitlab" -printInfo ">>>> 安装和配置必要依赖" +# 官方安裝參考:https://about.gitlab.com/install/#centos-7 +printInfo ">>>> install gitlab on Centos7" +printInfo ">>>> Install and configure the necessary dependencies" yum install -y curl policycoreutils-python openssh-server systemctl enable sshd systemctl start sshd -printInfo ">>>> 关闭防火墙" -firewall-cmd --permanent --add-service=http -systemctl reload firewalld -printInfo ">>>> 安装和配置邮件服务" +printInfo ">>>> open http, https and ssh access in the system firewall" +sudo firewall-cmd --permanent --add-service=http +sudo firewall-cmd --permanent --add-service=https +sudo systemctl reload firewalld +printInfo ">>>> install postfix" yum install postfix systemctl enable postfix systemctl start postfix -printInfo ">>>> 通过 yum 安装 gitlab" +printInfo ">>>> Add the GitLab package repository and install the package" curl -o- https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash EXTERNAL_URL="http://gitlab.transwarp.io" yum install -y gitlab-ce diff --git a/codes/linux/soft/gitlab/gitlab-backup.sh b/codes/linux/soft/gitlab/gitlab-backup.sh new file mode 100644 index 0000000..0a34151 --- /dev/null +++ b/codes/linux/soft/gitlab/gitlab-backup.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +# ----------------------------------------------------------------------------------------------------- +# Gitlab 操作脚本 +# 支持操作: +# 备份 Gitlab +# 恢复 Gitlab +# @author: Zhang Peng +# ----------------------------------------------------------------------------------------------------- + + +# ------------------------------------------------------------------------------ env + +# Gilab 操作的环境变量,使用方法: +# 可以在执行本脚本之前,export 以下环境变量,否则将按照默认配置执行 + +# Gitlab 备份文件最大数量(默认为 7 天) +export ENV_BACKUP_MAX_NUM=7 +# 备份路径 +export ENV_GITLAB_BACKUP_DIR="/var/opt/gitlab/backups" +# 备份日志路径 +export ENV_LOG_PATH="${ENV_GITLAB_BACKUP_DIR}/gitlab-backup.log" + +ENV_REMOTE_USER=root +ENV_REMOTE_HOST=172.22.6.42 + +# ------------------------------------------------------------------------------ load libs + +GIT_SCRIPTS_DIR=$(cd `dirname $0`; pwd) +if [[ ! -x ${GIT_SCRIPTS_DIR}/gitlab.sh ]]; then + echo "${GIT_SCRIPTS_DIR}/gitlab.sh not exists!" + exit 1 +fi +source ${GIT_SCRIPTS_DIR}/gitlab.sh + +# ------------------------------------------------------------------------------ functions + +backupGitlab +if [[ "$?" != ${ENV_SUCCEED} ]]; then + printError "退出" + exit ${ENV_FAILED} +fi + +#将备份文件传输到gitlab备份服务器 +BACKUP_FILE=$(find "${ENV_GITLAB_BACKUP_DIR}" -type f -name "*gitlab_backup.tar" | xargs ls -t | head -1) +scp ${BACKUP_FILE} ${ENV_REMOTE_USER}@${ENV_REMOTE_HOST}:${ENV_GITLAB_BACKUP_DIR} diff --git a/codes/linux/soft/gitlab/gitlab.sh b/codes/linux/soft/gitlab/gitlab.sh new file mode 100644 index 0000000..a2ba3c6 --- /dev/null +++ b/codes/linux/soft/gitlab/gitlab.sh @@ -0,0 +1,191 @@ +#!/usr/bin/env bash + +# ----------------------------------------------------------------------------------------------------- +# Gitlab 操作脚本 +# 支持操作: +# 备份 Gitlab +# 恢复 Gitlab +# @author: Zhang Peng +# ----------------------------------------------------------------------------------------------------- + +# ------------------------------------------------------------------------------ env + +# Regular Color +export ENV_COLOR_BLACK="\033[0;30m" +export ENV_COLOR_RED="\033[0;31m" +export ENV_COLOR_GREEN="\033[0;32m" +export ENV_COLOR_YELLOW="\033[0;33m" +export ENV_COLOR_BLUE="\033[0;34m" +export ENV_COLOR_MAGENTA="\033[0;35m" +export ENV_COLOR_CYAN="\033[0;36m" +export ENV_COLOR_WHITE="\033[0;37m" +# Bold Color +export ENV_COLOR_B_BLACK="\033[1;30m" +export ENV_COLOR_B_RED="\033[1;31m" +export ENV_COLOR_B_GREEN="\033[1;32m" +export ENV_COLOR_B_YELLOW="\033[1;33m" +export ENV_COLOR_B_BLUE="\033[1;34m" +export ENV_COLOR_B_MAGENTA="\033[1;35m" +export ENV_COLOR_B_CYAN="\033[1;36m" +export ENV_COLOR_B_WHITE="\033[1;37m" +# Reset Color +export ENV_COLOR_RESET="$(tput sgr0)" + +# status +export ENV_YES=0 +export ENV_NO=1 +export ENV_SUCCEED=0 +export ENV_FAILED=1 + +# ------------------------------------------------------------------------------ functions + +# 显示打印日志的时间 +SHELL_LOG_TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S") +# 那个用户在操作 +USER=$(whoami) + +redOutput() { + echo -e "${ENV_COLOR_RED} $@${ENV_COLOR_RESET}" +} +greenOutput() { + echo -e "${ENV_COLOR_B_GREEN} $@${ENV_COLOR_RESET}" +} +yellowOutput() { + echo -e "${ENV_COLOR_YELLOW} $@${ENV_COLOR_RESET}" +} +blueOutput() { + echo -e "${ENV_COLOR_BLUE} $@${ENV_COLOR_RESET}" +} +magentaOutput() { + echo -e "${ENV_COLOR_MAGENTA} $@${ENV_COLOR_RESET}" +} +cyanOutput() { + echo -e "${ENV_COLOR_CYAN} $@${ENV_COLOR_RESET}" +} +whiteOutput() { + echo -e "${ENV_COLOR_WHITE} $@${ENV_COLOR_RESET}" +} + +printInfo() { + echo -e "${ENV_COLOR_B_GREEN}[INFO] $@${ENV_COLOR_RESET}" +} +printWarn() { + echo -e "${ENV_COLOR_B_YELLOW}[WARN] $@${ENV_COLOR_RESET}" +} +printError() { + echo -e "${ENV_COLOR_B_RED}[ERROR] $@${ENV_COLOR_RESET}" +} + +callAndLog () { + $* + if [[ $? -eq ${ENV_SUCCEED} ]]; then + printInfo "$@" + return ${ENV_SUCCEED} + else + printError "$@ EXECUTE FAILED" + return ${ENV_FAILED} + fi +} + +# ------------------------------------------------------------------------------ env + +# Gilab 操作的环境变量,使用方法: +# 可以在执行本脚本之前,export 以下环境变量,否则将按照默认配置执行 + +# Gitlab 备份文件最大数量(默认为 7 天) +ENV_BACKUP_MAX_NUM=${ENV_BACKUP_MAX_NUM:-2} +# 备份路径 +ENV_GITLAB_BACKUP_DIR="${ENV_GITLAB_BACKUP_DIR:-/var/opt/gitlab/backups}" +# 备份日志路径 +ENV_LOG_PATH="${ENV_GITLAB_BACKUP_DIR}/gitlab-backup.log" + +magentaOutput "------------------------------------------------------------------------------" +magentaOutput "Gitlab 脚本操作环境变量:" +magentaOutput "ENV_BACKUP_MAX_NUM:${ENV_BACKUP_MAX_NUM}" +magentaOutput "ENV_GITLAB_BACKUP_DIR:${ENV_GITLAB_BACKUP_DIR}" +magentaOutput "ENV_LOG_PATH:${ENV_LOG_PATH}" +magentaOutput "------------------------------------------------------------------------------" + + +# ------------------------------------------------------------------------------ functions + +# 安装 Gitlab +installGitlab() { + # 官方安裝參考:https://about.gitlab.com/install/#centos-7 + printInfo ">>>> install gitlab on Centos7" + printInfo ">>>> Install and configure the necessary dependencies" + yum install -y curl policycoreutils-python openssh-server + systemctl enable sshd + systemctl start sshd + printInfo ">>>> open http, https and ssh access in the system firewall" + sudo firewall-cmd --permanent --add-service=http + sudo firewall-cmd --permanent --add-service=https + sudo systemctl reload firewalld + printInfo ">>>> install postfix" + yum install postfix + systemctl enable postfix + systemctl start postfix + printInfo ">>>> Add the GitLab package repository and install the package" + curl -o- https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash + EXTERNAL_URL="http://gitlab.transwarp.io" yum install -y gitlab-ce +} + +# 备份 Gitlab +backupGitlab() { + + #时间戳 + local beginTime=$(date +'%Y-%m-%d %H:%M:%S') + + #备份所有数据库 + printInfo ">>>> 备份 Gitlab 开始" + gitlab-rake gitlab:backup:create >> ${ENV_LOG_PATH}; + + #检查备份结果是否成功 + if [[ "$?" != ${ENV_SUCCEED} ]]; then + printError "<<<< 备份 Gitlab 失败" + return ${ENV_FAILED} + fi + + # 压缩备份sql文件,删除旧的备份文件 + cd "${ENV_GITLAB_BACKUP_DIR}" + + #只保存期限内的备份文件,其余删除 + find "${ENV_GITLAB_BACKUP_DIR} -name *_gitlab_backup.tar -type f -mtime +${ENV_BACKUP_MAX_NUM} -exec rm -rf {} \;" > /dev/null 2>&1 + + local endTime=$(date +'%Y-%m-%d %H:%M:%S') + local beginSeconds=$(date --date="${beginTime}" +%s) + local endSeconds=$(date --date="${endTime}" +%s) + printInfo "本次备份执行时间:$((endSeconds-beginSeconds)) s" + printInfo "<<<< 备份 Gitlab 成功\n" + return ${ENV_SUCCEED} +} + +# 恢复 Mysql +recoveryGitlab() { + + local version=$1 + if [[ !version ]]; then + printError "<<<< 未指定恢复版本" + return ${ENV_FAILED} + fi + + #创建备份目录及日志文件 + mkdir -p ${ENV_GITLAB_BACKUP_DIR} + if [[ ! -f ${ENV_LOG_PATH} ]]; then + touch ${ENV_LOG_PATH} + fi + + printInfo ">>>> 恢复 Gitlab 开始" + + gitlab-ctl stop unicorn + gitlab-ctl stop sidekiq + + gitlab-rake gitlab:backup:restore BACKUP=${version} + if [[ "$?" != 0 ]]; then + printError "<<<< 恢复 Gitlab 失败" + return ${ENV_FAILED} + fi + + printInfo "<<<< 恢复 Gitlab 成功\n" + return ${ENV_SUCCEED} +} diff --git a/codes/linux/soft/lib/mysql.sh b/codes/linux/soft/lib/mysql.sh index 33d3faf..27e5cbd 100644 --- a/codes/linux/soft/lib/mysql.sh +++ b/codes/linux/soft/lib/mysql.sh @@ -108,7 +108,7 @@ ENV_MYSQL_DATABASES="${ENV_MYSQL_DATABASES:---all-databases}" # 备份路径 ENV_MYSQL_BACKUP_DIR="${ENV_MYSQL_BACKUP_DIR:-/var/lib/mysql/backup}" # 备份日志路径 -export ENV_LOG_PATH="${ENV_MYSQL_BACKUP_DIR}/mysql-backup.log" +ENV_MYSQL_BACKUP_LOG_PATH="${ENV_MYSQL_BACKUP_DIR}/mysql-backup.log" magentaOutput "------------------------------------------------------------------------------" magentaOutput "Mysql 脚本操作环境变量:" @@ -119,7 +119,7 @@ magentaOutput "ENV_MYSQL_PASSWORD:${ENV_MYSQL_PASSWORD}" magentaOutput "ENV_BACKUP_MAX_NUM:${ENV_BACKUP_MAX_NUM}" magentaOutput "ENV_MYSQL_DATABASES:${ENV_MYSQL_DATABASES}" magentaOutput "ENV_MYSQL_BACKUP_DIR:${ENV_MYSQL_BACKUP_DIR}" -magentaOutput "ENV_LOG_PATH:${ENV_LOG_PATH}" +magentaOutput "ENV_MYSQL_BACKUP_LOG_PATH:${ENV_MYSQL_BACKUP_LOG_PATH}" magentaOutput "------------------------------------------------------------------------------" @@ -133,7 +133,7 @@ backupAllDatabase() { #备份所有数据库 printInfo ">>>> 备份所有数据库开始" - mysqldump -h ${ENV_MYSQL_HOST} -P${ENV_MYSQL_PORT} -u${ENV_MYSQL_USERNAME} -p${ENV_MYSQL_PASSWORD} --all-databases > "${ENV_MYSQL_BACKUP_DIR}/all-${timestamp}.sql" 2>> ${ENV_LOG_PATH}; + mysqldump -h ${ENV_MYSQL_HOST} -P${ENV_MYSQL_PORT} -u${ENV_MYSQL_USERNAME} -p${ENV_MYSQL_PASSWORD} --all-databases > "${ENV_MYSQL_BACKUP_DIR}/all-${timestamp}.sql" 2>> ${ENV_MYSQL_BACKUP_LOG_PATH}; #检查备份结果是否成功 if [[ "$?" != ${ENV_SUCCEED} ]]; then @@ -172,7 +172,7 @@ backupSelectedDatabase() { for database in ${databaseList}; do printInfo "正在备份数据库:${database}" - mysqldump -h ${ENV_MYSQL_HOST} -P${ENV_MYSQL_PORT} -u${ENV_MYSQL_USERNAME} -p${ENV_MYSQL_PASSWORD} "${database}" > "${ENV_MYSQL_BACKUP_DIR}/${database}-${timestamp}.sql" 2>> ${ENV_LOG_PATH}; + mysqldump -h ${ENV_MYSQL_HOST} -P${ENV_MYSQL_PORT} -u${ENV_MYSQL_USERNAME} -p${ENV_MYSQL_PASSWORD} "${database}" > "${ENV_MYSQL_BACKUP_DIR}/${database}-${timestamp}.sql" 2>> ${ENV_MYSQL_BACKUP_LOG_PATH}; if [[ "$?" != 0 ]]; then printError "<<<< 备份 ${database} 失败" return ${ENV_FAILED} @@ -200,8 +200,8 @@ backupSelectedDatabase() { backupMysql() { #创建备份目录及日志文件 mkdir -p ${ENV_MYSQL_BACKUP_DIR} - if [[ ! -f ${ENV_LOG_PATH} ]]; then - touch ${ENV_LOG_PATH} + if [[ ! -f ${ENV_MYSQL_BACKUP_LOG_PATH} ]]; then + touch ${ENV_MYSQL_BACKUP_LOG_PATH} fi #正式备份数据库 @@ -216,13 +216,13 @@ backupMysql() { recoveryMysql() { #创建备份目录及日志文件 mkdir -p ${ENV_MYSQL_BACKUP_DIR} - if [[ ! -f ${ENV_LOG_PATH} ]]; then - touch ${ENV_LOG_PATH} + if [[ ! -f ${ENV_MYSQL_BACKUP_LOG_PATH} ]]; then + touch ${ENV_MYSQL_BACKUP_LOG_PATH} fi printInfo ">>>> 恢复数据库开始" - mysql -h ${ENV_MYSQL_HOST} -P${ENV_MYSQL_PORT} -u${ENV_MYSQL_USERNAME} -p${ENV_MYSQL_PASSWORD} < ${ENV_LOG_PATH} + mysql -h ${ENV_MYSQL_HOST} -P${ENV_MYSQL_PORT} -u${ENV_MYSQL_USERNAME} -p${ENV_MYSQL_PASSWORD} < ${ENV_MYSQL_BACKUP_LOG_PATH} if [[ "$?" != 0 ]]; then printError "<<<< 恢复数据库失败" return ${ENV_FAILED} diff --git a/codes/linux/soft/mysql-install.sh b/codes/linux/soft/mysql-install.sh index 84b09b0..77fbb2c 100644 --- a/codes/linux/soft/mysql-install.sh +++ b/codes/linux/soft/mysql-install.sh @@ -121,8 +121,10 @@ wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/conf printInfo ">>>> create mysql log file" mkdir -p /var/log/mysql -touch /var/log/mysql/mysql-slow.log -chmod 777 /var/log/mysql/mysql-slow.log +touch /var/log/mysql/mysql.log +touch /var/log/mysql/mysql_slow_query_log.log +chmod 777 /var/log/mysql/mysql.log +chmod 777 /var/log/mysql/mysql_slow_query_log.log chown -R mysql:mysql /var/log/mysql printInfo ">>>> modify limits.conf" diff --git a/codes/linux/soft/nexus-install.sh b/codes/linux/soft/nexus-install.sh index 39d0687..75dbb87 100644 --- a/codes/linux/soft/nexus-install.sh +++ b/codes/linux/soft/nexus-install.sh @@ -1,38 +1,146 @@ #!/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 发行版本。 # sonatype nexus 会被安装到 /opt/maven 路径。 # 注意:sonatype nexus 要求必须先安装 JDK # @author: Zhang Peng -################################################################################### +# ----------------------------------------------------------------------------------------------------- -EOF -printf "${RESET}" +# ------------------------------------------------------------------------------ env -printf "${GREEN}>>>>>>>> install nexus begin.${RESET}\n" +# Regular Color +export ENV_COLOR_BLACK="\033[0;30m" +export ENV_COLOR_RED="\033[0;31m" +export ENV_COLOR_GREEN="\033[0;32m" +export ENV_COLOR_YELLOW="\033[0;33m" +export ENV_COLOR_BLUE="\033[0;34m" +export ENV_COLOR_MAGENTA="\033[0;35m" +export ENV_COLOR_CYAN="\033[0;36m" +export ENV_COLOR_WHITE="\033[0;37m" +# Bold Color +export ENV_COLOR_B_BLACK="\033[1;30m" +export ENV_COLOR_B_RED="\033[1;31m" +export ENV_COLOR_B_GREEN="\033[1;32m" +export ENV_COLOR_B_YELLOW="\033[1;33m" +export ENV_COLOR_B_BLUE="\033[1;34m" +export ENV_COLOR_B_MAGENTA="\033[1;35m" +export ENV_COLOR_B_CYAN="\033[1;36m" +export ENV_COLOR_B_WHITE="\033[1;37m" +# Reset Color +export ENV_COLOR_RESET="$(tput sgr0)" -mkdir -p /opt/maven -cd /opt/maven +# status +export ENV_YES=0 +export ENV_NO=1 +export ENV_SUCCEED=0 +export ENV_FAILED=1 -version=3.13.0-01 -curl -o /opt/maven/nexus-unix.tar.gz http://download.sonatype.com/nexus/3/nexus-${version}-unix.tar.gz +# ------------------------------------------------------------------------------ functions + +# 显示打印日志的时间 +SHELL_LOG_TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S") +# 那个用户在操作 +USER=$(whoami) + +redOutput() { + echo -e "${ENV_COLOR_RED} $@${ENV_COLOR_RESET}" +} + +greenOutput() { + echo -e "${ENV_COLOR_B_GREEN} $@${ENV_COLOR_RESET}" +} + +yellowOutput() { + echo -e "${ENV_COLOR_YELLOW} $@${ENV_COLOR_RESET}" +} + +blueOutput() { + echo -e "${ENV_COLOR_BLUE} $@${ENV_COLOR_RESET}" +} + +magentaOutput() { + echo -e "${ENV_COLOR_MAGENTA} $@${ENV_COLOR_RESET}" +} + +cyanOutput() { + echo -e "${ENV_COLOR_CYAN} $@${ENV_COLOR_RESET}" +} + +whiteOutput() { + echo -e "${ENV_COLOR_WHITE} $@${ENV_COLOR_RESET}" +} + +printInfo() { + echo -e "${ENV_COLOR_B_GREEN}[INFO] $@${ENV_COLOR_RESET}" +} + +printWarn() { + echo -e "${ENV_COLOR_B_YELLOW}[WARN] $@${ENV_COLOR_RESET}" +} + +printError() { + echo -e "${ENV_COLOR_B_RED}[ERROR] $@${ENV_COLOR_RESET}" +} + +callAndLog () { + $* + if [[ $? -eq ${ENV_SUCCEED} ]]; then + printInfo "$@" + return ${ENV_SUCCEED} + else + printError "$@ EXECUTE FAILED" + return ${ENV_FAILED} + fi +} + +# ------------------------------------------------------------------------------ main +ENV_NEXUS_VERSION=${ENV_NEXUS_VERSION:-3.13.0-01} +ENV_NEXUS_DIR=${ENV_NEXUS_DIR:-/opt/maven} + +printInfo ">>>> install nexus begin." + +mkdir -p ${ENV_NEXUS_DIR} +printInfo "download nexus" +#由于国内网络问题,有可能下载失败 +curl -o ${ENV_NEXUS_DIR}/nexus-unix.tar.gz https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-${ENV_NEXUS_VERSION}-unix.tar.gz +if [[ "$?" != ${ENV_SUCCEED} ]]; then + printError "<<<< download nexus-${ENV_NEXUS_VERSION}-unix.tar.gz failed" + return ${ENV_FAILED} +fi tar -zxf nexus-unix.tar.gz -printf "${GREEN}<<<<<<<< install nexus end.${RESET}\n" +printInfo ">>>> setting systemd." +#通过设置 systemd,是的 nexus 注册为服务,开机自启动 +touch /lib/systemd/system/nexus.service +cat >> /lib/systemd/system/nexus.service << EOF +[Unit] +Description=nexus +After=network.target + +[Service] +Type=forking +LimitNOFILE=65536 #警告处理 +Environment=RUN_AS_USER=root +ExecStart=${ENV_NEXUS_DIR}/nexus-${ENV_NEXUS_VERSION}/bin/nexus start +ExecReload=${ENV_NEXUS_DIR}/nexus-${ENV_NEXUS_VERSION}/bin/nexus restart +ExecStop=${ENV_NEXUS_DIR}/nexus-${ENV_NEXUS_VERSION}/bin/nexus stop +Restart=on-failure +PrivateTmp=true + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable nexus +systemctl start nexus + +printInfo ">>>> setting firewalld." +firewall-cmd --zone=public --add-port=8081/tcp --permanent +firewall-cmd --reload +# 如果防火墻使用的是 iptables,使用如下配置: +#iptables -I INPUT -p tcp -m tcp --dport 8081 -j ACCEPT +#/etc/rc.d/init.d/iptables save +#service iptables restart + +printInfo "<<<<<<<< install nexus success." diff --git a/codes/shell/输入和输出/免密码传输.sh b/codes/shell/输入和输出/免密码传输.sh new file mode 100644 index 0000000..30264bd --- /dev/null +++ b/codes/shell/输入和输出/免密码传输.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# ------------------------------------------------------------------------------ +# 免密码传输 +# @author Zhang Peng +# @since 2020/4/8 +# ------------------------------------------------------------------------------ + +REMOTE_HOST=192.168.0.2 + +# 如果本机没有公私钥对,可以执行以下命令生成 ssh 公私钥对 +#ssh-keygen -t rsa + +# 服务器 A 上执行以下命令 +scp ~/.ssh/id_rsa.pub root@${REMOTE_HOST}:~/.ssh/id_rsa.pub.tmp + +# 服务器 B 上执行以下命令 +cat ~/.ssh/id_rsa.pub.tmp >> ~/.ssh/authorized_keys +rm ~/.ssh/id_rsa.pub.tmp diff --git a/docs/linux/ops/firewalld.md b/docs/linux/ops/firewalld.md index b639986..90fb778 100644 --- a/docs/linux/ops/firewalld.md +++ b/docs/linux/ops/firewalld.md @@ -29,7 +29,7 @@ firewall-cmd --query-panic # 查看是否拒绝 firewall-cmd --zone=public --list-ports # 查看所有打开的端口 firewall-cmd --zone=public --query-port=80/tcp # 查看是否有开放的 80 TCP 端口 -firewall-cmd --zone=public --add-port=80/tcp --permanent # 添加开发端口(--permanent永久生效,没有此参数重启后失效) +firewall-cmd --zone=public --add-port=8080/tcp --permanent # 添加开放端口(--permanent永久生效,没有此参数重启后失效) firewall-cmd --zone=public --remove-port=80/tcp --permanent # 永久删除开放的 80 TCP 端口 ``` diff --git a/docs/linux/soft/gitlab-ops.md b/docs/linux/soft/gitlab-ops.md index 8827ab3..1aff5f7 100644 --- a/docs/linux/soft/gitlab-ops.md +++ b/docs/linux/soft/gitlab-ops.md @@ -1,13 +1,11 @@ # Gitlab 运维 -## gitlab 安装 +## 一、gitlab 安装 ### Gitlab 的普通安装 #### 下载 - - 进入官方下载地址:https://about.gitlab.com/install/ ,如下图,选择合适的版本。 ![img](http://dunwu.test.upcdn.net/snap/20190129155838.png!zp) @@ -74,7 +72,7 @@ docker run -d \ ![img](http://dunwu.test.upcdn.net/snap/20190131150515.png!zp) -## gitlab-ci-multi-runner 安装 +## 二、gitlab-ci-multi-runner 安装 > 参考:https://docs.gitlab.com/runner/install/ @@ -246,7 +244,9 @@ sudo rm -v /etc/gitlab/ssl/gitlab.domain.com.csr sudo chmod 600 /etc/gitlab/ssl/gitlab.domain.com.* ``` -## gitlab 配置 +## 三、gitlab 配置 + +### 基本配置 ``` sudo vim /etc/gitlab/gitlab.rb @@ -278,7 +278,6 @@ sudo gitlab-ctl reconfigure sudo gitlab-ctl restart ``` - ### 创建你的 SSH key 1. 使用 Gitlab 的第一步是生成你自己的 SSH 密钥对(Github 也类似)。 @@ -341,7 +340,7 @@ sudo gitlab-ctl restart ![img](https://docs.gitlab.com/ce/user/project/issues/img/new_issue_from_issue_board.png) -## gitlab 权限配置 +## 四、gitlab 权限配置 ### 用户组的权限 @@ -356,6 +355,74 @@ sudo gitlab-ctl restart | 管理组成员 | | | | | ✓ | | 移除组 | | | | | | +## 五、备份/迁移/升级 + +### 备份 + +#### 手动备份 + +执行 `gitlab-rake gitlab:backup:create` 开始备份全量数据,成功后,会在 `/var/opt/gitlab/backups` 下生产一个名称类似 `1585910556_2020_04_03_11.3.0_gitlab_backup.tar` 的压缩包。 + +### 定时自动备份 + +可以利用 crontab 来定时执行备份命令。 + +执行 `vim /etc/crontab` 或 `crontab -e` 手动编辑定时任务。 + +### 迁移 + +> 迁移前,需要确保新老机器的 Gitlab 版本号一致。 + +将备份的压缩包拷贝到新机器的备份路径下(默认为 `/var/opt/gitlab/backups`)。 + +(1)将备份文件权限修改为777,不然可能恢复的时候会出现权限不够,不能解压的问题 + +```shell +chmod 777 1585910556_2020_04_03_11.3.0_gitlab_backup.tar +``` + +(2)停止相关数据连接服务 + +```shell +gitlab-ctl stop unicorn +gitlab-ctl stop sidekiq +``` + +(3)从备份文件中恢复 Gitlab + +```shell +# gitlab-rake gitlab:backup:restore BACKUP=备份文件编号 +gitlab-rake gitlab:backup:restore BACKUP=1585910556_2020_04_03_11.3.0 +``` + +### 升级 + +升级前,一定要做好备份,记录当前 gitlab 的版本号。 + +第一步还是使用官方命令进行升级。 + +```shell +sudo yum install -y gitlab-ce +``` + +如果下载速度理想,就无需手动升级安装。不理想就需要`停止自动更新`,并手动下载安装包 + +访问官方地址,下载对应`版本`,对应`系统`的安装包。 + +注:可以根据`自动升级时下载的版本`,选择对应文件。 + +```http +https://packages.gitlab.com/gitlab/gitlab-ce +``` + +安装包手动上传至服务器,并`替换`下载未完成的安装包。下面是升级缓存地址: + +``` +/var/cache/yum/x86_64/7/gitlab_gitlab-ce/packages/ +``` + +再次执行官方升级命令即可完成自动安装。 + ## 资料 - 官网:https://about.gitlab.com/ @@ -363,4 +430,4 @@ sudo gitlab-ctl restart - 官网下载:https://about.gitlab.com/downloads/ - 官网安装说明:https://about.gitlab.com/installation/#centos-7 -- [操作系统、运维部署总结系列](https://github.com/dunwu/OS) \ No newline at end of file +- [操作系统、运维部署总结系列](https://github.com/dunwu/OS) diff --git a/docs/linux/soft/nexus-ops.md b/docs/linux/soft/nexus-ops.md index 374234b..5346413 100644 --- a/docs/linux/soft/nexus-ops.md +++ b/docs/linux/soft/nexus-ops.md @@ -10,29 +10,51 @@ > - JDK 1.8 > - Maven 3.5.4 -## 1. 安装 Nexus +## 一、Nexus 安装 进入[官方下载地址](https://www.sonatype.com/download-oss-sonatype),选择合适版本下载。 -![img](http://dunwu.test.upcdn.net/snap/20181127203029.png!zp) +![img](http://dunwu.test.upcdn.net/snap/20181127203029.png) 本人将 Nexus 部署在 Linux 机器,所以选用的是 Unix 版本。 这里,如果想通过命令方式直接下载(比如用脚本安装),可以在[官方历史发布版本页面](https://help.sonatype.com/repomanager3/download/download-archives---repository-manager-3)中找到合适版本,然后执行以下命令: ```shell +# 个人习惯将 nexus 安装在 /opt/maven 目录下 wget -O /opt/maven/nexus-unix.tar.gz http://download.sonatype.com/nexus/3/nexus-3.13.0-01-unix.tar.gz -tar -zxf nexus-unix.tar.gz + ``` -解压后,有两个目录: +- 【解压】执行 `tar -zxf nexus-unix.tar.gz` 命令,会解压出两个目录: + - `nexus-` - 程序目录。包含了 Nexus 运行所需要的文件。是 Nexus 运行必须的。 + - `nexus-/etc` - 配置目录。 + - `nexus-/etc/nexus.properties` - nexus 核心配置文件(默认 etc 目录下有 `nexus-default.properties`,可以基于此修改)。 + - `sonatype-work` - 仓库目录。包含了 Nexus 生成的配置文件、日志文件、仓库文件等。当我们需要备份 Nexus 的时候默认备份此目录即可。 +- [修改环境变量】执行 `vim /etc/profile`,在文件尾部添加以下内容: -- `nexus-3.13.0-01` - 包含了 Nexus 运行所需要的文件。是 Nexus 运行必须的。 -- `sonatype-work` - 包含了 Nexus 生成的配置文件、日志文件、仓库文件等。当我们需要备份 Nexus 的时候默认备份此目录即可。 +``` +NEXUS_HOME=/usr/program/nexus2.11.4 +export NEXUS_HOME +``` -## 2. 启动/停止 Nexus +刷新环境变量:`source /etc/profile` -进入 nexus-3.13.0-01/bin 目录,有一个可执行脚本 nexus。 +- 【检查安装是否成功】执行 `nexus -version` 查看是否安装成功。 +- 【防火墙】 + - iptabes + - 添加规则:`iptables -I INPUT -p tcp -m tcp --dport 8081 -j ACCEPT` + - 载入规则:`/etc/rc.d/init.d/iptables save` + - 重启 iptables:`service iptables restart` + - firewalld + - 添加规则:`firewall-cmd --zone=public --add-port=8081/tcp --permanent` + - 载入规则:`firewall-cmd --reload` + +## 二、Nexus 使用 + +### 启动/停止 Nexus + +进入 `nexus-3.13.0-01/bin` 目录,有一个可执行脚本 nexus。 执行 `./nexus`,可以查看允许执行的参数,如下所示,含义可谓一目了然: @@ -45,15 +67,13 @@ Usage: ./nexus {start|stop|run|run-redirect|status|restart|force-reload} - 停止 nexus - `./nexus stop` - 重启 nexus - `./nexus restart` -启动成功后,在浏览器中访问 `http://:8081`,欢迎页面如下图所示: +Nexus 的默认启动端口为 `8081`,启动成功后,在浏览器中访问 `http://:8081`,欢迎页面如下图所示: -![img](http://dunwu.test.upcdn.net/snap/20181127203131.png!zp) +![img](http://dunwu.test.upcdn.net/snap/20181127203131.png) -点击右上角 Sign in 登录,默认用户名/密码为:admin/admin123。 +点击右上角 Sign in 登录,默认用户名/密码为:`admin/admin123`。 -## 3. 搭建 Maven 私服 - -### 3.1. 配置仓库 +### 配置 maven 仓库 Nexus 中的仓库有以下类型: @@ -62,26 +82,116 @@ Nexus 中的仓库有以下类型: - `virtual` - 虚拟仓库。用于适配 Maven 1; - `group` - 仓库组。Nexus 通过仓库组的概念统一管理多个仓库,这样我们在项目中直接请求仓库组即可请求到仓库组管理的多个仓库。 -![img](http://dunwu.test.upcdn.net/cs/java/javalib/maven/nexus.png!zp) +![img](http://dunwu.test.upcdn.net/cs/java/javalib/maven/nexus.png) -> **最佳实践** +建议配置如下: + +- **hosted 仓库** + - **maven-releases** - 存储私有仓库的发行版 jar 包 + - **maven-snapshots** - 存储私有仓库的快照版(调试版本) jar 包 +- **proxy 仓库** + - **maven-central-maven** - 中央库(如果没有配置 mirror,默认就从这里下载 jar 包),从 https://repo1.maven.org/maven2/ 获取资源 + - **maven-aliyun** - 国内 maven 仓库,提高访问速度。 +- **group 仓库** + - **maven-public** - 私有仓库的公共空间,把上面三个仓库组合在一起对外提供服务,在本地 maven 基础配置 settings.xml 中使用。 + +![img](http://dunwu.test.upcdn.net/snap/20181127203156.png) + +> 其中: > -> 建议配置如下: -> -> - hosted 仓库 -> - maven-releases - 存储私有仓库的发行版 jar 包 -> - maven-snapshots - 存储私有仓库的快照版(调试版本) jar 包 -> - proxy 仓库 -> - maven-central - maven 中央库(如果没有配置 mirror,默认就从这里下载 jar 包),从 https://repo1.maven.org/maven2/ 获取资源 -> - maven-aliyun - 国内 maven 仓库,提高访问速度。 -> - group 仓库 -> - maven-public - 私有仓库的公共空间,把上面三个仓库组合在一起对外提供服务,在本地 maven 基础配置 settings.xml 中使用。 +> **maven-central**、**maven-public**、**maven-release**、**maven-snapshot** 仓库是默认配置好的 maven 仓库。maven-central 配置的是 `https://repo1.maven.org/maven2/` 的代理仓库,即 maven 中央仓库地址。 -![img](http://dunwu.test.upcdn.net/snap/20181127203156.png!zp) +参考配置如下: -### 3.2. 配置 settings.xml +![](http://dunwu.test.upcdn.net/snap/20200403165258.png) -如果要使用 Nexus,还必须在 settings.xml 和 pom.xml 中配置认证信息。 +推荐配置的代理仓库: + +- OSS SNAPSHOT 仓库:`http://oss.jfrog.org/artifactory/oss-snapshot-local/` +- aliyun 仓库(受限于国内网络,可以通过它来加速):`http://maven.aliyun.com/nexus/content/groups/public/` + +### 配置 yum 仓库 + +![](http://dunwu.test.upcdn.net/snap/20200403201609.png) + +推荐配置的 yum 代理仓库: + +- aliyun yum 仓库:`http://mirrors.aliyun.com/centos` + +配置本地 yum: + +(1)新增 nexus.repo 文件,内容如下: + +```ini +[base] +name=Nexus +baseurl= http://:/repository/yum-aliyun/$releasever/os/$basearch/ +enabled=1 +gpgcheck=0 +priority=1 +``` + +(2)更新 yum 缓存,执行以下命令: + +```shell +yum clean all +yum makecache +``` + +### 定时任务 + +随着 jar 包越来越多,尤其是 SNAPSHOT 包由于不限制重复上传,尤其容易导致磁盘空间膨胀。所以,需要定期进行清理或修复。 + +Nexus 内置了多个定时任务,可以执行清理。 + +【示例】定期清理 SNAPSHOST + +![](http://dunwu.test.upcdn.net/snap/20200403173030.png) + +## 三、开机自启动 + +作为常用服务,有必要将 Nexus 设为 `systemd` 服务,以便在断电恢复后自动重启。 + +配置方法如下: + +在 `/lib/systemd/system` 目录下创建 `nexus.service` 文件,内容如下: + +```ini +[Unit] +Description=nexus +After=network.target + +[Service] +Type=forking +LimitNOFILE=65536 #警告处理 +Environment=RUN_AS_USER=root +ExecStart=/opt/maven/nexus-3.13.0-01/bin/nexus start +ExecReload=/opt/maven/nexus-3.13.0-01/bin/nexus restart +ExecStop=/opt/maven/nexus-3.13.0-01/bin/nexus stop +Restart=on-failure +PrivateTmp=true + +[Install] +WantedBy=multi-user.target +``` + +保存后,可以使用以下命令应用 nexus 服务: + +- `systemctl enable nexus` - 启动 nexus 开机启动 +- `systemctl disable nexus` - 关闭 nexus 开机启动 +- `systemctl start nexus` - 启动 nexus 服务 +- `systemctl stop nexus` - 停止 nexus 服务 +- `systemctl restart nexus` - 重启 nexus 服务 + +> 执行 `systemctl enable nexus` 后,再执行 reboot 重启,重连后,可以检测是否成功开机自动重启。 + +## 四、Nexus 和 Maven + +Nexus 是 maven 私服。现在,Nexus 服务器已经部署好了,如何配合 maven 使用呢? + +### 配置 settings.xml + +如果要使用 Nexus,还必须在 `settings.xml` 和 `pom.xml` 中配置认证信息。 一份完整的 `settings.xml`: @@ -94,7 +204,10 @@ Nexus 中的仓库有以下类型: org.sonatype.plugins - + + D:\Tools\maven\.m2 + + releases @@ -108,11 +221,12 @@ Nexus 中的仓库有以下类型: - + public * + http://10.255.255.224:8081/repository/maven-public/ @@ -154,9 +268,9 @@ Nexus 中的仓库有以下类型: ``` -### 3.3. 配置 pom.xml +### 配置 pom.xml -在 pom.xml 中添加如下配置: +在 `pom.xml` 中添加如下配置,这样就可以执行 `mvn deploy`,将本地构建的 jar、war 等包发布到私服上。 ```xml @@ -178,9 +292,9 @@ Nexus 中的仓库有以下类型: > - `` 和 `` 的 id 必须和 `settings.xml` 配置文件中的 `` 标签中的 id 匹配。 > - `` 标签的地址需要和 maven 私服的地址匹配。 -### 3.4. 执行 maven 构建 +### 执行 maven 构建 -如果要使用 settings.xml 中的私服配置,必须通过指定 `-P zp` 来激活 profile。 +如果要使用 `settings.xml` 中的私服配置,必须通过指定 `-P zp` 来激活 profile。 示例: @@ -192,40 +306,9 @@ $ mvn clean package -Dmaven.skip.test=true -P zp $ mvn clean deploy -Dmaven.skip.test=true -P zp ``` -## 4. 开机自启动 +> 至此,已经可以正常向 Nexus 上传、下载 jar 包。 -将 Nexus 设置为 systemd 服务,以便开机自启动。 - -在 `/lib/systemd/system` 目录下创建 `nexus.service` 文件,内容如下: - -```ini -[Unit] -Description=nexus -After=network.target - -[Service] -Type=forking -LimitNOFILE=65536 #警告处理 -Environment=RUN_AS_USER=root -ExecStart=/opt/maven/nexus-3.13.0-01/bin/nexus start -ExecReload=/opt/maven/nexus-3.13.0-01/bin/nexus restart -ExecStop=/opt/maven/nexus-3.13.0-01/bin/nexus stop -Restart=on-failure -PrivateTmp=true - -[Install] -WantedBy=multi-user.target -``` - -保存后,可以使用以下命令应用 nexus 服务: - -- `systemctl enable nexus` - 启动 nexus 开机启动 -- `systemctl disable nexus` - 关闭 nexus 开机启动 -- `systemctl start nexus` - 启动 nexus 服务 -- `systemctl stop nexus` - 停止 nexus 服务 -- `systemctl restart nexus` - 重启 nexus 服务 - -## 5. Nexus 备份和迁移 +## 五、备份和迁移 Nexus 三个重要目录: @@ -235,17 +318,17 @@ Nexus 三个重要目录: | sonatype-work 目录 | sonatype-work | nexus/conf/nexus.xml 里面有 storage 的地址 | | storage 目录 | storage | 里面主要是各种程序的 jar 包等 | -### 5.1. 备份 +### 备份 Nexus 的数据都存储在 sonatype-work 目录,备份 Nexus 数据只需要将其打包即可。 -### 5.2. 迁移 +### 迁移 将原 Nexus 服务器中的 sonatype-work 目录迁移到新 Nexus 服务器的 sonatype-work 目录下。 -## 6. FAQ +## 六、FAQ -### 6.1. 配置 INSTALL4J_JAVA_HOME +### 配置 INSTALL4J_JAVA_HOME 我在工作中遇到 nexus systemctl 服务无法自启动的问题,通过查看状态,发现以下报错: @@ -255,7 +338,7 @@ Please define INSTALL4J_JAVA_HOME to point to a suitable JVM 通过排查,找到原因:即使环境上已安装 JDK,且配置了 JAVA_HOME,但 nexus 仍然无法正确找到 JDK,需要在 `/bin/nexus` 中指定 `INSTALL4J_JAVA_HOME_OVERRIDE=` -## 7. 参考资料 +## 参考资料 - [maven 私库 nexus3 安装及使用](https://blog.csdn.net/clj198606061111/article/details/52200928) - [Nexus 安装 使用说明](https://www.cnblogs.com/jtlgb/p/7473837.html) diff --git a/docs/linux/soft/svn-ops.md b/docs/linux/soft/svn-ops.md index 1746929..31ebbc1 100644 --- a/docs/linux/soft/svn-ops.md +++ b/docs/linux/soft/svn-ops.md @@ -4,30 +4,15 @@ > > 本文目的在于记录 svn 的安装、配置、使用。 - +## 安装 -- [1. 安装配置](#1-安装配置) - - [1.1. 安装 svn](#11-安装-svn) - - [1.2. 创建 svn 仓库](#12-创建-svn-仓库) - - [1.3. 配置 svnserve.conf](#13-配置-svnserveconf) - - [1.4. 配置 passwd](#14-配置-passwd) - - [1.5. 配置 authz](#15-配置-authz) - - [1.6. 启动关闭 svn](#16-启动关闭-svn) - - [1.7. 开机自启动 svn 方法](#17-开机自启动-svn-方法) - - [1.8. svn 客户端访问](#18-svn-客户端访问) -- [2. 参考资料](#2-参考资料) - - - -## 1. 安装配置 - -### 1.1. 安装 svn +### 安装 svn ```bash $ yum install -y subversion ``` -### 1.2. 创建 svn 仓库 +### 创建 svn 仓库 ```bash $ mkdir -p /share/svn @@ -38,11 +23,13 @@ conf db format hooks locks README.txt 在 conf 目录下有三个重要的配置文件 -- authz - 是权限控制文件 -- passwd - 是帐号密码文件 -- svnserve.conf - 是 SVN 服务配置文件 +- `authz` - 是权限控制文件 +- `passwd` - 是帐号密码文件 +- `svnserve.conf` - 是 SVN 服务配置文件 -### 1.3. 配置 svnserve.conf +## 配置 + +### 配置 svnserve.conf ```bash $ vim /share/svn/conf/svnserve.conf @@ -58,13 +45,13 @@ authz-db = authz #使用哪个文件作为权限文件 realm = /share/svn # 认证空间名,版本库所在目录 ``` -### 1.4. 配置 passwd +### 配置 passwd ```bash $ vim /share/svn/conf/passwd ``` -添加内容如下: +添加新用户的用户名/密码如下: ```ini [users] @@ -73,13 +60,13 @@ user2 = 123456 user3 = 123456 ``` -### 1.5. 配置 authz +### 配置 authz ```bash $ vim /share/svn/conf/authz ``` -添加内容如下: +指定用户的访问权限(`r` 为读权限;`w` 为写权限): ```ini [/] @@ -89,14 +76,16 @@ user3 = rw *= ``` -### 1.6. 启动关闭 svn +## 服务器管理 + +### 启动关闭 svn ```bash $ svnserve -d -r /share/svn # 启动 svn $ killall svnserve # 关闭 svn ``` -### 1.7. 开机自启动 svn 方法 +### 开机自启动 svn 方法 安装好 svn 服务后,默认是没有随系统启动自动启动的,而一般我们有要求 svn 服务稳定持续的提供服务。所以,有必要配置开机自启动 svn 服务。 @@ -137,7 +126,14 @@ $ vi /etc/sysconfig/svnserve 重启服务器后,执行 `ps -ef | grep svn` 应该可以看到 svn 服务的进程已经启动。 -### 1.8. svn 客户端访问 +- 启动一个服务 - systemctl start svnserve.service +- 关闭一个服务 - systemctl stop svnserve.service +- 重启一个服务 - systemctl restart svnserve.service +- 显示一个服务的状态 - systemctl status svnserve.service +- 在开机时启用一个服务 - systemctl enable svnserve.service +- 在开机时禁用一个服务 - systemctl disable svnserve.service + +## 客户端使用 进入 [svn 官方下载地址](https://tortoisesvn.net/downloads.html),选择合适的版本,下载并安装。 @@ -145,9 +141,9 @@ $ vi /etc/sysconfig/svnserve 在新的窗口,输入地址 `svn://<你的 IP>` 即可,不出意外输入用户名和密码就能连接成功了(这里的用户、密码必须在 passwd 配置文件的清单中)。默认端口 3690,如果你修改了端口,那么要记得加上端口号。如下图所示: -![img](http://dunwu.test.upcdn.net/snap/20190129175443.png!zp) +![img](http://dunwu.test.upcdn.net/snap/20190129175443.png) -## 2. 参考资料 +## 参考资料 - https://www.cnblogs.com/liuxianan/p/linux_install_svn_server.html - https://blog.csdn.net/testcs_dn/article/details/45395645