1.安装一个wget,进入目录opt下
#安装wget
yum -y install wget
#进入目录/opt/下面
cd /opt/
2.获取 mysql8.0 rpm包,安装mysql8.0,安装mysql-server,yum会自动下载所需安装及依赖包.
#获取 mysql8.0 rpm包
wget https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm
# 安装mysql8.0
rpm -ivh mysql80-community-release-el7-5.noarch.rpm
# 安装mysql-server,yum会自动下载所需安装及依赖包
yum -y install mysql-server
3.启动MySQL,查看mysql运行状态.
# 启动MySQL
systemctl restart mysqld
# 查看mysql运行状态
systemctl status mysqld
4.# 查看mysql 在初始化的时候生成的随机密码,在:后面, 登录mysql,
# 查看mysql 在初始化的时候生成的随机密码
grep "password" /var/log/mysqld.log
# 登录mysql
mysql -uroot -p
5.修改密码,使用mysql库,#将Host设置为通配符%,允许任意用户远程访问,刷新一下权限
# 修改密码,如下,我修改为:Psw@2023
ALTER user 'root'@'localhost' IDENTIFIED BY 'Psw@2023';
# 使用mysql库
use mysql;
# 将Host设置为通配符%,允许任意用户远程访问
update user set host = '%' where user = 'root';
# 刷新一下权限
flush PRIVILEGES;
# 退出
exit
6. 创建目录,进入目录,下载安装包
# 创建目录
mkdir /root/wiki
# 进入目录
cd /root/wiki
# 下载安装包
wget https://github.com/phachon/mm-wiki/releases/download/v0.2.1/mm-wiki-v0.2.1-linux-amd64.tar.gz
7.解压安装包,进入程序安装目录,关闭防火墙,关闭setenforce0
# 解压安装包
tar -zxvf mm-wiki-v0.2.1-linux-amd64.tar.gz
# 进入程序安装目录
cd install
# 关闭防火墙
systemctl stop firewalld
#关闭setenforce0
setenforce 0
8.# 执行安装程序,默认端口为 8090
# 执行安装程序,默认端口为 8090
./install
浏览器访问 `http://ip:8090`进入安装界面,完成安装配置(如:http://192.168.100.129:8090)
9.配置后台开机自启,重新加载所有被修改过的服务配置,启动wiki服务,查看wiki服务状态.
# 配置后台开机自启
cat > /usr/lib/systemd/system/wiki.service << EOF
[Unit]
Description= wiki
Documentation= https://github.com/phachon/mm-wiki/releases/download/v0.2.1/mm-wiki-v0.2.1-linux-amd64.tar.gz
[Service]
EnvironmentFile=/root/wiki/conf/mm-wiki.conf
ExecStart=/root/wiki/mm-wiki
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
# 重新加载所有被修改过的服务配置
systemctl daemon-reload
# 启动wiki服务
systemctl start wiki
# 查看wiki服务状态
systemctl status wiki
10.配置nginx反向代理,安装epel扩展源,安装nginx.
# 安装epel扩展源
yum -y install epel-release
#配置nginx源
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
# 安装nginx
yum -y install nginx
11.修改nginx配置文件.
#修改nginx文件 把里面内容全部删除 加入
#user nginx; # 一定要注释掉
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
listen [::]:80;
server_name 192.168.10.60; # 添加自己的IP
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://192.168.10.60:8080; # 添加自己的ip
proxy_connect_timeout 600;
proxy_read_timeout 600;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
12.启动nginx,进入wiki目录,执行命令。
# 启动nginx服务
systemctl restart nginx
#进入目录
cd /root/wiki
#执行目录
./mm-wiki --conf conf/mm-wiki.conf
最后百度http://192.168.10.60:8080 自己的ip
13.使用nginx反向代理、负载均衡部署wiki完毕,有那些地方不懂,可以联系小编,我觉得这个nginx这个网站非常方便,大家可以用他可以搭建多个网站,我也有使用lamp架构搭建的一些网站,大家可以学习一下。