溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

發(fā)布時(shí)間:2020-07-15 18:33:16 來(lái)源:網(wǎng)絡(luò) 閱讀:4365 作者:Melvin0906 欄目:系統(tǒng)運(yùn)維

一、介紹

????Snipe-IT 是一個(gè)免費(fèi)的開(kāi)源IT資產(chǎn)管理web應(yīng)用程序。是一款基于Laravel5.4的免費(fèi)的開(kāi)源IT資產(chǎn)管理系統(tǒng)。Snipe-IT用于IT資產(chǎn)管理,IT部門(mén)可通過(guò)它能夠跟蹤誰(shuí)擁有哪些筆記本電腦,何時(shí)購(gòu)買(mǎi)、包含哪些軟件許可證和可用的附件等。

????主要的功能特性:可托管在云主機(jī)、強(qiáng)大的REST API、快速更新、保證APP和Platform的安全性、一鍵備份、LDAP登錄/用戶(hù)同步。

二、環(huán)境準(zhǔn)備

? ? 此時(shí)安裝使用的系統(tǒng)如下:

????1、操作系統(tǒng):

????Centos7.6:?CentOS Linux release 7.6.1810 (Core)?

????2、Apache

????????此系統(tǒng)搭建使用的是 Apache2.4.6

????3、PHP

????????此系統(tǒng)搭建使用的是 PHP7.2

????4、數(shù)據(jù)庫(kù)

????????此系統(tǒng)搭建使用的數(shù)據(jù)庫(kù)版本是:Mariadb5.5.60

三、安裝前準(zhǔn)備

????1、系統(tǒng)更新,在此用的系統(tǒng)是最小化安裝的Centos7.6版本

????????yum -y install epel-release

????????yum update -y

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????2、使用yum安裝Apache 2.4.6

????????yum install -y httpd httpd-devel

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????httpd -v

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????3、使用yum安裝Mariadb 數(shù)據(jù)庫(kù)

????????yum install -y mariadb mariadb-server

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????4、源碼安裝PHP、配置Apache支持

????????安裝PHP所需要的依賴(lài)環(huán)境

????????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

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????下載PHP安裝包,并解壓:

????????cd /home

????????wget http://cn2.php.net/get/php-7.2.3.tar.gz/from/this/mirror

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????tar zxvf mirror

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????對(duì)PHP7.2.3 進(jìn)行源碼編譯安裝:

????? ?cd? php-7.2.3

????????ls

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)?

????????進(jìn)行檢查配置:

????????./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

????????(PS:此操作步驟大概檢查一分鐘左右,只要不出錯(cuò),就一直執(zhí)行,直到出現(xiàn)下面界面:)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????以上檢查沒(méi)有錯(cuò)誤之后,下面就開(kāi)始進(jìn)行安裝和編譯了:

????????make && make install

????????(PS:此過(guò)程大概會(huì)持續(xù)三到五分鐘左右,根據(jù)自己的設(shè)備性能決定,只要不報(bào)錯(cuò),就等待自行安裝,直至出現(xiàn)下面的界面:)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

? ? 等待以上的安裝完成后,下面需要配置php的環(huán)境變量:

????????vim /etc/profile

????????在該文件的最下面添加以下的信息:

?????????PATH=$PATH:/usr/local/php7.2.3/bin

????????export PATH

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????? ? 使其環(huán)境變量生效:?

????????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

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????啟動(dòng) php-fpm

????????service php-fpm start

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????查看開(kāi)啟狀態(tài):

????????lsof -i:9000

????????(PS:此次未安裝lsof,可使用yum先安裝lsof)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????修改httpd.conf文件

????????vim /etc/httpd/conf/httpd.conf

????????需要修改的信息如下:

????????(1)在AddType application*后面加如下一行

????????AddType application/x-httpd-php .php .phtml

????????(2)在DirectoryIndex index.html加上index.php

????????DirectoryIndex index.php index.html

????????(3)確保httd.conf文件中包含以下字段,如不包含則加入此字段? (已存在,不存在需要加上)

????????LoadModule php7_module? ? ? ? /usr/lib64/httpd/modules/libphp7.so

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????重啟 httpd服務(wù):

????????service httpd restart

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????檢驗(yàn)httpd的PHP支持和版本信息:

????? ?echo "<?php phpinfo(); ?>" >> /var/www/html/index.php

????????重啟服務(wù)和查看httpd狀態(tài):

????????systemctl restart httpd

????????systemctl status httpd

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????瀏覽器輸入服務(wù)器地址,檢驗(yàn)PHP是否安裝成功:

????????(PS:操作此步驟之前,需要關(guān)閉服務(wù)器的防火墻,或者添加一下命令:

    1. firewall-cmd --permanent --zone=public --add-port=80/tcp

  1. systemctl restart firewalld.service)否則瀏覽器不能正常顯示。

  2. Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

三、安裝Snipe-IT

????1、初始化并創(chuàng)建snipeit數(shù)據(jù)庫(kù)

????????service mariadb start? ? ?# 啟動(dòng)maraidb服務(wù)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????mysql_secure_installation? ? ?#初始化數(shù)據(jù)庫(kù)服務(wù)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????登陸數(shù)據(jù)庫(kù),創(chuàng)建對(duì)應(yīng)用戶(hù)及對(duì)應(yīng)的數(shù)據(jù)庫(kù)

