ラベル CentOS の投稿を表示しています。 すべての投稿を表示
ラベル CentOS の投稿を表示しています。 すべての投稿を表示

2015年3月6日金曜日

ZabbixをCentOS 7にインストール

どこのサイトの情報も間違っているとのつぶやきを見かけたのでちょっと書いてみます。

ただし、基本的な流れとポイントのみです。

SELinuxは、disabledです。
firewalldの設定は、もっと厳密にした方が良いでしょう。
DBMSは、CentOS 7ですのでMariaDBとします。
PostgreSQLの方が良い方は、Zabbixのパッケージでパッケージ名のmysqlの部分がpgsqlのパッケージをインストールしてください。

=====
1.OSのインストール
=====
最低限の構成でOSをインストールします。

=====
2.各種パッケージのアップデート
=====
yum updateを利用して、インストールされている各種パッケージをアップデートします。

 # yum update

=====
3.SELinuxのdisabled
=====
手順の説明を簡略化するため、disabledにします。
環境に合わせて適宜設定することをお勧めします。

 # vi /etc/selinux/config

----- ここから -----
SELINUX=disabled
----- ここまで -----

=====
4.OS再起動
=====
SELinuxをdisabledに設定したので、それを反映させるためにOSを再起動しておきます。

 # reboot

=====
5.firewalldの設定
=====
rebootしたら、firewalldの設定を行います。
Zabbixサーバが外部から接続を受けるのは、Zabbixエージェントからのアクセスと、Webインターフェースへのアクセスです。
SNMPトラップや他のアクセスを許可する場合は、それらも許可するようにしてください。

 # firewall-cmd --add-port=10050/tcp --zone=public --permanent
 # firewall-cmd --add-port=10051/tcp --zone=public --permanent
 # firewall-cmd --add-service=http --zone=public --permanent
 # systemctl restart firewalld

Zabbixエージェントへのアクセスが、ローカルのループバックを利用するのであれば、10050をあける必要はありません。
つまり、Zabbixエージェントが外部のIPアドレスからアクセスされる場合には、10050をあけます。
Zabbixサーバが、Zabbixエージェントからのアクセスを外部から受ける時には、10051をあけます。

もっとアクセス可能なゾーンを特定したり、Zabbix用のサービスを定義して登録して、サービス名を利用して設定した方が良いかもしれません。
その手順はまた今度。

=====
6.Zabbix SIAのリポジトリ登録
=====
Zabbix SIAが、RHEL 7用のyumのリポジトリも公開しているので、それを登録します。

 2.2系用:
 # yum install http://repo.zabbix.com/zabbix/2.2/rhel/7/x86_64/zabbix-release-2.2-1.el7.noarch.rpm

 2.4系用:
 # yum install http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm

=====
7.Zabbix関連のパッケージインストール
=====
Zabbixサーバの本体、ZabbixサーバのWebインターフェース、自分自身を監視するためにZabbixエージェントをインストールします。
ここでインストールするのは、MySQLまたはMariaDB用です。

 # yum install zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese zabbix-agent

zabbix-web-japaneseというパッケージは、Webインターフェースで日本語のフォントを利用できるようにするための設定用パッケージです。

=====
8.MariaDBのインストール
=====
CentOS 7から、標準ではMySQLのサーバのパッケージ(mysql-server)が含まれなくなったので、その代わりにMariaDBのサーバ(mariadb-server)をインストールします。

 # yum install mariadb-server

MariaDB用の設定を行っておきます。

 # vi /etc/my.cnf.d/server.cnf

----- ここから -----
[mysqld]
character-set-server = utf8
collation-server     = utf8_general_ci
skip-character-set-client-handshake
innodb_file_per_table
----- ここまで -----

 # systemctl start mariadb
 # systemctl enable mariadb

=====
9.初期データベースの作成
=====
DBMS上にデータベースとそれにアクセスするためのユーザを作成します。

 # mysql -uroot
 mysql> create database zabbix;
 mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password' ;
 mysql> flush privileges;
 mysql> exit
 #

テーブルを作成して、初期データも投入します。

 # mysql -uroot zabbix < /usr/share/doc/zabbix-server-mysql-2.2.8/create/schema.sql
 # mysql -uroot zabbix < /usr/share/doc/zabbix-server-mysql-2.2.8/create/images.sql
 # mysql -uroot zabbix < /usr/share/doc/zabbix-server-mysql-2.2.8/create/data.sql

パス名は、バージョンごとにバージョン番号をパスに含んでいますので、インストールしたバージョンに合わせてパスを変更してください。

=====
10.Zabbixの設定ファイルの更新
=====
ここまでの設定のままであれば、最低限の設定としては、DBPasswordを設定するだけです。
DB作成時のパスワードをDBPasswordに設定してください。

 # vi /etc/zabbix/zabbix_server.conf

