Instal Inventaris OCS-NG di Fedora 30/Fedora 29

Dalam panduan ini, kita akan mempelajari cara menginstal OCS-NG Inventory di Fedora 30/Fedora 29. OCS (Open Computer and Software) Inventory Next Generation adalah alat opensource yang digunakan untuk menginventarisasi aset TI. Itu digunakan dalam arsitektur server-agen di mana agen OCS NG diinstal pada aset untuk menjadi inventaris untuk mengumpulkan informasi tentang aset itu. Dalam kasus di mana agen tidak dapat diinstal seperti di router, switch, SNMP dapat digunakan untuk mengumpulkan informasi aset.

Instal Inventaris OCS-NG di Fedora 30/Fedora 29

Dalam panduan ini, kita akan menginstal OCS-NG Inventory di Fedora 30/Fedora 29 dengan membangunnya dari kode sumber. Oleh karena itu, pastikan bahwa sistem Anda memenuhi prasyarat berikut sebelum Anda dapat melanjutkan untuk menginstal inventaris OCS.

Prasyarat

Inventaris OCS-NG berjalan di atas Stack LAMP/LEMP. Ini juga membutuhkan sejumlah Perpustakaan Perl dan ekstensi PHP. Periksa seluruh daftar Pustaka dan modul yang diperlukan di halaman prasyarat.

Perbarui paket sistem Anda

dnf update

Untuk menginstal semua pustaka dan modul yang diperlukan untuk Inventaris OCS, jalankan perintah di bawah ini;

Instal server Web Apache

dnf install httpd -y

Instal Server Database MariaDB

dnf install mariadb mariadb-server -y

Instal PHP dan Ekstensi yang Diperlukan

Nah, versi PHP yang tersedia di Fedora 30/Fedora 29 adalah PHP 7.3. Dalam panduan ini, kita akan menjalankan OCS Inventory dengan PHP 7.2. Mengapa kami menggunakan PHP 7.2? Dengan PHP 7.3, inventaris OCS memberi saya dasbor kosong dan macetProcessing… itulah alasan mengapa kami kembali menggunakan PHP 7.2. Jika Anda tahu cara memperbaiki masalah ini, silakan tinggalkan di bagian komentar di bawah.

Untuk menginstal PHP 7.2 di Fedora 30/29, Anda perlu menginstal repositori Remi.

Fedora 30

dnf install http://rpms.remirepo.net/fedora/remi-release-30.rpm -y

Fedora 29

dnf install http://rpms.remirepo.net/fedora/remi-release-29.rpm -y

Selanjutnya, instal PHP dan modul PHP yang diperlukan dari repositori Remi.

dnf --enablerepo=remi install php72 php72-{php-domxml,php-gd,php-imap,php-ldap,php-mbstring,php-mysqlnd,php-opcache,php-pdo,php-pear,php-pecl-apcu,php-pecl-zip,php-soap,php-xmlrpc,php-gd,php-xml,php-zip,php-fpm,php-bcmath,php-intl}

Instal Perl dan Bangun Alat

Jalankan perintah di bawah ini untuk menginstal Perl, modul Perl, dan alat bantu yang diperlukan.

dnf install -y make gcc perl-Archive-Zip perl-Compress-Zlib perl-DBD-MySQL perl-DBI perl-Mojolicious perl-Net-IP perl-Plack perl-SOAP-Lite perl-Switch perl-XML-Entities perl-XML-Simple perl-Apache-DBI perl-Digest-SHA1 perl-Apache2-SOAP

Izinkan Apache di FirewallD

firewall-cmd --permanent --add-service=http firewall-cmd --reload

Mulai dan Aktifkan service Apache, MariaDB dan PHP-FPM.

systemctl start httpd mariadb php72-php-fpm systemctl enable httpd mariadb php72-php-fpm

Untuk melakukan keamanan basis data awal, jalankan skrip aman MySQL.

mysql_secure_installation

Buat Database OCS dan Pengguna Database

Login ke MariaDB dan buat database OCS. ocsweb adalah database default yang digunakan oleh inventaris OCS.

mysql -u root -p
create database ocsweb;

Buat user basis data OCS dan berikan semua hak istimewa pada basis data OCS. ocsadalah user database default yang digunakan oleh inventaris OCS. Kata sandi default adalahocs.