????????mysql -u root -p

????????

????????mysql> create database snipeit;

????????mysql> grant all on snipeit.* to 'snipeit'@'%' identified by '324215';

????????mysql> flush privileges;

????????mysql> exit

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????2、安裝composer

????????什么是composer:

????????Composer 是由 Jordi Boggiano 和 Nils Aderman 創(chuàng)造的一個(gè)命令行工具,它的使命就是幫你為項(xiàng)目自動(dòng)安裝所依賴(lài)的開(kāi)發(fā)包。Composer 中的很多理念都借鑒自 npm 和 Bundler,如果你對(duì)這兩個(gè)工具有所了解的話,就會(huì)在 composer 中發(fā)現(xiàn)他們的身影。Composer 包含了一個(gè)依賴(lài)解析器,用來(lái)處理開(kāi)發(fā)包之間復(fù)雜的依賴(lài)關(guān)系;另外,它還包含了下載器、安裝器等有趣的東西。

????????下載并安裝compose:

????????cd

????????curl -sS https://getcomposer.org/installer | php

????????mv /root/composer.phar /usr/bin/composer

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????3、安裝snipeit

????????cd /var/www

????????yum install -y git

????????git clone https://github.com/snipe/snipe-it snipe-it

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????編輯配置文件

????????cd /var/www/snipe-it

????????sudo cp .env.example .env

????????vim .env

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????cd /var/www

????????yum install -y git

????????git clone https://github.com/snipe/snipe-it snipe-it


????????APP_URL=192.168.201.102? ? ? ?#填入地址

????????APP_TIMEZONE='Asia/Shanghai' #填入國(guó)家地址

?

????????DB_DATABASE=snipeit? ?#數(shù)據(jù)庫(kù)名稱(chēng)

????????DB_USERNAME=snipeit? ?#數(shù)據(jù)庫(kù)用戶(hù)名

????????DB_PASSWORD=324215? ?#數(shù)據(jù)庫(kù)密碼

?

????????其中

????????APP_DEBUG=false

????????調(diào)試的時(shí)候請(qǐng)更改為true

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????更改目錄權(quán)限:

????????chown -R apache:apache storage public/uploads

????????chmod -R 755 storage

????????chmod -R 755 public/uploads

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????使用composer安裝PHP依賴(lài)

????????composer install --no-dev --prefer-source

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????(PS:正在安裝中,此步驟安裝時(shí)間會(huì)較長(zhǎng),請(qǐng)耐心等待。。。)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????(中間可能會(huì)出現(xiàn)這樣的一個(gè)錯(cuò)誤,先不用理會(huì),等待繼續(xù)安裝)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????(PS:此過(guò)程安裝了大概兩個(gè)小時(shí),終于安裝成功了。出現(xiàn)以上界面)

????????如果安裝時(shí)間過(guò)長(zhǎng),可以修改源之后重新安裝嘗試

????????composer config -g repo.packagist composer https://packagist.phpcomposer.com

????????生成 app_key

????????php artisan key:generate

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????4、修改Apache配置文件,創(chuàng)建虛擬主機(jī)

????????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>

????

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????重啟Apache 服務(wù)并查看Apache狀態(tài):

????????systemctl restart httpd

????????systemctl enable httpd

????????systemctl status httpd

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????目前,Snipe-IT已經(jīng)安裝完成,就下來(lái)需要進(jìn)行查錯(cuò)和安裝前配置檢查

四、排除及遇到的問(wèn)題

????1、關(guān)閉系統(tǒng)的selinux:

????????vim /etc/sysconfig/selinux?

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????2、安裝前檢查報(bào)錯(cuò)

????????瀏覽器輸入服務(wù)器IP地址:

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????3、創(chuàng)建用戶(hù), 處理錯(cuò)誤:

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????出現(xiàn)以上的錯(cuò)誤,應(yīng)該是數(shù)據(jù)庫(kù)的問(wèn)題,修改 .env 文件:

????????cd?/var/www/snipe-it

????????vim .env

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????此篇文章的環(huán)境,數(shù)據(jù)庫(kù)和服務(wù)器是安裝再同一臺(tái)服務(wù)器上,修改DB_HOST=172.31.14.167(服務(wù)器地址)

????????systemctl restart mariadb? ?# 重啟maraidb服務(wù)

????????systemctl enable mariadb

????????systemctl status mariadb

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????4、繼續(xù)檢查錯(cuò)誤和創(chuàng)建用戶(hù)

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????5、填寫(xiě)用戶(hù)信息:

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

?五、界面展示:

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

??????1、關(guān)閉調(diào)試模式:

????????cd /var/www/snipe-it

????????vim .env

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????2、重啟httpd服務(wù)

????????systemctl restart httpd

????3、瀏覽器重新打開(kāi)服務(wù)器地址:? ??

????????Centos7操作系統(tǒng)搭建Snipe-IT資產(chǎn)管理系統(tǒng)

????????? 以上步驟已經(jīng)將snipe-IT系統(tǒng)安裝完成,已經(jīng)能正常的顯示為中文版本。


????

????????

????????

????????

????????

????????

????????

????????

????????

????????

????????

????????

????????

????????


????????

????????

????????

??????

????????

????????

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI