Firstly, download Ubuntu Server 16.04 from the Ubuntu website – You’ll need to get this installed yourself, there’s thousands of guides on the internet if you’re struggling.

Once your server is accessible, i’d recommend that you SSH to it, although you could perform this though a console.

Firstly, update the APT repositories to ensure everything’s up to date

apt-get update

And update any out of date packages. Review the packages that require updating, and then then type ‘yes’ on your keyboard when prompted if happy.

apt-get upgrade

Next, we’ll install some packages that are required for zabbix server

apt-get -y install build-essential mysql-server mysql-client libmysqlclient-dev libcurl4-openssl-dev libxml2-dev libopenipmi-dev libssl-dev libsnmp-dev libssh2-1-dev

You’ll be prompted to create a password for the MySQL root user – please make a password and remember it!

These should all install without any errors, if you’re having problems please leave a comment and I’ll try to help

Now we’ll download the Zabbix source and extract it

cd /usr/src
wget http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz
tar xzfv zabbix-3.0.3.tar.gz

Now we start getting to the fun part, actually configuring and compiling Zabbix. I’ve configured it with everything but ssh and jabber, you may remove parts such as –with-openipmi if you’re not wishing to use IPMI monitoring.

cd zabbix-3.0.*
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-openssl --prefix=/usr/local

This should only take a few moments, and you’ll be presented with the final configuration – check over this to ensure it has everything you need and then we can start compiling.

make install

This only took a minute or so on my small virtual machine I tested with, but could be slightly slower or faster depending on the specification of the server.

Now, we’ll make the MySQL accounts that Zabbix will need. Let’s start by getting to the MySQL console

mysql -u root -p

This will prompt for the MySQL root password that we set earlier. Now we’ll run the SQL to create the Zabbix user and database and assign that user privileges to access that database. Please change PASSWORD to your own password, this can be something completely random as you’ll only need it once to configure Zabbix.

create user 'zabbix'@'localhost' identified by 'PASSWORD';
create database zabbix;
grant all privileges on `zabbix`.* to 'zabbix'@'localhost';
flush privileges;
exit;

After each line, you should get returned something like ‘Query OK, 0 rows affected (0.00 sec)’ or ‘Query OK, 1 row affected (0.00 sec)’ printed to the screen.

Now we’ll import the Zabbix schema.

cd database/mysql
mysql -u root -p zabbix < schema.sql
mysql -u root -p zabbix < images.sql
mysql -u root -p zabbix < data.sql

You’ll be prompted to enter the MySQL root password 3 times here. If everything is OK there will be no other messages printed.

Now we’ll configure the MySQL password in the zabbix-server configuration file. Open /usr/local/etc/zabbix_server.conf in your text editor.

At around line 111, you’ll see the line

# DBPassword=

remove the # from the front and paste the Zabbix MySQL user password on the end. It should now look like this

DBPassword=PASSWORD

Save and quit the file.

Now we’ll add a user for Zabbix to run as. We’ll configure scripts to control the zabbix server daemon.

Create the file /etc/systemd/system/multi-user.target.wants/zabbix-server.service

Paste the following contents into the file and save and quit

[Unit]
Description=Zabbix Server
After=syslog.target network.target mysqld.service

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/zabbix_server -c /usr/local/etc/zabbix_server.conf
ExecReload=/usr/local/sbin/zabbix_server -R config_cache_reload
RemainAfterExit=yes
PIDFile=/var/run/zabbix/zabbix_server.pid

[Install]
WantedBy=multi-user.target

Now we need to add the user on the system for Zabbix to run as

useradd -M zabbix

Now we’ll reload systemd and start the zabbix-server service

systemctl daemon-reload
systemctl start zabbix-server.service

That completes the configuration needed for zabbix-server, we’ll move onto the Web interface now.

Firstly, install NGINX, PHP and various PHP modules that we’ll need to run the web interface.

apt-get -y install nginx php php-bcmath php-mbstring php-gd php-xmlwriter php-xmlreader php-mysqli

Now we’ll need to make a directory for the files to be served from and copy the front end files to it.

mkdir /usr/local/www
cd ../../frontends/php/
cp -r * /usr/local/www/
chown -R www-data:www-data /usr/local/www/*

Now we’ll configure the web server. Open /etc/nginx/sites-enabled/default in your favorite text editor. Delete all the existing contents and replace them to look like this:

server {
listen 80 default_server;
listen [::]:80 default_server;

root /usr/local/www;

index index.php;

server_name _;

location / {
try_files $uri $uri/ =404;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}

Now save this file. Next we’ll be changing some options in the PHP config. Open /etc/php/7.0/fpm/php.ini with your text editor.

Around line 368 you will see

max_execution_time = 30

This needs to be changed to

max_execution_time = 300

Around line 378 you will see

max_input_time = 60

This needs to be changed to

max_input_time = 300

Around line 656 you will see

post_max_size = 8M

This needs to be changed to

post_max_size = 16M

Around line 912 you will see

;date.timezone =

This needs to be changed like this

date.timezone = Europe/London

See a list of possible timezones here.

Save and exit the file, and restart NGINX and PHP FPM.

Now, go to your server’s address in your web browser, you should see a screen like this

Screen Shot 2016-06-19 at 07.58.28

Click the ‘Next Step’ button and you will be presented with a ‘Check of pre-requisites’ page. Scrolling down the list these should all have ‘OK’ next to them.

On the next page, you’ll just need to enter the password for the zabbix user in MySQL.

Screen Shot 2016-06-19 at 08.01.12

If everything is Ok, the next page will look like this. You can optionally give your server a name.

Screen Shot 2016-06-19 at 08.02.30

On the next page you’ll be presented with an installation summary like the below

Screen Shot 2016-06-19 at 08.03.07

On the next page, you’ll get a ‘Congratulations’ page like this

Screen Shot 2016-06-19 at 08.03.44

You’ve now successfully installed Zabbix and it’s web interface! Clicking finish will take you to the login page, the default user is admin and the password is zabbix.

You should see on the dashboard that the Zabbix server is running. This means all is OK – you can now start configuring Zabbix.

If you have any problems or questions, please leave a comment below.