部署开源软件snipe-it

与开源软件glpi一样,snipe-it也是用于管理IT资产的软件。
部署之前,需要把软件运行环境搭建起来,主要是apache ,mysql,PHP
一、环境部署简单如下:
1、YUM安装apache

[root@localhost ~]#  yum install -y httpd httpd-devel
[root@localhost ~]# systemctl start httpd 
[root@localhost ~]# httpd  -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Mar 24 2022 14:57:57
[root@localhost ~]# 

在这里插入图片描述
2、YUM安装最新Mariadb

[root@localhost ~]# vim /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://mirrors.aliyun.com/mariadb/yum/10.3/centos7-amd64/
gpgkey =  http://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1

[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base epel extras mariadb remi-safe updates
Cleaning up list of fastest mirrors
Other repos take up 21 M of disk space (use --verbose for details)
[root@localhost ~]# yum makecache

[root@localhost ~]# yum -y install MariaDB-server MariaDB-client

3、源码编译安装PHP7.4

[root@localhost ~]# cd /usr/src/
[root@localhost src]# wget -c https://www.php.net/distributions/php-7.4.10.tar.gz
[root@localhost src]# tar -zxvf php-7.4.10.tar.gz 
[root@localhost src]# cd php-7.4.10
[root@localhost php-7.4.10]# yum install -y make gcc wget openssl readline-devel openssl-devel libxslt-devel gmp-devel bzip2-devel freetype-devel libjpeg-devel   autoconf  freetype gd jpegsrc libmcrypt libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel sqlite sqlite-devel oniguruma oniguruma-devel

[root@localhost php-7.4.10]#./configure --prefix=/usr/local/php7.4.1 
[root@localhost php-7.4.10]# ./configure --prefix=/usr/local/php7.4.1 --with-config-file-path=/etc --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-apxs2=/usr/bin/apxs  --with-xmlrpc --with-openssl --with-mhash --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter  --enable-ftp --enable-gd --with-openssl-dir  --with-zlib-dir   --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex   --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  --with-xsl  --enable-mysqlnd-compression-support --with-pear --enable-opcache

make && make install

#添加PHP环境变量,并使之生效
[root@localhost php-7.4.10]# vim /etc/profile
PATH=$PATH/usr/local/php7.4.1/bin
export PATH
"/etc/profile" 78L, 1866C written
[root@localhost php-7.4.10]# source /etc/profile
[root@localhost php-7.4.10]# cp php.ini-production  /etc/php.ini
[root@localhost php-7.4.10]# cp /usr/local/php7.4.1/etc/php-fpm.conf.default  /usr/local/php7.4.1/etc/php-fpm.conf
[root@localhost php-7.4.10]# cp /usr/local/php7.4.1/etc/php-fpm.d/www.conf.default  /usr/local/php7.4.1/etc/php-fpm.d/www.conf
[root@localhost php-7.4.10]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@localhost php-7.4.10]# chmod +x /etc/init.d/php-fpm 
[root@localhost php-7.4.10]# 
#启动php服务
[root@localhost php-7.4.10]# /etc/init.d/php-fpm start
Starting php-fpm  done
[root@localhost php-7.4.10]# php -v
PHP 7.4.28 (cli) (built: Feb 15 2022 13:23:10) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies
    with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans
[root@localhost php-7.4.10]# 

4、配置httpd,启到PHP模块

[root@localhost php-7.4.10]# vim /etc/httpd/conf/httpd.conf

#增加:
1<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

2、 
 #
 AddType application/x-compress .Z
 AddType application/x-gzip .gz .tgz
 AddType application/x-httpd-php .php .phtml

 #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

