Snipe-IT open source asset management
Snipe-IT v6.x requires PHP8.1 for PHP8.2 you will need to wait for Snipe-IT v7 release.
Here is short how-to for FreeBSD 14.0 installation of Snipe-IT / Apache24 / PHP81 / MySQL
First read the main documentation from
Demo is also available at: https://snipeitapp.com/demo
This is clean install on FreeBSD 14.0 RELEASE. The guide is using packages to speed up the installation process but if you are using ports you can build all needed php extension by installing meta-port php81-extension and select required extensions there.
Before installation you need to have a working DNS registration of your host with A or CNAME record resolving snipe-it.example.com to the ip address of your server.(replace example.com with your real domain name)
All commands are executed as root.
Installation of all required software and runtime dependencies
#pkg
#git, apache, curl, MySQL, unzip
#php81, mod_php, PHP Extensions
In additional of official required PHP extensions you need php81-posix, php81-xmlreader, php81-xmlwriter required by some of the functions in Snipe-IT upgrade.php file and during installation of composer
Enable MySQL into /etc/rc.conf
Creating the database and user for Snipe-IT
If you want to change the MySQL root password use:
Creating the db and user
Note: RELOAD and PROCESS privileges are required for backup via the web page for the "snipe_user".
Edit /usr/local/etc/apache24/httpd.conf
#uncomment mod_rewrite.so
Create /usr/local/etc/apache24/Includes/php.conf
Create VirtalHost config file /usr/local/etc/apache24/Includes/snipeit.conf
Note: instead of having dir_module in your VirtualHost config you can edit httpd.conf DirectoryIndex and include index.php there.
Don't forget to change the ServerName it must match the FQDN from the DNS.
copy php.ini and edit the timezone and if you need bigger file upload edit 'post_max_size'
enable apache24 and start it
Download Snipe-IT using git and set the permissions
Change the owner of /usr/local/www/apache24/data/snipeit to unprivileged user in this example i will use "user" then log in with that "user" and install composer. It's not recomended to use root for installation of composer.
log in as unprivileged "user" and install the php composer packages ~169 pkgs (10-15min depending of your internet connection speed)
log in back as root and change again the owner of the snipeit to www so the apache can access it
Copy the configuration file and edit it.
#Edit .env according https://snipe-it.readme.io/docs/configuration
#FreeBSD mysqldump path is different so set DB_DUMP_PATH correctly
generate the APP_KEY
Set up the artisan scheduler into root crontab
in vi(1) i=insert
:wq = write quit
navigate to http://snipe-it.example.com and finish the installation.
notes
----
QR Codes
QR codes, when scanned on a mobile device using a QR scanner app, will open the asset details page of the asset whose QR code was scanned.
1D Barcodes
You can select between a few different 1D barcode formats, however barcode generation will fail if your asset tags do not conform to the requirements of the 1D barcode type.
Confirm that the barcode type you've selected is compatible with your asset tags. For example, if you have selected EAN5, your asset tags need to be 5 characters, numbers only. If your asset tags are a combination of numbers and letters, that won't be compatible. That's just a limitation on the barcode specifications, not something specific to Snipe-IT.
For more information on generating labels for your assets, check out the Asset Labels documentation.
Changing your URL
If you end up changing your Snipe-IT URL and you need to generate new QR codes so that the URLs resolve to your new address, you'll need to do the following:
Update your APP_URL in your .env
Clear your config cache: php artisan config:clear
Remove all of the barcodes in your public/uploads/barcodes directory. They will be re-generated the next time you pull them up, this time with the newly updated Snipe-IT URL.
Clear your browser cache
If some or all of your barcodes are still pointing to the same old URL when you refresh the barcode generator page, make sure all of the images within the public/uploads/barcodes directory have been deleted, and make sure you've cleared your browser cache.
You can customize your "Handing-Over Record" by editing /usr/local/www/apache24/data/snipeit/resources/views/users/print.blade.php then you need to clear the view cache using
upgrade procedure
login as unprivileged "user"
login as root
Snipe-IT v6.x requires PHP8.1 for PHP8.2 you will need to wait for Snipe-IT v7 release.
Here is short how-to for FreeBSD 14.0 installation of Snipe-IT / Apache24 / PHP81 / MySQL
First read the main documentation from
Demo is also available at: https://snipeitapp.com/demo
This is clean install on FreeBSD 14.0 RELEASE. The guide is using packages to speed up the installation process but if you are using ports you can build all needed php extension by installing meta-port php81-extension and select required extensions there.
Before installation you need to have a working DNS registration of your host with A or CNAME record resolving snipe-it.example.com to the ip address of your server.(replace example.com with your real domain name)
All commands are executed as root.
Installation of all required software and runtime dependencies
#pkg
pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
#git, apache, curl, MySQL, unzip
pkg install git curl unzip apache24 mysql80-server
#php81, mod_php, PHP Extensions
In additional of official required PHP extensions you need php81-posix, php81-xmlreader, php81-xmlwriter required by some of the functions in Snipe-IT upgrade.php file and during installation of composer
pkg install php81 mod_php81 php81-pear php81-composer php81-xmlreader php81-xmlwriter php81-iconv php81-dom php81-posix php81-mysqli php81-bcmath php81-gd php81-mbstring php81-pecl-mcrypt php81-ldap php81-simplexml php81-phar php81-filter php81-zlib php81-fileinfo php81-tokenizer php81-curl php81-pdo php81-xml php81-ctype php81-session php81-pdo_mysql php81-zip php81-ldap php81-sodium
Code:
- Core
- date
- libxml
- openssl
- pcre
- hash
- json
- Reflection
- SPL
- session
- standard
- mysqlnd
- bcmath
- ctype
- curl
- dom
- fileinfo
- filter
- gd
- gettext
- iconv
- intl
- mbstring
- mysqli
- PDO
- zlib
- posix
- SimpleXML
- snmp
- sockets
- sqlite3
- tokenizer
- xml
- xmlwriter
- zip
- Phar
- pdo_mysql
- pdo_sqlite
- xmlreader
- Zend OPcache
- ldap
- sodium
Enable MySQL into /etc/rc.conf
Code:
service mysql-server enable
service mysql-server start
mysql_secure_installation
mysql_secure_installation: [ERROR] unknown variable 'prompt=\u@\h [\d]>\_'.
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: y
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Please set the password for root here.
New password: 1mysqlrootP@ssw0rd
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
Creating the database and user for Snipe-IT
If you want to change the MySQL root password use:
Code:
mysql -u root -p
SET PASSWORD = 'newmysqlrootP@ssw0rd';
\q
Creating the db and user
Code:
mysql -u root -p
pager less -S
CREATE DATABASE snipeit;
CREATE USER 'snipe_user'@'localhost' IDENTIFIED BY 'P@ssw0rd';
GRANT ALL PRIVILEGES ON snipeit.* TO 'snipe_user'@'localhost';
GRANT RELOAD, PROCESS ON *.* TO 'snipe_user'@'localhost';
\q
Note: RELOAD and PROCESS privileges are required for backup via the web page for the "snipe_user".
Edit /usr/local/etc/apache24/httpd.conf
#uncomment mod_rewrite.so
ee /usr/local/etc/apache24/httpd.conf
Code:
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
Create /usr/local/etc/apache24/Includes/php.conf
ee /usr/local/etc/apache24/Includes/php.conf
Code:
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
Create VirtalHost config file /usr/local/etc/apache24/Includes/snipeit.conf
Note: instead of having dir_module in your VirtualHost config you can edit httpd.conf DirectoryIndex and include index.php there.
ee /usr/local/etc/apache24/Includes/snipeit.conf
Don't forget to change the ServerName it must match the FQDN from the DNS.
Code:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot "/usr/local/www/apache24/data/snipeit/public"
ServerName snipe-it.example.com
ErrorLog "/var/log/snipeit-error_log"
CustomLog "/var/log/snipeit-access_log" common
<Directory /usr/local/www/apache24/data/snipeit/public>
Require all granted
AllowOverride All
Options -Indexes
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
</VirtualHost>
copy php.ini and edit the timezone and if you need bigger file upload edit 'post_max_size'
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
ee /usr/local/etc/php.ini
Code:
date.timezone = Europe/London
enable apache24 and start it
Code:
service php-fpm enable
service apache24 enable
service php-fpm start
service apache24 start
Download Snipe-IT using git and set the permissions
Code:
mkdir /usr/local/www/apache24/data/snipeit
git clone https://github.com/snipe/snipe-it /usr/local/www/apache24/data/snipeit
Change the owner of /usr/local/www/apache24/data/snipeit to unprivileged user in this example i will use "user" then log in with that "user" and install composer. It's not recomended to use root for installation of composer.
Code:
chown -R user:www /usr/local/www/apache24/data/snipeit
log in as unprivileged "user" and install the php composer packages ~169 pkgs (10-15min depending of your internet connection speed)
Code:
% cd /usr/local/www/apache24/data/snipeit
% composer install --no-dev --prefer-source
log in back as root and change again the owner of the snipeit to www so the apache can access it
Code:
chown -R www:www /usr/local/www/apache24/data/snipeit
chmod -R 755 /usr/local/www/apache24/data/snipeit/storage
chmod -R 755 /usr/local/www/apache24/data/snipeit/public/uploads
Copy the configuration file and edit it.
Code:
cp /usr/local/www/apache24/data/snipeit/.env.example /usr/local/www/apache24/data/snipeit/.env
#FreeBSD mysqldump path is different so set DB_DUMP_PATH correctly
ee /usr/local/www/apache24/data/snipeit/.env
Code:
APP_ENV=production
APP_DEBUG=false
APP_KEY=
APP_URL=http://snipe-it.example.com
APP_TIMEZONE='UTC'
APP_LOCALE=en
MAX_RESULTS=500
# REQUIRED: DATABASE SETTINGS
# --------------------------------------------
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=snipeit
DB_USERNAME=snipe_user
DB_PASSWORD=P@ssw0rd
DB_PREFIX=null
DB_DUMP_PATH='/usr/local/bin'
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci
MAIL_DRIVER=smtp
MAIL_HOST=mail.example.com
MAIL_PORT=465
MAIL_USERNAME=no-reply@example.com
MAIL_PASSWORD=**************
MAIL_ENCRYPTION=SSL
MAIL_FROM_ADDR=no-reply@example.com
MAIL_FROM_NAME='Snipe-IT'
MAIL_REPLYTO_ADDR=admin@example.com
MAIL_REPLYTO_NAME='Snipe-IT'
MAIL_BACKUP_NOTIFICATION_ADDRESS=admin@example.com
generate the APP_KEY
Code:
cd /usr/local/www/apache24/data/snipeit
php artisan key:generate --force
php artisan migrate --force
Set up the artisan scheduler into root crontab
in vi(1) i=insert
:wq = write quit
Code:
crontab -e
* * * * * /usr/local/bin/php /usr/local/www/apache24/data/snipeit/artisan schedule:run > /dev/null
navigate to http://snipe-it.example.com and finish the installation.
notes
----
QR Codes
QR codes, when scanned on a mobile device using a QR scanner app, will open the asset details page of the asset whose QR code was scanned.
1D Barcodes
You can select between a few different 1D barcode formats, however barcode generation will fail if your asset tags do not conform to the requirements of the 1D barcode type.
Confirm that the barcode type you've selected is compatible with your asset tags. For example, if you have selected EAN5, your asset tags need to be 5 characters, numbers only. If your asset tags are a combination of numbers and letters, that won't be compatible. That's just a limitation on the barcode specifications, not something specific to Snipe-IT.
For more information on generating labels for your assets, check out the Asset Labels documentation.
Changing your URL
If you end up changing your Snipe-IT URL and you need to generate new QR codes so that the URLs resolve to your new address, you'll need to do the following:
Update your APP_URL in your .env
Clear your config cache: php artisan config:clear
Remove all of the barcodes in your public/uploads/barcodes directory. They will be re-generated the next time you pull them up, this time with the newly updated Snipe-IT URL.
Clear your browser cache
If some or all of your barcodes are still pointing to the same old URL when you refresh the barcode generator page, make sure all of the images within the public/uploads/barcodes directory have been deleted, and make sure you've cleared your browser cache.
You can customize your "Handing-Over Record" by editing /usr/local/www/apache24/data/snipeit/resources/views/users/print.blade.php then you need to clear the view cache using
php artisan view:clear
from /usr/local/apache24/data/snipeitupgrade procedure
chown -R user:www /usr/local/www/apache24/data/snipeit
login as unprivileged "user"
% cd /usr/local/www/apache24/data/snipeit
% php upgrade.php
login as root
chown -R www:www /usr/local/www/apache24/data/snipeit
chmod -R 755 /usr/local/www/apache24/data/snipeit/storage
chmod -R 755 /usr/local/www/apache24/data/snipeit/public/uploads
Last edited: