安装163yum源
代码语言:javascript复制yum -y install wget
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
cp CentOS7-Base-163.repo /etc/yum.repos.d/
yum clean all
yum makecache
安装LAMP
关闭firewall:
代码语言:javascript复制systemctl stop firewalld.service
systemctl disable firewalld.service
安装配置iptables
代码语言:javascript复制yum -y install iptables-services
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
iptables-save
service iptables save
systemctl restart iptables
systemctl enable iptables
关闭SELINUX
代码语言:javascript复制vim /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
setenforce 0 #使配置立即生效
安装Apache
代码语言:javascript复制yum install -y httpd
systemctl start httpd
systemctl enable httpd
安装配置Mariadb
代码语言:javascript复制yum install -y mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
mysql_secure_installation
systemctl restart mariadb.service
安装PHP
代码语言:javascript复制yum install -y php
yum install -y php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
chown apache.apache -R /var/www/html #权限设置
systemctl restart mariadb.service
systemctl restart httpd.service
PS:安装PHP相关模块
代码语言:javascript复制yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
#或者
yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
安装完成,重启mysqld,重启httpd
PS:Apache和PHP配置
Apache配置
代码语言:javascript复制vi /etc/httpd/conf/httpd.conf #编辑文件
ServerTokens OS #修改为:ServerTokens Prod (在出现错误页的时候不显示服务器操作系统的名称)
ServerSignature On #修改为:ServerSignature Off (在错误页中不显示Apache的版本)
Options Indexes FollowSymLinks #修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI,禁止列出目录)
#AddHandler cgi-script .cgi #修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)
AllowOverride None #修改为:AllowOverride All (允许.htaccess)
AddDefaultCharset UTF-8 #修改为:AddDefaultCharset GB2312 (添加GB2312为默认编码)
Options Indexes MultiViews FollowSymLinks #修改为 Options MultiViews FollowSymLinks(不在浏览器上显示树状目录结构)
DirectoryIndex index.html index.html.var #修改为:DirectoryIndex index.html index.htm Default.html Default.htm index.php Default.php index.html.var (设置默认首页文件,增加index.php)
KeepAlive Off #修改为:KeepAlive On (允许程序性联机)
MaxKeepAliveRequests 100 #修改为:MaxKeepAliveRequests 1000 (增加同时连接数)
/etc/init.d/httpd restart #重启
PHP配置
代码语言:javascript复制vi /etc/php.ini
date.timezone = PRC #在946行 把前面的分号去掉,改为date.timezone = PRC
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,
popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,
posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
#在386行 列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。
expose_php = Off #在432行 禁止显示php版本的信息
magic_quotes_gpc = On #在745行 打开magic_quotes_gpc来防止SQL注入
short_open_tag = ON #在229行支持php短标签
open_basedir = .:/tmp/ #在380行 设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php木马跨站
,如果改了之后安装程序有问题,可以注销此行,或者直接写上程序的目录/data/域名/:/tmp/
:wq! #保存退出
/etc/init.d/mysqld restart #重启MySql
/etc/init.d/httpd restart #重启Apche
配置数据库
代码语言:javascript复制mysql -uroot -p
mysql> CREATE USER 'glpi'@'%' IDENTIFIED BY 'glpipassword';
mysql> GRANT USAGE ON *.* TO 'glpi'@'%' IDENTIFIED BY 'glpipassword';
mysql> CREATE DATABASE IF NOT EXISTS `glpi` ;
mysql> GRANT ALL PRIVILEGES ON `glpi`.* TO 'glpi'@'%';
mysql> FLUSH PRIVILEGES;
mysql> quit
systemctl restart mariadb.service
安装glpi
代码语言:javascript复制tar -zxvf glpi-0.90.tar -C /var/www/html/
cd /var/www/html/
mv glpi-0.90/ glpi
chmod 777 -R /var/www/html/glpi/config/
chmod 777 -R /var/www/html/glpi/files/
安装fusioninventory插件
代码语言:javascript复制tar -zxvf fusioninventory-for-glpi_0.90.1.0.tar.gz -C /var/www/html/glpi/plugins/
安装fusioninventory-agent
PS:软件安装参考http://fusioninventory.org/documentation/agent/installation/windows_before_2.3.0.html
Windows
- 截图略,TAG自定义
Linux(agent使用方法类似)
代码语言:javascript复制cd /usr/bin/
fusioninventory-agent --local=/tmp/ --tag=yourtag --server=http://serverIP/glpi/plugins/fusioninventory/front/plugin_fusioninventory.communication.php --no-software
详情参考 :fusioninventory-agent --help
配置文件里面有详解 :more fusioninventory-agent
Mac
参考:http://prebuilt.fusioninventory.org/stable/macosx-intel//