Ad Widget

Collapse

Zabbix Installation Ubuntu Server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NomenNescio
    Member
    • Jan 2009
    • 70

    #1

    Zabbix Installation Ubuntu Server

    A clean Zabbix installation 1.6.2 server and agent on Ubuntu Server.
    This tutorial assumes you have LAMP (Linux Apache MySql PHP) installed. You can choose to install it while installing Ubuntu Server.
    First you will have to install the following packages:

    gcc
    libmysql++-dev
    libcurl4-gnutls-dev
    snmp
    libsnmp-dev
    php5-gd

    These can be installed by the following command

    sudo apt-get install ‘package name here’

    for example:

    sudo apt-get install gcc

    Do this with all the packages mentioned above.
    After you have done this, make a ‘zabbix’ account on linux, and add him to the admin group. You can do that with the following commands:

    sudo adduser zabbix

    and after you have created this user account, you can add it to the admin group with the this command:

    sudo adduser zabbix admin

    Then log into your zabbix account. Make sure you are in your home directory. You can check this by typing the command pwd it will show your current location. Your home directory probably is /home/zabbix and if it is not you can get there by typing:

    cd ~ or by typing cd /home/zabbix

    Now you should download the zabbix binaries. Go to the Zabbix website, “http://zabbix.com” to download the Zabbix binaries. You can download the Zabbix binaries from the command line by typing:

    wget ‘direct link here’

    Find the link to the Zabbix binaries and use the wget command. When I downloaded zabbix, my direct link was: (yours might be different)

    wget http://mesh.dl.sourceforge.net/sourc...x-1.6.2.tar.gz

    after you have downloaded the file, you can extract it by typing:

    tar –xvzf zabbix-1.6.2.tar.gz

    get in the extracted directory:

    cd zabbix-1.6.2

    now we must create the zabbix database and tables, you can do that by typing the following commands:

    mysql –u’user’ –p’Secret’ (Example: mysql –uroot –pSecret )

    create database zabbix; (don’t forget the ; )

    verify that you created the database by typing “show databases”, zabbix should be in the list now.
    Type quit to exit MySql
    Now we must populate the Zabbix database with tables. We can do this with the following commands (assuming you are in the zabbix-1.6.2 directory):

    cat create/schema/mysql.sql | mysql –uroot –pToekomst06 zabbix
    cat create/data/data.sql | mysql –uroot –pToekomst06 zabbix
    cat create/data/images_mysql.sql | mysql –uroot –pToekomst06 zabbix

    Now we run configure (assuming you are still in the zabbix-1.6.2 directory), enter the following command:

    sudo ./configure --enable-server --enable-agent --with-net-snmp --with-libcurl --with-mysql

    (You can choose to install more, look in the manual for more info)

    Now type:

    sudo make

    and then

    sudo make install

    now we must create a directory to put the zabbix config files in. Issue the following commands:

    sudo mkdir /etc/zabbix
    sudo cp misc/conf/zabbix_* /etc/zabbix/

    We will edit those config files later, first we must place the php frontend somewhere.

    sudo mkdir /home/zabbix/web
    sudo cp -R frontends/php/* /home/zabbix/web
    sudo chown –R zabbix /home/zabbix/web

    now, you must edit the file /etc/apache2/sites-enabled/000-default, first go to that directory:

    cd /etc/apache2/sites-enables

    Then edit the file with your editor of choice, mine’s vim so I’ll use vim for the rest of the tutorial.

    sudo vim 000-default

    change the line:
    DocumentRoot /var/www/
    To
    DocumentRoot /home/zabbix/web/
    and change the line :
    <Directory /var/www/>
    To
    <Directory /home/zabbix/web/>
    now open the file services in /etc

    sudo vim /etc/services

    and add the following lines:
    zabbix-agent 10050/tcp
    zabbix-agent 10050/udp
    zabbix-trap 10051/tcp
    zabbix-trap 10051/tcp

    now we must set the timezone and php execution time in php.ini
    php.ini is located in /etc/php5/apache2/php.ini

    open it with your editor

    sudo vim /etc/php5/apache2/php.ini

    change the line:
    max_execution_time = 30
    to
    max_execution_time = 300

    and
    change the line:
    ;date.timezone =
    to
    date.timezone = ‘your time zone here’, for example, I changed the mine to
    date.timezone = Europe/Amsterdam
    Supported timezone values can be found here:

    And don’t forget to remove the ;

    save the file and exit.
    restart apache by typing:

    sudo apache2ctl -k graceful

    (you have to restart apache every time you make a change to 000-default or php.ini to apply the changes)

    now go to the zabbix config files we moved to /etc/zabbix, type

    cd /etc/zabbix

    Edit the zabbix_server.conf file and
    change
    #ListenPort=10051
    to
    ListenPort=10051

    change the line
    DBUser=root
    to
    DBUser=(user that has the rights to the zabbix database, this could also be root)

    change the line

    #DBPassword=<password>
    to
    DBpassword=(password for the database user)

    Save the changes and open zabbix_agentd.conf file which is in the same directory as zabbix_server.conf.

    The line Server=127.0.0.1 does not have to be changed because zabbix server is running on the same machine. If you had installed zabbix agent on a different computer, you would have to set the IP to the machine where zabbix server is running.

    change the line
    #ServerPort=10051
    to
    ServerPort=10051

    The line
    Hostname= You may change this to a name you would like to give your host.

    Change the line
    #ListenPort=10050
    to
    ListenPort=10050

    Save and exit.

    Start up a web browser and type the server’s IP in the address bar. Insert all data, make sure it works, then save the resulting file in the specified linux directory.

    Zabbix is now installed, you can now log into zabbix, the default zabbix admin login is:

    Username: Admin
    Password: Zabbix
  • bbrendon
    Senior Member
    • Sep 2005
    • 870

    #2
    Why not install the packages?
    Unofficial Zabbix Expert
    Blog, Corporate Site

    Comment

    • NomenNescio
      Member
      • Jan 2009
      • 70

      #3
      Doesn't that usually install an older version?

      Comment

      • bbrendon
        Senior Member
        • Sep 2005
        • 870

        #4
        No. Both Ubuntu and debian have current packages.
        Unofficial Zabbix Expert
        Blog, Corporate Site

        Comment

        • NomenNescio
          Member
          • Jan 2009
          • 70

          #5
          Ah whatever, it might help someone who wants to do it the difficult way

          Comment

          • tchjts1
            Senior Member
            • May 2008
            • 1605

            #6
            Those directions also exist on the Zabbix Wiki - http://www.zabbix.com/wiki/doku.php?...:ubuntuinstall

            Community involvement is always good though!

            Comment

            • bbrendon
              Senior Member
              • Sep 2005
              • 870

              #7
              Originally posted by NomenNescio
              Ah whatever, it might help someone who wants to do it the difficult way
              LOL. Yes, there are scripts for that too

              There was a long thread once upon a time about how hard it was to install zabbix...blah blah complain complain.

              So I wrote this to silence them
              Unofficial Zabbix Expert
              Blog, Corporate Site

              Comment

              • elg
                Junior Member
                • Feb 2009
                • 2

                #8
                For ubuntu, the packages available are 1.4.2, not the latest released.

                root@zabbixsrv:~# apt-cache show zabbix-server-mysql
                Package: zabbix-server-mysql
                Priority: optional
                Section: universe/net
                Installed-Size: 2456
                Maintainer: Ubuntu MOTU Developers <[email protected]>
                Original-Maintainer: Zabbix Maintainers <[email protected]>
                Architecture: i386
                Source: zabbix
                Version: 1:1.4.2-4ubuntu3

                Comment

                • bbrendon
                  Senior Member
                  • Sep 2005
                  • 870

                  #9
                  Are you sure about that?
                  Unofficial Zabbix Expert
                  Blog, Corporate Site

                  Comment

                  • Tenzer
                    Senior Member
                    • Nov 2007
                    • 316

                    #10
                    Originally posted by bbrendon
                    Who are going to run a Debian server with the 'testing' or 'unstable' repositories?
                    The fact is that neither Ubuntu or Debian has a current version of Zabbix in their stable releases:

                    Comment

                    • bbrendon
                      Senior Member
                      • Sep 2005
                      • 870

                      #11
                      Originally posted by Tenzer
                      Who are going to run a Debian server with the 'testing' or 'unstable' repositories?
                      Hopefully no one.
                      Originally posted by Tenzer
                      The fact is that neither Ubuntu or Debian has a current version of Zabbix in their stable releases:
                      I'm not sure how that is relevant. The source packages are available.
                      Unofficial Zabbix Expert
                      Blog, Corporate Site

                      Comment

                      • troffasky
                        Senior Member
                        • Jul 2008
                        • 567

                        #12
                        Originally posted by Tenzer
                        The fact is that neither Ubuntu or Debian has a current version of Zabbix in their stable releases:
                        There's usually a reason for that.

                        Comment

                        • DSon
                          Member
                          • Sep 2009
                          • 44

                          #13
                          Question

                          Thanks for the instructions thus far in this thread. I'm having a problem with each of our Zabbix servers, namely that the zabbix_server service doesn't auto start.

                          The zabbix_server.log file states an error "creating mutex for log file". If I restart the server service it (mostly) won't work, stating "error connecting to mysql socket". If I then restart the server service for the 2rd time, it comes up okay.

                          Has anyone else had this behaviour?

                          I think it may be something to do with the startup sequence / timing - maybe that zabbix is trying to start before mysql / something else?

                          If anyone has any thoughts I'd be very greatful.



                          Thanks,
                          DSon.

                          Comment

                          • tchjts1
                            Senior Member
                            • May 2008
                            • 1605

                            #14
                            It would be helpful if you told us the version of Zabbix and Ubuntu that you have.

                            if the service is not auto starting, did you complete this step of the install?

                            Code:
                            Set the correct permissions and set ZABBIX to start when the machine boots: 
                            sudo chmod 755 /etc/init.d/zabbix-server
                            sudo update-rc.d zabbix-server defaults
                            sudo chmod 755 /etc/init.d/zabbix-agent
                            sudo update-rc.d zabbix-agent defaults

                            Comment

                            • DSon
                              Member
                              • Sep 2009
                              • 44

                              #15
                              More information..

                              Ok, thanks for the help- my version of Ubuntu is 8.10 and Zabbix is version 1.6.4.

                              I've also checked a couple of things and found out the following:

                              - there may be a permissions issue

                              If I try and run zabbix-server (start|restart|stop) it tells me "access denied" when trying to remove the .PID file (nor does it create a .PID file if one doesn't exist). I've verified the owner of the /var/run/zabbix-server directory is "zabbix", as well as the /etc/init.d/zabbix-server (also "zabbix"). Maybe there is something wrong with the zabbix user? It is a member of both the "zabbix" and "admin" groups - is this not sufficient to allow the zabbix user to create a .PID file? The only way I can run zabbix-server is by putting "sudo" before it. As explained previously, even using sudo still requires me to run zabbix-server (with -restart) TWICE before it runs without an error in the log file (first the "unable to connect through mysql.sock error, second the ""mutex" error).

                              - the zabbix-server daemon is definitely trying to start too early

                              When I watch the server boot up sequence I can see zabbix_server starting (well trying to start) before MySQL. The zabbix_server log file also shows the message "unable to connect through mysql.sock" - presumably because MySQL wasn't running when zabbix_server tried to connect to the dbase. I have tried using "update-rc.d" to specifiy a higher priority (e.g. 30 - 99) but this makes only a slight difference. Maybe there is a way of telling the zabbix_server to "pause" until it sees the MySQL .PID file appear?

                              I think if I can get the zabbix_server process to start AFTER MySQL, instead of the "unable to connect through mysql.sock"

                              Please help!

                              DSon.

                              Comment

                              Working...