重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.6/zabbix-2.4.6.tar.gz
成武网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、响应式网站开发等网站项目制作,到程序开发,运营维护。创新互联自2013年创立以来到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联。
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.1/zabbix-3.0.1.tar.gz
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.4/zabbix-3.0.4.tar.gz
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
建议使用2.4.6版本,默认支持中文
lamp+zabbix
环境
CentOS release 6.5
httpd-2.4.12.tar.bz2
cmake-2.8.10.2.tar.gz
MySQL-5.6.16.tar.gz
php-5.4.19.tar.gz
zabbix-2.2.6.tar.gz
准备lamp环境
cd /usr/local/src
###################安装编译环境
yum -y install vim-enhanced gcc gcc-c++ flex bison autoconf automake bzip2-devel net-snmp-devel net-snmp \
ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel \
gettext-devel pam-devel libtool libtool-ltdl openssl openssl-devel fontconfig-devel \
libxml2-devel curl-devel libicu libicu-devel libmcrypt libmcrypt-devel libmhash libmhash-devel
##################安装apr(apr作用支持apache可移植环境)
tar -zxf apr-1.5.1.tar.gz
cd apr-1.5.1
./configure --prefix=/usr/local/apr
make && make install
cd ..
tar -zxf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
make && make install
cd ..
##################安装httpd
tar -xf httpd-2.4.12.tar.bz2
cd httpd-2.4.12
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewrite --enable-cgi --enable-cgid --enable-modules=most \
--enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install
cd ..
#################启动httpd
/usr/local/apache/bin/apachectl start
#################安装mysql(通过cmake编译)
tar -xf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap --prefix=/usr/local/cmake
make && make install
cd ..
tar -zxf mysql-5.6.16.tar.gz
cd mysql-5.6.16
/usr/local/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_TCP_PORT=3306 -DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_USER=mysql -DEXTRA_CHARSETS=all -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=14
make && make install
##################初始化数据库,启动数据库
cd /usr/local/mysql/
./scripts/mysql_install_db --user=mysql
cd /usr/local/src
cp -p /usr/local/src/mysql-5.6.16/support-files/my-default.cnf /etc/my.cnf
/usr/local/mysql/bin/mysqld_safe --user=mysql &
#################创建环境变量
cat /etc/profile.d/mysqld.sh
export PATH=$PATH:/usr/local/mysql/bin
source /etc/profile.d/mysqld.sh
#################创建mysql自启脚本
cp -p /usr/local/src/mysql-5.6.16/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
#################安装php插件
#wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
#wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
#wget http://nchc.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8-config.tar.gz
#wget http://www.zlib.net/zlib-1.2.3.tar.gz
#wget http://prdownloads.sourceforge.net/freetype/freetype-2.1.10.tar.gz?download
##############安装zlib
tar zxf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure –prefix=/usr/local/zlib
make
make install
cd ..
##############安装libtool
tar -zxf libtool-1.5.20.tar.gz
cd libtool-1.5.20
./configure
make && make install
cd ..
##############安装jpeg
tar -zxf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config/config.guess .
cp /usr/share/libtool/config/config.sub .
./configure --enable-shared --enable-static
make
make install
cd ..
##############安装linpng
tar zxf libpng-1.2.8.tar.gz
cd libpng-1.2.8
mv ./scripts/makefile.linux ./makefile
make && make install
cd ..
##############安装freetype
tar -zxf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure --prefix=/usr/local/freetype
make && make install
cd ..
##############安装gd
tar -zxf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --with-png --with-jpeg --with-freetype=/usr/local/freetype
make && make install
cd ..
###############安装libmcrypt
tar -xf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure --prefix=/usr/local/libmcrypt
make && make install
cd /usr/local/src/php-5.4.19/ext/mcrypt/
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
#################安装php
tar -zxf php-5.4.19.tar.gz
cd php-5.4.19
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbregex \
--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs \
--with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts --disable-fileinfo --with-gd --enable-gd-native-ttf \
--with-zlib-dir=/usr/local/zlib --with-png --with-jpeg --with-freetype-dir=/usr/local/freetype
make && make install
###############如果出现,以下错误,重新安装zlib库
/usr/local/zlib/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libphp5.la] 错误 1
cd /usr/local/src/zlib-1.2.3
CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib/
make
make install
make clean
################准备配置文件
cp -p /usr/local/src/php-5.4.19/php.ini-production /etc/php.ini
###############修改apache配置文件,使其支持php,添加以下两行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
###############配置php模块
###############gettext模块
cd /usr/local/src/php-5.4.19/ext
cd gettext/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ..
###############bcmath模块
cd bcmath/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ..
###############mbstring模块
cd mbstring/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
sed -i '/tab-width/a\extension = "gettext.so"\nextension = "bcmath.so"\nextension = "mbstring.so"' /etc/php.ini
###############创建php页面,并判断是否成功连接到mysql
cat /usr/local/apache/htdocs/index.php
$conn=mysql_connect('localhost','root','123');
if ($conn)
echo "Connect to database successfully...";
else
echo "Connect to database failed...";
?>
###############重启apache进行测试
elinks --dump http://192.168.110.130
It works!
Connect to database successfully...
cd /usr/local/src
###############安装zabbix
groupadd zabbix
useradd -g zabbix -m zabbix
mkdir -p /etc/zabbix
###############准备数据库环境
create database zabbix character set utf8;
grant all privileges on zabbix.* to zabbix@192.168.110.130 identified by '123456';
flush privileges;
###############导入数据库脚本
tar -zxf zabbix-2.2.6.tar.gz
cd /usr/local/src/zabbix-2.2.6
mysql -uzabbix -h292.168.110.130 -p123456 zabbix < database/mysql/schema.sql
mysql -uzabbix -h292.168.110.130 -p123456 zabbix < database/mysql/p_w_picpaths.sql
mysql -uzabbix -h292.168.110.130 -p123456 zabbix < database/mysql/data.sql
###############编译安装zabbix
./configure --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp \
--with-libcurl --enable-server --enable-agent --enable-proxy --prefix=/usr/local/zabbix
#注:--prefix指定zabbix安装目录,--enable-server 支持zabbix服务器,--enable-agent支持zabbix代理,--enable-proxy 支持zabbix代理服务器,
--with-mysql 使用MySQL客户端库可以选择指定路径mysql_config,--with-net-snmp 使用net - snmp软件包,择性地指定路径NET - SNMP配置, --with-libcurl 使用curl包。
make && make install
###############配置权限
cp conf/{zabbix_server.conf,zabbix_agentd.conf} /etc/zabbix
chmod 400 /etc/zabbix/zabbix_server.conf
chown zabbix /etc/zabbix/zabbix_server.conf
chown -R zabbix:zabbix /etc/zabbix
chmod 0755 /etc/zabbix/zabbix_server.conf
ln -sf /usr/local/zabbix/etc/zabbix_server.conf /etc/zabbix/zabbix_server.conf
################修改参数,配置zabbix服务端
vim /etc/zabbix/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=192.168.110.130
DBName=zabbix zabbix所属数据库名称
DBUser=zabbix zabbix所属数据库用户
DBPassword=12345678 zabbix数据库密码
DBSocket=/var/lib/mysql/mysql.sock
StartPollers=30 轮询的初始值(0-1000)
StartIPMIPollers=4 IPMI轮询的初始值(0-1000)
StartPollersUnreachable=30 轮询不可达的主机数(包括IPMI 0-1000)
StartTrappers=8 捕获的初始值(0-1000)
StartPingers=4 ping的初始值(0-1000)
StartDiscoverers=0 自动发现的初始值(0-250)
CacheSize=384M 缓存大小
CacheUpdateFrequency=300 缓存更新的频率
StartDBSyncers=8 数据库同步时间
TrendCacheSize=128M 总趋势缓存大小
AlertScriptsPath=/usr/bin 脚本的存放位置
LogSlowQueries=1000 日志慢查询设定
#AlertScriptsPath=/usr/local/zabbix/scripts #指定告警脚本存放位置
################配置zabbix的php环境
cd frontends/
cp -rf php /usr/local/apache/htdocs/
cd /usr/local/apache/htdocs/
mv php zabbix
chown -R zabbix:zabbix zabbix
#注:vi /etc/php.ini
date.timezone = Asia/Shanghai
sed -i "s#;always_populate_raw_post_data = -1#always_populate_raw_post_data = -1#g" /etc/php.ini
sed -i "s#;cgi.fix_pathinfo=0#cgi.fix_pathinfo=0#g" /etc/php.ini
vim /etc/php.ini
date.timezone = Asia/Shanghai
max_execution_time = 300
max_input_time = 300
post_max_size = 32M
memory_limit = 128M
#######mbstring.func_overload = 2
#################配置zabbix.conf.php #web setup.php运行后自动生成(根据环境修改)
vi /usr/local/apache/htdocs/zabbix/conf/zabbix.conf.php
// Zabbix GUI configuration file
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '192.168.110.130';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = '123456';
// SCHEMA is relevant only for IBM_DB2 database
$DB['SCHEMA'] = '';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'pd';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
chmod 777 /usr/local/nginx/html/zabbix/conf
################配置zabbix启动服务
cp /usr/local/zabbix/sbin/zabbix_server /etc/init.d/
cp /usr/local/zabbix/sbin/zabbix_agentd /etc/init.d/
chmod 755 /etc/init.d/zabbix_*
sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g" /etc/init.d/zabbix_server
sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g" /etc/init.d/zabbix_agentd
service zabbix_server restart
service zabbix_agentd restart
################如果启动提示如下错误
/etc/init.d/zabbix_server: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64/
通过web访问http://ip/zabbix即可安装,谢谢
################zabbix汉化版
解决zabbix中文乱码、汉化
1、在windows中找一个自己喜欢的字体或者去网上下载一个字体C:\Windows\Fonts
2、将字体上传至/usr/local/apache/htdocs/zabbix/fonts目录下
3、修改zabbix页面管理的中文字体设置
vim /usr/local/apache/htdocs/zabbix/include/defines.inc.php
define('ZBX_FONT_NAME', 'simkai');
define('ZBX_GRAPH_FONT_NAME', 'simkai');
4、登陆页面设置相应用户的默认语言Administrator—->Users(此处要保证显示的是用户,否则显示的都是用户组)
5、点击用户名进入用户信息编辑,默认语言选择简体中文,然后点击save保存
6、刷新页面
#注:如遇到任何错误,请联系我:1742388465