소스 검색

添加服务器部署文档。

庞利祥 5 년 전
커밋
52c3116ee2

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+/.idea
+*.iml
+build
+package-lock.json

+ 43 - 0
deploy/docs/db/mariadb.md

@@ -0,0 +1,43 @@
+# 安装MariaDB
+## 删除旧版本
+
+centos7下默认安装有mariadb数据库,但是是旧版本,在安装新版本前需要先把旧版本删除,有些系统还默认安装mysql,也必须删除,否则与mariadb会产生冲突.
+
+```
+[root@localhost ~] rpm -qa | grep mariadb
+```
+## 创建 MariaDB.repo
+
+在目录下 /etc/yum.repos.d/ 创建文件: MariaDB.repo
+
+并把以下内容添加到所建文件中
+用阿里源,内容如下:
+
+```
+[mariadb]
+name = MariaDB
+baseurl = http://mirrors.aliyun.com/mariadb/yum/10.4/centos7-amd64/
+gpgkey =  http://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
+gpgcheck = 1
+```
+
+## 安装
+使用yum命令安装MariaDB数据库。
+
+```
+[root@localhost ~] yum install MariaDB-client MariaDB-server
+```
+
+## MariaDB服务配置命令
+
+```
+systemctl start mariadb #启动服务
+systemctl enable mariadb #设置开机启动
+systemctl restart mariadb #重新启动
+systemctl stop mariadb.service #停止MariaDB
+```
+
+## 初始化MariaDB
+
+
+https://blog.csdn.net/weixin_43731793/article/details/93378399

+ 74 - 0
deploy/docs/db/postgresql.md

@@ -0,0 +1,74 @@
+# PostgreSQL
+## 下载地址
+PostgreSQL官网地址:
+https://www.postgresql.org/
+
+PostgreSQL官网下载地址:
+https://www.postgresql.org/download/
+
+CentOS版PostgreSQL下载安装地址:
+https://www.postgresql.org/download/linux/redhat/
+
+## 安装依赖包
+### 安装Python
+如果系统已经安装Python3,或不需要数据库支持Python3,则跳过该安装过程。
+
+CentOS7默认软件源中没有Python3,要安装Python3需首先安装epel软件源。
+```
+[root@localhost ~] yum install epel-release
+```
+
+安装Python3.6。
+```
+[root@localhost ~] yum install python36
+```
+
+## 添加PostgreSQL软件件源地址
+使用yum命令添加PostgreSQL软件源。
+```
+[root@localhost ~] yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
+```
+
+## 安装PostgreSQL
+使用yum命令安装PostgreSQL。
+
+```
+[root@localhost ~] yum install postgresql12
+[root@localhost ~] yum install postgresql12-server
+[root@localhost ~] yum install postgresql12-contrib
+```
+
+初始化数据库。
+
+```
+[root@localhost ~] /usr/pgsql-12/bin/postgresql-12-setup initdb
+```
+
+配置开机启动与启动
+```
+[root@localhost ~] systemctl enable postgresql-12
+[root@localhost ~] systemctl start postgresql-12
+```
+
+## 配置远程访问
+### 修改密码
+首先,切换到postgres用户。然后执行修改用户密码SQL语句。其中“postgres”为要修改密码的用户,“123456”为用户的密码。
+```
+[root@localhost ~] su - postgres
+bash-4.2$ psql -c "alter user postgres with password '123456'"
+```
+
+### 修改配置文件
+
+打开并编辑文件“/var/lib/pgsql/12/data/postgresql.conf”。将“#listen_addresses = 'localhost'”改为“listen_addresses = '*'”
+![PostgreSQL远程连接配置](../static/images/db/postgresql_001.png)
+
+打开并编辑文件“/var/lib/pgsql/12/data/pg_hda.conf”。在文件的末尾添加“host  all  all  0.0.0.0/0  md5”。
+![PostgreSQL远程连接配置](../static/images/db/postgresql_002.png)
+
+## 安装Python3支持包
+如果不需要数据库Python3支持,则忽略该步骤。
+
+```
+[root@localhost ~] yum install postgresql12-plpython3
+```

