zoukankan      html  css  js  c++  java
  • 安装Snipe-IT资产管理系统

    一、环境准备

    CentOS 7 + Apache 2.4.6 + PHP +Mariadb5.5.60

    CentOS 7 (阿里云):http://mirrors.aliyun.com/centos/7.7.1908/isos/x86_64/CentOS-7-x86_64-DVD-1908.iso

    二、安装前准备

    1.系统更新

    #注 此处采用最小化安装的Centos7.7

    yum -y install epel-release
    yum update –y
    2.使用yum安装Apache

    yum install -y httpd httpd-devel
    3.使用yum安装Mariadb

    yum install -y mariadb mariadb-server
    4.安装PHP7.2并配置Apache支持

    # 删除系统中可能存在之前安装的php相关文件
    yum -y remove php*

    #安装PHP依赖环境

    yum install -y make gcc wget openssl readline-devel openssl-devel libxslt-devel gmp-devel bzip2-devel freetype-devel libjpeg-devel php-mcrypt libmcrypt libmcrypt-devel autoconf freetype gd jpegsrc libmcrypt libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel

    # 不必担心会影响已经配置好的阿里源

    rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm    (gipl有源)
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

    #注意: 如果你在使用Laravel框架,那么经过上述操作之后你会发现还缺少一个 b cmath 扩展。在网上也有各种各样的安装命令,但大多数都麻烦。下面这条命令可以做到,一次安装成功。

    yum install php72w-bcmath
    如果php启动失败请看这个   以上步骤没有装php-fpm  需要yum装

    安装PHP
    yum install php74-php-gd php74-php-pdo php74-php-mbstring php74-php-cli php74-php-fpm php74-php-mysqlnd
    启动FPM
    service php74-php-fpm start


    #安装完成之后,启动php-fpm

    service php-fpm start

    #查看php-fpm开启状态

    yum install lsof
    lsof –i:9000

    #查看PHP状态
    php -v
    #修改httpd.conf文件
    vi /etc/httpd/conf/httpd.conf

    #在AddType application*后面加如下一行
    AddType application/x-httpd-php .php .phtml

    #在DirectoryIndex index.html加上index.php
    DirectoryIndex index.php index.html

    #确保httd.conf文件中包含以下字段,如不包含则加入此字段
    LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so

    #重启httpd服务
    service httpd restart

    #检验httpd的PHP支持
    echo "<?php phpinfo(); ?>" >> /var/www/html/index.php

    #重启httpd服务,添加防火墙例外之后在网页访问,查看是否有显示PHP版本页面
    service httpd restart
    firewall-cmd --permanent --zone=public --add-port=80/tcp
    systemctl restart firewalld.service
    #环境检测
    cat /etc/redhat-release
    #CentOS Linux release 7.7.1908 (Core)


    uname -a
    #Linux snipe-it 3.10.0-1062.12.1.el7.x86_64 #1 SMP Tue Feb 4 23:02:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux


    mysql --version
    mysql Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64) using readline 5.1

    php -v
    PHP 7.2.27 (cli) (built: Jan 26 2020 15:49:49) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.27, Copyright (c) 1999-2018, by Zend Technologies


    php -fpm -v
    PHP 7.2.27 (cli) (built: Jan 26 2020 15:49:49) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.27, Copyright (c) 1999-2018, by Zend Technologies

    httpd -v
    Server version: Apache/2.4.6 (CentOS)
    Server built: Aug 8 2019 11:41:18

    三、安装snipeit

    #初始化并创建snipeit数据库
    service mariadb start
    mysql_secure_installation

    #登陆数据库,创建对应用户及对应的数据库
    mysql -u root -p
    mysql> create database snipeit;
    mysql> grant all on snipeit.* to 'snipeit'@'%' identified by 'Passw0rd';
    mysql> flush privileges;
    mysql> exit

    #安装composer
    Composer是PHP的依赖管理器
    cd ~
    curl -sS https://getcomposer.org/installer | php
    mv /root/composer.phar /usr/bin/composer

    #安装snipeit
    cd /var/www
    yum install -y git
    git clone https://github.com/snipe/snipe-it snipe-it
    #笔者这里克隆非常的慢,可以考虑使用工具下载源码后使用FTP上传

    #编辑配置文件
    cd /var/www/snipe-it
    sudo cp .env.example .env
    vi .env

    APP_URL=192.168.208.128 #填入IP地址,IP查询命令ip add
    APP_TIMEZONE='Asia/Shanghai' #时区
    DB_DATABASE=snipeit #数据库名称
    DB_USERNAME=snipeit #数据库用户名
    DB_PASSWORD=Passw0rd #前面设置数据库密码

    #其中
    APP_DEBUG=false #需要调试的时候请更改为true,一般用不到

    #更改目录权限
    chown -R apache:apache storage public/uploads
    chmod -R 755 storage
    chmod -R 755 public/uploads

    #安装PHP依赖
    composer install --no-dev --prefer-source #这里非常的慢,需要加载100多个插件

    #如果安装时间过长,可以修改为国内源之后重新安装尝试
    composer config -g repo.packagist composer https://packagist.phpcomposer.com

    #生成app_key
    php artisan key:generate

    #4.修改Apache配置文件,创建虚拟主机
    vi /etc/httpd/conf.d/snipeit.example.com.conf
    <VirtualHost *:80>
    ServerName snipeit.example.com
    DocumentRoot /var/www/snipe-it/public
    <Directory /var/www/snipe-it/public>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    </Directory>
    </VirtualHost>

    #重启Apache服务
    service httpd restart

    注意顺序,还有就是.env中的密码不能有null

  • 相关阅读:
    Failed to load config "react-app" to extend from.
    An unexpected error occurred: "expected workspace package to exist for "@babel/core"".
    写一个 LRU 缓存函数(#146)
    TERSUS笔记303-06末页
    TERSUS笔记302-08每页条数逻辑
    TERSUS笔记301-显示列表处理+序号+01共几条取值+08每页条数下拉菜单值设置+02共页数计算取值
    TERSUS笔记300-增加
    TERSUS笔记118-多表增删改查完整操作
    Java多线程之二(Synchronized)
    HashMap在JDK1.7中可能出现的并发问题
  • 原文地址:https://www.cnblogs.com/Su-per-man/p/14389419.html
Copyright © 2011-2022 走看看