Monday, 27 May 2013

Zabbix installation guide on ubuntu

1.  install apache2, apache2.2-common
#aptitude install apache2, When the Ubuntu installation is finished, you should be able to point your web browser to the server's IP number, and see a directory listing of the sites you have configured. Initially, this should show “apache2-default”, which will simply show a page saying “It works!” if you click on it.

2.  install php5
#aptitude install php5

3.  install mysql-server
#aptitude install mysql-server

4.  install php5-cgi php5-common php5-curl php5-gd php5-mysql
#apt-get install php5-cgi php5-common php5-curl php5-gd php5-mysql -y

5.  install zabbix-server-mysql zabbix-frontend-php
#aptitude install zabbix-server-mysql zabbix-frontend-php

6.  changes for php configuration 
#vi /etc/php5/apache2/php.ini
change default setting to followings 
date.timezone = Asia/Singapore
max_execution_time = 600 
memory_limit = 256M
post_max_size = 32M
mbstring.func_overload = 2

7.  restart apache2
#/etc/init.d/apache2 restart

8.  visit http://[your server ip]/zabbix with a browser, and go through the configuration steps. 

Apache+PHP+Fastcgi on Ubuntu server

1. In order to install Apache2, mod_fcgid, and php5, run
    #apt-get install apache2 apache2-suexec libapache2-mod-fcgid php-cgi
2. If Apache2 was already installed with PHP5 as an Apache2 module, disable the PHP5 module,
     #a2dismod php5
3. Then enable the following modules,
     #a2enmod rewrite
     #a2enmod suexec
     #a2enmod include
     #a2enmod fcgid
4. Open /etc/php5/cgi/php.ini, and uncomment following one line,
     cgi.fix_pathinfo = 1
5. Reload Apache,
    #/etc/init.d/apache2 force-reload
6. Creating Vhost for www.test.com,
           #useradd -s /bin/false -d /var/www/test test
           #mkdir -p /var/www/test/php-fcgi-scripts
           #mkdir -p /var/www/test/www 
           #vi /var/www/test/php-fcgi-scripts/php-fcgi-starter
                       #!/bin/sh
                       PHPRC=/etc/php5/cgi
                       export PHPRC
                       export PHP_FCGI_MAX_REQUESTS=5000
                       export PHP_FCGI_CHILDREN=8
                       exec /usr/lib/cgi-bin/php
      The PHPRC line contains the directory where the php.ini file is located                                         (i.e., /etc/php5/cgi/ translates to/etc/php5/cgi/php.ini). PHP_FCGI_MAX_REQUESTS is  the  maximum number of requests before an fcgid process is stopped and a new one is launched. PHP_FCGI_CHILDREN defines the number of PHP children that will be launched.  
           #chmod 755 /var/www/test/php-fcgi-scripts/php-fcgi-starter
           #chown -R test:test /var/www/test/php-fcgi-scripts
           vi /etc/apache2/sites-available/test
<VirtualHost *:80>
  ServerName www.test.com
  ServerAlias test.com
  ServerAdmin webmaster@test.com
  DocumentRoot /var/www/test/www/

  <IfModule mod_fcgid.c>
    SuexecUserGroup test test
   #PHP_Fix_Pathinfo_Enable 1
    <Directory /var/www/test/www/>
      Options +ExecCGI
      AllowOverride All
      AddHandler fcgid-script .php
      FCGIWrapper /var/www/test/php-fcgi-scripts/php-fcgi-starter .php
      Order allow,deny
      Allow from all
    </Directory>
  </IfModule>

  # ErrorLog /var/log/apache2/error.log
  # CustomLog /var/log/apache2/access.log combined
  ServerSignature Off

</VirtualHost>    
           
       
           #a2ensite test              
7. Reload Apache afterwards:
    #/etc/init.d/apache2 reload