3、
# LoadModule foo_module modules/mod_foo.so
LoadModule php7_module        /usr/lib64/httpd/modules/libphp7.so
#
Include conf.modules.d/*.conf

重启apache

[root@localhost php-7.4.10]# systemctl restart httpd
[root@localhost php-7.4.10]# 

二、安装snipe-it
1、初始化并创建snipeit数据库

[root@localhost php-7.4.10]# systemctl start mariadb
[root@localhost php-7.4.10]# mysql_secure_installation
#初始化完成,登录,创建数据库,并授权
[root@localhost php-7.4.10]# mysql -uroot -p
MariaDB [(none)]> create database snipe;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> grant all on snipe.* to 'snipe'@'%' identified by 'snipe';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> 

2、下载,解压snipeit软件包

[root@localhost php-7.4.10]# cd /usr/src/
[root@localhost src]# rz
rz waiting to receive.
 zmodem trl+C ȡ

  100%   15417 KB 15417 KB/s 00:00:01       0 Errors.gz...

[root@localhost src]# tar -zxvf snipe-it-6.0.0-RC-6.tar.gz
[root@localhost src]# mv snipe-it-6.0.0-RC-6 snipe-it
[root@localhost src]# mv snipe-it /var/www/
[root@localhost src]# cd /var/www/snipe-it/
[root@localhost snipe-it]# 
#配置snipe配置文件
[root@localhost snipe-it]# cp .env.example .env
[root@localhost snipe-it]# vim .env

#修改为如下几处:
APP_URL=172.18.1.252
APP_TIMEZONE='Asia/Shanghai'
APP_LOCALE=cn

DB_DATABASE=snipe
DB_USERNAME=snipe
DB_PASSWORD=snipe

#授权目录权限
[root@localhost snipe-it]# chown -R apache. storage public/uploads/
[root@localhost snipe-it]# chmod -R 755 storage/
[root@localhost snipe-it]# chmod -R 755 public/uploads/
[root@localhost snipe-it]# 

3、配置apache,创建虚拟主机

[root@localhost snipe-it]# vim /etc/httpd/conf.d/snipeit.com.conf 

#增加:
<VirtualHost *:80>
ServerName snipeit.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>

4、使用composer安装PHP依赖

#安装composer
[root@localhost snipe-it]# cd /usr/src/
[root@localhost src]# curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...

Composer (version 2.3.3) successfully installed to: /usr/src/composer.phar
Use it: php composer.phar

[root@localhost src]# mv composer.phar /usr/bin/composer
[root@localhost src]# 

#使用composer安装php依赖
[root@localhost src]# cd /var/www/snipe-it/
#更换composer下载镜像地址,默认是国外https://repo.packagist.org,更改为国外,这里替换为阿里云
[root@localhost snipe-it]# composer config -g -l repo.pachagist
[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https://repo.packagist.org
[process-timeout] 300
[use-include-path] false
[allow-plugins] 
[use-parent-dir] prompt
[preferred-install] dist
[notify-on-install] true
[github-protocols] [https, ssh]
[gitlab-protocol] 
[vendor-dir] vendor (/var/www/snipe-it/vendor)
[bin-dir] {$vendor-dir}/bin (/var/www/snipe-it/vendor/bin)
[cache-dir] /root/.cache/composer
[data-dir] /root/.local/share/composer
[cache-files-dir] {$cache-dir}/files (/root/.cache/composer/files)
[cache-repo-dir] {$cache-dir}/repo (/root/.cache/composer/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/root/.cache/composer/vcs)
[cache-ttl] 15552000
[cache-files-ttl] 15552000
[cache-files-maxsize] 300MiB (314572800)
[cache-read-only] false
[bin-compat] auto
[discard-changes] false
[autoloader-suffix] 
[sort-packages] false
[optimize-autoloader] false
[classmap-authoritative] false
[apcu-autoloader] false
[prepend-autoloader] true
[github-domains] [github.com]
[bitbucket-expose-hostname] true
[disable-tls] false
[secure-http] true
[cafile] 
[capath] 
[github-expose-hostname] true
[gitlab-domains] [gitlab.com]
[store-auths] prompt
[archive-format] tar
[archive-dir] .
[htaccess-protect] true
[use-github-api] true
[lock] true
[platform-check] php-only
[home] /root/.config/composer
[root@localhost snipe-it]# composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
[root@localhost snipe-it]# composer config -g -l repo.pachagist
[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https://mirrors.aliyun.com/composer/
[process-timeout] 300
[use-include-path] false
[allow-plugins] 
[use-parent-dir] prompt
[preferred-install] dist
[notify-on-install] true
[github-protocols] [https, ssh]
[gitlab-protocol] 
[vendor-dir] vendor (/var/www/snipe-it/vendor)
[bin-dir] {$vendor-dir}/bin (/var/www/snipe-it/vendor/bin)
[cache-dir] /root/.cache/composer
[data-dir] /root/.local/share/composer
[cache-files-dir] {$cache-dir}/files (/root/.cache/composer/files)
[cache-repo-dir] {$cache-dir}/repo (/root/.cache/composer/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/root/.cache/composer/vcs)
[cache-ttl] 15552000
[cache-files-ttl] 15552000
[cache-files-maxsize] 300MiB (314572800)
[cache-read-only] false
[bin-compat] auto
[discard-changes] false
[autoloader-suffix] 
[sort-packages] false
[optimize-autoloader] false
[classmap-authoritative] false
[apcu-autoloader] false
[prepend-autoloader] true
[github-domains] [github.com]
[bitbucket-expose-hostname] true
[disable-tls] false
[secure-http] true
[cafile] 
[capath] 
[github-expose-hostname] true
[gitlab-domains] [gitlab.com]
[store-auths] prompt
[archive-format] tar
[archive-dir] .
[htaccess-protect] true
[use-github-api] true
[lock] true
[platform-check] php-only
[home] /root/.config/composer
[root@localhost snipe-it]# 
#更新
[root@localhost snipe-it]# composer update
#更新106包
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
106 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
[root@localhost snipe-it]# 

执行PHP依赖检查安装

[root@localhost snipe-it]# composer install --no-dev --prefer-source
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 0 installs, 0 updates, 32 removals
  - Removing theseer/tokenizer (1.2.1)
  - Removing symfony/yaml (v5.4.3)
  - Removing symfony/dom-crawler (v4.4.39)
  - Removing sebastian/version (3.0.2)
  - Removing sebastian/type (2.3.4)
  - Removing sebastian/resource-operations (3.0.3)
  - Removing sebastian/object-reflector (2.0.4)
  - Removing sebastian/object-enumerator (4.0.4)
  - Removing sebastian/lines-of-code (1.0.3)
  - Removing sebastian/global-state (5.0.5)
  - Removing sebastian/environment (5.1.4)
  - Removing sebastian/complexity (2.0.2)
  - Removing sebastian/code-unit-reverse-lookup (2.0.3)
  - Removing sebastian/code-unit (1.0.8)
  - Removing sebastian/cli-parser (1.0.1)
  - Removing phpunit/phpunit (9.5.18)
  - Removing phpunit/php-token-stream (3.1.3)
  - Removing phpunit/php-timer (5.0.3)
  - Removing phpunit/php-text-template (2.0.4)
  - Removing phpunit/php-invoker (3.1.1)
  - Removing phpunit/php-file-iterator (3.0.6)
  - Removing phpunit/php-code-coverage (9.2.15)
  - Removing php-webdriver/webdriver (1.12.0)
  - Removing phar-io/version (3.2.1)
  - Removing phar-io/manifest (2.0.3)
  - Removing overtrue/phplint (3.0.6)
  - Removing n98/junit-xml (1.1.0)
  - Removing myclabs/deep-copy (1.11.0)
  - Removing mockery/mockery (1.5.0)
  - Removing laravel/dusk (v6.22.3)
  - Removing hamcrest/hamcrest-php (v2.0.1)
  - Removing fakerphp/faker (v1.19.0)
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package patchwork/utf8 is abandoned, you should avoid using it. Use symfony/polyfill-mbstring or symfony/string instead.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
82 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
[root@localhost snipe-it]# 

5、 生成 app_key

[root@localhost snipe-it]# php artisan key:generate
**************************************
*     Application In Production!     *
**************************************

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

Application key set successfully.
[root@localhost snipe-it]# 

在这里插入图片描述
至此,snipe-it部署完成,打开浏览器,输入地址,按提示配置就可以了
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

  • 3
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论
您好!要部署Snipe-IT,您可以按照以下步骤进行操作: 1. 首先,确保您的服务器满足Snipe-IT的系统要求。Snipe-IT需要PHP 7.2.5+、MySQL 5.7+或MariaDB 10.2+以及一些其他的PHP扩展。您还需要一个Web服务器(如Apache或Nginx)和Composer工具。 2. 在服务器上安装所需的软件和扩展。具体方式取决于您使用的操作系统和服务器软件。您可以参考Snipe-IT官方文档中的系统要求和安装指南,根据您的环境选择相应的步骤。 3. 下载Snipe-IT源代码。您可以从Snipe-IT的GitHub仓库中获取源代码。使用Git命令克隆存储库或直接下载源代码的zip文件。 4. 解压源代码并配置环境。将源代码解压到您选择的Web服务器的文档根目录下,并根据Snipe-IT的文档中提供的示例.env文件,创建一个名为.env的新文件,并根据您的环境配置其中的选项。 5. 安装依赖项。在源代码目录下运行`composer install --no-dev`命令,以安装Snipe-IT所需的PHP依赖项。这可能需要一些时间。 6. 生成应用程序密钥。在终端中运行`php artisan key:generate`命令,以生成一个唯一的应用程序密钥。 7. 创建数据库。使用您的MySQL或MariaDB管理工具创建一个新的空数据库,并为Snipe-IT设置一个数据库用户和密码。 8. 运行安装向导。在终端中,导航到源代码目录并运行`php artisan app:install`命令,按照向导中的提示完成安装过程。在过程中,您将需要提供数据库连接信息、管理员帐户信息以及其他一些配置选项。 9. 设置文件权限。确保Snipe-IT所需的文件和目录具有正确的权限,以便Web服务器可以访问和写入它们。具体的权限设置可能因您的环境而异,但一般来说,应该将`storage`目录和`bootstrap/cache`目录设置为可写。 10. 配置Web服务器。根据您使用的Web服务器,配置虚拟主机或站点,以将请求导向Snipe-IT的公共目录(通常是`public`目录)。确保启用了必要的模块和设置,以便支持Snipe-IT所需的URL重写和HTTPS等功能。 11. 完成安装。在完成上述步骤后,您应该能够通过浏览器访问Snipe-IT,并使用您在安装过程中创建的管理员帐户登录。 这些是部署Snipe-IT的一般步骤,具体的操作可能因您的环境而有所不同。如果您遇到任何问题,建议参考Snipe-IT官方文档或在Snipe-IT的社区论坛寻求帮助。祝您成功部署Snipe-IT

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿蔡BLOG

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值