【OS】
今回はCentOS6.6_x86_64版を使用。詳細は以下を参照。
http://centos.server-manual.com/
事前準備
セットアップに必要なパッケージを事前に設定しておく必要がある。以下を全て設定する。
システム変更が発生するので管理者権限が必須。rootにsuしておく事。
また、httpd.confやphp.iniを変更するので、予めバックアップしておく事。
【YUMパッケージ管理】
yum -y install yum-plugin-fastestmirror
yum -y update
yum -y groupinstall "Base" "Development tools" "Japanese Support"
[RPMforgeリポジトリ追加]
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -ivh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[EPELリポジトリ追加]
rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[ELRepoリポジトリ追加]
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
[Remiリポジトリ追加]
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
【SELinux無効化】
getenforce
Enforcing ←SELinux有効
setenforce 0
getenforce
Permissive ←SELinux無効
vi /etc/sysconfig/selinux
SELINUX=enforcing
SELINUX=disabled ←変更(起動時に無効にする)
【iptablesでHTTPを許可】
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT ←追加
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Iptables再起動
service iptables restart
【MySQL設定】
CentOS構築時にデフォルトでインストールされたバージョンをアンインストール。
yum erase mysql*
rpmの追加
yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
MySQL5.6のインストール
yum install mysql mysql-devel mysql-server mysql-utilities
確認
mysql –-version
mysql Ver 14.14 Distrib 5.6.15, for Linux (x86_64) using EditLine wrapper
デフォルトキャラクタセットをutf8に設定
vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
**character-set-server=utf8**
'#任意設定'
innodb_file_per_table
query-cache-size=16M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
**[mysql]
default-character-set=utf8**
起動・自動起動設定
service mysqld start
chkconfig mysqld on
DB設定
rootパスワード変更
mysql -u root
SET PASSWORD FOR root@localhost=password('***'); ←rootパスワード設定
EXIT;
GLPI・OCSNG用設定
mysql -u root -p パスワード
mysql>create database ocs;
mysql>create database glpi;
mysql>GRANT ALL PRIVILEGES ON glpi.* TO glpi@localhost IDENTIFIED BY 'glpi';
mysql>GRANT ALL PRIVILEGES ON ocs.* TO ocs@localhost IDENTIFIED BY 'ocs';
mysql>quit;
【追加パッケージ】
yum -y install --enablerepo=remi gd-last ←これを先に入れないとphpが入らない
yum -y install --enablerepo=remi-php56 php php-mysql php-mbstring php-ldap php-imap php-zip php-gd
yum -y install perl-CPAN perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL
perl-Apache-DBI perl-Net-IP perl-SOAP-Lite mod_perl perl-SOAP-Transport
libapache2-mod-perl2 libxml-simple-perl
【Perl関連】
perl -MCPAN -e shell
install YAML
install SOAP::Transport
install XML::Simple
【Apache+PHP設定】
上記
http://centos.server-manual.com/
Apache2・PHP参照
【OCSNG_UNIX_SERVER】
http://www.ocsinventory-ng.org/en/
OCSNG Inventoryを利用して、PC情報を吸い上げ、GLPIにその情報を登録します。
GLPI上では契約の管理等様々な情報を登録できますので、資産管理台帳としていきます。
tar zxvf OCSNG_UNIX_SERVER-2.1.1.tar.gz
cd OCSNG_UNIX_SERVER-2.1.1
sh setup.sh
console message | answer |
CAUTION: If upgrading Communication server from OCS Inventory NG 1.0 RC2 and previous, please remove any Apache configuration for Communication Server!Do you wish to continue ([y]/n)? | enter |
Your MySQL client seems to be part of MySQL version 5.1. Your computer seems to be running MySQL 4.1 or higher, good ;-) Which host is running database server [localhost] ? | enter |
On which port is running database server [3306] ? | enter |
Where is Apache daemon binary [/usr/sbin/httpd] ? | enter |
Where is Apache main configuration file [/etc/httpd/conf/httpd.conf] ? | enter |
Which user account is running Apache web server [apache] ? | enter |
Which user group is running Apache web server [apache] ? | enter |
Setup found Apache Include configuration directory in /etc/httpd/conf.d/. Setup will put OCS Inventory NG Apache configuration in this directory. Where is Apache Include configuration directory [/etc/httpd/conf.d/] ? | enter |
Found PERL Intrepreter at ;-) Where is PERL Intrepreter binary [/usr/bin/perl] ? | enter |
Do you wish to setup Communication server on this computer ([y]/n)? | enter |
Communication server can create detailled logs. This logs can be enabled by setting interger value of LOGLEVEL to 1 in Administration console menu Configuration. Where to put Communication server log directory [/var/log/ocsinventory-server] ? | enter |
*** Warning: PERL module XML::Entities is not installed ! This module is only required by OCS Inventory NG SOAP Web Service. Do you wish to continue ([y]/n] ? | enter |
Do you allow Setup renaming Communication Server Apache configuration file to 'z-ocsinventory-server.conf' ([y]/n) ? | enter |
Do you wish to setup Administration Server (Web Administration Console) on this computer ([y]/n)? | enter |
If you choose to move directory, YOU MUST MOVE 'download' directory to Administration Server writable/cache directory (by default /var/lib/ocsinventory-reports), especialy if you use deployement feature. Do you wish to continue ([y]/n)? | enter |
Where to copy Administration Server static files for PHP Web Console [/usr/share/ocsinventory-reports] ? | /var/www |
Where to create writable/cache directories for deployement packages, administration console logs, IPDiscover [/var/lib/ocsinventory-reports] ? | /var/www |
Setup has created a log file /root/OCSNG_UNIX_SERVER-2.0.5/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 ;-) |
vi /etc/httpd/conf.d/z-ocsinventory-server.conf
ocs_db_name
PerlSetEnv OCS_DB_NAME ocsweb←ocsに変更
ocs_db_local
PerlSetEnv OCS_DB_LOCAL ocsweb←ocsに変更
ocs_db_pwd
PerlSetVar OCS_DB_PWD ocs←ocsに変更(変更なし)
Apahce再起動
service httpd restart
OCSNGをブラウザで開く
http://localhost/ocsreports
【GLPI】
http://www.glpi-project.org/?lang=en
tar -zxvf glpi-0.84.7.tar.gz
mv glpi /var/www/html/
chown -R apache.apache /var/www/html/glpi
chmod -R 777 /var/www/html/glpi/config
chmod -R 777 /var/www/html/glpi/files
GLPIをブラウザで開きセットアップ開始
http://localhost/glpi/
日本語を選択し「OK」
ライセンスに同意して「実行」
「インストール」を選択
「実行」
サーバ:localhost ID:glpi PW:glpi を入力し「実行」
glpiを選択し「実行」
「実行」
「GLPI使用」
再度ログオン画面に戻るので、ID・PWを入力し実行
完了!
【OCSNG連携設定】
tar zxvf glpi-ocsinventoryng-1.0.2.tar.gz
mv ocsinventoryng /var/www/html/glpi/plugins
念の為apache再起動
/etc/rc.d/init.d/httpd restart
GLPIのメニューより「セットアップ」→「プラグイン」を選択
Ocs Inventory Ngの欄の「インストール」を押下。リロードされるので「有効」を押下
(↑の画面に変更される)
GLPIのメニューより「プラグイン」→「Ocs Inventory Ng」を選択
Configuration of OCSNG server:ocsを選択
各種設定を入力
名前:ocs
HOST for the database:localhost
データーベース:ocs
ユーザ:ocs
パスワード:ocs
Database in UT8:はい
有効:はい
Synchronisation method:Expert(Fully automatic for large configuration)
「保存」を押下
設定完了
GLPIの設定や使用方法は別途記載する予定です。