+ 19 - 0
deploy/docs/index.md

@@ -0,0 +1,19 @@
+# 介绍
+
+## 什么是Teadocs?
+
+Teadocs 是一款能够帮你快速构建html文档的工具,它基于nodejs编写,并使用markdown来编写文档内容。
+
+Teadocs 提供内置的搜索技术,除了编写好你引以为豪的内容以外,你无需关注的任何额外的技术问题。
+
+你可以使用它来编写开源书籍、API文档学习、笔记、学习心得、甚至可以用来写博客。
+
+## 原理
+
+Teadocs 会自动根据你编写的markdown文档自动生成html文档,并且生成的html文档具备可复用、可移植等特性,可以部署在任何你喜欢的地方。
+
+## 贡献
+
+github地址:[https://github.com/lisniuse/teadocs](https://github.com/lisniuse/teadocs)
+
+如果你想贡献代码,我们建议你先fork阅读Teadocs的源码,然后push你的idea。

+ 74 - 0
deploy/docs/os/centos7.md

@@ -0,0 +1,74 @@
+# 下载CentOS
+## 官网地址
+
+https://www.centos.org/
+
+## 下载地址
+在浏览器输入地址:https://www.centos.org/download/
+
+![下载CentOS](../static/images/os/centos_download.jpg)
+
+点击“CentOS Linux DVD ISO”按钮,进入下载列表页面,选择其中一下下载地址下载CentOS。
+
+国内下载地址:
+http://mirrors.nju.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1908.iso
+
+# 安装CentOS
+将安装盘装入机器,设置从光盘启动。(虚拟机可以加载iso光盘镜像文件到光驱中)
+
+![安装CentOS7 001](../static/images/os/centos7_001.png)
+
+选择“Install CentOS 7”,按回车键安装CentOS 7;
+
+![安装CentOS7 002](../static/images/os/centos7_002.png)
+
+“您在安装过程中想使用哪种语言?”使用“中文”->“简体中文(中国)”。点击“继续”按钮开始安装设置;
+
+![安装CentOS7 003](../static/images/os/centos7_003.png)
+
+点击“安装位置”,设置将操作系统安装到哪个磁盘;
+
+![安装CentOS7 004](../static/images/os/centos7_004.png)
+
+选择要安装CentOS的磁盘,然后点击“完成”按钮返回安装摘要窗口。
+
+![安装CentOS7 005](../static/images/os/centos7_005.png)
+
+点击“开始安装”按钮开始安装;
+
+![安装CentOS7 006](../static/images/os/centos7_006.png)
+
+点击“ROOT 密码”设置root用户密码;
+
+![安装CentOS7 007](../static/images/os/centos7_007.png)
+
+在“Root 密码”输入框,输入root用户密码。在“确认”输入框,输入相同的root用户密码。点击“完成”按钮,完成root用户密码的设置;
+
+![安装CentOS7 008](../static/images/os/centos7_008.png)
+
+点击“重启”按钮重启系统;重启后进入如下的登录界面。
+
+![安装CentOS7 009](../static/images/os/centos7_009.png)
+
+安装完成。
+
+# 配置
+
+安装ifconfig等网络工具
+
+``` shell
+[root@localhost ~] yum install net-tools
+```
+## 网络配置
+
+CentOS安装完成后,默认网络是关闭状态。要使用网络必须打开网络设置。编辑网络配置文件“/etc/sysconfig/network-scripts/ifcfg-ens33”。
+
+![启动网络](../static/images/os/centos_net_001.png)
+
+将“ONBOOT=no”改为“ONBOOT=yes”。保存文件。
+
+重新启动网络。
+
+``` shell
+[root@localhost ~] systemctl restart network
+```

BIN
deploy/docs/static/images/db/postgresql_001.png


BIN
deploy/docs/static/images/db/postgresql_002.png


BIN
deploy/docs/static/images/os/centos7_001.png


BIN
deploy/docs/static/images/os/centos7_002.png


BIN
deploy/docs/static/images/os/centos7_003.png


BIN
deploy/docs/static/images/os/centos7_004.png


BIN
deploy/docs/static/images/os/centos7_005.png


BIN
deploy/docs/static/images/os/centos7_006.png


BIN
deploy/docs/static/images/os/centos7_007.png


BIN
deploy/docs/static/images/os/centos7_008.png


BIN
deploy/docs/static/images/os/centos7_009.png


BIN
deploy/docs/static/images/os/centos_download.jpg


BIN
deploy/docs/static/images/os/centos_net_001.png


+ 41 - 0
deploy/docs/web/nginx.md

@@ -0,0 +1,41 @@
+# 安装Nginx
+## 安装Nginx源
+执行如焉命令安装Nginx源
+```
+[root@localhost ~] rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
+```
+
+## 安装Nginx
+
+```
+[root@localhost ~] yum install nginx
+```
+
+配置开机启动与启动
+```
+[root@localhost ~] systemctl enable nginx
+[root@localhost ~] systemctl start nginx
+```
+
+# 常用命令
+启动nginx
+```
+[root@localhost ~] nginx
+```
+
+测试Nginx配置是否正确
+```
+[root@localhost ~] nginx -t
+```
+
+优雅重启
+```
+[root@localhost ~] nginx reload
+```
+
+# Nginx的默认路径
+* Nginx配置路径:/etc/nginx/
+* PID目录:/var/run/nginx.pid
+* 错误日志:/var/log/nginx/error.log
+* 访问日志:/var/log/nginx/access.log
+* 默认站点目录:/usr/share/nginx/html

+ 26 - 0
deploy/docs/web/tomcat.md

@@ -0,0 +1,26 @@
+# 安装JDK
+## 下载JDK
+## 安装JDK
+rpm -ivh 
+# 安装Tomcat
+## 下载Tomcat
+
+wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.27/bin/apache-tomcat-9.0.27.tar.gz
+tar xvf apache-tomcat-9.0.27.tar.gz -C /opt
+## 安装Tomcat
+
+# 配置Tomcat
+## tomcat 管理员密码
+https://jingyan.baidu.com/article/fea4511a1c624ef7bb9125ec.html
+
+/opt/tomcat9/conf/tomcat-users.xml
+
+```
+<role rolename="manager-gui"/>
+<role rolename="manager-script"/>
+<role rolename="manager-jmx"/>
+<role rolename="manager-status"/>
+<user username="tomcat" password="123456" roles="manager-gui,manager-script,manager-jmx,manager-status"/>
+```
+
+# 常见问题处理

+ 6 - 0
deploy/package.json

@@ -0,0 +1,6 @@
+{
+  "scripts": {
+    "build": "teadocs build",
+    "dev": "teadocs dev"
+  }
+}

+ 24 - 0
deploy/teadocs.config.js

@@ -0,0 +1,24 @@
+'use strict';
+const path = require('path')
+
+module.exports = {
+    doc: {
+        name: "服务器部署文档",
+        description: "上格云服务器部署运维文档。",
+        version: "1.0.0",
+        dir: "./docs",
+        outDir: "./build",
+        staticDir: "./docs/static"
+    }, 
+    theme: {
+        dir: "",
+        title: "",
+        headHtml: "",
+        footHtml: "",
+        isMinify: true,
+        rootPath: "/docs/deploy/"
+    },
+    nav: {
+        tree: "./tree"
+    }
+}

+ 8 - 0
deploy/tree.md

@@ -0,0 +1,8 @@
+- [操作系统](/index)
+    - [安装CentOS7](/os/centos7)
+- 数据库服务器
+    - [安装PostgreSQL](/db/postgresql)
+    - [安装Mariadb](/db/mariadb)
+- Web服务器
+    - [安装Tomcat](/web/tomcat)
+    - [安装Nginx](/web/nginx)