----- ここから -----
DBPassword=password
----- ここまで -----

=====
11.ZabbixのWebインターフェース用設定修正
=====
Zabbixのパッケージのデフォルトでは、PHPのtimezoneの設定がコメントアウトされているので、設定を有効にしてタイムゾーンが日本ならば、Asia/Tokyoに設定します。

 # vi /etc/httpd/conf.d/zabbix.conf

----- ここから -----
php_value date.timezone Asia/Tokyo
----- ここまで -----

=====
12.各種デーモン起動
=====

 # systemctl start zabbix-server
 # systemctl start zabbix-agent
 # systemctl start httpd

 # systemctl enable zabbix-server
 # systemctl enable zabbix-agent
 # systemctl enable httpd

=====
13.Webインターフェースにアクセス
=====
ブラウザを利用して、「http://IPアドレス/zabbix/」にアクセスします。

最初のアクセス時は、Zabbix設定のウィザードが実行されるので、DBへのアクセス情報などを入力して次へ次へと進めてください。
「3. Configure DB connection」では、UserとPasswordを入力して「Test connection」をクリックして接続確認を行うことを忘れずに。

設定が終わるとログイン画面になります。アカウント「Admin」、パスワード「zabbix」でログインしてください。

=====
14.Zabbix serverの監視を有効に設定
=====
ログイン後、まずは日本語画面に切り替えます。

右上のProfileをクリックして、LanguageとしてJapaneseを選択してSaveボタンを押してください。

次に、「設定」 -> 「ホスト」と選択してホスト一覧を表示させ、表示された「Zabbix server」というホストのステータスの「無効」をクリックして「有効」に変更すれば、Zabbixサーバ自体の監視が開始されます。

2012年2月28日火曜日

CentOS 6標準phpのConfigureコマンド

情報提供用の書き込みです。

CentOS 6のphpのphpinfo()の出力の一部です。

Configure Command => './configure' '--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu' '--target=i686-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-sqlite' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config' '--enable-dom=shared' '--with-pgsql=shared' '--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--with-curl=shared,/usr' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-sqlite3=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--without-readline' '--with-libedit' '--with-pspell=shared' '--enable-phar=shared' '--with-tidy=shared,/usr' '--enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared' '--enable-posix=shared' '--with-unixODBC=shared,/usr' '--enable-fileinfo=shared' '--enable-intl=shared' '--with-icu-dir=/usr' '--with-enchant=shared,/usr' '--with-recode=shared,/usr'

2011年4月14日木曜日

ZABBIX-JPのRPMをCentOS 5.6上のPHP 5.3で動かせ!

CentOS 5.6がリリースされました。
よ〜く見ると、今までのPHPのアップデート以外に、php53というPHP 5.3が入っているではないですか。
そこで、Zabbix-1.8.4-1.JPをCentOS 5.6で搭載されたPHP 5.3を利用してインストールできないじゃないかとのご意見も聞かれたのでやってみた。

詳細は説明しません。
わからなかったら聞いてください。

以下、手順です。

# wget http://www.zabbix.jp/binaries/relatedpkgs/rhel5/i386/zabbix-jp-release-5-3.noarch.rpm
# rpm -ivh zabbix-jp-release-5-3.noarch.rpm
# alternatives --config zabbix-jp-release

4 プログラムがあり 'zabbix-jp-release' を提供します。

選択 コマンド
-----------------------------------------------
1 /usr/share/zabbix-jp-release/zabbix-jp-1.1.repo
2 /usr/share/zabbix-jp-release/zabbix-jp-1.4.repo
*+ 3 /usr/share/zabbix-jp-release/zabbix-jp-1.6.repo
4 /usr/share/zabbix-jp-release/zabbix-jp-1.8.repo

Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:4
# yum install zabbix-agent zabbix-server-mysql
# yum install php53 php53-gd php53-mbstring php53-xml php53-bcmath php53-mysql
# wget http://www.zabbix.jp/binaries/zabbix/zabbix-1.8/rhel5/i386/zabbix-web-1.8.4-1.el5.JP.i386.rpm
# wget http://www.zabbix.jp/binaries/zabbix/zabbix-1.8/rhel5/i386/zabbix-web-mysql-1.8.4-1.el5.JP.i386.rpm
# rpm -ivh --nodeps zabbix-web-1.8.4-1.el5.JP.i386.rpm zabbix-web-mysql-1.8.4-1.el5.JP.i386.rpm

# yum install mysql-server

後は通常のインストールと同じです。

2011年4月12日火曜日

CentOS 5.6へのアップデート手順

お行儀の良いアップデート手順は、以下のように行うらしい。from リリースノート。
yum clean all
yum update glibc\*
yum update yum\* rpm\* pyth\*
yum clean all
yum update mkinitrd nash
yum update selinux\*
yum update
shutdown -r now