|
Installation environment:
Ubuntu14.04 LTS mysql 5.6 php-fpm nginx 1.8.0
The first part, php + mysql + nginx components installed
1, the system updates
Sudo apt-get update && sudo apt-get upgrade
2, install php-fpm
Zabbix web front-end is written in php, you need to run php
Sudo apt-get install php-fpm (of course, can also be compiled source php)
3, the source compiler mysql5.6
1. Installation environment: Mysql-5.6.23.tar.gz
2. Install the necessary tools
Sudo apt-get install make bison g ++ build-essential libncurses5-dev cmake
3. Add the combined user settings installation directory permissions
Sudo groupadd mysql
Sudo useradd-g mysql mysql-s / bin / false # create mysql users and joined to the mysql group, does not allow mysql users to log directly into the system
Sudo mkdir-p / usr / local / mysql # Create Mysql installation directory
sudo mkdir -p / usr / local / mysql / data
Sudo mkdir -p / usr / local / mysql / log
sudo chown -R mysql: mysql / usr / local / mysql / data
sudo chown -R mysql: mysql / usr / local / mysql
4. Compile and install mysql
4.1 Obtain the source package
Cd / usr / local / src
sudo wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.23.tar.gz
4.2 Extract mysql source package
sudo tar -zxvf mysql-5.6.23.tar.gz
5. Compile the configuration
Cd mysql-5.6.23
sudo cmake -DCMAKE_INSTALL_PREFIX = / usr / local / mysql -DSYSCONFDIR = / etc -DMYSQL_UNIX_ADDR = / tmp / mysql.sock -DDEFAULT_CHARSET = utf8 -DDEFAULT_COLLATION = utf8_general_ci -DEXTRA_CHARSETS = all -DWITH_MYISAM_STORAGE_ENGINE = 1 -DWITH_INNOBASE_STORAGE_ENGINE = 1 -DWITH_MEMORY_STORAGE_ENGINE = 1 - DWITH_READLINE = 1 -DENABLED_LOCAL_INFILE = 1 -DMYSQL_DATADIR = / usr / local / mysql / data -DMYSQL_USER = mysql -DWITH_DEBUG = 0
Precautions:
Recompile, you need to remove the old object file and cache information.
# Make clean
# Rm -f CMakeCache.txt
# Rm -rf /etc/my.cnf
Sudo make -j4 # -j number that multi-core run
Sudo make install
6. Relevant configurations
6.1 Configuring Power On Startup
Sudo chmod + w / usr / local / mysql
Sudo cp ./support-files/my-default.cnf /etc/my.cnf
Sudo cp ./support-files/mysql.server /etc/init.d/mysqld
Sudo chmod 755 /etc/init.d/mysqld
6.2 Commonly used soft-connect command, set the environment variable
Sudo ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
Sudo ln -s / usr / local / mysql / bin / mysql / usr / bin
Sudo ln -s / usr / local / mysql / bin / mysqladmin / usr / bin
6.3 Initialize the database
Sudo / usr / local / mysql / scripts / mysql_install_db --defaults-file = / etc / my.cnf --basedir = / usr / local / mysql --datadir = / usr / local / mysql / data --user = mysql
7. Start mysql service to try
Sudo /etc/init.d/mysqld start
8. After the success of the root user password creation
Mysqladmin -u root password
9. After the success of use
Mysql -uroot -p
4, the installation of nginx
Sudo apt-get install nginx (of course, can be compiled nginx source)
Nginx profile settings
In / etc / ngnix / site-available / default:
Copy the code
# You may add here your
#server {
# ...
#}
# Statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# Of Nginx configuration files in order to fully unleash the power of Nginx.
# Http://wiki.nginx.org/Pitfalls
# Http://wiki.nginx.org/QuickStart
# Http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# File but keep this around for reference. Or just disable in sites-enabled.
#
# Please see / usr / share / doc / nginx-doc / examples / for more detailed examples.
##
Server {
Listen 80 default_server;
# Listen [::]: 80 default_server ipv6only = on;
Root / usr / share / nginx / html / zabbix /
Index index.php index.html index.htm;
# Make site accessible from http: // localhost /
Server_name zabbix.example.com.cn;
Location / {
# First attempt to serve request as file, then
# As directory, then fall back to displaying a 404.
Try_files $ uri $ uri / = 404;
# Uncomment to enable naxsi on this location
# Include /etc/nginx/naxsi.rules
}}
# Only for nginx-naxsi used with nginx-naxsi-ui: process denied request
#location / RequestDenied {
# Proxy_pass http://127.0.0.1:8080;
#}
#error_page 404 /404.html;
# Redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# Root / usr / share / nginx / html;
#}
# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
Location ~ \ .php $ {
Try_files $ uri = 404;
Fastcgi_split_path_info ^ (. + \. Php) (/.+) $;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# Fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
Fastcgi_pass unix: /var/run/php5-fpm.sock;
Fastcgi_index index.php;
Fastcgi_param SCRIPT_FILENAME / usr / share / nginx / html $ fastcgi_script_name;
Include fastcgi_params;
}}
# Deny access to .htaccess files, if Apache's document root
# Concurs with nginx's one
#
#location ~ /\.ht {
# Deny all;
#}
}}
# Another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# Listen 8000;
# Listen somename: 8080;
# Server_name somename alias another.alias;
# Root html;
# Index index.html index.htm;
#
# Location / {
# Try_files $ uri $ uri = 404;
#}
#}
# HTTPS server
#
#server {
# Listen 443;
# Server_name localhost;
#
# Root html;
# Index index.html index.htm;
#
# Ssl on;
# Ssl_certificate cert.pem;
# Ssl_certificate_key cert.key;
#
# Ssl_session_timeout 5m;
#
# Ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
# Ssl_ciphers "HIGH:! ANULL:! MD5 or HIGH:! ANULL:! MD5:! 3DES";
# Ssl_prefer_server_ciphers on;
#
# Location / {
# Try_files $ uri $ uri = 404;
#}
#}
Example @ ubuntu: / etc / nginx / sites-available $
The second part, Zabbix compiles the installation and Web front configuration
1, zabbix compiler installed dependencies
# Install the build suite
Sudo apt-get install build-essential
# Install the packages required by the php front end
Sudo apt-get install libmysqlclient15-dev php5-gd php5-mysql
# Install the packages required by zabbix, snmp \ curl \ ssl \ fping
Sudo apt-get install snmp libsnmp-dev snmpd libcurl4-openssl-dev fping
Create the zabbix user and the zabbix group
Sudo groupadd zabbix
Sudo useradd -r -s / usr / sbin / nologin -g zabbix zabbix
3, download zabbix source package, and extract
Wget http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix_2.4.5.orig.tar.gz
Sudo tar -zxvf zabbix_2.4.5.orig.tar.gz -C / usr / local / src /
Cd /usr/local/src/zabbix-2.4.5/database
4, the database initialization
Mysql -uroot -p -e "create database zabbix;"
Mysql -uroot -p -e "grant all privileges on zabbix. * To zabbix @ localhost identified by 'zabbix';"
Mysql -D zabbix -uzabbix -pzabbix < schema.sql
Mysql -D zabbix -uzabbix -pzabbix < image.sql
Mysql -D zabbix -uzabbix -pzabbix < data.sql
5, zabbix compiler installation
Cd.
./configure --prefix = / usr / local / zabbix --enable-server --enable-agent --enable-proxy --with-mysql --with-net-snmp --with-libcurl
Sudo make && sudo make install
# - with-net-snmp Enables the SNMP protocol
# - with-libcurl is used to monitor web sites
# - enable-server Available only on the server
# There are other IPMI, see. / Configure --help
Ps: incorrect report configure: error: MySQL library not found missing libmysqlclient15-dev
6, set the zabbix configuration file directory
Sudo mkdir / etc / zabbix
Cp conf / zabbix_ * / etc / zabbix /
Sudo chown -R zabbix: zabbix / etc / zabbix /
7, modify the configuration file
Sudo vim /et/zabbix/zabbix_server.conf
DBUser DBPassword these two keywords, replaced with the previous mysqlDB set the user and password
8, set up zabbix boot
Sudo cp misc / init.d / debian / zabbix-server /etc/init.d
Sudo cp misc / init.d / debian / zabbix-agent /etc/init.d
Cd! $
Sudo chmod 755 zabbix- *
Sudo update-rc.d zabbix-server defaults
Sudo update - rc.d zabbix - agent defaults
9, zabbix web interface installation settings
Sudo mkdir / usr / share / nginx / html / zabbix /
Cd /usr/src/zabbix-2.4.5/frontends/
Sudo cp -r php / * / usr / share / nginx / html / zabbix
In the browser to open http://zabbix.example.com.cn/zabbix start web interface setup
1) zabbix will check the php settings
Standard Red is the default need to modify the parameters, php settings file for / etc / php5 / cgi / php.ini
Sudo restart php-fpm restart
2) zabbix will check the mysql settings
Zabbix_server.conf My.cnf mysql pid sock and other documents on the distribution path to be consistent
My.cnf socket = /tmp/mysql.sock
Zabbix_server.conf DBSocket = /tmp/mysql.sock
Ps: / var /run/mysqld/mysqld.sock connection is not being given
Maybe sudo ln -s /tmp/mysql.sock/var/run/mysqld/mysqld.sock is a workaround
3) Finally, to manually generate the settings file zabbix.conf.php uploaded to / usr / share / nginx / html / zabbix / conf, zabbix default user is admin, the password is zabbix, login must be modified. |
|
|
|