snipe资产管理

方式一:推荐:https://snipe-it.readme.io/docs/downloading

方式二:手动安装

一、环境准备
CentOS 7 + Apache 2.4.6 + PHP +Mariadb5.5.60
其中Apache及Mariadb采用yum的方式直接安装,PHP采用二进制源码安装的方式

 

二、安装前准备
1.系统更新#注 此处采用最小化安装的Centos7.5
yum -y install epel-release

yum update -y
2.使用yum安装Apache 2.4.6
yum install -y httpd httpd-devel
3.使用yum安装Mariadb 5.5.60
yum install -y mariadb mariadb-server
4.源码安装PHP7.2并配置Apache支持
安装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
下载PHP安装包,并解压

cd /home
wget http://cn2.php.net/get/php-7.2.3.tar.gz/from/this/mirror
tar zxvf mirror
编译安装

cd php-7.2.3

./configure --prefix=/usr/local/php7.2.3 --with-config-file-path=/etc --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-apxs2=/usr/bin/apxs --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache
检查没有错误之后就可以开始安装了

make && make install
编译安装完成之后,配置环境变量

vim /etc/profile
在最下方加入

PATH=$PATH:/usr/local/php7.2.3/bin
export PATH
使配置生效

source /etc/profile
配置php-fpm

cd /home/php-7.2.3
cp php.ini-production /etc/php.ini
cp /usr/local/php7.2.3/etc/php-fpm.conf.default /usr/local/php7.2.3/etc/php-fpm.conf
cp /usr/local/php7.2.3/etc/php-fpm.d/www.conf.default /usr/local/php7.2.3/etc/php-fpm.d/www.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
启动php-fpm

service php-fpm start
查看开启状态

 

修改httpd.conf文件

vim /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服务,添加防火墙例外之后在网页访问,查看是否有以下图片信息

service httpd restart
firewall-cmd --permanent --zone=public --add-port=80/tcp
systemctl restart firewalld.service
 

 

 

 

三、安装snipeit
1.初始化并创建snipeit数据库
service mariadb start
mysql_secure_installation

 


登陆数据库,创建对应用户及对应的数据库

mysql -u root -p

mysql> create database snipeit;
mysql> grant all on snipeit.* to 'snipeit'@'%' identified by '324215';
mysql> flush privileges;
mysql> exit
2.安装composer
Composer是PHP的依赖管理器

cd
curl -sS https://getcomposer.org/installer | php
mv /root/composer.phar /usr/bin/composer
3.安装snipeit
cd /var/www
yum install -y git
git clone https://github.com/snipe/snipe-it snipe-it
编辑配置文件

cd /var/www/snipe-it
sudo cp .env.example .env
vim .env



APP_URL=192.168.201.102 #填入地址
APP_TIMEZONE='Asia/Shanghai' #填入国家地址

DB_DATABASE=snipeit #数据库名称
DB_USERNAME=snipeit #数据库用户名
DB_PASSWORD=324215 #数据库密码

其中
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
如果安装时间过长,可以修改源之后重新安装尝试

composer config -g repo.packagist composer https://packagist.phpcomposer.com
生成app_key

php artisan key:generate
4.修改Apache配置文件,创建虚拟主机
vim /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
至此Snipe-IT安装完成,接下来进行查错及安装前配置检查
 

四、排除及遇到的问题
1.如果出现配置完成之后仍然无法访问,请关闭本机的selinux

setenforce 0 #临时关闭selinux

vim /etc/sysconfig/selinux
SELINUX=enforcing 改为 SELINUX=disabled #永久关闭selinux
2.安装前检查报错

 

安装前检查出现如下报错,file owner报错的意思是当前文件的权限是root,可不必理会

debug的错误代表.env文件中的debug选项设置为开启,也可不必理会

五、界面展示


记得在自己的环境变量中把语言显示改成中文

 

然后整体的界面就会变成中文了

 

原文:https://blog.csdn.net/Lz__Heng/article/details/83054561

posted @ 2019-05-18 14:54  舍&得  阅读(373)  评论(0)    收藏  举报