開源資產管理系統Snipe-IT


CentOS7安裝IT資產管理系統
Snipe-IT介紹
資產管理工具
Github:https://github.com/snipe/snipe-it
官網:https://snipeitapp.com/
Demo:https://demo.snipeitapp.com/
安裝要求
系統要求(https://snipe-it.readme.io/docs/requirements):筆者環境:2vcpu 4G mem 20G /
Hostname Role IP
snipeit.aniu.so snipeit 192.168.1.xxx
PHP version Mariadb version snipeit version
7.2.24     mysql  Ver 15.1 Distrib 10.3.20-MariaDB,  4.8.0
#1.系統更新
$sudo yum -y install epel-release

$sudo yum update -y

#2.安裝LNMP

#3.配置php-fpm

nginx和fastcgi的通信方式有兩種,一種是TCP的方式,一種是unix socke方式
  • TCP是使用TCP端口連接127.0.0.1:9000
  • Socket是使用unix domain socket連接套接字
1、TCP配置方式
  • 編輯 /etc/nginx/conf.d/你的站點配置文件。將fastcgi_pass參數修改為127.0.0.1:9000
  • 編輯php-fpm配置文件 /etc/opt/rh/rh-php71/php-fpm.d/www.conf
  • 將user和group的值設為nginx
    user = nginx
    group = nginx
  • listen的值設置為127.0.0.1:9000,和站點配置文件中fastcgi_pass參數的值一樣
  • 完成后,我們必須更改 selinux 的資料庫並加入9000端口為httpd服務的有效連接。

semanage port -a -t http_port_t -p tcp 9000

  • 重啟php-fpm,重啟nginx
2、unix socket配置方式
以文件(一般是.sock)作為socket的唯一標識(描述符),需要通信的兩個進程引用同一個socket描述符文件就可以建立通道進行通信了。
  • 創建socket描述符文件
sudo touch /var/run/php7.1-fpm.sock sudo chown nginx:nginx /var/run/php7.1-fpm.sock sudo chmod 666 /var/run/php7.1-fpm.sock 
  • 修改php-fpm配置文件中
  • 將user和group的值設為nginx
    user = nginx
    group = nginx
  • listen的值設置為/var/run/php7.1-fpm.sock,和站點配置文件中fastcgi_pass參數的值一樣
  • 去掉listen.owner、listen.group、listen.mode前面的分號,以使php-fpm使用unix socket,並將listen.owner、listen.group的值設置為nginx
    listen.owner = nginx
    listen.group = nginx
  • 修改nginx站點配置文件.編輯 /etc/nginx/conf.d/你的站點配置文件。將fastcgi_pass參數修改為/var/run/php7.1-fpm.sock
  • 重啟nginx和php-fpm服務(最好先重啟php-fpm再重啟nginx)

#創建Snipe-IT數據庫
# 登錄數據庫
sudo mysql -u root -p

mysql> create database snipeit;
mysql> grant all on snipeit.* to 'snipe_user'@'192.168.1.%' identified by 'snipeitpass.';
mysql> flush privileges;

#4.安裝Snipe-IT
# 安裝git
[root@ops-01 ~]# cd /data/
[root@ops-01 data]# sudo git clone https://github.com/snipe/snipe-it snipeit 

# 從提供的示例文件創建.env文件
cd /data/snipeit
sudo cp .env.example .env

# 編輯.env文件,根據提供的說明找到以下行並修改
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------
APP_ENV=production
APP_DEBUG=false # 排錯的時候這個改為true
APP_URL=192.168.1.XXX
APP_TIMEZONE='Asia/Shanghai'
APP_LOCALe=zh-CN

 

# --------------------------------------------
# REQUIRED: DATABASE SETTINGS
# --------------------------------------------
DB_CONNECTION=mysql
DB_HOST=192.168.1.XXX
DB_DATABASE=snipeit
DB_USERNAME=snipe_user
DB_PASSWORD=snipeitpass.
DB_PREFIX=null
DB_DUMP_PATH='/usr/bin'
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci

 

#權限設置

# /data/snipeit cd /data/snipeit chown -R nginx:nginx chmod -R 755 storage chmod -R 755 public/uploads

#5.安裝Composer

# 使用以下命令安裝Composer,Composer是PHP的依賴管理器
[root@ops-01 ~]# cd ~

curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...

Composer (version 1.6.5) successfully installed to: /root/composer.phar
Use it: php composer.phar

[root@ops-01 ~]# mv /root/composer.phar /usr/bin/composer

composer config -g repo.packagist composer https://packagist.phpcomposer.com #使用國內鏡像加快composer install 速度
php composer.phar install --no - dev --prefer - source

 

#APP_KEY
[root@ops-01 snipeit]#composer update --no-scripts #先更新,解決項目的所有依賴

php artisan key:generate
**************************************
* Application In Production! *
**************************************

Do you really wish to run this command? (yes/no) [no]:
> yes

Application key [base64:yRuvb8BjQhuBDo6tYRToAbQ8PwiIKt0xko2TOVk5QqM=] set successfully.

#6.nginx 配置
[root@ops-01 conf.d]#mkdir /var/log/nginx/snipeit

vim snipeit.conf
server {
listen 80;
server_name snipeit.gabjoy.local;

root /data/snipeit/public;
index index.php index.html index.htm;
access_log /var/log/nginx/snipeit/snipeit.aniu.so.access.log main;
error_log /var/log/nginx/snipeit/snipeit.aniu.so.error.log;

location =/.env{
return 404;
}

location / {
try_files $uri $uri/ /index.php$is_args$args;
}

location ~ \.php$ {
root /data/snipeit/public;
try_files $uri $uri/ =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# 具體優化參數在nginx.conf配置

通過瀏覽器訪問:
這里寫圖片描述
這里寫圖片描述
————————————————
版權聲明:本文為CSDN博主「shaonbean」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/wh211212/article/details/80814045

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM