Martes, Oktubre 10, 2017

Snipe IT Installation Guide

Snipe IT Installation Guide






Snipe-IT is a free and open source web application for IT assets management. It is written on the Laravel 5.2 framework and uses MySQL to store its data. Snipe-IT is a complete and comprehensive solution for assets management, software license management, and much more.
In this tutorial, you will learn to install Snipe-IT on Ubuntu 16.10.
Step 1: System update
Before installing any packages on the Ubuntu server instance, it is recommended to update the system. Log in using the sudo user and run the following commands to update the system.
sudo apt-get update
sudo apt-get -y upgrade
Step 2: Install Apache web server
sudo apt-get -y install apache2
Start Apache and enable it to automatically run at boot time.
sudo systemctl start apache2
sudo systemctl enable apache2


Step 3: Install PHP 5.6
Snipe-IT is compatible with any version of PHP greater than 5.5.9. Since PHP 5.5 has reached end of life, you can install PHP 7. Run the following command to install PHP 7 with the modules required by Snipe-IT.
sudo apt-get -y install php php-pdo php-mbstring php-tokenizer php-curl php-mysql php-ldap php-zip php-fileinfo php-gd php-dom php-mcrypt
Step 4: Install MariaDB
MariaDB is a fork of MySQL. Install it using following command.
sudo apt-get -y install mariadb-server
Start MariaDB and enable it to automatically start at boot time.
sudo systemctl start mysql
sudo systemctl enable mysql
Secure your MariaDB installation.
sudo mysql_secure_installation
You will be asked for the current MariaDB root password. As we have just installed MariaDB, its root password has not been set. Press the enter key to proceed. Set a strong root password for your MariaDB server and answer Y to all of the other questions asked. The questions asked are self explanatory.
Step 5: Create database for Snipe-IT
Log into the MariaDB shell as its root user using the following command.
mysql -u root -p
Provide the password for the MariaDB root user.
Run the following queries to create a database and a database user for Snipe-IT.
CREATE DATABASE snipeit_data;
CREATE USER 'snipeit_user'@'localhost' IDENTIFIED BY 'rc@nys';
GRANT ALL PRIVILEGES ON snipeit_data.* TO 'snipeit_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Make sure that you use a semicolon at the end of each query above. You can replace the database name "snipeit_data" and username "snipeit_user" according to your needs. Be sure to change "StrongPassword" to a very strong password.
Step 6: Install Composer
Install Composer using the following command. Composer is a dependency manager for PHP.
cd ~
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Step 7: Install Snipe-IT
First, install Git.
sudo apt-get -y install git
Switch to Apache's web-root folder and clone the latest version of Snipe-IT.
cd /var/www/html
sudo git clone https://github.com/snipe/snipe-it snipe-it
Create the .env file from example file provided.
cd /var/www/html/snipe-it
sudo cp .env.example .env
Edit the .env file.
sudo nano .env
Find the following lines and edit the values according to instructions provided.
APP_URL=http://snipe.arcanys.com
APP_TIMEZONE='Asia/Manila'
DB_DATABASE=snipeit_data
DB_USERNAME=snipeit_user
DB_PASSWORD=rc@nys
Leave the default values for all of the other parameters. Save the file and exit the text editor.
Provide the appropriate ownership and file permissions.
sudo chown -R www-data:www-data storage public/uploads
sudo chmod -R 755 storage
sudo chmod -R 755 public/uploads
Install PHP dependencies using Composer.
sudo composer install --no-dev --prefer-source
Generate the "APP_Key".
sudo php artisan key:generate
Allow HTTP traffic on port 80 through the firewall.
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload
Step 8: Create virtual host
Run the following command to create a virtual host for your Snipe-IT site.
sudo nano /etc/apache2/sites-available/snipeit.arcanys.com.conf
Add the following lines into the file, then save the file.
<VirtualHost *:80>
   ServerName snipeit.example.com
   DocumentRoot /var/www/html/snipe-it/public
   <Directory /var/www/html/snipe-it/public>
       Options Indexes FollowSymLinks MultiViews
       AllowOverride All
       Order allow,deny
       allow from all
   </Directory>
</VirtualHost>
Activate the configuration and enable mod_rewrite using the following commands.
sudo a2ensite snipeit.example.com.conf
sudo a2enmod rewrite
Restart Apache.
sudo systemctl restart apache2
Step 9: Finish installation
Your Snipe-IT installation is now complete. You can finish configuring Snipe-IT through your web browser. Navigate to the following link snipe.arcanys.com
http://snipe.arcanys.com

Reference :








Current running .env (Config file  /var/www/html/snipe-it/.env)
# --------------------------------------------
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------
APP_ENV=production
APP_DEBUG=false
APP_KEY=base64:gmgfsD69w5ZwrqV2+O4QuHrMdL5WANVtyeXarwLiX+E=
APP_URL='http://snipe.arcanys.com'
APP_TIMEZONE='Asia/Manila'
APP_LOCALE=en


# --------------------------------------------
# REQUIRED: DATABASE SETTINGS
# --------------------------------------------
DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=snipeit_data
DB_USERNAME=snipeit_user
DB_PASSWORD=rc@nys
DB_PREFIX=null
DB_DUMP_PATH='/usr/bin'

# --------------------------------------------
# OPTIONAL: SSL DATABASE SETTINGS
# --------------------------------------------
DB_SSL=false
DB_SSL_KEY_PATH=null
DB_SSL_CERT_PATH=null
DB_SSL_CA_PATH=null
DB_SSL_CIPHER=null


# --------------------------------------------
# REQUIRED: OUTGOING MAIL SERVER SETTINGS
# --------------------------------------------
MAIL_DRIVER=smtp
MAIL_HOST=email-smtp.us-west-2.amazonaws.com
MAIL_PORT=587
MAIL_USERNAME=YOURUSERNAME
MAIL_PASSWORD=YOURPASSWORD
MAIL_ENCRYPTION=null
MAIL_FROM_ADDR=you@example.com
MAIL_FROM_NAME='Snipe-IT'
MAIL_REPLYTO_ADDR=you@example.com
MAIL_REPLYTO_NAME='Snipe-IT'


# --------------------------------------------
# REQUIRED: IMAGE LIBRARY
# This should be gd or imagick
# --------------------------------------------
IMAGE_LIB=gd


# --------------------------------------------
# OPTIONAL: SESSION SETTINGS
# --------------------------------------------
SESSION_LIFETIME=12000
EXPIRE_ON_CLOSE=false
ENCRYPT=false
COOKIE_NAME=snipeit_session
COOKIE_DOMAIN=null
SECURE_COOKIES=false


# --------------------------------------------
# OPTIONAL: CACHE SETTINGS
# --------------------------------------------
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync


# --------------------------------------------
# OPTIONAL: AWS S3 SETTINGS
# --------------------------------------------
AWS_SECRET=null
AWS_KEY=null
AWS_REGION=null
AWS_BUCKET=null

# --------------------------------------------
# OPTIONAL: LOGIN THROTTLING
# --------------------------------------------
LOGIN_MAX_ATTEMPTS=5
LOGIN_LOCKOUT_DURATION=60

# --------------------------------------------
# OPTIONAL: MISC
# --------------------------------------------
APP_LOG=single
APP_LOCKED=false
FILESYSTEM_DISK=local
APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1
ALLOW_IFRAMING=false







LDAP Settings (Admin > Settings)



Installation Guide for Icinga2

Installation Guide for Icinga2
(Server and Service Monitoring)



Introduction
Icinga Web 2 is the next generation open source monitoring web interface, framework and command-line interface developed by the Icinga Project, supporting Icinga 2, Icinga Core and any other monitoring backend compatible with the IDO database.


Step 1: Update the system

Log in from an SSH terminal as a sudo user, and then update the system to the latest stable status using the following commands:
sudo apt-get update -y
After the reboot, use the same sudo user to log in.

Step 2: Install Apache

