Chinaunix首页 | 论坛 | 博客
  • 博客访问: 52337
  • 博文数量: 19
  • 博客积分: 870
  • 博客等级: 准尉
  • 技术积分: 230
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-22 16:51
文章分类

全部博文(19)

文章存档

2013年(1)

2011年(1)

2009年(17)

我的朋友

分类: 系统运维

2009-03-25 14:14:09

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

Curl library

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, “ 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

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 :

To

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=
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

阅读(661) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~