1. Adicionar os repositórios para o
MariaDB e para o
PHP 5.5:
# nano /etc/yum.repos.d/mariadb.repo
[mariadb]
name = mariadb
baseurl = http://yum.mariadb.org/10.0/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# nano /etc/yum.repos.d/remi.repo
[remi]
name=Remi's RPM repository for Enterprise
Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[remi-php55]
name=Remi's PHP 5.5 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php55/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php55/mirror
# NOTICE: common dependencies are in "remi-safe"
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
# NOTICE: common dependencies are in "remi-safe"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
# yum update -y
2. Instalar o MariaDB e criar a base da dados do Zabbix.
# yum install MariaDB-server MariaDB-client -y
# service mysql start
2.1. Após a instalação do banco, vamos colocar uma senha de acesso para o root:
# mysql_secure_installation
Note:
RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Dê
Enter:
current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
2.2. Criar a base de dados para o Zabbix:
# mysql -u root -p
mysql>
CREATE DATABASE zabbix;
mysql>
GRANT ALL PRIVILEGES on zabbix.* to 'zabbixusr'@'localhost' IDENTIFIED BY 'SECRET_PASSWORD';
mysql>
FLUSH PRIVILEGES;
mysql>
quit
3. Instalar o Apache e iniciar:
# yum install httpd -y
# chkconfig httpd on
# service httpd start
4. Instalar os pacotes PHP:
# yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml php-bcmath
5. Instalação do repositório do Zabbix:
# rpm -Uvh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
5.1. Instalação dos pacotes do Zabbix:
# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
5.2. Importar o shema e os dados para o banco do Zabbix criado anteriormente:
# cd /usr/share/doc/zabbix-server-mysql-3.0.3/
# zcat create.sql.gz | mysql -u root -p zabbix
5.3. Configuração de conexão do Zabbix Server ao banco de dados:
# nano /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbixusr
DBPassword=SECRET_PASSWORD
# chkconfig zabbix-server on
# service zabbix-server start
6. Alterar os valores abaixo no "php.ini":
# nano /etc/php.ini
max_execution_time 300
memory_limit 128M
post_max_size 16M
upload_max_filesize 2M
max_input_time 300
always_populate_raw_post_data -1
date.timezone America/Sao_Paulo
7. Criar o vhost para o Zabbix:
# nano /etc/httpd/conf.d/vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName zabbix.inpi.gov.br
ServerAlias zabbix
DocumentRoot /usr/share/zabbix/
<Directory "/usr/share/zabbix/">
php_admin_flag register_globals on
Options Indexes -MultiViews FollowSymLinks
AllowOverride all
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
7.1. Reiniciar o Apache e acessar a URL:
# service httpd restart
7.2. URL para acesso após criar o vhost.
Fim.