Install Apache using the following command:
sudo apt-get install apache2 -y
Delete the default Ubuntu Apache welcome page:
sudo rm /var/www/html/index.html
For security purposes, you should prohibit Apache from exposing files and directories within the web root directory /var/www/html to visitors:
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/apache2/apache2.conf
Start the Apache service and get it started on boot:
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

Step 3: Configure the UFW firewall

By default, the UFW firewall is disabled on a newly deployed Vultr Ubuntu 16.04 server instance. Use the following commands to enable the UFW firewall and to allow inbound traffic of SSH, HTTP, and HTTPS:
sudo ufw app list
sudo ufw allow OpenSSH
sudo ufw allow in "Apache Full"
sudo ufw enable

Step 4: Install MariaDB

4.1) Use the following command to install MariaDB:
sudo apt-get install mariadb-client mariadb-server -y
4.2) Start the MariaDB service:
sudo systemctl start mysql.service
sudo systemctl enable mysql.service
4.3) Secure the installation of MariaDB:
sudo /usr/bin/mysql_secure_installation
During the interactive process, answer questions one by one as below:
Enter current password for root (enter for none): Enter
Set root password? [Y/n]: Y
New password: <your-password>
Re-enter new password: <your-password>
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y
Note: Replace <your-password> with your own MySQL root password.
4.4) Modify the authentication plugin of MySQL root user:
sudo mysql -u root -p
Use the MariaDB root password you set earlier to log in.
In the MySQL shell:
UPDATE mysql.user SET authentication_string=PASSWORD('<your-password>'), plugin='mysql_native_password' WHERE user='root';
FLUSH PRIVILEGES;
EXIT;
Note: Replace <your-password> with your own MySQL root password.

Step 5: Install PHP

Install PHP 7.0 and several extensions for Icinga 2 and Icinga Web 2:
sudo apt-get install php7.0 libapache2-mod-php7.0 php7.0-gd php7.0-intl php7.0-xml php7.0-ldap php7.0-mysql php7.0-pgsql php-imagick -y
Install the current version of Composer:
cd
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Note: The above commands may be out of date in the future, so you should always get the latest version from the Composer official website.
As a matter of convenience, move the Composer script composer.phar to /usr/local/bin and rename it composer:
sudo mv ~/composer.phar /usr/local/bin/composer
Install zip and unzip:
sudo apt-get install zip unzip -y
Install the ZendFramework Db component using Composer:
composer require zendframework/zend-db
Then you need to setup the proper timezone for your machine, which can be determined from the PHP official website. For example, if your server instance resides in the Vultr Los Angeles datacenter, then the timezone value for it is America/Los_Angeles.
Open the PHP configuration file with the vi editor:
sudo vi /etc/php/7.0/apache2/php.ini
Find the line:
;date.timezone =
Change it to:
date.timezone = America/Los_Angeles
Save and quit:
:wq!
Restart the Apache service in order to put new settings into effect:
sudo systemctl restart apache2.service

Step 6: Install Icinga 2 and its plugins

Setup the Icinga APT repo:
cd
wget -O - http://packages.icinga.org/icinga.key | sudo apt-key add -
sudo add-apt-repository 'deb http://packages.icinga.org/ubuntu icinga-xenial main'
sudo apt-get update
Install Icinga 2 and several plugins using the Icinga APT repo:
sudo apt-get install icinga2 nagios-plugins -y
To learn more about Icinga 2 plugins, please visit the Monitoring Plugins Project website.
Start the Icinga 2 service:
sudo systemctl start icinga2.service
sudo systemctl enable icinga2.service
By default, the Icinga 2 program will enable three features: checker, mainlog, and notification. You can confirm that using the following command:
sudo icinga2 feature list

Step 7: Setup the Icinga 2 IDO modules

7.1) Install the IDO (Icinga Data Output) modules for MySQL
sudo apt-get install icinga2-ido-mysql
In the Configuring icinga2-ido-mysql wizard, when being asked whether you want to enable Icinga 2's ido-mysql feature, choose <No>. We will manually enable this feature later.
When being asked whether you want to configure a database for icinga2-ido-mysql, choose <No>. Instead, you can manually create a database as explained in step 7.2.
7.2) Create a database for Icinga 2
Log into the MySQL shell as root:
sudo mysql -u root -p
Use the MariaDB root password you set in step 4 to log in.
In the MySQL shell, create a database named icinga and a database user named icinga with the password icinga, and then grant privileges on this database to this database user.
CREATE DATABASE icinga;
GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';
FLUSH PRIVILEGES;
EXIT;
7.3) Import the Icinga 2 IDO schema
sudo mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql
When prompted, input the MariaDB root password to finish the job.
7.4) Enable the IDO MySQL module
sudo vi /etc/icinga2/features-available/ido-mysql.conf
Find these lines:
user = "icinga2",
password = "",
host = "localhost",
database = "icinga2"
Modify them as below:
user = "icinga"
password = "icinga"
host = "localhost"
database = "icinga"
Save and quit:
:wq!
Enable the ido-mysql feature:
sudo icinga2 feature enable ido-mysql
sudo systemctl restart icinga2.service

Step 8: Install Icinga Web 2

8.1) Setup external command pipe
sudo icinga2 feature enable command
sudo systemctl restart icinga2.service
sudo icinga2 feature list
Before you can send commands to Icinga 2 using a web interface, you need to add the www-data user to the icingacmd group:
sudo groupadd icingacmd
sudo usermod -a -G icingacmd www-data
Use the following command to confirm your setup:
id www-data
8.2) Install Icinga Web 2 packages
sudo apt-get install icingaweb2 icingaweb2-module-monitoring icingaweb2-module-doc icingacli -y
Point the Apache web root directory to a location specified by Icinga Web 2:
sudo icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public
sudo systemctl restart apache2.service
8.3) Setup Icinga Web 2 database
sudo mysql -u root -p

CREATE DATABASE icingaweb2;
EXIT;
8.4) Load the Icinga Web 2 database schema
mysql -u root -p icingaweb2 < /usr/share/icingaweb2/etc/schema/mysql.schema.sql
8.5) Generate a setup token for later use in the Icinga Web 2 web installation wizard
sudo icingacli setup token create
8.6) Initiate the Icinga 2 installation wizard in the web interface
Point your web browser to the following URL:
http://<your-serve-ip>/icingaweb2/setup
8.7) On the Welcome page, input the setup token you generated earlier, and then click the Next button.
8.8) On the Modules page, select one or more modules you want to enable (at least, the Monitoring module is required), and then click the Next button.
8.9) On the Requirements page, make sure that every required item is satisfied, and then click the Next button.
8.10) On the Authentication page, you need to choose the authentication method when accessing Icinga Web 2. Here, you can choose Database, and then click the Next button.
8.11) On the Database Resource page, fill out all required fields as below, and then click the Next button.
  • Resource Name*: icingaweb_db
  • Database Type*: MySQL
  • Host*: localhost
  • Database Name*: icingaweb2
  • Username*: root
  • Password*: <MariaDB-root-password>
8.12) On the Authentication Backend page, using the default backend name icingaweb2, click the Next button to move on.
8.13) On the Administration page, setup the first Icinga Web 2 administrative account (say it is icingaweb2admin) and password (say it is icingaweb2pass), and then click the Next button.
8.14) On the Application Configuration page, you can adjust application- and logging-related configuration options to fit your needs. For now, you can use the default values listed below and click the Next button to proceed.
  • Show Stacktraces: Checked
  • User Preference Storage Type*: Database
  • Logging Type*: Syslog
  • Logging Level*: Error
  • Application Prefix*: icingaweb2
8.15) On the Review page, double check your configuration, and then click the Next button.
8.16) On the Monitoring Module Configuration Welcome page, click the Next button.
8.17) On the Monitoring Backend page, use the default backend name icinga and backend type IDO, and then click the Next button.
8.18) On the Monitoring IDO Resource page, input IDO database details you setup earlier, and then click the Next button.
  • Resource Name*: icinga_ido
  • Database Type*: MySQL
  • Host*: localhost
  • Database Name*: icinga
  • Username*: icinga
  • Password*: icinga
8.19) On the Command Transport page, still use these default values listed below. Click the Next button to move on.
  • Transport Name*: icinga2
  • Transport Type*: Local Command File
  • Command File*: /var/run/icinga2/cmd/icinga2.cmd
8.20) On the Monitoring Security page, still use the default value:
  • Protected Custom Variables: *pw*,*pass*,community
Click the Next button to go to next page.
8.21) On the review page, double check your configuration, and then click the Finish button.
8.22) On the Congratulations! page, click the Login to Icinga Web 2 button to jump to the Icinga Web 2 login page. Use the Icinga Web 2 administrative account and password you setup earlier to log in.


Adding Server and Service to Monitor
  1. Go to /etc/icinga2/conf.d/
  2. You may copy config from other “arcanysweb.conf”
Sample :
// Host Declaration Block
//
object Host "www.arcanys.com" {
   // Define the host IPv4 Address
   address         = "54.169.181.159"
   // Define a basic functionality test
   // Hostalive does a basic ICMP ECHO to the target
   // specified in the address directive.
   check_command   = "hostalive"
}


//
// Service Declaration Block
// Service: HTTP
// Note: The address specified in the above directive
//       is carried into the service declaration
//       blocks via specifying the host_name variable
//
object Service "https" {
   host_name               = "www.arcanys.com"
   // Enable HTTPS checking
   vars.http_address = "54.169.181.159"
   vars.http_port = "443"
   vars.http_ssl           = "1"
   // Time till warning is issued
   vars.http_warn_time     = "5"
   // Time till critical notification
   vars.http_critical_time = "10"
   check_command           = "http"
}


// Service Declaration Block
// Service: SSL Cert Check
// Note: The address specified in the above directive
//       is carried into the service declaration                                                                                                                                                                                                                                                                                                                                                                                                                                          
//       blocks via specifying the host_name variable
//
object Service "ssl" {
   host_name                         = "www.arcanys.com"
   vars.ssl_addres                 = "54.169.181.159"
   vars.ssl_port                     = "443"
  vars.ssl_cert_valid_days_warn     = "30"
  vars.ssl_cert_valid_days_critical = "15"
   check_command                     = "ssl"
}


//
// Service Declaration Block
// Service: SSH
// Note: The address specified in the above directive
//       is carried into the service declaration
//       blocks via specifying the host_name variable
//
object Service "ssh" {
   host_name     = "www.arcanys.com"
   vars.ssh_address = "54.169.181.159"
   check_command = "ssh"
}


// EOF
You can check on the guide on the services and parameters that can be use.


3. Check config for errors, resolve if there are any errors.
service icinga2 checkconfig
4. Restart icinga2 service
service icinga2 restart
5. Check Icinga Web Dashboard, new server that was created should be displayed.


Enable Notifications
  1. Install ssmtp and utils
sudo apt-get install mailutils ssmtp -y
2. Configure sSMTP
Edit the /etc/ssmtp/ssmtp.conf. Uncomment FromLineOverride=YES and add your mailhub configuration. Here is a sample sSMTP config for a GMail SMTP:
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster


# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587
AuthUser=repos@arcanys.com
AuthPass=JunGw@p0
UseSTARTTLS=YES
# Where will the mail seem to come from?
rewriteDomain=arcanys.com


# The full hostname
hostname=TestPC


# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

3. Edit users.conf
/**
* The example user 'icingaadmin' and the example
* group 'icingaadmins'.
*/


object User "icingaadmin" {
 import "generic-user"


 display_name = "Icinga 2 Admin"
 groups = [ "icingaadmins" ]


 email = "alerts@arcanys.com"
}


object UserGroup "icingaadmins" {
 display_name = "Icinga 2 Admin Group"
}


4. Restart icinga2 service
service icinga2 restart


Sources :
https://docs.icinga.com/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/plugin-check-commands
---end---









Snipe IT Installation Guide

Snipe IT Installation Guide Snipe-IT is a free and open source web application for IT assets management. It is written on the Laravel 5...