From 2dfb94d0109c61f5a689cc894f95b9d885131d53 Mon Sep 17 00:00:00 2001 From: Zhang Peng Date: Thu, 16 May 2019 11:49:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=20github=20=E5=92=8C=20gitee?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 115 ++++++++---------- codes/linux/README.md | 4 +- codes/linux/clear.sh | 11 -- codes/linux/download.sh | 32 +++-- codes/linux/dunwu-soft.sh | 2 +- codes/linux/dunwu-sys.sh | 16 +-- codes/linux/soft/README.md | 46 +++---- codes/linux/soft/elk/install-elk.sh | 4 +- .../elk}/install_elasticserch.sh | 0 .../{tool => soft/elk}/install_filebeat.sh | 0 .../{tool => soft/elk}/install_kibana.sh | 0 .../{tool => soft/elk}/install_logstash.sh | 0 codes/linux/soft/fastdfs-install.sh | 88 ++++++++------ codes/linux/{tool => soft}/install_grafana.sh | 0 codes/linux/soft/maven-install.sh | 2 +- codes/linux/soft/nginx-install.sh | 2 +- codes/linux/soft/nginx/README.md | 4 +- codes/linux/soft/redis-install.sh | 2 +- codes/linux/sys/README.md | 24 ++-- codes/linux/sys/change-yum-repo.sh | 6 +- codes/linux/sys/sys-settings.sh | 12 +- .../tool/{Git状态检测.sh => gitcheck} | 0 .../{系统详细信息检查.sh => syscheck} | 34 +++--- docs/linux/soft/fastdfs.md | 48 ++++++++ scripts/gitpush.sh | 5 + 25 files changed, 265 insertions(+), 192 deletions(-) delete mode 100644 codes/linux/clear.sh rename codes/linux/{tool => soft/elk}/install_elasticserch.sh (100%) rename codes/linux/{tool => soft/elk}/install_filebeat.sh (100%) rename codes/linux/{tool => soft/elk}/install_kibana.sh (100%) rename codes/linux/{tool => soft/elk}/install_logstash.sh (100%) rename codes/linux/{tool => soft}/install_grafana.sh (100%) rename codes/linux/tool/{Git状态检测.sh => gitcheck} (100%) rename codes/linux/tool/{系统详细信息检查.sh => syscheck} (96%) create mode 100644 docs/linux/soft/fastdfs.md create mode 100644 scripts/gitpush.sh diff --git a/README.md b/README.md index 4586396..cbaf322 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # Linux 教程 -## :wrench: [软件安装配置](docs/linux/soft/README.md) +> 项目同步维护在 [github](https://github.com/dunwu/linux-tutorial) 和 [gitee](https://gitee.com/turnon/linux-tutorial) + +| :wrench: | :shell: | :memo: | :books: | +| :----------------------------------: | :---------------------: | :--------------------: | :-------------------------: | +| [软件安装配置](#wrench-软件安装配置) | [运维脚本](#shell-运维脚本) | [知识点](#memo-知识点) | [学习资源](#books-学习资源) | + +## :wrench: 软件安装配置 - [JDK 安装](docs/linux/soft/jdk-install.md) - [Elastic 安装](docs/linux/soft/elastic) @@ -17,7 +23,7 @@ - [Zookeeper 安装](docs/linux/soft/zookeeper-install.md) - [Nacos 安装](docs/linux/soft/nacos-install.md) -## :shell: 脚本 +## :shell: 运维脚本 - [软件安装配置脚本集合](https://github.com/dunwu/linux-tutorial/tree/master/codes/linux/soft) @@ -54,62 +60,49 @@ ## :books: 学习资源 -### 命令行检索 - -- [Linux 命令大全](http://man.linuxde.net/) -- [linux-command](https://jaywcjlove.gitee.io/linux-command/) - -### 社区网站 - -- [Linux 中国](https://linux.cn/) - 各种资讯、文章、技术 -- [实验楼](https://www.shiyanlou.com/) - 免费提供了 Linux 在线环境,不用在自己机子上装系统也可以学习 Linux,超方便实用。 -- [鸟哥的 linux 私房菜](http://linux.vbird.org/) - 非常适合 Linux 入门初学者看的教程。 -- [Linux 公社](http://www.linuxidc.com/) - Linux 相关的新闻、教程、主题、壁纸都有。 -- [Linux Today](http://www.linuxde.net) - Linux 新闻资讯发布,Linux 职业技术学习!。 - -### 知识相关 - -- [Linux 思维导图整理](http://www.jianshu.com/p/59f759207862) -- [Linux 初学者进阶学习资源整理](http://www.jianshu.com/p/fe2a790b41eb) -- [Linux 基础入门(新版)](https://www.shiyanlou.com/courses/1) -- [【译】Linux 概念架构的理解](http://www.jianshu.com/p/c5ae8f061cfe) [En](http://oss.org.cn/ossdocs/linux/kernel/a1/index.html) -- [Linux 守护进程的启动方法](http://www.ruanyifeng.com/blog/2016/02/linux-daemon.html) -- [Linux 编程之内存映射](https://www.shiyanlou.com/questions/2992) -- [Linux 知识点小结](https://blog.huachao.me/2016/1/Linux%E7%9F%A5%E8%AF%86%E7%82%B9%E5%B0%8F%E7%BB%93/) -- [10 大白帽黑客专用的 Linux 操作系统](https://linux.cn/article-6971-1.html) - -### 软件工具 - -- [超赞的 Linux 软件](https://www.gitbook.com/book/alim0x/awesome-linux-software-zh_cn/details) Github 仓库[Zh](https://github.com/alim0x/Awesome-Linux-Software-zh_CN) [En](https://github.com/VoLuong/Awesome-Linux-Software) -- [程序员喜欢的 9 款最佳的 Linux 文件比较工具](http://os.51cto.com/art/201607/513796.htm) -- [提高 Linux 开发效率的 5 个工具](http://www.codeceo.com/article/5-linux-productivity-tools.html) -- [你要了解的 11 款面向 Linux 系统的一流备份实用工具](http://os.51cto.com/art/201603/508027.htm) -- [16 个很有用的在线工具](http://www.simlinux.com/archives/264.html) -- Adobe 软件的最佳替代品 [原文在这里](https://linux.cn/article-8928-1.html) - - [Evince (Adobe Acrobat Reader)](https://wiki.gnome.org/Apps/Evince) 一个“支持多种文档格式的文档查看器”,可以查看 PDF,还支持各种漫画书格式 - - [Pixlr (Adobe Photoshop)](https://pixlr.com/) 一个强大的图像编辑工具 - - [Inkscape (Adobe Illustrator)](https://inkscape.org/zh/) 一个专业的矢量图形编辑器 - - [Pinegrow Web Editor (Adobe Dreamweaver)](https://pinegrow.com/) 一个可视化编辑制作 HTML 网站 - - [Scribus (Adobe InDesign)](https://www.scribus.net/) 一个开源电子杂志制作软件 - - [Webflow (Adobe Muse)](https://webflow.com/) 一款可以帮助用户不用编码就可以快速创建网站的谷歌浏览器插件。 - - [Tupi (Adobe Animate)](http://www.maefloresta.com/portal/) 一款可以创建 HTML5 动画的工具。 - - [Black Magic Fusion (Adobe After Effects)](https://www.blackmagicdesign.com) 一款先进的合成软件,广泛应用于视觉特效、广电影视设计以及 3D 动画设计等领域。 - -### 中国开源镜像站点 - -- 阿里云开源镜像站:http://mirrors.aliyun.com/ -- 网易开源镜像站:http://mirrors.163.com/ -- 搜狐开源镜像站:http://mirrors.sohu.com/ -- 北京交通大学:http://mirror.bjtu.edu.cn/ \<教育网荐\> -- 兰州大学:http://mirror.lzu.edu.cn/ \<西北高校 FTP 搜索引擎\> -- 厦门大学:http://mirrors.xmu.edu.cn/ -- 上海交通大学:http://ftp.sjtu.edu.cn/ -- 清华大学:http://mirrors.tuna.tsinghua.edu.cn/ - - http://mirrors6.tuna.tsinghua.edu.cn/ - - http://mirrors4.tuna.tsinghua.edu.cn/ -- 中国科学技术大学:http://mirrors.ustc.edu.cn/ - - http://ipv4.ustc.edu.cn/ \<教育网、电信\> - - http://ipv6.ustc.edu.cn/ \ -- 东北大学:http://mirror.neu.edu.cn/ -- 浙江大学:http://mirrors.zju.edu.cn/ -- 东软信息学院:http://mirrors.neusoft.edu.cn/ +- 命令行检索 + - [Linux 命令大全](http://man.linuxde.net/) + - [linux-command](https://jaywcjlove.gitee.io/linux-command/) +- 社区网站 + - [Linux 中国](https://linux.cn/) - 各种资讯、文章、技术 + - [实验楼](https://www.shiyanlou.com/) - 免费提供了 Linux 在线环境,不用在自己机子上装系统也可以学习 Linux,超方便实用。 + - [鸟哥的 linux 私房菜](http://linux.vbird.org/) - 非常适合 Linux 入门初学者看的教程。 + - [Linux 公社](http://www.linuxidc.com/) - Linux 相关的新闻、教程、主题、壁纸都有。 + - [Linux Today](http://www.linuxde.net) - Linux 新闻资讯发布,Linux 职业技术学习!。 +- 知识相关 + - [Linux 思维导图整理](http://www.jianshu.com/p/59f759207862) + - [Linux 初学者进阶学习资源整理](http://www.jianshu.com/p/fe2a790b41eb) + - [Linux 基础入门(新版)](https://www.shiyanlou.com/courses/1) + - [【译】Linux 概念架构的理解](http://www.jianshu.com/p/c5ae8f061cfe) [En](http://oss.org.cn/ossdocs/linux/kernel/a1/index.html) + - [Linux 守护进程的启动方法](http://www.ruanyifeng.com/blog/2016/02/linux-daemon.html) + - [Linux 编程之内存映射](https://www.shiyanlou.com/questions/2992) + - [Linux 知识点小结](https://blog.huachao.me/2016/1/Linux%E7%9F%A5%E8%AF%86%E7%82%B9%E5%B0%8F%E7%BB%93/) + - [10 大白帽黑客专用的 Linux 操作系统](https://linux.cn/article-6971-1.html) +- 软件工具 + - [超赞的 Linux 软件](https://www.gitbook.com/book/alim0x/awesome-linux-software-zh_cn/details) Github 仓库[Zh](https://github.com/alim0x/Awesome-Linux-Software-zh_CN) [En](https://github.com/VoLuong/Awesome-Linux-Software) + - [程序员喜欢的 9 款最佳的 Linux 文件比较工具](http://os.51cto.com/art/201607/513796.htm) + - [提高 Linux 开发效率的 5 个工具](http://www.codeceo.com/article/5-linux-productivity-tools.html) + - [你要了解的 11 款面向 Linux 系统的一流备份实用工具](http://os.51cto.com/art/201603/508027.htm) + - [16 个很有用的在线工具](http://www.simlinux.com/archives/264.html) + - Adobe 软件的最佳替代品 [原文在这里](https://linux.cn/article-8928-1.html) + - [Evince (Adobe Acrobat Reader)](https://wiki.gnome.org/Apps/Evince) 一个“支持多种文档格式的文档查看器”,可以查看 PDF,还支持各种漫画书格式 + - [Pixlr (Adobe Photoshop)](https://pixlr.com/) 一个强大的图像编辑工具 + - [Inkscape (Adobe Illustrator)](https://inkscape.org/zh/) 一个专业的矢量图形编辑器 + - [Pinegrow Web Editor (Adobe Dreamweaver)](https://pinegrow.com/) 一个可视化编辑制作 HTML 网站 + - [Scribus (Adobe InDesign)](https://www.scribus.net/) 一个开源电子杂志制作软件 + - [Webflow (Adobe Muse)](https://webflow.com/) 一款可以帮助用户不用编码就可以快速创建网站的谷歌浏览器插件。 + - [Tupi (Adobe Animate)](http://www.maefloresta.com/portal/) 一款可以创建 HTML5 动画的工具。 + - [Black Magic Fusion (Adobe After Effects)](https://www.blackmagicdesign.com) 一款先进的合成软件,广泛应用于视觉特效、广电影视设计以及 3D 动画设计等领域。 +- 中国开源镜像站点 + - [阿里云开源镜像站](http://mirrors.aliyun.com/) + - [网易开源镜像站](http://mirrors.163.com/) + - [搜狐开源镜像站](http://mirrors.sohu.com/) + - [北京交通大学](http://mirror.bjtu.edu.cn/) + - [兰州大学](http://mirror.lzu.edu.cn/) + - [厦门大学](http://mirrors.xmu.edu.cn/) + - [上海交通大学](http://ftp.sjtu.edu.cn/) + - [清华大学](http://mirrors.tuna.tsinghua.edu.cn/) + - [中国科学技术大学](http://mirrors.ustc.edu.cn/) + - [东北大学](http://mirror.neu.edu.cn/) + - [浙江大学](http://mirrors.zju.edu.cn/) + - [东软信息学院](http://mirrors.neusoft.edu.cn/) diff --git a/codes/linux/README.md b/codes/linux/README.md index f5b5e87..6e95ca7 100644 --- a/codes/linux/README.md +++ b/codes/linux/README.md @@ -7,7 +7,7 @@ (1)下载脚本 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/download.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/download.sh | bash ``` (2)执行脚本 @@ -20,7 +20,7 @@ cd /tmp/dunwu-ops (3)清除脚本 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/clear.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/clear.sh | bash ``` 本项目总结、收集 Linux 环境下运维常用到的脚本工具,大致分为三类: diff --git a/codes/linux/clear.sh b/codes/linux/clear.sh deleted file mode 100644 index c7dd9b7..0000000 --- a/codes/linux/clear.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -path=/tmp/dunwu-ops/ -printf "\n>>>>>>>>> remove ${path}" - -if [[ -d ${path} ]]; then - rm -f ${path} - printf "清除脚本成功" -else - printf "${path} 不存在,无法执行清除脚本操作" -fi diff --git a/codes/linux/download.sh b/codes/linux/download.sh index 506bc25..230af17 100644 --- a/codes/linux/download.sh +++ b/codes/linux/download.sh @@ -1,13 +1,27 @@ #!/usr/bin/env bash -path=/tmp/dunwu-ops -mkdir -p ${path} +############################################################################## +# 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)" +############################################################################## -printf "\n>>>>>>>>> download scripts to ${path}" -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/dunwu-ops.sh -O ${path}/dunwu-ops.sh -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/dunwu-soft.sh -O ${path}/dunwu-soft.sh -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/dunwu-sys.sh -O ${path}/dunwu-sys.sh +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; } -chmod +x ${path}/dunwu-ops.sh -chmod +x ${path}/dunwu-soft.sh -chmod +x ${path}/dunwu-sys.sh +if [[ -d ${path} ]]; then + cd ${path} + git pull +else + mkdir -p ${path} + git clone --no-checkout https://gitee.com/turnon/linux-tutorial.git ${path} +fi +printf "\n${C_GREEN}<<<<<<<< Download linux-tutorial to ${path} ok.${C_RESET}\n" diff --git a/codes/linux/dunwu-soft.sh b/codes/linux/dunwu-soft.sh index d56844f..a467a99 100644 --- a/codes/linux/dunwu-soft.sh +++ b/codes/linux/dunwu-soft.sh @@ -33,7 +33,7 @@ if [[ -n $index ]]; then exit -1 fi key=${menus[$no]} - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/${key}-install.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/${key}-install.sh | bash else echo "输入项不支持!" exit -1 diff --git a/codes/linux/dunwu-sys.sh b/codes/linux/dunwu-sys.sh index e236621..f1d8747 100644 --- a/codes/linux/dunwu-sys.sh +++ b/codes/linux/dunwu-sys.sh @@ -16,22 +16,22 @@ select item in ${menus[@]} do case ${item} in "替换yum镜像") - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/change-yum-repo.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/change-yum-repo.sh | bash main ;; "安装基本的命令工具") - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/install-tools.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/install-tools.sh | bash main ;; "安装常用libs") - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/install-libs.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/install-libs.sh | bash main ;; "系统配置") - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/sys-settings.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/sys-settings.sh | bash main ;; "全部执行") - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/change-yum-repo.sh | bash - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/install-tools | bash - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/install-libs.sh | bash - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/sys-settings.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/change-yum-repo.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/install-tools | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/install-libs.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/sys-settings.sh | bash printf "执行完毕,退出。\n" ;; "退出") exit 0 ;; diff --git a/codes/linux/soft/README.md b/codes/linux/soft/README.md index 4d7f77a..f7930a2 100644 --- a/codes/linux/soft/README.md +++ b/codes/linux/soft/README.md @@ -11,8 +11,8 @@ 执行以下任意命令即可执行安装脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/zsh-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/zsh-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/zsh-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/zsh-install.sh | bash ``` ## JDK8 安装 @@ -26,8 +26,8 @@ JDK8 会被安装到 `/usr/lib/jvm/java` 路径。 执行以下任意命令即可执行安装脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/jdk8-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/jdk8-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/jdk8-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/jdk8-install.sh | bash ``` ## Maven 安装配置 @@ -42,8 +42,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 执行以下任意命令即可执行安装脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/maven-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/maven-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/maven-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/maven-install.sh | bash ``` ## Node.js 安装 @@ -57,8 +57,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 执行以下任意命令即可执行安装脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/nodejs-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/nodejs-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nodejs-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nodejs-install.sh | bash ``` ## MongoDB 安装 @@ -72,8 +72,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 执行以下任意命令即可执行安装脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/mongodb-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/mongodb-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/mongodb-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/mongodb-install.sh | bash ``` ## Redis 安装配置 @@ -89,15 +89,15 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 执行以下任意命令即可按照默认配置安装脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/redis-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/redis-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/redis-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/redis-install.sh | bash ``` 定制化配置 ```sh # 下载脚本到本地 -wget https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/redis-install.sh +wget https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/redis-install.sh chmod +x redis-install.sh ./redis-install.sh 5.0.4 /opt/redis 6379 123456 ``` @@ -118,8 +118,8 @@ chmod +x redis-install.sh 使用方法: ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/tomcat8-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/tomcat8-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/tomcat8-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/tomcat8-install.sh | bash ``` ## Kafka 安装 @@ -131,8 +131,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 使用方法:执行以下任意命令即可执行脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/kafka-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/kafka-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/kafka-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/kafka-install.sh | bash ``` ## RocketMQ 安装 @@ -144,8 +144,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 使用方法:执行以下任意命令即可执行脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/rocketmq-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/rocketmq-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/rocketmq-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/rocketmq-install.sh | bash ``` ## Nacos 安装 @@ -157,8 +157,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 使用方法:执行以下任意命令即可执行脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/nacos-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/nacos-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nacos-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nacos-install.sh | bash ``` ## ZooKeeper 安装 @@ -170,7 +170,7 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 使用方法:执行以下任意命令即可执行脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/zookeeper-install.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/zookeeper-install.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/zookeeper-install.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/zookeeper-install.sh | bash ``` diff --git a/codes/linux/soft/elk/install-elk.sh b/codes/linux/soft/elk/install-elk.sh index f9687e8..8751960 100644 --- a/codes/linux/soft/elk/install-elk.sh +++ b/codes/linux/soft/elk/install-elk.sh @@ -76,7 +76,7 @@ replaceLogstashConfig() { sed -i "s/# http.host: \"127.0.0.1\"/ http.host: ${IP}/g" ${ELASTIC_SOFTWARE_PATH}/logstash-${version}/config/logstash.yml touch ${ELASTIC_SOFTWARE_PATH}/logstash-${version}/bin/nohup.out cd ${ELASTIC_SOFTWARE_PATH}/logstash-${version}/bin - wget "https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/elk/config/logstash.conf" + wget "https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/elk/config/logstash.conf" } # 替换 Kibana 配置 @@ -125,6 +125,6 @@ replaceFilebeatConfig # 最后,将启动脚本下载到本地 mkdir -p /home/zp/script -wget -P /home/zp/script "https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/elk/boot-elk.sh" +wget -P /home/zp/script "https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/elk/boot-elk.sh" #setPrivilegeForUser diff --git a/codes/linux/tool/install_elasticserch.sh b/codes/linux/soft/elk/install_elasticserch.sh similarity index 100% rename from codes/linux/tool/install_elasticserch.sh rename to codes/linux/soft/elk/install_elasticserch.sh diff --git a/codes/linux/tool/install_filebeat.sh b/codes/linux/soft/elk/install_filebeat.sh similarity index 100% rename from codes/linux/tool/install_filebeat.sh rename to codes/linux/soft/elk/install_filebeat.sh diff --git a/codes/linux/tool/install_kibana.sh b/codes/linux/soft/elk/install_kibana.sh similarity index 100% rename from codes/linux/tool/install_kibana.sh rename to codes/linux/soft/elk/install_kibana.sh diff --git a/codes/linux/tool/install_logstash.sh b/codes/linux/soft/elk/install_logstash.sh similarity index 100% rename from codes/linux/tool/install_logstash.sh rename to codes/linux/soft/elk/install_logstash.sh diff --git a/codes/linux/soft/fastdfs-install.sh b/codes/linux/soft/fastdfs-install.sh index 642d2b1..cbb351a 100644 --- a/codes/linux/soft/fastdfs-install.sh +++ b/codes/linux/soft/fastdfs-install.sh @@ -2,31 +2,31 @@ ############################################################################## # console color -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)" +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)" ############################################################################## -printf "${PURPLE}" +printf "${C_PURPLE}" cat << EOF ################################################################################### -# 安装 FastDFS 脚本 -# FastDFS 会被安装到 /opt/fdfs 路径。 +# install FastDFS 脚本 +# FastDFS 会被install到 /opt/fdfs 路径。 # @system: 适用于 CentOS # @author: Zhang Peng ################################################################################### EOF -printf "${RESET}" +printf "${C_RESET}" -command -v yum >/dev/null 2>&1 || { echo >&2 -e "${RED}Require yum but it's not installed. Aborting.${RESET}"; exit 1; } -command -v git >/dev/null 2>&1 || { echo >&2 -e "${RED}Require git but it's not installed. Aborting.${RESET}"; exit 1; } +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_RED}Require git but it's not installed. Aborting.${C_RESET}"; exit 1; } yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y @@ -46,24 +46,38 @@ if [[ -n $3 ]]; then fi mkdir -p ${root} - -echo -e "\n${GREEN}>>>>>>>>> 安装 libfastcommon${RESET}" +root=/opt/fdfs +echo -e "\n${C_GREEN}>>>>>>>>> install libfastcommon${C_RESET}" mkdir -p ${root}/libfastcommon -git clone https://github.com/happyfish100/libfastcommon.git "${root}/libfastcommon" +curl -o ${root}/libfastcommon.zip http://dunwu.test.upcdn.net/soft/fdfs/libfastcommon.zip +if [[ ! -f ${root}/libfastcommon.zip ]]; then + echo -e "\n${C_RED}>>>>>>>>> install libfastcommon failed,exit. ${C_RESET}" +fi +unzip -o ${root}/libfastcommon.zip -d ${root} cd ${root}/libfastcommon +chmod +x -R ${root}/libfastcommon/*.sh ./make.sh && ./make.sh install -echo -e "\n${GREEN}>>>>>>>>> 安装 fastdfs${RESET}" +echo -e "\n${C_GREEN}>>>>>>>>> install fastdfs${C_RESET}" mkdir -p ${root}/fastdfs -git clone https://github.com/happyfish100/fastdfs.git "${root}/fastdfs" +curl -o ${root}/fastdfs.zip http://dunwu.test.upcdn.net/soft/fdfs/fastdfs.zip +if [[ ! -f ${root}/fastdfs.zip ]]; then + echo -e "\n${C_RED}>>>>>>>>> install fastdfs failed,exit. ${C_RESET}" +fi +unzip -o ${root}/fastdfs.zip -d ${root} cd ${root}/fastdfs +chmod +x -R ${root}/fastdfs/*.sh ./make.sh && ./make.sh install -echo -e "\n${GREEN}>>>>>>>>> 安装 fastdfs-nginx-module${RESET}" +echo -e "\n${C_GREEN}>>>>>>>>> install fastdfs-nginx-module${C_RESET}" mkdir -p ${root}/fastdfs-nginx-module -git clone https://github.com/happyfish100/fastdfs-nginx-module.git "${root}/fastdfs-nginx-module" +curl -o ${root}/fastdfs-nginx-module.zip http://dunwu.test.upcdn.net/soft/fdfs/fastdfs-nginx-module.zip +if [[ ! -f ${root}/fastdfs-nginx-module.zip ]]; then + echo -e "\n${C_RED}>>>>>>>>> install fastdfs-nginx-module failed,exit. ${C_RESET}" +fi +unzip -o ${root}/fastdfs-nginx-module.zip -d ${root} -echo -e "\n${GREEN}>>>>>>>>> 安装 nginx${RESET}" +echo -e "\n${C_GREEN}>>>>>>>>> install nginx${C_RESET}" mkdir -p ${nginx_path} wget -O ${nginx_path}/nginx-${version}.tar.gz http://nginx.org/download/nginx-${version}.tar.gz tar zxf ${nginx_path}/nginx-${version}.tar.gz -C ${nginx_path} @@ -71,50 +85,54 @@ cd ${nginx_path}/nginx-${version} ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre --add-module=${root}/fastdfs-nginx-module/src/ make && make install -echo -e "\n${GREEN}>>>>>>>>> fastdfs 配置文件准备${RESET}" +echo -e "\n${C_GREEN}>>>>>>>>> fastdfs 配置文件准备${C_RESET}" # 配置修改参考:https://github.com/happyfish100/fastdfs/wiki cp ${root}/fastdfs/conf/http.conf /etc/fdfs/ #供nginx访问使用 cp ${root}/fastdfs/conf/mime.types /etc/fdfs/ #供nginx访问使用 cp ${root}/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/config/fastdfs/tracker.conf -O /etc/fdfs/tracker.conf -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/config/fastdfs/storage.conf -O /etc/fdfs/storage.conf -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/config/fastdfs/client.conf -O /etc/fdfs/client.conf +wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/fastdfs/tracker.conf -O /etc/fdfs/tracker.conf +wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/fastdfs/storage.conf -O /etc/fdfs/storage.conf +wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/fastdfs/client.conf -O /etc/fdfs/client.conf # fdfs 存储路径和服务端口(以默认形式配置) fdfs_store_path=/home/fdfs fdfs_server_port=7001 ip=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}') -echo -e "\n${GREEN} - 修改 tracker.conf 配置${RESET}" + +mkdir -p ${fdfs_store_path} +echo -e "\n${C_GREEN} - 修改 tracker.conf 配置${C_RESET}" sed -i "s#^base_path=.*#base_path=${fdfs_store_path}#g" /etc/fdfs/tracker.conf -echo -e "\n${GREEN} - 修改 storage.conf 配置${RESET}" +echo -e "\n${C_GREEN} - 修改 storage.conf 配置${C_RESET}" sed -i "s#^base_path=.*#base_path=${fdfs_store_path}#g" /etc/fdfs/storage.conf sed -i "s#^store_path0=.*#store_path0=${fdfs_store_path}#g" /etc/fdfs/storage.conf sed -i "s#^tracker_server=.*#tracker_server=${ip}:22122#g" /etc/fdfs/storage.conf sed -i "s#^http.server_port=.*#http.server_port=${fdfs_server_port}#g" /etc/fdfs/storage.conf -echo -e "\n${GREEN} - 修改 client.conf 配置${RESET}" +echo -e "\n${C_GREEN} - 修改 client.conf 配置${C_RESET}" sed -i "s#^base_path=.*#base_path=${fdfs_store_path}#g" /etc/fdfs/client.conf sed -i "s#^tracker_server=.*#tracker_server=${ip}:22122#g" /etc/fdfs/client.conf -echo -e "\n${GREEN} - 修改 mod_fastdfs.conf 配置${RESET}" +echo -e "\n${C_GREEN} - 修改 mod_fastdfs.conf 配置${C_RESET}" sed -i "s#^url_have_group_name=.*#url_have_group_name=true#g" /etc/fdfs/mod_fastdfs.conf sed -i "s#^tracker_server=.*#tracker_server=${ip}:22122#g" /etc/fdfs/mod_fastdfs.conf sed -i "s#^store_path0=.*#store_path0=${fdfs_store_path}#g" /etc/fdfs/mod_fastdfs.conf -echo -e "\n${GREEN} - 修改 nginx.conf 配置${RESET}\n" +echo -e "\n${C_GREEN} - 修改 nginx.conf 配置${C_RESET}\n" mkdir -p /usr/local/nginx/conf/conf -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/config/nginx/nginx.conf -O /usr/local/nginx/conf/nginx.conf -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/config/nginx/conf/fdfs.conf -O /usr/local/nginx/conf/conf/fdfs.conf +wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/nginx/nginx.conf -O /usr/local/nginx/conf/nginx.conf +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 -echo -e "\n${GREEN}>>>>>>>>> 启动 fastdfs ${RESET}" +echo -e "\n${C_GREEN}>>>>>>>>> 启动 fastdfs ${C_RESET}" +chmod +x /etc/init.d/fdfs_trackerd /etc/init.d/fdfs_trackerd start #启动tracker服务 #/etc/init.d/fdfs_trackerd restart #重启动tracker服务 #/etc/init.d/fdfs_trackerd stop #停止tracker服务 chkconfig fdfs_trackerd on #自启动tracker服务 +chmod +x /etc/init.d/fdfs_storaged /etc/init.d/fdfs_storaged start #启动storage服务 #/etc/init.d/fdfs_storaged restart #重动storage服务 #/etc/init.d/fdfs_storaged stop #停止动storage服务 chkconfig fdfs_storaged on #自启动storage服务 -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/config/nginx/nginx.service -O /usr/lib/systemd/system/nginx.service +wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/nginx/nginx.service -O /usr/lib/systemd/system/nginx.service chmod +x /usr/lib/systemd/system/nginx.service #设置nginx.service为系统服务 systemctl enable nginx.service diff --git a/codes/linux/tool/install_grafana.sh b/codes/linux/soft/install_grafana.sh similarity index 100% rename from codes/linux/tool/install_grafana.sh rename to codes/linux/soft/install_grafana.sh diff --git a/codes/linux/soft/maven-install.sh b/codes/linux/soft/maven-install.sh index f4df910..6d58b7e 100644 --- a/codes/linux/soft/maven-install.sh +++ b/codes/linux/soft/maven-install.sh @@ -47,6 +47,6 @@ source /etc/profile # 备份并替换 settings.xml,使用 aliyun 镜像加速 maven echo -e "\n>>>>>>>>> replace ${path}/conf/settings.xml" cp ${path}/conf/settings.xml ${path}/conf/settings.xml.bak -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/config/settings-aliyun.xml -O ${path}/conf/settings.xml +wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/settings-aliyun.xml -O ${path}/conf/settings.xml mvn -v diff --git a/codes/linux/soft/nginx-install.sh b/codes/linux/soft/nginx-install.sh index 2ba8f7b..2887aef 100644 --- a/codes/linux/soft/nginx-install.sh +++ b/codes/linux/soft/nginx-install.sh @@ -43,7 +43,7 @@ cd ${root}/nginx-${version} make && make install # 设置 service -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/config/nginx/nginx.service -O /usr/lib/systemd/system/nginx.service +wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/nginx/nginx.service -O /usr/lib/systemd/system/nginx.service chmod +x /usr/lib/systemd/system/nginx.service #设置nginx.service为系统服务 systemctl enable nginx.service diff --git a/codes/linux/soft/nginx/README.md b/codes/linux/soft/nginx/README.md index c706b32..ff96dd7 100644 --- a/codes/linux/soft/nginx/README.md +++ b/codes/linux/soft/nginx/README.md @@ -5,7 +5,7 @@ 使用方法: ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/nginx/install-nginx.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nginx/install-nginx.sh | bash ``` 脚本会下载解压 nginx 到 `/opt/nginx` 路径下。 @@ -15,6 +15,6 @@ curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/lin 使用方法: ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/nginx/install-nginx-by-yum.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/nginx/install-nginx-by-yum.sh | bash ``` diff --git a/codes/linux/soft/redis-install.sh b/codes/linux/soft/redis-install.sh index 465d62e..f153ec6 100644 --- a/codes/linux/soft/redis-install.sh +++ b/codes/linux/soft/redis-install.sh @@ -54,7 +54,7 @@ cd - echo -e "\n>>>>>>>>> config redis" cp ${path}/redis.conf ${path}/redis.conf.default -wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/soft/config/redis-remote-access.conf -O ${path}/redis.conf +wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/config/redis-remote-access.conf -O ${path}/redis.conf 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 diff --git a/codes/linux/sys/README.md b/codes/linux/sys/README.md index 7b94b75..2966928 100644 --- a/codes/linux/sys/README.md +++ b/codes/linux/sys/README.md @@ -20,8 +20,8 @@ 使用方法:执行以下任意命令即可执行脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/yum/change-yum-repo.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/yum/change-yum-repo.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/yum/change-yum-repo.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/yum/change-yum-repo.sh | bash ``` ## 安装基本工具(可选) @@ -45,8 +45,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 使用方法:执行以下任意命令即可执行脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/install-tools.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/install-tools.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/install-tools.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/install-tools.sh | bash ``` ## 安装常见 lib @@ -63,8 +63,8 @@ lib 清单(可以根据需要,在 install-libs.sh 中把不需要的工具 使用方法:执行以下任意命令即可执行脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/install-libs.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/install-libs.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/install-libs.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/install-libs.sh | bash ``` ## 关闭防火墙 @@ -72,8 +72,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 使用方法:执行以下任意命令即可执行脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/stop-firewall.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/stop-firewall.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/stop-firewall.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/stop-firewall.sh | bash ``` ## 设置 DNS @@ -81,8 +81,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 使用方法:执行以下任意命令即可执行脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/set-dns.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/set-dns.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/set-dns.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/set-dns.sh | bash ``` ## 设置 ntp @@ -90,6 +90,6 @@ wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/li 使用方法:执行以下任意命令即可执行脚本。 ```sh -curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/set-ntp.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/set-ntp.sh | bash +curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/set-ntp.sh | bash +wget -qO- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/set-ntp.sh | bash ``` diff --git a/codes/linux/sys/change-yum-repo.sh b/codes/linux/sys/change-yum-repo.sh index 8fcc3c6..345c0c3 100644 --- a/codes/linux/sys/change-yum-repo.sh +++ b/codes/linux/sys/change-yum-repo.sh @@ -23,7 +23,7 @@ cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak # 根据发型版本选择相应 yum 镜像 if [[ ${version} == 5 ]]; then # Cento5 已废弃,只能使用 http://vault.CentOS.org/ 替换,但由于是国外镜像,速度较慢 - wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/yum/Centos-5.repo -O /etc/yum.repos.d/CentOS-Base.repo + wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/yum/Centos-5.repo -O /etc/yum.repos.d/CentOS-Base.repo # 根据实际发型版本情况替换 detailVersion=`lsb_release -r | awk '{print substr($2,1,3)}'` @@ -32,9 +32,9 @@ if [[ ${version} == 5 ]]; then # 不替换下面的开关,可能会出现错误:Could not open/read repomd.xml sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/CentOS-Media.repo elif [[ ${version} == 6 ]]; then - wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/yum/Centos-6.repo -O /etc/yum.repos.d/CentOS-Base.repo + wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/yum/Centos-6.repo -O /etc/yum.repos.d/CentOS-Base.repo elif [[ ${version} == 7 ]]; then - wget -N https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/yum/Centos-7.repo -O /etc/yum.repos.d/CentOS-Base.repo + wget -N https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/yum/Centos-7.repo -O /etc/yum.repos.d/CentOS-Base.repo else echo -e "版本不支持,替换 yum repo 失败" fi diff --git a/codes/linux/sys/sys-settings.sh b/codes/linux/sys/sys-settings.sh index 605130d..e08c7d0 100644 --- a/codes/linux/sys/sys-settings.sh +++ b/codes/linux/sys/sys-settings.sh @@ -96,13 +96,13 @@ do case ${ITEM} in "设置 DNS") - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/set-dns.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/set-dns.sh | bash ;; "设置 NTP") - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/set-ntp.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/set-ntp.sh | bash ;; "关闭防火墙") - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/stop-firewall.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/stop-firewall.sh | bash ;; "配置 IPv4") configIpv4 @@ -111,9 +111,9 @@ case ${ITEM} in closeIpv6 ;; "全部执行") - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/set-dns.sh | bash - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/set-ntp.sh | bash - curl -o- https://raw.githubusercontent.com/dunwu/linux-tutorial/master/codes/linux/sys/stop-firewall.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/set-dns.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/set-ntp.sh | bash + curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/sys/stop-firewall.sh | bash configIpv4 closeIpv6 ;; diff --git a/codes/linux/tool/Git状态检测.sh b/codes/linux/tool/gitcheck similarity index 100% rename from codes/linux/tool/Git状态检测.sh rename to codes/linux/tool/gitcheck diff --git a/codes/linux/tool/系统详细信息检查.sh b/codes/linux/tool/syscheck similarity index 96% rename from codes/linux/tool/系统详细信息检查.sh rename to codes/linux/tool/syscheck index f711a16..fad6131 100644 --- a/codes/linux/tool/系统详细信息检查.sh +++ b/codes/linux/tool/syscheck @@ -1,18 +1,7 @@ #!/usr/bin/env bash -cat << EOF -################################################################################### -# 系统信息检查脚本 -# @author: Zhang Peng -################################################################################### -EOF - -[[ $(id -u) -gt 0 ]] && echo "请用root用户执行此脚本!" && exit 1 -sysversion=$(rpm -q centos-release|cut -d- -f3) -double_line="===============================================================" -line="----------------------------------------------" - -# 定义字体色彩 +############################################################################## +# console color C_RESET="$(tput sgr0)" C_BLACK="\033[1;30m" C_RED="\033[1;31m" @@ -22,6 +11,23 @@ C_BLUE="\033[1;34m" C_PURPLE="\033[1;35m" C_CYAN="\033[1;36m" C_WHITE="\033[1;37m" +############################################################################## + +printf "${C_PURPLE}" +cat << EOF + +################################################################################### +# 系统信息检查脚本 +# @author: Zhang Peng +################################################################################### + +EOF +printf "${C_RESET}" + +[[ $(id -u) -gt 0 ]] && echo "请用root用户执行此脚本!" && exit 1 +sysversion=$(rpm -q centos-release|cut -d- -f3) +double_line="===============================================================" +line="----------------------------------------------" # 打印头部信息 printHeadInfo() { @@ -161,7 +167,7 @@ EOF # 获取系统网络信息 get_net_info() { - pri_ipadd=$(ip a show dev eth0|grep -w inet|awk '{print $2}'|awk -F '/' '{print $1}') + pri_ipadd=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}') pub_ipadd=$(curl ifconfig.me -s) gateway=$(ip route | grep default | awk '{print $3}') mac_info=$(ip link| egrep -v "lo"|grep link|awk '{print $2}') diff --git a/docs/linux/soft/fastdfs.md b/docs/linux/soft/fastdfs.md new file mode 100644 index 0000000..2ec1a54 --- /dev/null +++ b/docs/linux/soft/fastdfs.md @@ -0,0 +1,48 @@ +# FastDFS + +## 简介 + +FastDFS 是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等。 +FastDFS 为互联网量身定制,充分考虑了冗余备份、负载均衡、线性扩容等机制,并注重高可用、高性能等指标,使用 FastDFS 很容易搭建一套高性能的文件服务器集群提供文件上传、下载等服务。 + +## 概念 + +FastDFS 服务端有三个角色:跟踪服务器(tracker server)、存储服务器(storage server)和客户端(client)。 + +**tracker server**:跟踪服务器,主要做调度工作,起负载均衡的作用。在内存中记录集群中所有存储组和存储服务器的状态信息,是客户端和数据服务器交互的枢纽。相比 GFS 中的 master 更为精简,不记录文件索引信息,占用的内存量很少。 + +Tracker 是 FastDFS 的协调者,负责管理所有的 storage server 和 group,每个 storage 在启动后会连接 Tracker,告知自己所属的 group 等信息,并保持周期性的心跳,tracker 根据 storage 的心跳信息,建立 group==>[storage server list]的映射表。 + +Tracker 需要管理的元信息很少,会全部存储在内存中;另外 tracker 上的元信息都是由 storage 汇报的信息生成的,本身不需要持久化任何数据,这样使得 tracker 非常容易扩展,直接增加 tracker 机器即可扩展为 tracker cluster 来服务,cluster 里每个 tracker 之间是完全对等的,所有的 tracker 都接受 stroage 的心跳信息,生成元数据信息来提供读写服务。 + +**storage server**:存储服务器(又称:存储节点或数据服务器),文件和文件属性(meta data)都保存到存储服务器上。Storage server 直接利用 OS 的文件系统调用管理文件。 + +Storage server(后简称 storage)以组(卷,group 或 volume)为单位组织,一个 group 内包含多台 storage 机器,数据互为备份,存储空间以 group 内容量最小的 storage 为准,所以建议 group 内的多个 storage 尽量配置相同,以免造成存储空间的浪费。 + +以 group 为单位组织存储能方便的进行应用隔离、负载均衡、副本数定制(group 内 storage server 数量即为该 group 的副本数),比如将不同应用数据存到不同的 group 就能隔离应用数据,同时还可根据应用的访问特性来将应用分配到不同的 group 来做负载均衡;缺点是 group 的容量受单机存储容量的限制,同时当 group 内有机器坏掉时,数据恢复只能依赖 group 内地其他机器,使得恢复时间会很长。 + +group 内每个 storage 的存储依赖于本地文件系统,storage 可配置多个数据存储目录,比如有 10 块磁盘,分别挂载在`/data/disk1-/data/disk10`,则可将这 10 个目录都配置为 storage 的数据存储目录。 + +storage 接受到写文件请求时,会根据配置好的规则(后面会介绍),选择其中一个存储目录来存储文件。为了避免单个目录下的文件数太多,在 storage 第一次启动时,会在每个数据存储目录里创建 2 级子目录,每级 256 个,总共 65536 个文件,新写的文件会以 hash 的方式被路由到其中某个子目录下,然后将文件数据直接作为一个本地文件存储到该目录中。 + +**client**:客户端,作为业务请求的发起方,通过专有接口,使用 TCP/IP 协议与跟踪器服务器或存储节点进行数据交互。FastDFS 向使用者提供基本文件访问接口,比如 upload、download、append、delete 等,以客户端库的方式提供给用户使用。 + +另外两个概念: + +**group** :组, 也可称为卷。 同组内服务器上的文件是完全相同的 ,同一组内的 storage server 之间是对等的, 文件上传、 删除等操作可以在任意一台 storage server 上进行 。 + +**meta data** :文件相关属性,键值对( Key Value Pair) 方式,如:width=1024,heigth=768 。 + +![](http://www.ityouknow.com/assets/images/2018/fastdfs/fastdfs_arch.png) + + + + + +Tracker 相当于 FastDFS 的大脑,不论是上传还是下载都是通过 tracker 来分配资源;客户端一般可以使用 ngnix 等静态服务器来调用或者做一部分的缓存;存储服务器内部分为卷(或者叫做组),卷于卷之间是平行的关系,可以根据资源的使用情况随时增加,卷内服务器文件相互同步备份,以达到容灾的目的。 + +## 参考资料 + +- [FastDFS 官方 Github](https://github.com/happyfish100/fastdfs) +- [FastDFS 官方 wiki](https://github.com/happyfish100/fastdfs/wiki) +- [分布式文件系统 FastDFS 详解](https://www.cnblogs.com/ityouknow/p/8240976.html) diff --git a/scripts/gitpush.sh b/scripts/gitpush.sh new file mode 100644 index 0000000..ac58b52 --- /dev/null +++ b/scripts/gitpush.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cd .. +git push origin master +git push second master