Snipe-IT is a free and open source web based application for IT asset management, to enable IT departments to track who has which laptop, when it was purchased, which software licenses and accessories are available, and so on.
This means there there is no executable file (aka no .exe files), and it must be run on a web server and accessed through a web browser. Some of it's features are listed below, have a look at them:
- Easily see which assets are assigned, to whom, and their physical location
- One-click checkin
- Require User Acceptance on Checkout
- Email alerts for expiring warrantees and licenses
- Add your own custom fields for additional asset attributes
- Easily import and export assets
- Optional digital signatures on asset acceptance
You'll need a CentOS 7 server and a normal user with root user privileges over it to follow this guide for installing Snipe-IT on your server. You can switch between non root user to root user using
sudo -i command. It is recommended to install Snipe-IT on a freshly updated server so run below given command and it'll do the job for you.
yum -y update
Installing Apache Web Server
Once the system is updated, you can install the dependencies required. To install Snipe-IT you will need to install the Apache web server along with MaraiDB and PHP with a few extensions.
Run the following command to install the Apache web server.
yum -y install httpd
Now you can start Apache and enable it to start at boot time, using the following commands.
systemctl start httpd.service systemctl enable httpd.service
You can check the status of Apache web server using the following command.
systemctl status httpd
You should see following output:
[root@Sajid ~]# systemctl status httpd ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2017-02-08 14:46:03 UTC; 22s ago Docs: man:httpd(8) man:apachectl(8) Main PID: 10743 (httpd) Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec" CGroup: /system.slice/httpd.service ├─10743 /usr/sbin/httpd -DFOREGROUND ├─10744 /usr/sbin/httpd -DFOREGROUND ├─10745 /usr/sbin/httpd -DFOREGROUND ├─10746 /usr/sbin/httpd -DFOREGROUND ├─10747 /usr/sbin/httpd -DFOREGROUND └─10748 /usr/sbin/httpd -DFOREGROUNDFeb 08 14:46:03 ip-172-31-22-142 systemd: Starting The Apache HTTP Server... Feb 08 14:46:03 ip-172-31-22-142 systemd: Started The Apache HTTP Server.
We will need to install MariaDB for database purposes for Snipe-IT. MariaDB 5.5 is shipped in the default CentOS 7 repository, so just run this command to install MariaDB.
yum -y install mariadb-server
Now you'll have to start the MariaDB service and enable it to start at the boot time like we have done before for apache server, to do so please run following command.
systemctl start mariadb.service systemctl enable mariadb.service
You can check status of mariaDB using this below given command and you should see following output.
systemctl status mariadb.service
[root@Sajid ~]# systemctl status mariadb.service ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2017-02-08 14:47:40 UTC; 22s ago Main PID: 18035 (mysqld_safe) CGroup: /system.slice/mariadb.service ├─18035 /bin/sh /usr/bin/mysqld_safe --basedir=/usr └─18192 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/ma...Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: The latest information about MariaDB is available at http://mariadb.org/. Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: You can find additional information about the MySQL part at: Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: http://dev.mysql.com Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: Support MariaDB development by buying support/new features from MariaDB Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: Corporation Ab. You can contact us about this at firstname.lastname@example.org. Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: Alternatively consider joining our community based development effort: Feb 08 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: http://mariadb.com/kb/en/contributing-to-the-mariadb-project/ Feb 08 14:47:39 ip-172-31-22-142 mysqld_safe: 170208 14:47:39 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'. Feb 08 14:47:39 ip-172-31-22-142 mysqld_safe: 170208 14:47:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql Feb 08 14:47:40 ip-172-31-22-142 systemd: Started MariaDB database server.
We recommend you make sure that this installation is secure and to do so run following command.
You'll be asked to provide a root password so enter an appropriate password and answer yes to all questions by pressing Y.
Now you'll have to create a database for Snipe-IT so please follow the instructions.
mysql -u root -p
You'll be asked to enter password so simply enter a password and now execute the following queries to create a new database.
CREATE DATABASE snipeit_data;
The above query will create a database named snipeit_data. For the database you can use any name you prefer in the place of snipeit_data. Make sure that you use semicolon at the end of each query as a query always ends with a semicolon. Once the database is created you can create a new user and grant the required permissions to the user for the database.
CREATE USER 'snipeit_user'@'localhost' IDENTIFIED BY 'StrongPassword';
The above query will create a user with username snipeit_user. You can use any preferred username instead of snipeit_user. Replace StrongPassword with a strong password.
Now provide the appropriate privileges to your database user over the database you have created. Run the following query to do so.
GRANT ALL PRIVILEGES ON snipeit_data.* TO 'snipeit_user'@'localhost';
Now run the following query to immediately apply the changes on the database privileges.
Now you can exit from MariaDB prompt using following command.
We will have to install PHP to install Snipe-IT as we know it is written using Laravel framework. So run below given commands to install PHP.
yum -y install epel-release
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
The above command will enable remi repository.
yum -y install yum-utils
yum-config-manager --enable remi-php56
yum -y install php php-openssl php-pdo php-mbstring php-tokenizer php-curl php-mysql php-ldap php-zip php-fileinfo php-gd php-dom php-mcrypt
Finally restart your apache web server to apply changes that we have just configured and to do so run following command.
systemctl restart httpd
Composer is a dependency for PHP and you'll have to install it first before installing Snipe-IT. Simply run below commands and they'll do the job for you.
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/bin/composer
We have installed all the dependencies required to install Snipe-IT and now we are ready to install it from git.
If in case you don't have git already installed on your server then you can install it using
yum -y install git.
Now switch to web root directory of apache web server and clone the latest version of Snipe-IT using these commands:
git clone https://github.com/snipe/snipe-it snipe-it
.env file like shown below and replace filename with your own filename.
cp .env.filename .env
.env file using any text editor here we are using nano text editor.
nano .envFind the following lines and edit the values.
APP_URL=null #Provide yourdomainname or IP address here APP_TIMEZONE='UTC' #Change it according to your country DB_DATABASE=null #Provide the database name you created earlier DB_USERNAME=null #Provide database user's username DB_PASSWORD=null #Provide the DB user's password
Save the file and exit from the text editor.
Next, you'll have to set proper ownership and file permission, So run following commands.
chown -R apache:apache storage public/uploads
chmod -R 755 storage
chmod -R 755 public/uploads
composer install --no-dev --prefer-source
Generate the App key:
php artisan key:generate
Next, set up firewall rules to allow HTTP traffic on port 80 through firewall.
firewall-cmd --zone=public --permanent --add-service=http
Creating a Virtual Host
Create a virtual host using following command.
nano /etc/httpd/conf.d/snipeit.example.com.confAdd below given content to the file then save and exit from text editor.
<VirtualHost *:80> ServerName snipeit.YourDomain.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>
Finally restart your apache web server using
systemctl restart httpd
You've installed Snipe-IT on your CentOS 7 server completely and now you can configure it through your web browser. Open up your favourite web browser and point it to IP address of your CentOS server http://YourServerIP and finish the installation wizard.
In this tutorial you've learned how to install Snipe-IT on your CentOS 7 server. you also learned to configure Snipe-IT and we hope now you have enough knowledge to work with Snipe-IT.