Ads 468x60px

How to Install Snipe-IT on CentOS 7 | IT Asset Management


Snipe-IT is a free and open source, cross-platform, feature-rich IT asset management system built using a PHP framework called Laravel. It is web-based software, which enables IT administrators in medium to large enterprises to track physical assets, software licenses, accessories and consumables in a single place.


In this article, I will explain how to install a IT asset management system called Snipe-IT using a LAMP (Linux, Apache, MySQL & PHP) stack on CentOS and Debian based systems.

Step 1: Install LAMP Stack

1. First update the system (meaning update the list of packages that needs to be upgraded and add new packages that have entered in repositories enabled on the system).

$ sudo yum update  
     
2. Once system has been updated, now you can install LAMP (Linux, Apache, MySQL & PHP) stack with all needed PHP modules as shown.

$ sudo yum install epel-release
$ sudo rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ sudo yum -y install yum-utils
$ sudo yum-config-manager --enable remi-php71   [Install PHP 7.1]
$ sudo yum-config-manager --enable remi-php72   [Install PHP 7.2]
$ sudo yum-config-manager --enable remi-php73   [Install PHP 7.3]

4. Next, install PHP 7.x on CentOS 7 with the required modules needed by Snipe-IT.

$ sudo yum install httpd mariadb mariadb-server 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

5. After the LAMP stack installation completes, start the web server for the mean time, and enable it to start on the next system boot with the following command.

$ sudo systemctl start enable status httpd     

6. Next, you need to secure and harden your MySQL installation using the following command.  

$ sudo mysql_secure_installation 

7. Finally start MySQL server and enable it to start at the next system boot.

$ sudo systemctl start mysql

8. Now log in to the MariaDB shell and create a database for Snipe-IT, a database user and set a suitable password for the user as follows.

$ mysql -u root -p

Provide the password for the MariaDB root user.

MariaDB [(none)]> CREATE DATABASE snipeit_db;
MariaDB [(none)]> CREATE USER 'snipeituser'@'localhost' IDENTIFIED BY 'P@ssword123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON snipeit_db.* TO 'snipeituser'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit

9. Now you need to install Composer – a dependency manager for PHP, with the commands below.

$ sudo curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

10. First install Git to fetch and clone the latest version of Snipe-IT under Apache web-root directory.


$ sudo yum -y install git      

$ cd  /var/www/
$ sudo git clone https://github.com/snipe/snipe-it.git

11. Now go into the snipe-it directory and rename the .env.example file to .env.

$ cd snipe-it
$ ls
$ sudo mv .env.example .env

12. Next, configure the snipe-it environment, here you’ll provide the database connection settings and many more.

First open the .env file.

$ sudo vi .env

Then Find and change the following variables according to instructions given.


APP_URL=http://192.168.1.2/setup         #set your domain name or IP address
APP_KEY=                                                #set your app key
DB_HOST=localhost                                #set it to localhost
DB_DATABASE=snipeit_db                    #set the database name
DB_USERNAME=snipeituser                 #set the database username
DB_PASSWORD=password                   #set the database user password

Save and close the file.

13. Now you need to set the appropriate permissions on certain directories as follows.

$ sudo chmod -R 755 storage 
$ sudo chmod -R 755 public/uploads

$sudo chown -R apache:apache storage public/uploads     

14. Next, install all the dependencies required by PHP using Composer dependency manager as follows.

$ sudo composer install --no-dev –prefer-source

15. Now you can generate the “APP_KEY” value with the following command (this will be set automatically in the .env file).

$ sudo php artisan key:generate

16. Now, you need to create a virtual host file on the web server for Snipe-IT.


$ sudo vi /etc/httpd/conf.d/snipeit.example.com.conf 

Then add/modify the line below in your Apache config file (use your server IP address here).

<VirtualHost 192.168.1.2:80>
    ServerName 192.168.1.2
    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>
Save and close the file.


17. Lastly, restart Apache web server to take new changes into effect.


$ sudo systemctl restart httpd      

18. Now open your web browser and enter the URL: http://192.168.1.2 to view the Snipe-IT web installation interface.

First you will see the Pre-Flight Check page below, click Next: Create Database Tables.


0 nhận xét:

Post a Comment