Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jtzero/22ee8e052c10f186b4f2d5e66ecef191 to your computer and use it in GitHub Desktop.
Save jtzero/22ee8e052c10f186b4f2d5e66ecef191 to your computer and use it in GitHub Desktop.

cd ~/Downloads

wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb

dpkg -i zabbix-release_3.2-1+xenial_all.deb

apt-get update

should add /etc/apt/sources.list.d/zabbix.list

apt-get install nginx postgresql php php-cli php-fpm php-pgsql php-bcmath php-mbstring \ php-gd php-xml zabbix-server-pgsql zabbix-frontend-php

mine errored /var/lib/dpkg/info/zabbix-frontend-php.postinst: 24: /var/lib/dpkg/info/zabbix-frontend-php.postinst: /usr/sbin/a2enconf: not found

just re-ran apt-get install zabbix-frontend-php

should create /etc/php/7.0/mods-available/ and pdo_pgsql.ini and bcmath.ini should exist

Creating config file /etc/php/7.0/mods-available/bcmath.ini with new version

if you got Not replacing deleted config file /etc/php/7.0/mods-available/some_extension_name.ini then the ini's weren't created run an apt-get purge php-postgresql php-bcmath php-mbstring php-gd php-xml and run the apt-get install from above nano /etc/sites-enabled/default and add at the top

upstream php-handler {
  server unix:/var/run/php/php7.0-fpm.sock;
}

and inside of server {

location /zabbix {
  if ($scheme ~ ^http:){
      rewrite ^(.*)$  https://$host$1 permanent;
  }
  alias                       /usr/share/zabbix/;
  index                       index.php;
  error_page          403 404 502 503 504  /zabbix/index.php;

  location ~ \.php$ {
      if (!-f $request_filename) { return 404; }
      expires                 epoch;
      include                 /etc/nginx/fastcgi_params;
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_index           index.php;
      fastcgi_pass            php-handler;
      # https://blog.martinfjordvald.com/2013/04/nginx-config-history-fastcgi_params-versus-fastcgi-conf/
      # "as it takes the alias directive into account,..."
      fastcgi_param SCRIPT_FILENAME $request_filename;
  }

  location ~ \.(jpg|jpeg|gif|png|ico)$ {
      access_log      off;
      expires         33d;
  }
}

systemctl restart nginx.service

navigate to http://locahost/zabbix should load the zabbix pre-install


sudo su postgres

psql

psql_shell> CREATE USER zabbix WITH PASSWORD 'zabbix';

psql_shell> CREATE DATABASE zabbix WITH ENCODING='UTF-8' OWNER zabbix;

psql_shell> GRANT ALL PRIVILEGES ON DATABASE zabbix to zabbix;

psql_shell> \c zabbix zabbix -- change to zabbix databsae

psql_shell> \d -- verify the tables are owned by user zabbix

psql_shell> \q

zcat /usr/share/doc/zabbix-server-pgsql/create.sql.gz | psql -U zabbix zabbix

exit

nano /etc/postgresql/9.5/main/pg_hba.conf

add lines

local    zabbix          zabbix                                md5
host     zabbix          zabbix          192.168.2.1/32        md5

nano /etc/php/7.0/fpm/php.ini find and modify the following items

memory_limit 128M
max_execution_time 300
post_max_size 16M
upload_max_filesize 2M
max_input_time 300
date.timezone YOUR_TIMEZONE

add this to the bottom always_populate_raw_post_data -1

/etc/init.d/php7.0-fpm restart you can use systemctl but mine didnt report anything

nano /etc/zabbix/zabbix_server.conf

update DBName=zabbix DBUser=zabbix DBPassword=zabbix

/etc/init.d/zabbix-server restart

navigate to http://localhost/zabbix and follow the steps, it should generate /usr/share/zabbix/conf/zabbix.conf.php -> /etc/zabbix/web/zabbix.conf.php and redirect you to a login screen which the login is Admin/zabbix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment