centos8 禅道部署

邱秋 • 2021年07月18日 • 阅读:740 • linux centos 禅道

环境

CentOS 8 + 禅道16.x + Nginx + Mysql + PHP

PHP 配置

centos 自带的有 php环境

sudo dnf module list php # 查看版本,默认7.2

安装php7.2以及所需组件。

sudo dnf install php php-pdo php-gd php-mbstring php-mysqlnd php-ldap php-json php-xml php-zip

重启服务

systemctl start php-fpm.service #开启
systemctl status php-fpm.service  #查看状态
systemctl enable php-fpm.service  #开机启动

权限配置,编辑 www.conf

vi /etc/php-fpm.d/www.conf

找到 做修改

user = (非root 用户)
group = (非root 用户)

这里没配好 503,500

注意这里 使用端口和非端口的区别,和下面nignx 配置对应

;listen = /run/php-fpm/www.sock
listen = 9000

配置好了重启

systemctl restart php-fpm.service

Mysql 安装配置

安装 mariadb

dnf -y install mariadb mariadb-server 
systemctl start mariadb.service # 开启服务 
systemctl enable mariadb.service # 开机启动 

systemctl status mariadb.service # 查看服务状态
systemctl stop mariadb.service # 关闭服务

mariadb 为mysql 分支

数据库安装设置,重置数据库root账号密码,执行该命令前必须开启mariadb服务。

mysql_secure_installation 

Enter current password for root (enter for none): 输入当前root账号密码,刚安装默认为空,直接回车即可 
Set root password? [Y/n] 是否输入root密码,输入y 回车 
New password: 输入密码 
Re-enter new password: 重复输入 
Remove anonymous users? [Y/n] 删除其他用户 y 
Disallow root login remotely? [Y/n] 允许root账号远程登录 y 
Remove test database and access to it? [Y/n] 删除测试表 y 
Reload privilege tables now? [Y/n] 重新加载配置表 y

登陆测试,执行如下命令并输入密码。
mysql -uroot -p

mariadb 的远程链接配置

select User, host from mysql.user;

输出

+------+-----------+
| User | host      |
+------+-----------+
| root | 127.0.0.1 |
| root | ::1       |
| root | localhost |
+------+-----------+

允许外部ip连接

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

输出

+------+-----------+
| User | host      |
+------+-----------+
| root | %         |
| root | 127.0.0.1 |
| root | ::1       |
| root | localhost |
+------+-----------+

允许单独的ip链接

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.100.%' IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;

最后一步还需要配置防火墙 / 安全策略组,开放3306 端口

安装禅道 v16.x

下载地址:http://www.zentao.net/download.html

[安装包下载] For php 7.4

wget https://www.zentao.net/dl/zentao/16.5/ZenTaoPMS.16.5.php7.2_7.4.zip

dnf -y install unzip # 安装unzip解压 ,有就不装
unzip ZenTaoPMS.16.5.php7.2_7.4.zip # 解压禅道源码包

Nginx 绑定域名

yum install nginx # 有就跳过
systemctl start nginx.service

权限

vi /etc/nginx/nginx.conf

修改 user 为 root

user = root

代理配置

vi /etc/nginx/conf.d/zentao.conf

server{
  server_name xxx.com;
  client_max_body_size 1000M;

  location / {
    root /home/[user]/www/zentaopms; # 安装前
    #root /home/[user]/www/zentaopms/www; # 安装后
    index index.php index.html index.htm;
  }

  location ~ .*\.php$ {
    fastcgi_pass   127.0.0.1:9000; #注意这里和php 配置对应
    #fastcgi_pass  unix:/run/php-fpm/www.sock 
    fastcgi_index  index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO                $fastcgi_script_name; 
    include        fastcgi_params;    
    include fastcgi.conf;            
  } 

  ## For https
  listen 443 ssl http2; 

  ssl_certificate   /etc/nginx/cer/fullchain.cer;
  ssl_certificate_key /etc/nginx/cer/cert.key;
  ssl_protocols TLSv1.1 TLSv1.2;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
  ssl_prefer_server_ciphers on;
  ssl_session_cache shared:SSL:10m;
  ssl_session_timeout 10m;
}

server{
 if ($host = xxx.com) {
     return 301 https://$host$request_uri;
 } 
 server_name xxx.com;
 listen 80;
 return 404; 
}

重启服务

nginx -s reload

访问 http://xxx.com/www/index.php 开始安装

安装之后把 nginx root 路径加上www即可

完工!

我,秦始皇,打钱!