美文网首页
Centos7 部署安装Chemex资产管理软件

Centos7 部署安装Chemex资产管理软件

作者: apple524 | 来源:发表于2023-10-24 14:51 被阅读0次

    禁用防火墙 如有安全需要求则手动放通端口

    systemctl stop firewalld
    systemctl disable firewalld

    禁用selinux

    vim /etc/selinux/config
    SELINUX=disabled

    安装yum工具包集合

    yum install -y yum-utils

    依赖包安装

    yum install -y openssl-devel gcc gcc-++ gcc-c++ wget make libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel bison autoconf sqlite-devel oniguruma-devel

    配置PNP源

    yum -y install https://mirrors.aliyun.com/remi/enterprise/remi-release-7.rpm

    安装PHP

    yum-config-manager --enable remi-php81

    yum repolist all |grep php

    yum install -y php php-{cli,fpm,fileinfo,ldap,mysqlnd,zip,devel,gd,mbstring,curl,xml,xmlrpc,pear,bcmath,json}

    php -v
    PHP 8.1.20 (cli) (built: Jun 6 2023 23:02:31) (NTS gcc x86_64)
    Copyright (c) The PHP Group
    Zend Engine v4.1.20, Copyright (c) Zend Technologies

    修改参数

    vim /etc/php.ini
    zlib.output_compression = On

    服务启动

    systemctl start php-fpm
    systemctl enable php-fpm

    创建nginx帐号

    useradd nginx -s /sbin/nologin

    https://nginx.org/download/nginx-1.20.2.tar.gz

    解压nginx安装包

    tar zxf nginx-1.20.2.tar.gz -C /usr/local/

    cd /usr/local/nginx-1.20.2/

    编译

    ./configure --prefix=/usr/local/nginx --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-http_ssl_module --user=nginx --group=nginx

    安装

    make && make install

    配置systemctl托管nginx

    vim /usr/lib/systemd/system/nginx.service
    [Unit]
    Description=nginx
    After=network.target remote-fs.target

    [Service]
    Type=forking
    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ExecStop=/usr/local/nginx/sbin/nginx -s stop
    ExecReload=/usr/local/nginx/sbin/nginx -s reload

    [Install]
    WantedBy=multi-user.target

    刷新服务及启动服务

    systemctl daemon-reload && systemctl start nginx

    查看服务

    systemctl status nginx

    配置nginx.conf

    备份配置文件

    cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak

    辑配置文件

    vim /usr/local/nginx/conf/nginx.conf

    user nginx;
    worker_processes 1;
    events {
    worker_connections 1024;
    }
    http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;
    server {
    listen 80;
    server_name localhost;
    root /usr/local/nginx/html/public/; #改为chemex路径
    location / { #web服务器的伪静态规则
    index index.html index.htm index.php;
    try_files uriuri/ /index.php?args; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/local/nginx/html/public/; } location ~ \.php {
    root html;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/public/$fastcgi_script_name; ##改为chemex路径
    include fastcgi_params;
    }
    }
    }

    配置nginx自启动

    systemctl status nginx.service

    配置MYSQL YUM源

    vim /etc/yum.repos.d/mysql.repo

    [mysql]
    name= mysql8.0
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-8.0-community-el7-x86_64/
    enable=1
    gpgcheck=0

    清除并缓存YUM数据

    yum clean all && yum makecache

    安装MYSQL

    yum install -y mysql-community-server

    启动MYSQL服务

    systemctl enable --now mysqld
    systemctl enable mysqld

    查询mysql密码

    grep "password" /var/log/mysqld.log
    2023-07-05T08:26:48.865118Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 6DzAtt#nRna
    ated for root@localhost: ipOpLsoQ
    4,_

    登mysql

    mysql -uroot -pipOpLsoQ*4,_

    修改root帐号本地登陆密码

    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'm4aDGw4ZhxdGdoCJ';
    Query OK, 0 rows affected (0.01 sec)

    创建chemex表

    mysql> create database chemex;
    Query OK, 1 row affected (0.01 sec)

    创建Chemex用户

    mysql> create user 'chemex'@'%' identified by 'm4aDGw4ZhxdGdoCJ';
    Query OK, 0 rows affected (0.01 sec)

    添加chemex访问chemex

    mysql> grant all privileges on chemex.* to 'chemex'@'%';
    Query OK, 0 rows affected (0.00 sec)

    如无远程管理需求可直接退出mysql,进入下一步配置

    以下为MYSQL远程管理连接配置,如不需要使用远程管理可不配置

    因mysql8之前,加密规则是mysql_native_password mysql8之后,加密规则是caching_sha2_password

    升级8.0版本的不会改变现有用户的身份验证方法,但新用户会默认使用新的caching_sha2_password

    所以新安装的mysql8数据库需要手动修改数据库加密规则

    切换用户管理

    mysql> use mysql;

    查询帐号权限

    mysql> select user,host,plugin,authentication_string from mysql.user;
    +------------------+-----------+-----------------------+------------------------------------------------------------------------+
    | user | host | plugin | authentication_string |
    +------------------+-----------+-----------------------+------------------------------------------------------------------------+
    | chemex | % | caching_sha2_password | A005E 5ZHas%g9Q\}UtTKC1szZyA8L5iRqEw9BM9GJOIFy1ntaiK6YuijeF. | | root | % | caching_sha2_password |A005\G*|Bv-+Zm< 4 G?huUpHPWBgRawrTjxLTsCcRlITUWYoN4dobCJSUVfLveL7 |
    | mysql.infoschema | localhost | caching_sha2_password | A005THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | | mysql.session | localhost | caching_sha2_password |A005THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
    | mysql.sys | localhost | caching_sha2_password | A005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
    +------------------+-----------+-----------------------+------------------------------------------------------------------------+
    5 rows in set (0.01 sec)

    修改root帐号为% 以下不使用远程管理可不配置

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'm4aDGw4ZhxdGdoCJ';
    ALTER USER 'chemex'@'%' IDENTIFIED WITH mysql_native_password BY 'm4aDGw4ZhxdGdoCJ';
    Query OK, 0 rows affected (0.00 sec)

    需要先修改localhost为%再执行以下命令

    mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'm4aDGw4ZhxdGdoCJ';
    Query OK, 0 rows affected (0.00 sec)

    查询帐号权限

    mysql> select user,host,plugin,authentication_string from mysql.user;
    +------------------+-----------+-----------------------+------------------------------------------------------------------------+
    | user | host | plugin | authentication_string |
    +------------------+-----------+-----------------------+------------------------------------------------------------------------+
    | chemex | % | caching_sha2_password | A005E 5ZHas%g9Q\}UtTKC1szZyA8L5iRqEw9BM9GJOIFy1ntaiK6YuijeF. | | root | % | mysql_native_password | *2B261B38F624F4B274FB9202B91510E387E7DFFB | | mysql.infoschema | localhost | caching_sha2_password |A005THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
    | mysql.session | localhost | caching_sha2_password | A005THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | | mysql.sys | localhost | caching_sha2_password |A005THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
    +------------------+-----------+-----------------------+------------------------------------------------------------------------+
    5 rows in set (0.00 sec)

    更新策略

    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

    退出

    mysql> exit
    Bye

    Composer安装

    php -r "readfile('https://getcomposer.org/installer');" | php
    ls -lah composer.phar

    移动文件到/usr/local/bin/composer

    mv composer.phar /usr/local/bin/composer

    更改为腾讯源

    composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer

    查看当前源

    composer config -g -l

    进入nginx目录

    cd /usr/local/nginx

    安装git

    yum install -y git

    下载chemex

    git clone https://gitee.com/celaraze/chemex.git

    删除目录、重命名cheme为html

    rm -rf html
    mv chemex html

    权限修改

    chown -R nginx:nginx html
    chmod 755 -R html
    chmod 777 -R html/storage #755无法打开页面
    chmod 777 -R html/bootstrap #755无法打开页面

    /html/public/uploads #目录权限777,不然系统内无法上传导入表格

    进入目录

    cd html/

    创建文件及图标上传目录

    mkdir /public/uploads

    安装

    composer install -vvv

    复制 .env文件

    cp .env.example .env

    配置mysql连接用户及密码(密码带字符需要''、“”否则报错)

    vim .env

    第一步:数据库配置

    数据库类型,不需要修改(兼容mariadb)

    DB_CONNECTION=mysql

    数据库地址

    DB_HOST=127.0.0.1

    数据库端口号,mysql默认是3306

    DB_PORT=3306

    数据库名称,如果没有此数据库,后续会提示创建

    DB_DATABASE=chemex

    数据库用户名

    DB_USERNAME=chemex

    数据库密码

    DB_PASSWORD='m4aDGw4ZhxdGdoCJ'

    安装chemex

    php artisan chemex:install

    使用http:you_IP 进行登陆 默认用户名密码为:admin

    如有疑问可以查看chmemx根目录下的/docs文档

    相关文章

      网友评论

          本文标题:Centos7 部署安装Chemex资产管理软件

          本文链接:https://www.haomeiwen.com/subject/kkssidtx.html