grant all on ocsweb.* to [email protected] identified by '[email protected]';

Reload tabel hak istimewa dan keluar dari koneksi database.

flush privileges; quit

Anda dapat memeriksa ocsdb-import.log untuk masalah impor data OCS.

Download Arsip Server Inventaris OCS-NG

Arahkan ke halaman downloadan OCS dan download Server OCS. Anda cukup menjalankan perintah di bawah ini untuk mengambil OCS 2.6.

wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.6/OCSNG_UNIX_SERVER_2.6.tar.gz

Setelah downloadan selesai, ekstrak arsipnya.

tar xzf OCSNG_UNIX_SERVER_2.6.tar.gz

Instal Inventaris OCS

Arahkan ke direktori sumber Server OCS dan jalankan perintah di bawah ini untuk menjalankan instalasi.

cd OCSNG_UNIX_SERVER_2.6/
sh setup.sh

Setelah penginstal berjalan, ikuti petunjuk untuk menginstal inventaris OCS-NG yang sesuai. tekanENTER untuk menerima default.

+----------------------------------------------------------+ | | | Welcome to OCS Inventory NG Management server setup ! | | | +----------------------------------------------------------+ Trying to determine which OS or Linux distribution you use +----------------------------------------------------------+ | Checking for Apache web server binaries !				| +----------------------------------------------------------+ CAUTION: If upgrading Communication server from OCS Inventory NG 1.0 RC2 and previous, please remove any Apache configuration for Communication Server! Do you wish to continue ([y]/n)?y Assuming Communication server 1.0 RC2 or previous is not installed on this computer. Starting OCS Inventory NG Management server setup from folder /root/OCSNG_UNIX_SERVER_2.6 Storing log in file /root/OCSNG_UNIX_SERVER_2.6/ocs_server_setup.log +----------------------------------------------------------+ | Checking for database server properties...			 | +----------------------------------------------------------+ Your MySQL client seems to be part of MySQL version 10.3. Your computer seems to be running MySQL 4.1 or higher, good ;-) Which host is running database server [localhost] ? OK, database server is running on host localhost ;-) On which port is running database server [3306] ? OK, database server is running on port 3306 ;-) +----------------------------------------------------------+ | Checking for Apache web server daemon...				| +----------------------------------------------------------+ Where is Apache daemon binary [/usr/sbin/httpd] ? OK, using Apache daemon /usr/sbin/httpd ;-) +----------------------------------------------------------+ | Checking for Apache main configuration file...		 | +----------------------------------------------------------+ Where is Apache main configuration file [/etc/httpd/conf/httpd.conf] ? OK, using Apache main configuration file /etc/httpd/conf/httpd.conf ;-) +----------------------------------------------------------+ | Checking for Apache user account...					 | +----------------------------------------------------------+ Which user account is running Apache web server [apache] ? OK, Apache is running under user account apache ;-) +----------------------------------------------------------+ | Checking for Apache group...							| +----------------------------------------------------------+ Which user group is running Apache web server [apache] ? OK, Apache is running under users group apache ;-) +----------------------------------------------------------+ | Checking for Apache Include configuration directory... | +----------------------------------------------------------+ Setup found Apache Include configuration directory in /etc/httpd/conf.d. Setup will put OCS Inventory NG Apache configuration in this directory. Where is Apache Include configuration directory [/etc/httpd/conf.d] ? OK, Apache Include configuration directory /etc/httpd/conf.d found ;-) +----------------------------------------------------------+ | Checking for PERL Interpreter...						| +----------------------------------------------------------+ Found PERL interpreter at </usr/bin/perl> ;-) Where is P
ERL interpreter binary [/usr/bin/perl] ? OK, using PERL interpreter /usr/bin/perl ;-) Do you wish to setup Communication server on this computer ([y]/n)?y +----------------------------------------------------------+ | Checking for Make utility... | +----------------------------------------------------------+ OK, Make utility found at </usr/bin/make> ;-) +----------------------------------------------------------+ | Checking for Apache mod_perl version... | +----------------------------------------------------------+ Checking for Apache mod_perl version 1.99_22 or higher Found that mod_perl version 1.99_22 or higher is available. OK, Apache is using mod_perl version 1.99_22 or higher ;-) +----------------------------------------------------------+ | Checking for Communication server log directory... | +----------------------------------------------------------+ Communication server can create detailed logs. This logs can be enabled by setting integer value of LOGLEVEL to 1 in Administration console menu Configuration. Where to put Communication server log directory [/var/log/ocsinventory-server] ? OK, Communication server will put logs into directory /var/log/ocsinventory-server ;-) +----------------------------------------------------------------------------+ | Checking for Communication server plugins configuration directory... | +----------------------------------------------------------------------------+ Communication server need a directory for plugins configuration files. Where to put Communication server plugins configuration files [/etc/ocsinventory-server/plugins] ? OK, Communication server will put plugins configuration files into directory /etc/ocsinventory-server/plugins ;-) +-------------------------------------------------------------------+ | Checking for Communication server plugins perl directory... | +-------------------------------------------------------------------+ Communication server need a directory for plugins Perl modules files. Where to put Communication server plugins Perl modules files [/etc/ocsinventory-server/perl] ? OK, Communication server will put plugins Perl modules files into directory /etc/ocsinventory-server/perl ;-) +----------------------------------------------------------+ | Checking for required Perl Modules...					| +----------------------------------------------------------+ Checking for DBI PERL module... Found that PERL module DBI is available. Checking for Apache::DBI PERL module... Found that PERL module Apache::DBI is available. Checking for DBD::mysql PERL module... Found that PERL module DBD::mysql is available. Checking for Compress::Zlib PERL module... Found that PERL module Compress::Zlib is available. Checking for XML::Simple PERL module... Found that PERL module XML::Simple is available. Checking for Net::IP PERL module... Found that PERL module Net::IP is available. Checking for SOAP::Lite Perl module... Found that PERL module SOAP::Lite is available. Checking for Archive::Zip Perl module... Found that PERL module Archive::Zip is available. +----------------------------------------------------------+ | Checking for optional Perl Modules... | +----------------------------------------------------------+ Checking for Apache2::SOAP PERL module... Found that PERL module SOAP::Apache2 is available. Checking for XML::Entities PERL module... Found that PERL module XML::Entities is available. Do you wish to setup Rest API server on this computer ([y]/n)?y +----------------------------------------------------------+ | Checking for REST API Dependencies... 		 | +----------------------------------------------------------+ Found that PERL module Mojolicious::Lite is available. Found that PERL module Switch is available. Found that PERL module Plack::Handler is available. +----------------------------------------------------------+ | Configuring REST API Server files... 		 | +----------------------------------------------------------+ Where do you want the API code to be store [/usr/lib64/perl5/vendor_perl] ? Copying files to /usr/lib64/perl5/vendor_perl +----------------------------------------------------------+ | Configuring REST API Server configuration files... 		 | +----------------------------------------------------------+ +----------------------------------------------------------+ | OK, looks good ;-) | | | | Configuring Communication server Perl modules... | +----------------------------------------------------------+ Checking if your kit is complete... Looks good Generating a Unix-style Makefile Writing Makefile for Apache::Ocsinventory Writing MYMETA.yml and MYMETA.json +----------------------------------------------------------+ | OK, looks good ;-) | | | | Preparing Communication server Perl modules... | +----------------------------------------------------------+ +----------------------------------------------------------+ | OK, prepare finshed ;-) | | | | Installing Communication server Perl modules... | +----------------------------------------------------------+ +----------------------------------------------------------+ | OK, Communication server Perl modules install finished;-)| | | | Creating Communication server log directory... | +----------------------------------------------------------+ Creating Communication server log directory /var/log/ocsinventory-server. Fixing Communication server log directory files permissions. Configuring logrotate for Communication server. Removing old communication server logrotate file /etc/logrotate.d/ocsinventory-NG Writing communication server logrotate to file /etc/logrotate.d/ocsinventory-server +----------------------------------------------------------------------+ | OK, Communication server log directory created ;-) | | | | Creating Communication server plugins configuration directory... | +----------------------------------------------------------------------+ Creating Communication server plugins configuration directory /etc/ocsinventory-server/plugins. +----------------------------------------------------------------------+ | OK, Communication server plugins configuration directory created ;-) | | | | Creating Communication server plugins Perl directory... | +----------------------------------------------------------------------+ Creating Communication server plugins Perl directory /etc/ocsinventory-server/perl. +----------------------------------------------------------------------+ | OK, Communication server plugins Perl directory created ;-) | | | | Now configuring Apache web server... | +----------------------------------------------------------------------+ To ensure Apache loads mod_perl before OCS Inventory NG Communication Server, Setup can name Communication Server Apache configuration file 'z-ocsinventory-server.conf' instead of 'ocsinventory-server.conf'. Do you allow Setup renaming Communication Server Apache configuration file to 'z-ocsinventory-server.conf' ([y]/n) ?y OK, using 'z-ocsinventory-server.conf' as Communication Server Apache configuration file Removing old communication server configuration to file /etc/httpd/conf.d/ocsinventory.conf Writing communication server configuration to file /etc/httpd/conf.d/z-ocsinventory-server.conf +----------------------------------------------------------------------+ | OK, Communication server setup successfully finished ;-) | | | | Please, review /etc/httpd/conf.d/z-ocsinventory-server.conf | | to ensure all is good. Then restart Apache daemon. | +----------------------------------------------------------------------+ Do you wish to setup Administration Server (Web Administration Console) on this computer ([y]/n)?y +----------------------------------------------------------+ | Checking for Administration Server directories... | +----------------------------------------------------------+ CAUTION: Setup now install files in accordance with Filesystem Hierarchy Standard. So, no file is installed under Apache root document directory (Refer to Apache configuration files to locate it). If you're upgrading from OCS Inventory NG Server 1.01 and previous, YOU MUST REMOVE (or move) directories 'ocsreports' and 'download' from Apache root document directory. If you
choose to move directory, YOU MUST MOVE 'download' directory to Administration Server writable/cache directory (by default /var/lib/ocsinventory-reports), especially if you use deployment feature. Do you wish to continue ([y]/n)?y Assuming directories 'ocsreports' and 'download' removed from Apache root document directory. Where to copy Administration Server static files for PHP Web Console [/usr/share/ocsinventory-reports] ? OK, using directory /usr/share/ocsinventory-reports to install static files ;-) Where to create writable/cache directories for deployment packages, administration console logs, IPDiscover and SNMP [/var/lib/ocsinventory-reports] ? OK, writable/cache directory is /var/lib/ocsinventory-reports ;-) +----------------------------------------------------------+ | Checking for required Perl Modules... | +----------------------------------------------------------+ Checking for DBI PERL module... Found that PERL module DBI is available. Checking for DBD::mysql PERL module... Found that PERL module DBD::mysql is available. Checking for XML::Simple PERL module... Found that PERL module XML::Simple is available. Checking for Net::IP PERL module... Found that PERL module Net::IP is available. +----------------------------------------------------------+ | Installing files for Administration server... | +----------------------------------------------------------+ Creating PHP directory /usr/share/ocsinventory-reports/ocsreports. Copying PHP files to /usr/share/ocsinventory-reports/ocsreports. Fixing permissions on directory /usr/share/ocsinventory-reports/ocsreports. Creating database configuration file /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php. Creating IPDiscover directory /var/lib/ocsinventory-reports/ipd. Fixing permissions on directory /var/lib/ocsinventory-reports/ipd. Creating packages directory /var/lib/ocsinventory-reports/download. Fixing permissions on directory /var/lib/ocsinventory-reports/download. Creating snmp mibs directory /var/lib/ocsinventory-reports/snmp. Fixing permissions on directory /var/lib/ocsinventory-reports/snmp. Creating Administration server log files directory /var/lib/ocsinventory-reports/logs. Fixing permissions on directory /var/lib/ocsinventory-reports/logs. Creating Administration server scripts log files directory /var/lib/ocsinventory-reports/scripts. Fixing permissions on directory /var/lib/ocsinventory-reports/scripts. Configuring IPDISCOVER-UTIL Perl script. Installing IPDISCOVER-UTIL Perl script. Fixing permissions on IPDISCOVER-UTIL Perl script. Writing Administration server configuration to file /etc/httpd/conf.d/ocsinventory-reports.conf +----------------------------------------------------------------------+ | OK, Administration server installation finished ;-) | | | | Please, review /etc/httpd/conf.d/ocsinventory-reports.conf | to ensure all is good and restart Apache daemon. | | | | Then, point your browser to http://server//ocsreports | to configure database server and create/update schema. | +----------------------------------------------------------------------+ Setup has created a log file /root/OCSNG_UNIX_SERVER_2.6/ocs_server_setup.log. Please, save this file. If you encounter error while running OCS Inventory NG Management server, we can ask you to show us its content ! DON'T FORGET TO RESTART APACHE DAEMON ! Enjoy OCS Inventory NG ;-)

