GLPI是非常优秀开源IT管理系统,包括资产统计、helpdesk等等功能,配合OCSNG还可以实现自动采集客户端软硬件信息。
虽然这套软件也有Windows版的,但Linux下的更加稳定,推荐在Linux上安装,本人之前写过一篇安装文章,那个时候为了收集中日文的计算机信息,还需要第三方的程序和修改glpi代码才能实现,现在这两个软件官方原生已经支持UTF8,不需要我们折腾了,不过安装过程依然不那么简单,呵呵
好了,先安装基本的Linux系统,本例使用的是CentOS6.0,GLPI版本0.84.5,OCSNG版本是2.1.1。
这里说一下默认光盘安装的CentOS6,有几个需要注意的地方,第一建议关闭防火墙和selinux,第二,配制好网卡,默认情况下,网卡开机是不启用的,需要修改配置文件
|
vi /etc/sysconfig/network-scripts/ifcfg-eth0 |
|
把
改为
然后开始安装基础软件httpd,php,mysql,还需要下载一些软件 glpi-0.84.6.tar.gz json-1.2.1.tar OCSNG_UNIX_SERVER-2.1.1.tar.gz OCSNG-Windows-Agent-2.1.1.zip OCSNG-Windows-Packager-2.1RC1.zip 安装OCSNG服务端
|
tar zxvf OCSNG_UNIX_SERVER-2.1.1.tar.gz |
cd OCSNG_UNIX_SERVER-2.1.1 |
./setup.sh |
|
接下来一路回车,你会依次看到如下的选择提示
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
|
Do you wish to continue ([y]/n)? |
Which host is running database server [localhost] ? |
On which port is running database server [3306] ? |
Where is Apache daemon binary [/usr/sbin/httpd] ? |
Where is Apache main configuration file [/etc/httpd/conf/httpd.conf] ? |
Which user account is running Apache web server [apache] ? |
Which user group is running Apache web server [apache] ? |
Where is Apache Include configuration directory [/etc/httpd/conf.d/] ? |
Where is PERL Intrepreter binary [/usr/bin/perl] ? |
Do you wish to setup Communication server on this computer ([y]/n)? |
Where to put Communication server log directory [/var/log/ocsinventory-server] ? |
Communication server need a directory for plugins configuration files. |
Where to put Communication server plugins configuration files [/etc/ocsinventory-server/plugins] ? |
Communication server need a directory for plugins Perl modules files. |
Where to put Communication server plugins Perl modules files [/etc/ocsinventory-server/perl] ? |
|
然后我这里会出现如下错误提示,根据提示安装对应的软件
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
|
+----------------------------------------------------------+ |
| Checking for required Perl Modules... | |
+----------------------------------------------------------+ |
|
Checking for DBI PERL module... |
Found that PERL module DBI is available. |
Checking for Apache::DBI PERL module... |
*** ERROR: PERL module Apache::DBI is not installed ! |
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... |
*** ERROR: PERL module XML::Simple is not installed ! |
Checking for Net::IP PERL module... |
*** ERROR: PERL module Net::IP is not installed ! |
*** ERROR: There is one or more required PERL modules missing on your computer ! |
Please, install missing PERL modules first. |
|
OCS setup.sh can install perl module from packages for you |
The script will use the native package from your operating system like apt or rpm |
Do you wish to continue (y/[n])? |
|
下载perl-Apache-DBI-1.09-1.el6.noarch.rpm,并安装 我这里提示
|
rpm -i perl-Apache-DBI-1.09-1.el6.noarch.rpm |
warning: perl-Apache-DBI-1.09-1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY |
error: Failed dependencies: |
perl(Digest::SHA1) is needed by perl-Apache-DBI-1.09-1.el6.noarch |
|
还需要安装依赖perl-Digest-SHA1
|
yum install perl-Digest-SHA1 |
rpm -i perl-Apache-DBI-1.09-1.el6.noarch.rpm |
|
继续安装依赖包
|
yum install perl-XML-Simple perl-Net-IP |
|
重新运行OCSNG安装程序 之后有提示还缺一些SOAP相关的包,直接忽略就行了,不需要这个功能
配置数据库安全 mysql_secure_installation 设置root密码,关闭root远程访问,移出不必要的数据库 /etc/my.cnf中找到[client]和[mysqld],然后在它们下面均加上default-character-set=utf8就可以了。别忘了重启下mysql服务 创建ocsng和glpi的数据库和用户
|
mysql -u root -p |
create database glpi; |
create database ocsweb; |
grant all privileges on glpi.* to glpi@localhost identified by 'password'; |
grant all privileges on ocsweb.* to ocs@localhost identified by 'password'; |
set global max_allowed_packet = 2*1024*1024*10 |
exit |
|
配置ocsng的web界面(以下地址请将192.168.1.11替换为你自己的服务器IP) 进入http://192.168.1.11/ocsreports 输入上面设置的password密码,提交即可 再删掉安装文件 /usr/share/ocsinventory-reports/ocsreports/install.php 用admin/admin登陆进ocsng的web界面后更改下默认密码即可
下面安装glpi,由于glpi需要json,新版本的php如果要编译json必须修改代码
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
|
tar xvf json-1.2.1.tar |
cd json-1.2.1 |
vi JSON_parser.c |
添加#define ZVAL_DELREF Z_DELREF_P |
phpize |
./configure |
make |
make install |
echo "; Enable json extension module" > /etc/php.d/json.ini |
echo "extension=json.so" >> /etc/php.d/json.ini |
/etc/init.d/httpd restart |
tar zxvf glpi-0.84.6.tar.gz |
mv glpi /var/www/html/ |
chown apache.apache /var/www/html/glpi/ -R |
|
输入http://192.168.5.11/glpi直接跳转到安装界面 选择语言,提交,一路下一步即可 删除/var/www/html/glpi/install/install.php 修改密码后完成glpi的安装
配置glpi的插件ocsng 之前的老版本,glpi中直接集成了ocsng的连接组件,新版本中变为了插件方式,到glpi网站下载插件glpi-ocsinventoryng-1.0.2.tar.gz
|
tar zxvf glpi-ocsinventoryng-1.0.2.tar.gz |
mv ocsinventoryng /var/www/html/glpi/plugins/ |
|
去插件中启用就可以了
配置域整合 名称 yourdc.local Server 192.168.1.200 Basedn DC=yourdc,DC=LOCAL rootdn (非匿名) ldapconnect@yourdc.local Login Field samaccountname 连接过滤器 (&(objectClass=user)(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2))) 然后配置导入信息即可
这里发现一个bug,以前在0.7x版本上是没问题的,现在升级到0.8x以后ldap连接测试可以通过,但是无法导入用户,打开调试模式得到如下错误
|
PHP Warning: ldap_search(): Search: Operations error in /var/www/html/glpi/inc/authldap.class.php at line 1400 |
|
经过研究代码和数据库发现,rootdn_passwd这个密码并没有真正写入数据库,而直接在数据库中修改此项也没生效,只好改ldap连接代码了,本人非php专家,所以改成可以满足自己应用就好了,修复bug没那个精力。。。
|
vi /var/www/html/glpi/inc/authldap.class.php |
|
找到
|
static function connectToServer($host, $port, $login="", $password="", $use_tls=false, |
$deref_options) { |
|
这个函数,在下面添加即可
|
$password="yourdnpasswd"; |
|
最后重新进入导入用户界面就可以看到亲切的域帐号了。。。
(责任编辑:IT) |