1. 程式人生 > >Centos 7 安裝OCSInventory NG 2.3.1全記錄

Centos 7 安裝OCSInventory NG 2.3.1全記錄

zip ocsinventory

OCSInventory Server 安裝記錄

OS:centos 7 core

IP:192.168.8.108

hostname:OCSInventory


user root:ocsadmin

usr ocs:ocsadmin


yum install openssh  vim wget -y#ssh vim wget
yum update

關閉selinux

vim /etc/selinux/config
SELINUX=disable

關閉防火墻

systemctl stop firewalld.service
systemctl disable firewalld.service
reboot
yum install  make mod_perl php gcc httpd php-pclzip 
No package mod_perl available
No package php-pclzip

不急等會再安裝一次


安裝mariadb數據庫

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install mod_perl php-pclzip    #上面的那兩個包已經可以安裝上了
yum -y install mariadb-server mariadb    #安裝mariadb數據庫
systemctl start mariadb.service    #啟動數據庫
systemctl enable mariadb.service    #設置自己啟動
/usr/bin/mysql_secure_installation    #設置數據庫密碼第一個直接按回車,後面會提示讓你設置數據庫用戶root的密碼


更新php

rpm -Uvh http://download.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum repolist all
yum search yum-config-manager
yum install yum-utils
yum-config-manager --enable remi
yum-config-manager --enable remi-php71
yum update php*

繼續安裝各種包

yum install php-mbstring php-gd php-xml php-pecl-memcached php-mysql php-soap -y
yum -y install perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL perl-Net-IP perl-SOAP-Lite mod_perl perl-Digest-SHA1 perl-Test-Simple
systemctl enable httpd    設置httpd開機啟動
systemctl start httpd

啟動apache

安裝perl相關的包

yum install mod_perl perl-CPAN perl-Archive-Zip  perl-Net-IP perl-XML-Simple perl-SOAP-Lite.noarch perl-ExtUtils-Embed perl-XML-Entities
yum install perl-XML-SAX perl-Apache-DBI perl-Apache2-SOAP
yum install httpd-devel
#cpan
>install YAML
>install ModPerl::MM
>install Apache2::SOAP
>install Apache::DBI

安裝git

yum install git
cd /home/ocs/
 git clone https://github.com/OCSInventory-NG/OCSInventory-Server.git OCSInventory-Server
cd OCSInventory-Server
git clone https://github.com/OCSInventory-NG/OCSInventory-ocsreports.git ocsreports

安裝OCSInventory 現在是2.3.1版本

./setup.sh



其中一個地方需要輸入路經

Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports]?/var/www/html/

其它一路回車就行

Enjoy OCS Inventory NG ;-) 出現
systemctl restart httpd.service


登陸


SECURITY ALERT!
Your install.php exists in your installation directory (by default : /usr/share/ocsinventory-reports/ocsreports).
The default SQL login/password is set on your database: ocsweb

此處錯誤

OCS的WIKI頁面有相關辦法

下面說一個棘手的問題

點擊OCSInventory Plugins頁面出現錯誤的解決辦法

當我們點到Plugins這個頁面時會出現以下提示,這是zip模塊沒有安裝


Please install the following modules in order to get this feature working :

- ZipArchive

安裝比較麻煩

下面提供一種zip模塊的安裝辦法

安裝zip模塊依賴於libzip 而yum安裝的libzip版太低無法和zip兼容所以

yum remove libzip #移除libzip yum安裝的是0.10版太低了,現在都1.3版了
cd /home/ocs
wget https://libzip.org/download/libzip-1.3.0.tar.gz
wget http://pecl.php.net/get/zip-1.15.1.tgz
tar -zxvf libzip-1.3.0.tar.gz
cd libzip-1.3.0
./configure


提示configure:error:ZLIB version too old please install at least v1.1.2

實際上是zlib-devel模塊沒有安裝

yum install zlib-devel
cd libzip-1.3.0
./configure
make && make install
cd ..
tar -zxvf zip-1.15.1
yum install php-devel
phpize
./configure --with-php-config=/usr/bin/php-config#此處寫你自己的php-config目錄
make && make install

提示

/usr/local/include/zip.h:59:21: fatal error:zipconf.h:No such file or directory

找到zip.h 和zipconf.h兩個文件

修改zip.h文件

vim zip.h
#incloud <zipconf.h> 改為
#incloud </usr/local/lib/libzip/include/zipconf.h>#zipconf.h的路經
make && make install

修改php.ini

vim /etc/php.ini
extension = /usr/lib64/php/modules/zip.so
zlib.output_compression=On


重啟httpd

systemctl restart httpd.service


到此不再有錯誤提示


Centos 7 安裝OCSInventory NG 2.3.1全記錄