安装一套OCS inventory-ng 环境
官网 : http://www.ocsinventory-ng.org/en/
首先安装Server
相关的包在官网上下载即可
我下载的是
OCSNG_UNIX_SERVER-1.02.3.tar.gz
我使用SecureCRT连接我的linux测试机
用rz上传到对应的目录,我安装在 /usr/local/
然后解压
tar -zxvf OCSNG_UNIX_SERVER-2.1.2.tar.gz
cd OCSNG_UNIX_SERVER-2.1.2
sh setup.sh
其中前面的数据库配置直接默认就ok
//apache 二进制文件的执行路径
Where is Apache daemon binary [] ?/usr/local/apache2/bin/apachectl
//apache 主配置文件的路径
Where is Apache main configuration file [/usr/local/apache2/conf/httpd.conf] ?
之后的选着perl ,用户和用户组等可以自己指定
之后安装完成会显示
Setup has created a log file /usr/local/OCSNG_UNIX_SERVER-2.1.2/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 his content !
DON'T FORGET TO RESTART APACHE DAEMON !
Enjoy OCS Inventory NG ;-)
这样就提示安装完成了
在安装过程中可能会报错,缺少perl模块,我们下载相应的组件即可
可以通过CPAN下载比较方便
perl -MCPAN -e shell
之后install你想要安装的模块就好
当然也可以perl -MCPAN -e "install ........."
安装OCS inventory-ng 也需要PHP和MySQL,至于这两项的安装也很简单
服务器我们也可以使用nginx
我使用nginx,安装完成之后把php前端copy到相应的目录下就好
配置nginx文件
upstream fcgi-ocsreports {
server unix:/dev/shm/php-fpm.sock;
}
server {
server_name yourIp;
listen 80;
index index.php;
root 你的php项目的目录;
access_log /home/logs/nginx/fcgi.access.log main; //日志文件目录
error_log /home/logs/nginx/fcgi.error.log error;
send_timeout 180;
fastcgi_connect_timeout 180;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
location ~* \.php$ {
include fcgi.conf;
fastcgi_index index.php;
fastcgi_pass fcgi-ocsreports;
}
}
然后就可以进入ocs的web前端来配置数据库了
之后安装agent,windows的agent安装比较简单,这里主要说明linux下的agent安装
同样的在OCS的官网下载对应的agent版本
tar解压
然后perl Makefile.PL
make
make install 安装
以下提示一路回车
Do you want to configure the agent
Please enter 'y' or 'n'?> [y]
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'?> [y]
[info] The config file will be written in /etc/ocsinventory/ocsinventory-agent.cfg,
What is the address of your ocs server?> [ocsinventory-ng]
192.168.50.92(输入ocsinventory-server的ip地址)
Do you need credential for the server? (You probably don't)
Please enter 'y' or 'n'?> [n]
Do you want to apply an administrative tag on this machine
Please enter 'y' or 'n'?> [y] (该服务器是否使用管理标签)
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)?> [/var/lib/ocsinventory-agent]
Do you want to create the /var/lib/ocsinventory-agent directory?
Please enter 'y' or 'n'?> [y]
New settings written! Thank you for using OCS Inventory
Should I remove the old linux_agent
Please enter 'y' or 'n'?> [n]
Do you want to use OCS-Inventory software deployment feature?
Please enter 'y' or 'n'?> [y]
Do you want to use OCS-Inventory SNMP scans feature?
Please enter 'y' or 'n'?> [y]
Do you want to send an inventory of this machine?
Please enter 'y' or 'n'?> [y]
[info] Accountinfo file doesn't exist. I create an empty one.
-> Success!
看到以上信息,说明安装成功
[root@localhost Ocsinventory-Agent-2.0rc2]# ocsinventory-agent –debug
………………………………………….省略
[debug] Calling handlers : `end_handler'
如果没提示error说明安装OK!
在安装的过程中也可能会提示缺少perl模块,使用CPAN安装即可