{"id":44174,"date":"2024-10-06T13:30:14","date_gmt":"2024-10-06T05:30:14","guid":{"rendered":"https:\/\/server.hk\/cnblog\/44174\/"},"modified":"2024-10-06T13:30:14","modified_gmt":"2024-10-06T05:30:14","slug":"centos-%e4%b8%8b-zabbix-%e5%ae%89%e8%a3%9d%e9%83%a8%e7%bd%b2%e5%8f%8a%e6%bc%a2%e5%8c%96","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/44174\/","title":{"rendered":"CentOS \u4e0b Zabbix \u5b89\u88dd\u90e8\u7f72\u53ca\u6f22\u5316"},"content":{"rendered":"<h1 id=\"centos-%e4%b8%8b-zabbix-%e5%ae%89%e8%a3%9d%e9%83%a8%e7%bd%b2%e5%8f%8a%e6%bc%a2%e5%8c%96-FNgybUPZYL\">CentOS \u4e0b Zabbix \u5b89\u88dd\u90e8\u7f72\u53ca\u6f22\u5316<\/h1>\n<p>Zabbix \u662f\u4e00\u6b3e\u5f37\u5927\u7684\u958b\u6e90\u76e3\u63a7\u89e3\u6c7a\u65b9\u6848\uff0c\u80fd\u5920\u5e6b\u52a9\u7528\u6236\u76e3\u63a7\u5404\u7a2e IT \u57fa\u790e\u8a2d\u65bd\u7684\u6027\u80fd\u548c\u53ef\u7528\u6027\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS \u7cfb\u7d71\u4e0a\u5b89\u88dd\u548c\u90e8\u7f72 Zabbix\uff0c\u4e26\u9032\u884c\u6f22\u5316\u8a2d\u7f6e\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u670d\u52d9\u65bc\u4e2d\u6587\u7528\u6236\u3002<\/p>\n<h2 id=\"%e4%b8%80%e3%80%81%e7%92%b0%e5%a2%83%e6%ba%96%e5%82%99-FNgybUPZYL\">\u4e00\u3001\u74b0\u5883\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u5b89\u88dd Zabbix \u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u6e96\u5099\u597d CentOS \u74b0\u5883\u3002\u4ee5\u4e0b\u662f\u5b89\u88dd Zabbix \u6240\u9700\u7684\u57fa\u672c\u74b0\u5883\uff1a<\/p>\n<ul>\n<li>\u64cd\u4f5c\u7cfb\u7d71\uff1aCentOS 7 \u6216 8<\/li>\n<li>Web \u4f3a\u670d\u5668\uff1aApache \u6216 Nginx<\/li>\n<li>\u8cc7\u6599\u5eab\uff1aMySQL \u6216 PostgreSQL<\/li>\n<li>PHP \u7248\u672c\uff1a7.2 \u6216\u66f4\u9ad8\u7248\u672c<\/li>\n<\/ul>\n<h2 id=\"%e4%ba%8c%e3%80%81%e5%ae%89%e8%a3%9d-zabbix-FNgybUPZYL\">\u4e8c\u3001\u5b89\u88dd Zabbix<\/h2>\n<h3 id=\"1-%e5%ae%89%e8%a3%9d%e5%bf%85%e8%a6%81%e7%9a%84%e4%be%9d%e8%b3%b4%e5%8c%85-FNgybUPZYL\">1. \u5b89\u88dd\u5fc5\u8981\u7684\u4f9d\u8cf4\u5305<\/h3>\n<pre><code>sudo yum install -y epel-release\nsudo yum install -y httpd mariadb-server mariadb php php-mysql php-gd php-xml php-bcmath php-mbstring php-json php-ldap php-xmlrpc php-soap<\/code><\/pre>\n<h3 id=\"2-%e4%b8%8b%e8%bc%89-zabbix-%e5%ae%89%e8%a3%9d%e5%8c%85-FNgybUPZYL\">2. \u4e0b\u8f09 Zabbix \u5b89\u88dd\u5305<\/h3>\n<p>\u53ef\u4ee5\u5f9e Zabbix \u5b98\u65b9\u7db2\u7ad9\u4e0b\u8f09\u6700\u65b0\u7248\u672c\u7684\u5b89\u88dd\u5305\u3002\u4ee5\u4e0b\u662f\u4e0b\u8f09\u548c\u5b89\u88dd\u7684\u547d\u4ee4\uff1a<\/p>\n<pre><code>wget https:\/\/cdn.zabbix.com\/zabbix\/sources\/stable\/5.0\/zabbix-5.0.0.tar.gz\ntar -zxvf zabbix-5.0.0.tar.gz\ncd zabbix-5.0.0<\/code><\/pre>\n<h3 id=\"3-%e9%85%8d%e7%bd%ae%e8%b3%87%e6%96%99%e5%ba%ab-FNgybUPZYL\">3. \u914d\u7f6e\u8cc7\u6599\u5eab<\/h3>\n<p>\u63a5\u4e0b\u4f86\uff0c\u9700\u8981\u5275\u5efa Zabbix \u7684\u8cc7\u6599\u5eab\u548c\u7528\u6236\uff1a<\/p>\n<pre><code>sudo mysql -u root -p\nCREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;\nCREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'your_password';\nGRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';\nFLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n<h3 id=\"4-%e5%b0%8e%e5%85%a5%e5%88%9d%e5%a7%8b%e8%b3%87%e6%96%99-FNgybUPZYL\">4. \u5c0e\u5165\u521d\u59cb\u8cc7\u6599<\/h3>\n<pre><code>cd database\/mysql\nmysql -u zabbix -p zabbix &lt; schema.sql\nmysql -u zabbix -p zabbix &lt; images.sql\nmysql -u zabbix -p zabbix &lt; data.sql<\/code><\/pre>\n<h3 id=\"5-%e9%85%8d%e7%bd%ae-zabbix-%e4%bc%ba%e6%9c%8d%e5%99%a8-FNgybUPZYL\">5. \u914d\u7f6e Zabbix \u4f3a\u670d\u5668<\/h3>\n<p>\u7de8\u8f2f Zabbix \u4f3a\u670d\u5668\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>sudo nano \/etc\/zabbix\/zabbix_server.conf<\/code><\/pre>\n<p>\u4fee\u6539\u4ee5\u4e0b\u884c\u4ee5\u8a2d\u7f6e\u8cc7\u6599\u5eab\u9023\u63a5\uff1a<\/p>\n<pre><code>DBPassword=your_password<\/code><\/pre>\n<h3 id=\"6-%e5%95%9f%e5%8b%95%e6%9c%8d%e5%8b%99-FNgybUPZYL\">6. \u555f\u52d5\u670d\u52d9<\/h3>\n<pre><code>sudo systemctl start mariadb\nsudo systemctl start httpd\nsudo systemctl start zabbix-server\nsudo systemctl enable mariadb\nsudo systemctl enable httpd\nsudo systemctl enable zabbix-server<\/code><\/pre>\n<h2 id=\"%e4%b8%89%e3%80%81zabbix-%e6%bc%a2%e5%8c%96%e8%a8%ad%e7%bd%ae-FNgybUPZYL\">\u4e09\u3001Zabbix \u6f22\u5316\u8a2d\u7f6e<\/h2>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u70ba\u4e86\u4f7f Zabbix \u754c\u9762\u652f\u6301\u4e2d\u6587\uff0c\u9700\u8981\u9032\u884c\u6f22\u5316\u8a2d\u7f6e\u3002\u4ee5\u4e0b\u662f\u5177\u9ad4\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-%e4%b8%8b%e8%bc%89%e4%b8%ad%e6%96%87%e8%aa%9e%e8%a8%80%e5%8c%85-FNgybUPZYL\">1. \u4e0b\u8f09\u4e2d\u6587\u8a9e\u8a00\u5305<\/h3>\n<p>\u53ef\u4ee5\u5f9e Zabbix \u5b98\u65b9\u7db2\u7ad9\u6216\u793e\u5340\u4e0b\u8f09\u4e2d\u6587\u8a9e\u8a00\u5305\uff0c\u7136\u5f8c\u5c07\u5176\u653e\u7f6e\u5728 Zabbix \u7684\u8a9e\u8a00\u76ee\u9304\u4e2d\uff1a<\/p>\n<pre><code>cd \/usr\/share\/zabbix\/lang\nwget https:\/\/example.com\/path\/to\/chinese\/lang.zip\nunzip lang.zip<\/code><\/pre>\n<h3 id=\"2-%e4%bf%ae%e6%94%b9%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6-FNgybUPZYL\">2. \u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/h3>\n<p>\u7de8\u8f2f Zabbix \u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u8a2d\u7f6e\u9ed8\u8a8d\u8a9e\u8a00\u70ba\u4e2d\u6587\uff1a<\/p>\n<pre><code>sudo nano \/etc\/zabbix\/web\/zabbix.conf.php<\/code><\/pre>\n<p>\u627e\u5230\u4ee5\u4e0b\u884c\u4e26\u4fee\u6539\uff1a<\/p>\n<pre><code>$ZBX_LANGUAGE = 'zh_CN';<\/code><\/pre>\n<h3 id=\"3-%e9%87%8d%e5%95%9f%e6%9c%8d%e5%8b%99-FNgybUPZYL\">3. \u91cd\u555f\u670d\u52d9<\/h3>\n<pre><code>sudo systemctl restart httpd\nsudo systemctl restart zabbix-server<\/code><\/pre>\n<h2 id=\"%e5%9b%9b%e3%80%81%e7%b8%bd%e7%b5%90-FNgybUPZYL\">\u56db\u3001\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u6211\u5011\u6210\u529f\u5728 CentOS \u7cfb\u7d71\u4e0a\u5b89\u88dd\u4e26\u90e8\u7f72\u4e86 Zabbix\uff0c\u4e26\u5b8c\u6210\u4e86\u6f22\u5316\u8a2d\u7f6e\u3002\u9019\u4f7f\u5f97 Zabbix \u66f4\u52a0\u9069\u5408\u4e2d\u6587\u7528\u6236\u7684\u4f7f\u7528\u9700\u6c42\u3002\u82e5\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u6280\u8853\u652f\u6301\u6216\u5c0b\u627e\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u8cc7\u8a0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u5982\u4f55\u5728 CentOS \u4e0a\u5b89\u88dd\u548c\u90e8\u7f72 Zabbix\uff0c\u4e26\u9032\u884c\u6f22\u5316\u8a2d\u7f6e\uff0c\u63d0\u5347\u76e3\u63a7\u7cfb\u7d71\u7684\u672c\u5730\u5316\u9ad4\u9a57\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-44174","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=44174"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44174\/revisions"}],"predecessor-version":[{"id":44175,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44174\/revisions\/44175"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=44174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=44174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=44174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}