Centos7安装部署咖啡壶开源资产管理系统

一、简介

咖啡壶是开源、高颜值的IT资产管理平台。资产管理、归属、追溯、盘点以及轻量的服务器状态面板。支持导出导入、LDAP、自定义字段等。基于优雅的Laravel框架和DcatAdmin开发。

二、环境准备

2.1、操作系统

此次部署固定资产管理系统使用的是Linux系统。CentOS 7.9,如何安装不做介绍。
关闭防火墙

systemctl stop firewalld
systemctl disable firewalld

关闭selinux

[root@localhost html]# vim /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled                #### 修改为disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

reboot                  # 重启linux系统

2.2、PHP

安装PHP。

# 安装yum-utils 工具
yum install -y yum-utils
 
# 安装依赖
yum install 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
 
# 更换yum源
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
#为PHP 8启用流模块
sudo yum-config-manager --disable 'remi-php*'
sudo yum-config-manager --enable remi-php80
 
#安装PHP 8及扩展:
yum install php -y
yum install -y php-cli php-fpm \
php-mysqlnd php-zip php-devel \
php-gd php-mbstring php-curl \
php-xml php-pear php-bcmath \
php-json php-redis  php-xmlrpc \
php-fileinfo php-mysqli php-ldap
 
[root@localhost ~]# php -v
PHP 8.0.8 (cli) (built: Jun 29 2021 07:41:19) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.8, Copyright (c) Zend Technologies
 
# php 安装成功 修改php.ini文件
vim /etc/php.ini
zlib.output_compression = On
 
systemctl start php-fpm

2.3、中间件

安装中间件nginx

 useradd  nginx -s /sbin/nologin 
 
tar zxf nginx-1.20.1.tar.gz -C /usr/local/
cd /usr/local/nginx-1.20.1
 ./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

配置nginx.conf

 server {
        listen       80;
        server_name  localhost;
        root /html/public; 
 
        location / {
 
            index index.php  index.html index.htm;
            try_files $uri $uri/ /index.php?$args;                # 这一句不能少
        }

2.4、数据库

安装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 clean all && yum makecache
yum install mysql-community-server    -y     
systemctl enable --now mysqld
 grep "password" /var/log/mysqld.log 
 
mysql -uroot -p
 
ALTER USER 'root'@'%' IDENTIFIED BY 'new password';
create database chemex;
create user 'chemex'@'%' identifed by 'admin';
grant all privileges on chemex.* to 'chemex'@'%';
flush privileges

2.5、composer

安装composer

php -r "readfile('https://getcomposer.org/installer');" | php
mv composer.phar /usr/local/bin/composer
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/            # 更换国内源
composer config -g -l repo.packagist                      # 查看当前源

三、安装部署

3.1、下载咖啡壶源码

咖啡壶下载地址:https://gitee.com/dcat-phper/chemex.git

cd /usr/local/nginx                                                                    # 切换到网站根目录
git clone https://gitee.com/dcat-phper/chemex.git           # 下载咖啡壶源码
rm -rf html                                                                                  # 删除默认html根目录
mv chemex html                                                                        # 将下载的源码重命名为html
chown -R nginx:nginx html                                                    # 更改根目录的属组和属主为nginx,将nginx的安装目录/usr/local/nginx的属组和属主为nginx,nginx是中间件nginx的运行用户。
chmod -R 755 html                                                                  # 修改根目录的权限属性
chmod -R 777 html/storage                                                   # 修改html/storage的权限属性为777
cp .env.example .env                                                               # 拷贝.env.example一份命名为.env
vim .env                                                                                     # 安装配置文件要求配置
    DB_CONNECTION=mysql #数据库类型,不需要修改(兼容mariadb)
    DB_HOST=127.0.0.1 # 数据库地址
    DB_PORT=3306 # 数据库端口号
    DB_DATABASE=chemex # 数据库名称
    DB_USERNAME=chemex # 数据库用户名
    DB_PASSWORD=admin # 数据库密码,自己在MySQL中的配置的密码

3.2、执行安装chemex

 php artisan chemex:install
 chmod 777 -R /html/storage

四、访问资产管理系统

通过访问http://your_ip打开资产管理系统,初始密码为admin/admin。

登录界面

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容