版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

下载安装包

下载对应版本(MySQL)的安装包并解压到需要安装的文件夹。

安装 MySQL 8

切换清华国内源

代码块
languagebash
wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql80-community-el7/mysql80-community-release-el7-3.noarch.rpm
rpm -qa |grep mariadb
yum install mysql-server
systemctl enable mysqld

配置 数据库文件 my.cnf

需要注意配置文件中的 “default_authentication_plugin=mysql_native_password” 项目,如果没有该项目,数据库启动后连接时会提示密码错误。

代码块
languagetext
[client]
port    = 3306
socket  = /data/mysql/mysql.sock

[mysql]
prompt = "\u@mysqldb \R:\m:\s [\d]> "

[mysqld]
datadir = /data/mysql
socket  = /data/mysql/mysql.sock
character_set_server = UTF8MB4
default_time_zone = "+8:00"
plugin_dir = /usr/lib64/mysql/plugin
default_authentication_plugin=mysql_native_password

##performance setttings
lock_wait_timeout = 3600
open_files_limit    = 65535
max_connections = 512
table_open_cache = 1024
table_definition_cache = 1024
thread_cache_size = 768
interactive_timeout = 600
log_timestamps = SYSTEM
log_error = /data/mysql/error.log
slow_query_log = 1
slow_query_log_file = /data/mysql/slow.log
##innodb settings
innodb_buffer_pool_size = 45875M
innodb_data_file_path = ibdata1:12M:autoextend
## 根据您的服务器IOPS能力适当调整
## 一般配普通SSD盘的话,可以调整到 10000 - 20000
## 配置高端PCIe SSD卡的话,则可以调整的更高,比如 50000 - 80000
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_open_files = 65535

初始化密码

MySQL 8.0 初始化会自动生成 root 密码,保存在数据库的日志文件中

代码块
languagebash
grep "temporary password" /var/log/mysqld.log

修改密码安全等级

代码块
languagesql
set global validate_password.policy=0;

重置 root 密码

代码块
languagebash
mysqld --user=mysql --console --skip-grant-tables
set global validate_password.policy=0;
alter user 'root'@'localhost' identified by 'www.password';

添加用户

代码块
languagesql
create user 'confluence'@'localhost' identified with mysql_native_password by 'password';
grant all privileges on confluence.* to 'confluence'@'localhost';
set global validate_password.policy=0;

安装 Java 环境

配置 JDK 1.8 环境

代码块
languagebash
tar zxvf jdk-8u192-linux-x64_\(1\).tar.gz
mv jdk1.8.0_192/ /usr/local/jdk
vim /etc/profile
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=${JAVA_HOME}/lib:${JRE_HOME}/lib
source /etc/profile

配置 python pip 组件

代码块
languagebash
yum install python3 python3-setuptools python3-pip python3-ldap python3-devel mysql-devel gcc gcc-c++ -y
mkdir -p ~/.pip
cat > ~/.pip/pip.conf <<EOF
[global]
index-url = https://opentuna.cn/pypi/web/simple
trusted-host = opentuna.cn
timeout = 120
[install]
trusted-host = opentuna.cn
EOF
pip3 install --user --timeout=3600 django==2.2.* future mysqlclient pymysql Pillow pylibmc 
pip3 install --user --timeout=3600 captcha jinja2 sqlalchemy==1.4.3 psd-tools django-pylibmc django-simple-captcha
yum install libreoffice libreoffice-headless libreoffice-pyuno
pip3 install --user --upgrade pip
pip3 install --user cryptography

seafile 安装

按提示完成 seafile 安装。如果在安装过程中出现数据库无法创建或验证不成功的情况,可以参照重置密码的方式重新设定对应数据库的用户密码

配置防火墙

代码块
languagebash
firewall-cmd --zone=public --add-port=80/tcp --permanent

配置代理服务器

代码块
languagebash
yum install nginx
vim /etc/nginx/conf.d/seafile.conf 


代码块
languagetext
server {

    listen 80;
    server_name  seafile.test.lan;
    root html;
    index index.html index.htm;

 location / {
   root html;
   index  index.html index.htm;
   proxy_set_header Host $http_host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_pass http://127.0.0.1:8000;

   proxy_set_header   X-Forwarded-Host $server_name;
   proxy_read_timeout  300s;
   proxy_send_timeout  300s;
   send_timeout  300s;
   client_max_body_size 0;
  }


location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;
    }

   error_page  404   /50x.html;
   error_page   500 502 503 504  /50x.html;
   location = /50x.html {
      root   html;
 }
 }

配置 seafile

代码块
languagebash
vim ./seahub/seahub/utils/licenseparse.py

目录
printablefalse