Setelah instalasi selesai, Anda dapat memeriksa file log instalasi untuk masalah apa pun. File log tersedia di bawah;

$HOME/OCSNG_UNIX_SERVER_2.6/ocs_server_setup.log

Konfigurasikan Server Web OCS

Selanjutnya, Anda perlu mengkonfigurasi pengaturan koneksi database pada file konfigurasi server web OCS.

vim /etc/httpd/conf.d/z-ocsinventory-server.conf
... # Master Database settings # Replace localhost by hostname or ip of MySQL server for WRITE PerlSetEnv OCS_DB_HOST localhost # Replace 3306 by port where running MySQL server, generally 3306 PerlSetEnv OCS_DB_PORT 3306 # Name of database PerlSetEnv OCS_DB_NAME ocsweb PerlSetEnv OCS_DB_LOCAL ocsweb # User allowed to connect to database PerlSetEnv OCS_DB_USER ocs # Password for user PerlSetVar OCS_DB_PWD [email protected]...
vim /etc/httpd/conf.d/zz-ocsinventory-restapi.conf
... <Perl> $ENV{PLACK_ENV} = 'production'; $ENV{MOJO_HOME} = '/usr/share/perl5/vendor_perl'; $ENV{MOJO_MODE} = 'deployment'; $ENV{OCS_DB_HOST} = 'localhost'; $ENV{OCS_DB_PORT} = '3306'; $ENV{OCS_DB_LOCAL} = 'ocsweb'; $ENV{OCS_DB_USER} = 'ocs'; $ENV{OCS_DB_PWD} = '[email protected]'; </Perl>...

