发表于 2019-2-16 08:48:46

IT资产管理解决方案 CentOS+OCS+GLPI-John.Jin的博客

  OCS Inventory NG(Open Computer and Software Inventory Next Generation)是一款系统管理软件
  主要功能:

[*]  Relevant inventory 资产清单管理.
[*]  Powerfull deployment system 强大的部署系统,代理程序软件部署方便宜用。.
[*]  Web Administration Console 基于Web的管理控制界面.
[*]  Multiple operating systems support,多操作系统支持 Microsoft Windows, Linux, *BSD, Sun Solaris, IBM AIX, HP-UX, MacOS X.
[*]  Lightweight bandwith usage: 轻量网络带宽使用,Windows系统的全部清单信息大约5 KB .
[*]  High performance: 高性能,1 000 000 电脑每天做清单扫描,使用的服务器是bi-Xeon 3 GHz /4 GB RAM.
[*]  3-Tier architecture 三层架构设计,支持http/https/xml等协议河标准.
[*]  基于有名的开源产品实现, Apache web 服务器, MySQL 数据库服务器, PHP 和 PERL 脚本语言.
[*]  Web service 提供 SOAP 接口的Web服务访问.
[*]  Plugins support 通过API提供插件支持.
  1. 操作系统为CentOS5.2
  2. OCS Inventory 与GLPI 的web目录放在/var/www/html和/var/www/htmltwo(我建的目录),用chown –R apache:apache 目录,修改上面两个目录的权限。(我遇到问题:后面安装的GLPI无法访问。我的解决办法:分成两个目录后,我用虚拟主机的方式指定相同的IP,不同的端口访问。)
  #vi /etc/httpd/conf/httpd.conf
  添加:
  DocumentRoot /var/www/html/ocsreports
  DocumentRoot /var/www/html/glpi
  Options FollowSymLinks
  AllowOverride None
  Order alow,deny
  Allow from all
  安装准备:定义yum的非官方库
  #vi /etc/yum.repos.d/dag.repo
  
  Name=Dag RPM Repository for Red Hat Enterprise Linux
  Baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
  Gpgcheck=1
  Enabled=1
  Gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
  网络设置,设置网卡静态IP:
  Ifconfig eth0 192.168.1.7netmask 255.255.255.0 (即时生效,系统重启后还是会读/etc/sysconfig/network-scripts/ifcfg-eth0)
  DNS 设置: /etc/resolv.conf网关设置:/etc/sysconfig/network
  配置开发环境:
  #yum install -y gcc gcc-c++ glibc-devel glibc-headers autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libXpm libX11 libxml2-devel gettext-devel pcre-devel mysql mysql-server httpd php php-devel php-gd php-pecl-zip php-mysql php-devel php-pear php-imap php-ldap php-odbc php-xml php-xmlrpc mod_perl
  配置Perl环境
  #yum install –y perl mod_perl
  #yum install perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL perl-Net-IP perl-XML-SAX perl-Apache2-SOAP perl-Apache-DBI
  Perl需要手动安装的模块
  安装SOAP-Lite
  #tar –zxvf SOAP-Lite-0.69.tar.gz
  #cd SOAP-Lite-0.69
  #perl Makefile.PL
  #make
  #make test
  #make install
  安装XML-Entities
  #tar –zxvf XML-Entities-0.0307.tar.gz
  #cd XML-Entities-0.0307
  #perl Makefile.PL
  #make
  #make test
  #make install
  安装Digest-SHA1.2.02
  #tar –zxvf Digest-SHA1.2.02.tar.gz
  #cd Digest-SHA1.2.02
  #perl Makefile.PL
  #make test
  #make
  #make install
  数据库服务和Apache服务
  #service mysqld start   MySQL服务开启
  #service httpd start       Apache服务开启
  #chkconfig mysqld on      MySQL服务设为开机启动
  #chkconfig httpd on       Apache服务设为开机启动
  #vi /etc/httpd/conf/httpd.conf   配置Apache对PHP的支持
  添加如下两行:
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
  定位至:DirectoryIndex index.html
  修改为:DirectoryIndex index.php index.html
  #chown –R apache:apache /var/www/html
  Service httpd restart
  修改MySQL root 密码
  #/usr/bin/mysqladmin –u root password ‘123456’ 数据库管理员用户和密码设置
  iptables 设置   
  #vi /etc/sysconfig/iptables
  -A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
  -A RH-Firewall-1-INPUT –m tcp –dport 8080 –j ACCEPT
  #service iptables restart
  安装OCS Inventory
  #tar –zxvf OCSNG_UNIX_SERVER-1.3.2-linvinus-with-utf8_patch.tar.gz
  #cd OCSNG_UNIX_SERVER-1.3.2
  #sh setup.shy
  注意事项:
  Where to copy Administration Server static files for PHP Web Console
   ?/var/www/html/ 选择WEB文件存放的路径。
  浏览器地址栏输入:http://serverip/ocsreports/install.php,就可以配置了。
  安装GLPI
  Json和php-mbstring安装
  #yum install php-mbstring
  Wget http://percl.php.net/get/json -o json-1.2.1.tgz
  Tar –xf json-1.2.1.tgz
  Cd json-1.2.1
  Phpize
  ./configure
  Make
  Make install
  Echo “extenson=json.so” >> /etc/php.ini 或vi /etc/php.ini,在最后一行添加:extension=json.so
  Service httpd restart
  测试json是否安装成功
  #php –r ‘var_dump(function_exists(“json_encode”));’
  如果返回信息为bool(true),说明安装成功。
  #tar –zxvf plpi-0.78-RC2.tar.gz
  #cp –a glpi /var/www/html
  #chown –R apache:apache /var/www/html/glpi
  让GLPI支持中文
  0.78版进入glpi安装目录,修改/inc/dbmysql.class.php文件,定位到$this->dbenc 修改”latin1″为”utf8″ 即可
  0.74及以前版本在/inc/ocsng.class.php文件中修改
  配置GLPI
  浏览器输入http://serverip/glpi
  1.环境检测
  2.选择语言
  3.输入数据库帐号
  4.创建新的GLPI数据库
  5.完成
  默认管理员:glpi,密码:glpi
  linux客户端安装配置
  #yum install –y perl-XML-Simple perl-Compress-Zlib perl-Net-IP perl-LWP perl-Digest-MD5 PERL-Net-SSLeay perl-Crypt-SSLeay perl-XML-SAX perl-XML-LibXML perl-Proc-Daemon perl-PID-File
  No package perl-LWP available
  No package perl-Digest-MD5 available
  #perl -MCPAN –e ‘install Proc::Daemon’
  #perl-MCPAN –e ‘install Proc::PID::File’
  从镜像点下载下来的包会保存在以下目录
  #ll /root/.cpan/build
  下载:OCSNG_LINUX_AGENT
  #wget http://lwlp.googlecode.com/files/OCSNG_LINUX_agent_1.1.2.tar.gz
  #tar –zxvf OCSNG_LINUX_AGENT_1.1.2.tar.gz –C /opt/src
  #cd /opt/src/OCSNG_LINUX_AGENT_1.1.2
  #cp ipdiscover /usr/sbin/ipdisconver
  #perl Makefile.PL
  #make
  #make install
  以下提示一路回车
  Do you want to configure the agent
  Please enter 'y' or 'n'?>
  Where do you want to write the configuration file?
  0 -> /etc/ocsinventory
  1 -> /usr/local/etc/ocsinventory
  2 -> /etc/ocsinventory-agent
  ?> 2 (选择配置文件存放目录)
  Do you want to create the directory /etc/ocsinventory-agent?
  Please enter 'y' or 'n'?>
   The config file will be written in /etc/ocsinventory/ocsinventory-agent.cfg,
  What is the address of your ocs server?> 192.168.50.92(输入ocsinventory-server的ip地址)
  Do you need credential for the server? (You probably don't)
  Please enter 'y' or 'n'?>
  Do you want to apply an administrative tag on this machine
  Please enter 'y' or 'n'?> (该服务器是否使用管理标签)
  tag?> viong (显示在web管理控制界面中)
  ocsinventory agent presents: /usr/bin/ocsinventory-agent
  Where do you want the agent to store its files? (You probably don't need to change it)?>
  Do you want to create the /var/lib/ocsinventory-agent directory?
  Please enter 'y' or 'n'?>
  New settings written! Thank you for using OCS Inventory
  Should I remove the old linux_agent
  Please enter 'y' or 'n'?>
  Do you want to use OCS-Inventory software deployment feature?
  Please enter 'y' or 'n'?>
  Do you want to use OCS-Inventory SNMP scans feature?
  Please enter 'y' or 'n'?>
  Do you want to send an inventory of this machine?
  Please enter 'y' or 'n'?>
   Accountinfo file doesn't exist. I create an empty one.
  -> Success!
  看到以上信息,说明安装成功
  # ocsinventory-agent –debug
  ………………………………………….省略
   Calling handlers : `end_handler'
  Windows平台,分发OCS客户端
  http://www.renren.it/a/bianchengyuyan/PHP/20110618/75702.html
  设置GLPI用OCSNG方式
  http://www.opboy.com/archives/tag/ocsglpi
  参考:
  1. http://www.centospub.com/make/newenv.html
  2. http://www.opboy.com/archives/tag/ocsglpi
  3. http://viong.blog.运维网.com/844766/503694
  4. http://www.renren.it/a/bianchengyuyan/PHP/20110618/75702.html

页: [1]
查看完整版本: IT资产管理解决方案 CentOS+OCS+GLPI-John.Jin的博客