您好,登錄后才能下訂單哦!
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.6/zabbix-2.4.6.tar.gz
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
<html><body><h2>It works!</h2></body></html>
<?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
<?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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。