In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Compile and install zabbix 1.1 environment preparation
System environment:
Redhat 6.6 64-bit
Mysql-5.6.34
Php-5.6.28
Zabbix-3.2.1
Close iptables and SELINUX before configuration to avoid errors during installation.
# service iptables stop
# setenforce 0
# vi / etc/sysconfig/selinux
-
SELINUX=disabled
-
Environmental requirements of zabbix 3.2.0
MySQL 5.1 or above is preferably 5.6 or higher
PHP 5.4 or later
1.2 LAMP installation 1.2.1 yum installation httpd
Install Apahce, PHP, MySQL and php connection mysql library components.
# yum-y install httpd httpd-devel
1.2.2 compile install mysql5.6 install the tools and libraries needed to compile the source code yum install\ make\ gcc\ gcc-c++\ ncurses-devel\ cmake
New mysql user groups:
Groupadd mysql
New mysql users:
Useradd-g mysql mysql-s / sbin/nologinchmod 755 / home/mysql/ directories required for new MySQL
Create a new mysql installation directory
Mkdir-p / usr/local/mysql
Cmake\-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\-DMYSQL_DATADIR=/home/mysql/\-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock\-DWITH_MYISAM_STORAGE_ENGINE=1\-DWITH_INNOBASE_STORAGE_ENGINE=1\-DWITH_ARCHIVE_STORAGE_ENGINE=1\-DWITH_BLACKHOLE_STORAGE_ENGINE=1\-DENABLED_LOCAL_INFILE=1\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DEXTRA_CHARSETS=all\-DWITH_SSL=system\-DMYSQL_TCP_PORT=3306\-enable-proxy\-DWITH_SSL=bundled
Note: to rerun the configuration, you need to delete the CMakeCache.txt file
Rm-f CMakeCache.txt
Make
Make install
Modify the mysql installation directory
Chown-R mysql:mysql / usr/local/mysql
Initialize configuration
Enter the installation path
# cd / usr/local/mysql
Enter the installation path, execute the initialization configuration script, and create the database and table that comes with the system.
# scripts/mysql_install_db-basedir=/usr/local/mysql-datadir=/home/mysql-user=mysql
Note: when starting the MySQL service, the my.cnf will be searched in a certain order, first in the / etc directory, and if it cannot be found, it will search for "$basedir/my.cnf"
Note: if there is a my.cnf in the / etc directory, you need to rename this file to another name, such as / etc/my.cnf.bak, otherwise, the file will interfere with the correct configuration of the MySQL installed by the source code, resulting in failure to start.
After updating the system with "yum update", you need to check to see if there is an extra my.cnf in the / etc directory, and if so, rename it to something else. Otherwise, MySQL will start with this configuration file, which may cause problems such as not starting properly.
Copy the mysql service startup configuration file # mv / etc/my.cnf / etc/my.cnf.bak# cp / usr/local/mysql/support-files/my-default.cnf / etc/my.cnf launch MySQL
Add services, copy service scripts to the init.d directory, and set boot up
# cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld
Set up boot boot
Chkconfig mysqld on
Service mysqld start
Configure user
After MySQL starts successfully, root does not have a password by default. We need to set the root password.
Before setting up, we need to set PATH, or we can't call mysql directly.
Modify the / etc/profile file to add at the end of the file
PATH=/usr/local/mysql/bin:$PATHexport PATH
Close the file and run the following command to make the configuration take effect immediately
Source / etc/profile
Execute the following command to change the root password
Mysql-uroot mysql > SET PASSWORD = PASSWORD ('123456')
Or
# mysqladmin-uroot-p password 123qweEnter password: enter Warning: Using a password on the command line interface can be insecure.
To set that root users can access remotely, execute
Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'172.16.%' IDENTIFIED BY' password' WITH GRANT OPTION
When the red password is remote access, the password of the root user can be different from that of the local user.
Configure the firewall
Port 3306 of the firewall is not enabled by default. To access it remotely, you need to open this port.
Open / etc/sysconfig/iptables
Under "- An INPUT-m state-- state NEW-m tcp-p-dport 22-jACCEPT", add:
-An INPUT-m state-- state NEW-m tcp-p-dport 3306-j ACCEPT
Then save and close the file, and run the following command in the terminal to refresh the firewall configuration:
Service iptables restart
OK, after everything is configured, you can access your MySQL.
1.2.3 compile and install PHP5.6
Add dependent applications
Yum install-y gcc\ gcc-c++\ autoconf\ libjpeg\ libjpeg-devel\ libpng\ libpng-devel\ freetype\ freetype-devel\ libpng\ libpng-devel\ libxml2\ libxml2-devel\ zlib\ zlib-devel\ glibc\ glibc-devel\ glib2\ bzip2\ bzip2-devel\ ncurses\ curl\ openssl-devel\ gdbm-devel\ db4-devel\ libXpm-devel\ libX11-devel\ gd-devel\ gmp-devel\ readline-devel\ libxslt-devel\ expat-devel\ xmlrpc-c\ xmlrpc-c-devel\ Libcurl\ libcurl-devel install encryption extension Library Install Libmcrypttar zxvf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8./configuremakemake install first
Compile and install. / configure\-- prefix=/usr/local/php\-- with-config-file-path=/etc\-- with-apxs2=/usr/sbin/apxs\-- with-mysql=/usr/local/mysql\-- with-mysqli=/usr/local/mysql/bin/mysql_config\-- enable-inline-optimization\-- enable-fpm\-- enable-soap\-- with-libxml-dir\-- with-xmlrpc\-- with-openssl\-- with-mcrypt\-- With-mhash\-- with-pcre-regex\-- with-sqlite3\-- with-zlib\-- enable-bcmath\-- with-iconv\-- with-bz2\-- enable-calendar\-- with-curl\-- with-cdb\-- enable-dom\-- enable-exif\-enable-fileinfo\-- enable-filter\-- with-pcre-dir\-- enable-ftp\-- with-gd\-- with-openssl-dir\-- with-jpeg-dir\ -- with-png-dir\-- with-zlib-dir\-- with-freetype-dir\-- enable-gd-native-ttf\-- with-gettext\-- with-gmp\-- with-mhash\-- enable-json\-- enable-mbstring\-- disable-mbregex\-- disable-mbregex-backtrack\-- with-libmbfl\-- with-onig\-enable-pdo\-with-pdo-mysql\-- with-zlib-dir\-- with-pdo-sqlite \-- with-readline\-- enable-session\-- enable-shmop\-- enable-simplexml\-- enable-sockets\-- enable-sysvmsg\-- enable-sysvsem\-- enable-sysvshm\-- enable-wddx\-- with-libxml-dir\-- with-xsl\-- enable-zip\-- enable-mysqlnd-compression-support\-- with-pear
Note:
-- with-mysql=/usr
-- with-mysqli=/usr/bin/mysql_config
-- with-apxs2=/usr/sbin/apxs
-- enable-gd-jis-conv will make the Chinese garbled code without this parameter.
Among them-- with-apxs2 is used to generate the PHP module libphp5.so of Apache, which can be removed without need.
Php configuration
Php.ini is the php running core configuration file
Php-fpm.conf is the configuration file for the php-fpm process service
# cd php-5.6.28# cp php.ini-production / etc/php.ini# cp / usr/local/php/etc/php-fpm.conf.default / usr/local/php/etc/php-fpm.conf# cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm# chmod + x / etc/init.d/php-fpmfpm Test php configuration # / usr/local/php/sbin/php-fpm-t [23-May-2016 20:03 : 52] NOTICE: configuration file / usr/local/php/etc/php-fpm.conf test is successful # chkconfig-- add php-fpm# chkconfig php-fpm on# service php-fpm startStarting php-fpm done netstat-anpttcp 00 127.0.0.1 usr/local/php/etc/php-fpm.conf test is successful 9000 0.0.0.0 * LISTEN 705/php-fpm
Modify the default port:
Vi / usr/local/php/etc/php-fpm.conf
Listen = 127.0.0.1purl 8000
1.3Configuring apache access PHP configuring httpd.conf to make apache support PHP
# vi / usr/local/apache/conf/httpd.conf
Find AddType application/x-gzip .gz .tgz (369) and add the following under it
AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps DirectoryIndex index.php index.html / / adjust the home file settings LoadModule php5_module / usr/lib64/httpd/modules/libphp5.so
Test page: vi / var/www/html/test.php
2.1 download the zabbix source code package
Official website: http://www.zabbix.com/download.php
Download zabbix-3.2.1.tar.gz
Install the components required for zabbix (server,agent) yum-y install curl libcurl-devel net-snmp net-snmp-develperl-DBI libdbi-dbd-mysql mysql-devel gcc gcc++ make libxml2 libxml2-devel2.2 compile and install zabbixserver: (172.28.3.103) the server creates zabbix user groups and users:
# groupadd zabbix
# useradd-g zabbix-s / sbin/nologin zabbix
# tar xzvf zabbix-3.2.1.tar.gz
Compile and install: # cd zabbix-3.2.1 #. / configure-- prefix=/usr/local/zabbix-server-- enable-server-- with-mysql-- with-net-snmp-- with-libcurl-- with-libxml2-- enable-agent-- enable-ipv6 make & & make install
If you add the-- prefix=/usr/local/zabbix-server parameter when compiling, the zabbix configuration file defaults to the / usr/local/zabbix-server/etc directory. (if no path is specified at compile time, the default path used by the zabbix configuration file is under / usr/local/etc/)
Create databases and authorized users
Description:
The order of importing data files cannot be changed, or you can use the mysql command to import data files at the command line.
[root@test ~] # service mysqld start
Modify the root password of the database
[root@test] # mysqladmin-u root-p password 123qwe
Enter password: you don't need to fill in here and enter directly.
Mysql > create database zabbix character set utf8; mysql > grant all on zabbix.* to zabbix@'localhost' identified by '123456; mysql > flush privileges;mysql > grant all on zabbix.* to zabbix@'%' identified by' zabbix'
Import the database sql script:
# cd zabbix-3.2.1
Under the unzipped zabbix directory, import the three sql files under the database/mysql directory into the zabbix database. (the following is using the zabbix user to import the file, which exists by default in the database.)
# mysql-uzabbix-p123456 zabbix
< database/mysql/schema.sql # mysql -uzabbix -p123456 zabbix < database/mysql/p_w_picpaths.sql # mysql -uzabbix -p123456 zabbix < database/mysql/data.sql 或是 mysql>Use zabbix
Database changed
Mysql > source / root/zabbix-3.2.1/database/mysql/schema.sql
Mysql > source / root/zabbix-3.2.1/database/mysql/p_w_picpaths.sql
Mysql > source / root/zabbix-3.2.1/database/mysql/data.sql
Modify the configuration file and start
Mkdir-p / var/www/zabbix
Cp-R frontends/php / var/www/zabbix
Chmod 777 / var/www/zabbix/php/conf
Edit configuration file (server,agent)
# cd / usr/local/zabbix-server/etc
Remove comments from the configuration file:
# cat zabbix_server.conf | grep-v "#" | grep-v "^ $" > zabbix_server.conf.bak
# cp zabbix_server.conf.bak zabbix_server.conf
# cat zabbix_agentd.conf | grep-v "#" | grep-v "^ $" > zabbix_agentd.conf.bak
# cp zabbix_agentd.conf.bak zabbix_agentd.conf
We only need to pay attention to DBHost, DBName, DBUser, DBPassword. These are the parameters that configure zabbix server to connect to the mysql database.
Server configuration:
# vim / usr/local/zabbix-server/etc/zabbix_server.conf LogFile=/var/log/zabbix/zabbix_server.log DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=123456
Client configuration:
# vi / usr/local/zabbix-server/etc/zabbix_agentd.confLogFile=/var/log/zabbix/zabbix_agentd.logServer=172.28.3.103ServerActive=172.28.3.103Hostname=172.28.3.103
Create the location where the log files are stored:
Mkdir / var/log/zabbix
Chown-R zabbix:zabbix / var/log/zabbix
Start the zabbix service:
/ usr/local/zabbix-server/sbin/zabbix_server
Use server to manage and start the zabbix service: # cd zabbix-3.2.1# cp misc/init.d/fedora/core/zabbix_server / etc/init.d/# cp misc/init.d/fedora/core/zabbix_agentd / etc/init.d/# chkconfig-- add zabbix_server# chkconfig-- add zabbix_agentd# chkconfig zabbix_server on# chkconfig zabbix_agentd on
Create a soft link:
Ln-s / usr/local/zabbix/sbin/zabbix_server / usr/local/sbin/ ln-s / usr/local/zabbix/sbin/zabbix_agentd / usr/local/sbin/
Start the service:
Service zabbix_server start
Service zabbix_agentd start
Agent: (172.28.3.100) the client creates zabbix user groups and users:
# groupadd zabbix
# useradd-g zabbix-s / sbin/nologin zabbix
Compile and install: # cd zabbix-3.2.1#. / configure-- prefix=/usr/local/zabbix-agent-- enable-agentmake & & make install # cd / usr/local/zabbix-agent# vi etc/zabbix_agentd.confLogFile=/var/log/zabbix/zabbix_agentd.logServer=172.28.3.103ServerActive=172.28.3.103Hostname=172.28.3.100
Use server to manage and start the zabbix service: # cd zabbix-3.2.1# cp misc/init.d/fedora/core/zabbix_agentd / etc/init.d/# chkconfig-- add zabbix_agentd# chkconfig zabbix_agentd on
Create a soft link:
# ln-s / usr/local/zabbix/sbin/zabbix_agentd/usr/local/sbin/
Start the service:
Service zabbix_agentd start
2.3 configure the zabbix web page vim / etc/httpd/conf.d/zabbix.conf # # Zabbix monitoring system php web frontend# # Alias / zabbix/usr/share/zabbixAlias / zabbix/ var/www/zabbix/php Options FollowSymLinks AllowOverride None Order allow Deny Allow from all # Require all granted php_value max_execution_time 300 php_value memory_limit 128m php_value post_max_size 16M php_value upload_max_filesize 2m php_value max_input_time 300 php_value always_populate_raw_post_data-1 # php_value date.timezone Europe/Riga php_value date.timezone Asia/Chongqing
Php_value date.timezone Asia/Chongqing mainly defines the time zone of php.
Finally, restart the apache,zabbix service as follows:
Services httpd restart
Services zabbix_server restart
Then visit the address of http://172.28.3.103/zabbix/setup.php and install it as follows:
Log in after completion: the default user name and password for zabbix is Admin/zabbix
If an error is reported in the step of creating a zabbix.conf.php file, you can manually download that file in the corresponding directory to create a zabbix.conf.php file and copy the contents: vi / var/www/zabbix/php/conf/zabbix.conf.php
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.