Announcement

Collapse
No announcement yet.

Zabbix server install Centos 7

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Zabbix server install Centos 7

    Hello,

    here is a guide to install zabbix server on Centos 7 i have installed it
    and all works Great!
    hope it helps.

    Versions:
    Centos 7.3
    Zabbix server 3.2

    Credits:
    http://www.linuxtechi.com/install-za...ntos-7-rhel-7/
    https://serverfault.com/questions/23...per-table-cons



    Installation on a new server :
    First Server steps:
    yum update -y
    yum upgrade -y
    yum install wget epel-release php56-mbstring yum-utils
    yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optiona

    and then :
    yum install php-mbstring php-bcmath



    # add this to .bashrc :
    vi .bashrc

    HISTTIMEFORMAT="%d/%m/%y %T "

    # disable selinux:
    vi /etc/selinux/config
    change SELINUX=enforcing to SELINUX=disabled

    #then run on CLI and run:
    setenforce 0


    # installing Zabbix server:
    rpm -ivh http://repo.zabbix.com/zabbix/3.2/rh...el7.noarch.rpm

    yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway mariadb-server


    #start MariaDb:
    systemctl enable mariadb
    systemctl start mariadb


    #make SQL secure (optional)

    mysql_secure_installation


    #Set the below parameters in the PHP config file (/etc/php.ini )


    vi /etc/php.ini

    change this values:
    [CODE]max_execution_time = 600
    max_input_time = 600
    memory_limit = 256M
    post_max_size = 32M
    upload_max_filesize = 16M
    date.timezone = Asia/Kolkata (your machine timezone)


    #firewall settings:
    firewall-cmd --permanent --add-port=10050/tcp
    firewall-cmd --permanent --add-port=10051/tcp
    firewall-cmd --permanent --add-port=80/tcp
    firewall-cmd --reload
    systemctl restart firewalld

    # Now start services:

    systemctl start zabbix-server
    systemctl enable zabbix-server
    systemctl enable httpd
    systemctl restart httpd

    # to avoid future DB issues (DB growing too fast)we will set innodb per table:


    #Backup mysql:

    mysqldump --all-databases -p > mysqlall.sql


    #Shutdown mysql

    service mariadb stop


    # Add the following lines to /etc/my.cnf.d/server.conf

    [mysqld]
    innodb_file_per_table
    innodb_flush_method=O_DIRECT
    innodb_log_file_size=1G
    innodb_buffer_pool_size=4G
    innodb_data_file_path=ibdata1:10M:autoextend


    Whatever your set for innodb_buffer_pool_size, make sure innodb_log_file_size is 25% of innodb_buffer_pool_size.


    #Delete ibdata1, ib_logfile0 and ib_logfile1 (see update below before deleting!)

    rm -rf /var/lib/mysql/ib*


    #Restart mysql

    service mariadb restart


    #now we will set zabbix DB:


    mysql -p
    >> create database zabbixdb;
    >> grant all privileges on zabbixdb.* to [email protected] identified by 'PASSWORD';
    >> flush privileges;
    >>exit


    #building zabbixdb:
    cd /usr/share/doc/zabbix-server-mysql-3.2.4/
    gunzip create.sql.gz
    mysql -u root -p zabbixdb < create.sql


    # now we will set zabbix server DB Parameters at zabbix_server.conf:


    vi /etc/zabbix/zabbix_server.conf
    DBHost=localhost
    DBName=zabbixdb
    DBUser=zabbix
    DBPassword=XXXXXXX



    #restart server:

    systemctl restart Zabbix-server


    #enabling Zabbix agent and installing Zabbix_get:

    systemctl enable zabbix-agent
    systemctl start zabbix-agent

    wget http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-get-3.2.4-2.el7.x86_64.rpm

    rpm -Uvh zabbix-get-3.2.4-2.el7.x86_64.rpm


    after this been done go to http://127.0.0.1/zabbix
    it will reload zabbix first settings page just follow its orders and make sure
    all DB settings there is correct and all packages is marked as green OK.

    Login with :
    user: admin
    password: zabbix

    Good Luck!
    Last edited by batchenr; 15-04-2017, 23:43.

    #2
    yum install wget epel-release php56-mbstring yum-utils
    yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optiona

    and then :
    yum install php-mbstring php-bcmath
    I do not recommend installing both php56-mbstring and php-mbstring.
    Beginners are obstacles by installing different versions of packages at the same time, so please be careful.

    rhui-REGION-rhel-server-extras and rhui-REGION-rhel-server-optional are for RHEL 7 on EC2.
    These are not for CentOS 7.

    The following package is unnecessary if it is configured with the standard package of CentOS 7.

    Code:
    php56-mbstring yum-utils rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
    Also, if you install zabbix-web-mysql using the yum command, the following package will be installed automatically.

    Code:
    php-mbstring php-bcmath

    mysql -p
    >> create database zabbixdb;
    >> grant all privileges on zabbixdb.* to [email protected] identified by 'PASSWORD';
    >> flush privileges;
    >>exit
    In the manual, it is described as follows.

    Code:
    shell> mysql -uroot -p<root_password>
    mysql> create database zabbix character set utf8 collate utf8_bin;
    mysql> grant all privileges on zabbix.* to [email protected] identified by '<password>';
    mysql> quit;
    Please pay attention to the character set to use.
    If you do not specify a character code at create database, specify it in /etc/my.cnf.d/server.cnf.

    Manual:
    https://www.zabbix.com/documentation...ion_with_mysql


    #building zabbixdb:
    cd /usr/share/doc/zabbix-server-mysql-3.2.4/
    gunzip create.sql.gz
    mysql -u root -p zabbixdb < create.sql
    You can simplify the procedure as follows.
    Code:
    # zcat /usr/share/doc/zabbix-server-mysql-3.2.4/create.sql.gz | mysql -uzabbix -p zabbixdb
    wget http://repo.zabbix.com/zabbix/3.2/rh...el7.x86_64.rpm

    rpm -Uvh zabbix-get-3.2.4-2.el7.x86_64.rpm
    If you can use the yum command, just install the zabbix_get command by running the following command:
    Code:
    # yum install zabbix-get
    I encourage you to capitalize the first letter of the account when logging in to the web frontend. (admin -> Admin)
    It depends on the character set and collation of the DBMS environment to be used.

    Comment


      #3
      Hi,

      I'm trying to install Zabbix 3.2 on CentOS 7.3, but I get some keys errors.
      I think that there are any kind of differences with the packages on the repository.

      I didi it on some servers and I got the same error...

      I translate from spanish, for you:

      ---
      Total size: 42 M
      Instaled sizw: 156 M
      Is this ok [y/d/N]: y
      Downloading packages:
      warning:/var/cache/yum/x86_64/7/zabbix/packages/zabbix-agent-3.2.7-1.el7.x86_64.rpm: EncabezadoV4 RSA/SHA512 Signature, Key ID a14fe591: NOKEY
      Getting key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591


      The GPG keys listed for "Zabbix Official Repository - x86_64" repository, are installed, but aren't correct with this package.
      Check if the keys URLs for this repository are correct configured.


      Wrong package: zabbix-agent-3.2.7-1.el7.x86_64
      GPG keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

      ---

      I think are there an error on Zabbix site, but I apreciate some helps for install it.

      Thank, you

      Comment


        #4
        After reinstalling the zabbix-release package, try clearing the cache of yum before trying.

        ex.
        Code:
        # yum remove zabbix-release
        # yum install http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
        # yum clean all
        # yum install zabbix-agent

        Comment


          #5
          Excelent!!!

          Thank you very much!!!

          Comment


            #6
            more basic guide

            @ Atushi

            Would you be able to write a more basic step by step guide

            combining the Zabbix "Installation instructions"

            with your comments and filling in the blanks for the non Linux users like myself ?

            Thanks
            M

            Comment


              #7
              Hi mw72,
              If you have disabled SELinux, you can install it as follows.
              However, since version 3.2 has been discontinued, it is the procedure for version 3.4.

              Code:
              # yum update
              # yum install http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
              # yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
              # yum install mariadb-server
              # vi /etc/my.cnf.d/server.cnf
              -----
              [mysqld]
              character-set-server = utf8
              collation-server     = utf8_bin
              skip-character-set-client-handshake
              innodb_file_per_table
              -----
              
              # systemctl start mariadb
              # systemctl enable mariadb
              # mysql -uroot
              MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
              MariaDB [(none)]> grant all privileges on zabbix.* to [email protected] identified by 'password';
              MariaDB [(none)]> exit
              # zcat /usr/share/doc/zabbix-server-mysql-3.4.7/create.sql.gz | mysql -uroot zabbix
              # vi /etc/zabbix/zabbix_server.conf
              -----
              DBPassword=password
              -----
              
              # vi /etc/httpd/conf.d/zabbix.conf
              -----
              php_value date.timezone Asia/Tokyo
              -----
              
              # systemctl start zabbix-server
              # systemctl start zabbix-agent
              # systemctl start httpd
              # systemctl enable zabbix-server
              # systemctl enable zabbix-agent
              # systemctl enable httpd
              # firewall-cmd --add-port=10051/tcp --zone=public --permanent
              # firewall-cmd --add-service=http --zone=public --permanent
              # firewall-cmd --reload

              Comment

              Working...
              X