Demikian pula, buka /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php file konfigurasi dan perbarui password basis data Inventaris OCS.

vim /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php
... define("DB_NAME", "ocsweb"); define("SERVER_READ", "localhost"); define("SERVER_WRITE", "localhost"); define("COMPTE_BASE", "ocs"); define("PSWD_BASE", "[email protected]"); ?>

Tetapkan izin dan kepemilikan yang tepat dari file konfigurasi Server Web OCS.

chmod -R 766 /usr/share/ocsinventory-reports chown -R apache:apache /usr/share/ocsinventory-reports/ chown -R apache:apache /var/lib/ocsinventory-reports/

Konfigurasikan SELinux untuk mengaktifkan OCS-NG agar dapat diakses dari Internet.

chcon -R -t httpd_sys_rw_content_t /usr/share/ocsinventory-reports/

Mulai ulang service Apache, MariaDB, dan PHP-FPM.

systemctl restart httpd mariadb.service php72-php-fpm.service

Selesaikan penyiapan inventaris OCS dengan menavigasi ke http://server-hostname-or-IP/ocsreports.

Konfigurasikan koneksi database Inventaris OCS dan klik Send.

Jika kredensial basis data yang disediakan baik-baik saja, penginstalan akan berhasil.

Untuk masuk ke gui inventaris OCS, klik Click here to enter OCS-NG GUI. KlikPerform the update untuk memperbarui basis data.

Sebelum Anda dapat masuk ke inventaris OCS, buat cadangan atau hapus file instalasi OCS-NG dari server.

mv /usr/share/ocsinventory-reports/ocsreports/install.php /usr/share/ocsinventory-reports/ocsreports/install.php.original

Selanjutnya, klik Click here to enter OCS-NG GUI untuk membuka interface masuk inventaris OCS.

Gunakan kredensial admin untuk password dan nama user.

Setelah Anda masuk, pastikan untuk mengganti nama password dengan mengklik Settings gear > My account > Password. 

Itu saja tentang menginstal Inventaris OCS-NG di Fedora 30/Fedora 29. Dalam panduan berikutnya, kita akan belajar cara menginstal agen inventaris OCS-NG.

Referensi:

Dokumentasi Inventaris OCS-NG

Tutorial Terkait

Instal Snipe-IT di Debian 10/Ubuntu 18.04

Instal LAMP Stack di Fedora 30

Instal LAMP Stack di Fedora 28/29