In this blog, we will look at how to import assets in Snipe-IT. You can import assets in bulk if required. There are two ways to import assets, first one is through web interface and the second one is command line. Both ways have their pros and cons.
This post is still in development…
Last updated 14th Sept 2021
Let’s have look the difference in a below table:
Web Interface
Command Line
Easy to use, user friendly
Need access to the command line and complex
Good for small files, it chokes while importing large records
Works seamless while importing larger imports
Can’t automate
Automation can be made
Importing through Web Interface
In this section, we will actually go through the steps to import assets through web interface. In order achieve this step you need access to SNIPE-IT’s web interface as an admin.
Login as admin on SNIPE-IT and click on import
Select file and click on import
Click on process and you will see a screen to select different options.
Click on process and importer will redirect the page after process the changes
Assets are imported successfully
What if you would like to update existing assets through CSV? Yes, you can do this. Update any value in the existing used CSV file and then import that file by checking the box “Update Existing Values”.
Update CSV file, in our case I will update just a serial number of SPARE-01
Import the updated CSV file by following the steps 2 to 5 from the first section
Check the updated serial number, it should reflect the changes on the web interface as well
Importing through command line
This is slightly complex than using web interface to import assets. Let’s have a look at the steps which we need to go through.
Login to your SNIPE-IT Server
Save your import file on the server
Open File Explorer and browse to the root directory where SNIPE-IT is installed.
Click on file and open PowerShell as an administrator
Run the following command. There are different switches available to achieve different results. – Command – Different Switches
For this test, we will be running the following command. It will import the assets from the mentioned location in the command and it will also output the results in the PowerShell.
Asset import file
Download the file which is used in this example below:
In this blog post, we will look at SNIPE-IT installation on Ubuntu Server with NGINX web server.
Last updated on 9th of March 2021
Check-out step-by-step video demonstration of SNIPE-IT installation.
Requirements for this guide to follow
Ubuntu server up and running
Static IP assigned to the server
Internet connectivity
Logged in with user account created during Ubuntu server installation or Root user (logging in as root not recommended)
1. Connect to Ubuntu server
Highly recommend to use a SSH client for connectivity and it will make easy to copy/paste commands as compare to directly interacting with your Ubuntu server console. I will be using Putty as SSH client. Here is the direct link to download Putty or you could use your preferred SSH client.
OpenSSH server status/installation
OpenSSH is already installed. You can check SSH server status
sudo service ssh status
If Open SSH server is not installed, you can install it by using the following commands:
sudo apt install OpenSSH-Server
Verify Open SSH server status
sudo service ssh status
Open SSH server’s configuration file is located here, file name is sshd_config. Open SSH should work out of the box, however, you can edit it if needed with your preferred choice of editor
cd /etc/ssh
2. Update/Upgrade installed packages
Update and upgrade installed packages on Ubuntu server. You will need to run this command as sudo and enter ‘y’ when prompted to confirm.
sudo apt update && sudo apt upgrade
3. Install NGINX, MySQL, PHP and PHP FPM
Install NGINX
sudo apt install nginx
Install MySQL
sudo apt install mysql-server
Install PHP and PHP-FPM
sudo add-apt-repository universe
sudo apt install php-fpm php-mysql
Check versions
MySQL server version
sudo mysql -V
NGINX version
sudo nginx -V
PHP Version
sudo php --version
Test Installation
NGINX: Browse to IP address of your server and you should see NGINX generic web page
MySQL: Run the following command to see the status of MySQL Server
sudo service mysql status
4. Create a new site and test PHP
In this step, we will create a new site for Snipe-IT, disable default site and test php. Also, we will restart the relevant services. We will come back to this later and update the root folder once SNIPE-IT is downloaded.
Create new site with name ams.teknex.com.au, you can update this name if you like to something else
Easiest way to check PHP-FPM version is by typing the following in the terminal and hit tab. This should populate the value as shown below. For instance if your PHP-FPM version is 7.4 then enter the value as php7.4-fpm.
If you like, you can have a quick look inside the .env file with nano editor. We will come back to this file later on. Don’t make any changes to the file and use Ctrl + X to exit
sudo nano .env
6. Configure MySQL Server
Run MySQL secure installation command line wizard and secure the installation.
sudo mysql_secure_installation
yes or no, if you would like to install Validate Password Plugin (I selected no for this in my lab environment)
The next part offers you to change the password for the root of MySQL and enter password twice
The next option to remove anonymous users, I will choose Yes
The next option to stop root login remotely, I would go for no
Reload privileges table: Yes
You will see, “All done”, once it is all done
7. Create an initial database and a user
In this step, we will create database, user and grant specific privileges to new user.
Database
snipeit_db
User
snipeit_user
Password
password
Login to MySQL server, provide password for MySQL root user when it prompts
sudo mysql -u root -p
Create new database snipeit_db
CREATE DATABASE snipeit_db;
Create new user snipeit_user
CREATE USER 'snipeit_user'@'localhost' IDENTIFIED BY 'password';
Grant permissions to sipeit_user on database snipeit_db
GRANT ALL PRIVILEGES ON snipeit_db.* TO 'snipeit_user'@'localhost';
Verify permissions
Show GRANTS FOR 'snipeit_user'@'localhost';
Flush privileges
flush privileges;
Quit
quit;
Restart MySQL service
sudo service mysql restart
Check MySQL service status
sudo service mysql status
8. Update .env file
Let’s update .env file with the required information.
cd /var/www/snipeit
sudo nano .env
Update the following:
App_URL
DB_DATABASE
DB_USERNAME
DB_PASSWORD
9. Update folder permissions
Update folder permissions in the Snipe-IT root directory
Working directory is /var/www/snipeit
cd /var/www/snipeit
Update permissions
sudo chown -R www-data:www-data /var/www/snipeit/
sudo chmod -R 755 storage
sudo chmod -R 755 public/uploads
10. Download Composer
Working directory is logged in user’s home directory. In my case it is /home/snipeit
This post is refined version of original LinkedIn post Snipe-IT Configuration On Ubuntu in which we installed step by step Snipe-IT on Ubuntu Server. You would be able to copy all the commands much easier through this post.
Last updated on 14th August 2021
Working Config: PHP 7.4.3 MySQL 8.0.26 Apache 2.4.41 Snipe-IT 5.1.8 build 6227
Requirements for this guide to follow
Ubuntu server up and running
Static IP assigned to the server
Internet connectivity
Logged in with user account created during Ubuntu server installation or Root user (logging in as root not recommended)
1. Connect to Ubuntu server
Highly recommend to use a SSH client for connectivity and it will make easy to copy/paste commands as compare to directly interacting with your Ubuntu server console. I will be using Putty as SSH client. Here is the direct link to download Putty or you could use your preferred SSH client.
OpenSSH server status/installation
OpenSSH is already installed. You can check SSH server status
sudo service ssh status
If Open SSH server is not installed, you can install it by using the following commands:
sudo apt install OpenSSH-Server
Verify Open SSH server status
sudo service ssh status
Open SSH server’s configuration file is located here, file name is sshd_config. Open SSH should work out of the box, however, you can edit it if needed with your preferred choice of editor
cd /etc/ssh
2. Update/Upgrade installed packages
Update and upgrade installed packages on Ubuntu server. You will need to run this command as sudo and enter ‘y’ when prompted to confirm.
sudo apt update && sudo apt upgrade
3. Install Apache, MySQL and PHP
You can use a repository like tasksel to install LAMP server components. Otherwise, you can install individual components. Install Apache, MySQL and PHP using tasksel
sudo apt install tasksel
sudo tasksel install lamp-server
Check versions
MySQL server version
sudo mysql -V
Apache version
sudo apache2 -V
PHP Version
sudo php --version
Test Installation
Apache: Browse to IP address of your server and you should see Apache generic web page
MySQL: Run the following command to see the status of MySQL Server
sudo service mysql status
PHP: Create a simple PHP page and browse to IP_Address/phpinfo.php
If you like, you can have a quick look inside the .env file with nano editor. We will come back to this file later on. Don’t make any changes to the file and use Ctrl + X to exit
sudo nano .env
5. Configure MySQL Server
Run MySQL secure installation command line wizard and secure the installation.
sudo mysql_secure_installation
yes or no, if you would like to install Validate Password Plugin (I selected no for this in my lab environment)
The next part offers you to change the password for the root of MySQL and enter password twice
The next option to remove anonymous users, I will choose Yes
The next option to stop root login remotely, I would go for no
Reload privileges table: Yes
You will see, “All done”, once it is all done
6. Create an initial database and a user
In this step, we will create database, user and grant specific privileges to new user.
Database
snipeit
User
mysqlsnipeit
Password
snipeit
Login to MySQL server, provide password for MySQL root user when it prompts
sudo mysql -u root -p
Create new database snipeit
CREATE DATABASE snipeit;
Create new user mysqlclient
CREATE USER 'mysqlsnipeit'@'localhost' IDENTIFIED BY 'snipeit';
Grant permissions to mysqlsnipeit on database snipeit
GRANT ALL PRIVILEGES ON snipeit.* TO 'mysqlsnipeit'@'localhost';
Verify permissions
Show GRANTS FOR 'mysqlsnipeit'@'localhost';
Flush privileges
flush privileges;
Quit
quit;
Restart MySQL service
sudo service mysql restart
Check MySQL service status
sudo service mysql status
7. Update .env file
Let’s update .env file with the required information.
cd /var/www/snipeit
sudo nano .env
Update the following:
App_URL
DB_Database
DB_USername
DB_Password
8. Update folder permissions
Update folder permissions in the Snipe-IT root directory
I noticed the following warning when I installed Composer today on 14th August 2021. Even though, this has no impact on the installation whatsoever. I was still able to generate the app key in the next step.
12. Generate App Key for .env file
Run the following command and enter yes when prompted
sudo php artisan key:generate
Verify the key generation
View contents of .env file and check APP_KEY value
sudo cat .env
13. Create a new site for Snipe-IT
In this step, we will create a new site for Snipe-IT, copy default site and remove it as well. Also, we will restart the relevant services.
Create new site with name ams.test.com.conf, you can update this name if you like to something else
In this detailed tutorial, we will go through all the required steps needed to be performed in order to successfully install Snipe-IT on Windows Server 2019.
This blog is updated on 19th Dec 2021. Make sure you install Visual C++ 2015-2019 Redistributable if you are planning to use PHP Version 7.3 or higher
Create a new folder “PHP” in the System Drive. In the most cases it is C: Drive.
Copy all data from original downloaded folder PHP.7.*.* to C:PHP
Open IIS Server Manager
Click on your Server Name and you will see the following Window.
Double click on PHP Manager and register new PHP-CGI.EXE. You will find PHP-CGI.EXE file in C:\PHPPHP-CGI.EXE. Follow the steps below to accomplish this task.
Test PHP Installation
There are two ways in which PHP could be tested.
First Method (this test will be enough)
It can be tested within IIS Manager.
Second method
A separate text file you could create within c:\inetpub\wwwroot > name it phpinfo.php > Edit with notepad and add this content without quotation marks
“<?php phpinfo(); ?>“
You might need to restart your IIS Server through IIS Server Manager is some cases before you open http://localhost/phpinfo.php
Enable/Disable PHP Extensions
Open IIS Manager
Click on your Server Name > Open PHP Manager
Disable following extensions leave other enabled extensions as enabled
php_gettext.dll
php_soap.dll
php_xmlrpc.all
Enable following extensions in addition to already enabled extensions
php_exif.dll
fileinfo.dll
php_pdo_mysql.dll
php_ldap.dll
After enabling and disabling, you will end up with the following extensions.
Copy all files and folders from downloaded snipeit to c:\inetpub\wwwroot\snipeit
9. Update environmental file
Find DB Dump Path (It will be needed in the .env file)
Follow the below steps to find the DB_DUMP_PATH
Find where MariaDB is located, in my case, it is C:\Program FilesMariaDB\10.0\bin.
To find MariaDB bin folder location, open Command Prompt as administrator and run the following command without quotations:
“cmd /c for %A in (“C:\Program Files\MariaDB 10.0\bin”) do @echo %~sA”
cmd /c for %A in ("C:\Program Files\MariaDB 10.0\bin") do @echo %~sA
The output would be the DB_DUMP_PATH, copy that path. In my case, it was the following
C:PROGRA~1MARIAD~1.0bin
Save this output in a text file as below
'C:\\PROGRA~1\\MARIAD~1.0\\bin'
Open .env.example with Notepad++, .env file is located in the Snipe-IT root folder
Update required fields as shown in the screenshot
– APP_URL
– DB_DATABASE
– DB_USERNAME
– DB_PASSWORD
– DB_DUMP_PATH
Save that file as .env
10. Install Composer
Download Composer exe file
Copy that file to Snipeit root directory, c:\intepub\wwwroot\snipeit
Run Composer exe file > Leave Developer Mode unchecked > Browse to PHP root directory as discussed in step number 5 > Select PHP.exe file > Follow the prompts and finish
Open Command Prompt (this might not work in PowerShell) as an administrator in the Snipe-IT root directory and run the following command (this step requires Internet connectivity, make sure you test it before hand)
composer install
11. Generate App Key
Open command prompt as an administrator in the Snipe-IT root directory and run the following command
php artisan key:generate
Open .env file with Notepad++ and you would see App Key populated in the .env file automatically as shown in the above screenshot
12. Create a new website
Open IIS Manager
Update Bindings of Default Web Site
Create new website
Open IIS Server Manager and enter the details as shown in the screenshot below and click OK to start the website immediately.
Update Handler Mappings
In IIS Manager, click on Sites and double click on newly created site SNIPE IT
Double Click on Handler Mappings
Update the settings as shown in the screenshot
13. Fix Folder Permissions
Add permissions for the IIS user for the uploads folder:
Go to C:\inetpub\wwwroot\snipe-it\public
Right Click uploads > Properties
Go to the Security Tab > Edit
Click Add and change location to local machine
Type IUSR in object name box
Click OK
Give IUSR full control
Click OK twice
Add permissions for the IIS user for the cache folder:
Go to C:\inetpub\wwwroot\snipe-it\bootstrap
Right Click cache > Properties
Go to the Security Tab > Edit
Click Add and change location to local machine
Type IUSR in object name box
Click OK
Give IUSR full control
Click OK twice
Add permissions for the IIS user for the storage folder:
Go to C:\inetpub\wwwroot\snipe-it
Right Click storage > Properties
Go to Security Tab > Edit
Click Add and change location to local machine
Type IUSR in object name box
Click OK
Give IUSR modify permissions
Click OK twice
Add permissions for the IIS user for the Windows Temp folder:
Go to C:\Windows
Right Click temp > Properties
Go to the Security Tab > Edit
Click Add and change location to local machine
Type IUSR in object name box
Click OK
Give IUSR modify permissions
Click OK twice
Add permissions for the IIS_IUSRS for the Windows Temp folder:
Go to C:\Windows
Right Click Temp > Properties
Go to the Security Tab > Edit
Click Add and change location to local machine
Type IIS_IUSRS in object name box
Click OK
Give IIS_IUSRS modify permissions
Click OK twice
Add permissions for the IIS_IUSRS for the Storage folder:
Go to c:\inetpub\wwwroot\snipe-it
Right Click Storage > Properties
Go to the Security Tab > Edit
Click Add and change location to local machine
Type IIS_IUSRS in object name box
Click OK
Give IIS_IUSRS modify permissions
Click OK twice
14. Browse to Snipe-IT Pre Flight Setup
Change security settings for IE in the Server Manager > Local Server > Enhanced Mode > Turn Off For Administrators
Open IE and browse to your IIS Server’s IP address > In this case it is 10.0.0.2
Snipe-IT Page will load
Click Next Create Database Tables
It might show Something Went Wrong > Refresh the page
Next: Create User > Fill all the required information > You should see the below page