Initiarizing
sudo /usr/sbin/groupadd -g 20071 zabbix
sudo /usr/sbin/useradd -u 20191 -g 20071 -c 'Zabbix User' -m -d '/home/zabbix' -s '/bin/tcsh' -p '*' zabbix
sudo /usr/sbin/useradd -g 20000 -u 16000 -c 'PHP user' -s /bin/sh -m -d /home/webuser webuser
sudo yum install -y readline-devel.x86_64 openssl-devel.x86_64 net-snmp-libs.x86_64 gd-devel.x86_64
Postgres
_PSG_VER=postgresql-9.2.4
_PSG_HOME=/usr/local/${_PSG_VER}
mkdir -pv ~/src/archive; cd ~/src/archive
http_proxy="http://sysworks01.db.rakuten.co.jp:10080" wget http://ftp.postgresql.org/pub/source/${_PSG_VER//postgresql-/v}/${_PSG_VER}.tar.bz2
tar jxvf ./${_PSG_VER}.tar.bz2 -C ../
cd ../${_PSG_VER}
CFLAGS="-Wall -fno-strict-aliasing -O3" ./configure \
--prefix=${_PSG_HOME} \
--with-openssl
make -> check "All of PostgreSQL successfully made. Ready to install."
sudo make install --> check "PostgreSQL installation complete."
sudo cp -vi ./contrib/start-scripts/linux /etc/init.d/postgresql
sudo vi /etc/init.d/postgresql
sudo chmod +x /etc/init.d/postgresql
cd /usr/local
sudo ln -s ${_PSG_VER} postgresql
sudo /usr/sbin/groupadd -g 20026 postgres
sudo /usr/sbin/useradd -u 20026 -g 20026 -c 'PostgreSQL Server' -d /usr/local/postgresql -s /bin/bash postgres
sudo chown postgres:postgres -R ${_PSG_VER}
ls -al ./postgresql*
Make postgres disk
sudo mkdir -pv /usr/local/var/log/postgresql
sudo mkdir -pv /var/run/postgres
sudo chown postgres:postgres -Rv /usr/local/var/postgresql/{conf,var} /usr/local/var/log/postgresql /var/run/postgres
sudo -u postgres /usr/local/postgresql/bin/initdb -D /usr/local/var/postgresql/var/data -U postgres --no-locale --encoding=UTF-8
sudo -u postgres cp -v /usr/local/postgresql/share/postgresql.conf.sample /usr/local/var/postgresql/var/data/postgresql.conf
sudo -u postgres cp -iv /usr/local/postgresql/share/pg_service.conf.sample /usr/local/var/postgresql/conf/pg_service.conf
sudo -u postgres cp -iv /usr/local/postgresql/share/pg_ident.conf.sample /usr/local/var/postgresql/conf/pg_ident.conf
sudo -u postgres cp -iv /usr/local/postgresql/share/pg_hba.conf.sample /usr/local/var/postgresql/conf/pg_hba.conf
sudo vi /usr/local/var/postgresql/conf/pg_hba.conf
sudo vi /usr/local/var/postgresql/var/data/postgresql.conf -> reffer to the stg-ktw101z.stg.jp.local
echo "/usr/local/lib" |sudo tee -a /etc/ld.so.conf.d/libc.conf
echo "/usr/local/postgresql/lib" |sudo tee -a /etc/ld.so.conf.d/postgres.conf
sudo /sbin/ldconfig
/sbin/ldconfig -p |grep postgres
sudo /etc/init.d/postgresql start
JAVA
_JDK_VER=jdk1.6.0_24
_JDK_HOME=/usr/java
mkdir -pv ~/src/archive; cd ~/src/archive
http_proxy="http://sysworks01.db.rakuten.co.jp:10080" wget ""
sudo mkdir -pv /usr/java; cd /usr/java
sudo ~/src/archive/jdk-6u24-linux-x64.bin
sudo ln -s ${_JDK_VER} jdk6
ls -la
ZBX
_ZBX_VER=zabbix-2.0.6
_ZBX_HOME=/usr/local/${_ZBX_VER}
export PATH="${PATH}:/usr/java/jdk6/bin"
mkdir -pv ~/src/archive; cd ~/src/archive
http_proxy="http://sysworks01.db.rakuten.co.jp:10080" wget "http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/${_ZBX_VER//zabbix-/}/${_ZBX_VER}.tar.gz/download"
tar zxvf ./${_ZBX_VER}.tar.gz -C ../
cd ../${_ZBX_VER}
CFLAGS="-Wall -fno-strict-aliasing -O3" \
./configure \
--prefix=${_ZBX_HOME} \
--enable-server \
--enable-agent \
--enable-java \
--with-net-snmp \
--with-libcurl \
--with-postgresql=/usr/local/postgresql/bin/pg_config
make
sudo make install
cd /usr/local
sudo ln -s ${_ZBX_VER} zabbix
ls -la ./zabbix*
sudo cp -vr ~/src/${_ZBX_VER}/misc/init.d/fedora/core5/zabbix_server /etc/init.d/
cd /etc
sudo scp -r `whoami`@stg-ktw101z.stg.jp.local:/etc/zabbix ./
sudo mkdir -pv /var/run/zabbix /usr/local/var/log/zabbix
sudo chown -Rv zabbix:zabbix /var/run/zabbix /usr/local/var/log/zabbix
sudo cp -vr ~/src/${_ZBX_VER}/misc/init.d/fedora/core5/zabbix_server /etc/init.d/
sudo vi /etc/init.d/zabbix_server
sudo /etc/init.d/postgresql status -> check "" pg_ctl: server is running (PID: 7857) ""
/usr/local/postgresql/bin/createuser -U postgres zabbix -P -S -R -D -> Enter Password
/usr/local/postgresql/bin/createdb -U postgres -O zabbix -E UTF8 zabbix_db01
/usr/local/postgresql/bin/psql -U zabbix zabbix_db01 < ~/src/${_ZBX_VER}/database/postgresql/schema.sql
/usr/local/postgresql/bin/psql -U zabbix zabbix_db01 < ~/src/${_ZBX_VER}/database/postgresql/images.sql #Proxy doesn't need
/usr/local/postgresql/bin/psql -U zabbix zabbix_db01 < ~/src/${_ZBX_VER}/database/postgresql/data.sql #Proxy doesn't need
/usr/local/postgresql/bin/psql -U zabbix zabbix_db01 -c "\di"
sudo /etc/init.d/zabbix_server start
Apache
_APACHE_HOME=/usr/local/apache22-monitor01
_APACHE_VER=httpd-2.2.25
mkdir -pv ~/src/archive; cd ~/src/archive
http_proxy="http://sysworks01.db.rakuten.co.jp:10080/" wget "http://ftp.jaist.ac.jp/pub/apache//httpd/${_APACHE_VER}.tar.bz2"
tar jxvf ./${_APACHE_VER}.tar.bz2 -C ../
cd ../${_APACHE_VER}
CFLAGS_OPTS="-C3"
CFLAGS="${CFLAGS_OPTS}" ./configure \
--prefix=${_APACHE_HOME} \
--with-mpm=prefork \
--enable-mods-shared="ssl autoindex deflate" \
--enable-modules="rewrite expires headers info usertrack mime_magic" \
--disable-version \
--disable-cgid \
--disable-cgi \
--disable-actions \
--disable-userdir \
--disable-include \
--disable-authn-file \
--disable-authn-default \
--disable-authz-groupfile \
--disable-authz-user \
--disable-authz-default \
--disable-auth-basic
make
sudo make install
ls -la /usr/local
sudo rm -vr ${_APACHE_HOME}/conf/httpd.conf ${_APACHE_HOME}/conf/extra
cd ${_APACHE_HOME}/conf
sudo scp `whoami`@stg-ktw101z.stg.jp.local:/usr/local/apache22-monitor01/conf/httpd.conf ./
sudo scp -r `whoami`@stg-ktw101z.stg.jp.local:/usr/local/apache22-monitor01/conf/extra ./
sudo mkdir -vp /usr/local/apache22-monitor01/vhosts/monitor-i18n/{logs,htdocs}
sudo mkdir -v /var/run/apache
sudo cp -vir ~/src/${_ZBX_VER}/frontends/php/* /usr/local/apache22-monitor01/vhosts/monitor-i18n/htdocs/zabbix/
sudo vi "/usr/local/apache22-monitor01/vhosts/monitor-i18n/htdocs/zabbix/conf/zabbix.conf.php"
PHP
sudo mkdir /etc/php -pv
_PHP_VER=php-5.5.10
_PHP_HOME=/usr/local/${_PHP_VER}
cd ~/src/archive
http_proxy="http://sysworks01.db.rakuten.co.jp:10080" wget "http://jp1.php.net/get/${_PHP_VER}.tar.bz2/from/this/mirror"
tar jxvf ./${_PHP_VER}.tar.bz2 -C ../
cd ../${_PHP_VER}
_PSG_HOME=/usr/local/postgresql
_APACHE_HOME=/usr/local/apache22-monitor01
CFLAGS="-Wall -fno-strict-aliasing -O3" ./configure \
--prefix=${_PHP_HOME} \
--disable-ipv6 \
--enable-bcmath \
--enable-mbstring \
--enable-sockets \
--with-gd \
--enable-gd-jis-conv \
--with-jpeg-dir=/usr/lib \
--with-png-dir=/usr/lib \
--with-freetype-dir=/usr/lib \
--with-gettext \
--with-curl \
--with-apxs2=${_APACHE_HOME}/bin/apxs \
--with-config-file-path=/etc/php \
--with-pgsql=${_PSG_HOME}/bin \
--with-pdo-pgsql=${_PSG_HOME}/bin
make
sudo make install
ls -la /usr/local/apache22-monitor01/modules/libphp5.so
cd /usr/local/
sudo ln -s ${_PHP_VER} php
sudo cp -vi ~/src/${_PHP_VER}/php.ini-production /etc/php/php.ini
sudo vi /etc/php/php.ini
sudo ${_APACHE_HOME}/bin/apachectl start
Monitoring Tools
_FPING_VER=fping-3.5
cd ~/src/archive
http_proxy="http://sysworks01.db.rakuten.co.jp:10080" wget "http://fping.org/dist/${_FPING_VER}.tar.gz"
tar zxvf ./${_FPING_VER}.tar.bz -C ../
cd ../${_FPING_VER}
./configure \
--prefix=/usr \
--enable-ipv4
make
sudo make install
ls /usr/sbin/fping
sudo chown root:zabbix /usr/sbin/fping
sudo chmod 710 /usr/sbin/fping
sudo chmod ug+s /usr/sbin/fping
cd /usr/bin && ls -la ./traceroute
sudo ln -s /bin/traceroute
ls -la ./traceroute
Optional: OPcache (PHP extension)
_OPCACHE_VER=zendopcache-7.0.3
cd ~/src/archive
http_proxy="http://sysworks01.db.rakuten.co.jp:10080" wget "http://pecl.php.net/get/${_OPCACHE_VER}.tgz"
tar zxvf ./${_OPCACHE_VER}.tgz -C ../
cd ../${_OPCACHE_VER}
/usr/local/php/bin/phpize
./configure --enable-opcache --with-php-config=/usr/local/php/bin/php-config
sudo make install
sudo vim /etc/php/php.ini
/usr/local/php/bin/php -v | grep OPcache
#empty
sudo /usr/local/apache22-monitor01/bin/apachectl restart
/usr/local/php/bin/php -v | grep OPcache
#with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies