./configure --prefix=/application/nginx1.10.3 --user=www --group=www --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-pcre
make && make install
---------------------------------------------------------------
php./configure --prefix=/application/php-5.6.11 --with-config-file-path=/application/php-5.6.11/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath
make && make install
---------------------------------------------------------------
cp php.ini-production /application/php/etc/php.ini
cp /application/php/etc/php-fpm.conf.default /application/php/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件
---------------------------------------------------------------修改php.ini参数:(zabbix环境需要修改的参数)vi /application/php-5.6.11/etc/php.inimax_execution_time = 300
memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M max_input_time = 300 date.timezone = PRC---------------------------------------------------------------
mysql
yum install cmake gcc* ncurses-devel -y cmake -DCMAKE_INSTALL_PREFIX=/application/mysql5.6.35 -DDEFAULT_CHARSET=utf8 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DDEFAULT_COLLATION=utf8_general_cimake && make install
---------------------------------------------------------------ln -s /application/mysql5.6.35 /application/mysql groupadd mysqlmkdir -pv /data/mysqluseradd -r -g mysql -d /data/mysql -s /sbin/nologin mysql
chown -R mysql.mysql /application/mysqlchown -R mysql.mysql /data/mysql---------------------------------------------------------------拷贝mysql的配置文件:复制代码
cd /usr/local/mysql/support-files/cp my-medium.cnf /data/mysql/my.cnf
mysql5.6.35 my.cnf只支持保存在安装目录下
mv /data/mysql/my.cnf /application/mysql5.6.35/my.cnfcp mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
---------------------------------------------------------------修改MySQL配置文件my.cnf中数据目录:
datadir=/data/mysql/
---------------------------------------------------------------初始化MySQL:
(application 为安装目录)(soft 为安装包所在目录)cd /application/mysql/scripts./mysql_install_db --user=mysql --basedir=/application/mysql5.6.35/ --datadir=/data/mysql/
在安装目录下
./scripts/mysql_install_db --user=mysql --basedir=/application/mysql5.6.35/ --datadir=/data/mysql/如果在初始化数据库时出现任何问题,需要删除数据文件夹,如上面的/data/mysql的内容
---------------------------------------------------------------
echo 'PATH=$PATH:/application/mysql5.6.35/bin' >>/etc/profilesource /etc/profile
echo "export PATH=$PATH:/usr/local/mysql3306/bin" >>/etc/profile
source /etc/profile---------------------------------------------------------------remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
---------------------------------------------------------------
如果在
注:在启动MySQL服务时,会按照一定次序搜索my.cnf,先在/etc目录下找,找不到则会搜索"$basedir/my.cnf",在本例中就是 /usr/local/mysql/my.cnf,这是新版MySQL的配置文件的默认位置!
注意:在CentOS 6.4版操作系统的最小安装完成后,在/etc目录下会存在一个my.cnf,需要将此文件更名为其他的名字,如:/etc/my.cnf.bak,否则,该文件会干扰源码安装的MySQL的正确配置,造成无法启动。
在使用"yum update"更新系统后,需要检查下/etc目录下是否会多出一个my.cnf,如果多出,将它重命名成别的。否则,MySQL将使用这个配置文件启动,可能造成无法正常启动等问题。
---------------------------------------------------------------
zabbix./configure --prefix=/application/zabbix-3.2.4 --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
出错解决方法:“configure: error: Not found mysqlclient library”
locate libmysqlclient.so.18/usr/local/mysql-5.6.30/lib/libmysqlclient.so.18/usr/local/mysql-5.6.30/lib/libmysqlclient.so.18.1.0# ll /usr/local/mysql-5.6.30/lib/
-rw-r--r--. 1 root root 19517976 Jun 6 06:13 libmysqlclient.alrwxrwxrwx. 1 root root 16 Jun 6 06:21 libmysqlclient_r.a -> libmysqlclient.alrwxrwxrwx. 1 root root 17 Jun 6 06:21 libmysqlclient_r.so -> libmysqlclient.solrwxrwxrwx. 1 root root 20 Jun 6 06:21 libmysqlclient_r.so.18 -> libmysqlclient.so.18lrwxrwxrwx. 1 root root 24 Jun 6 06:21 libmysqlclient_r.so.18.1.0 -> libmysqlclient.so.18.1.0lrwxrwxrwx. 1 root root 20 Jun 6 06:21 libmysqlclient.so -> libmysqlclient.so.18lrwxrwxrwx. 1 root root 24 Jun 6 06:21 libmysqlclient.so.18 -> libmysqlclient.so.18.1.0-rwxr-xr-x. 1 root root 8856265 Jun 6 06:13 libmysqlclient.so.18.1.0-rw-r--r--. 1 root root 211954186 Jun 6 06:20 libmysqld.a-rw-r--r--. 1 root root 14190 Jun 6 06:13 libmysqlservices.adrwxr-xr-x. 3 root root 4096 Jun 6 06:21 plugin#cp libmysqlclient.a /usr/lib64/
故障:
checking for mysql_config... noconfigure: error: MySQL library not found解决:
yum install mysql-devel -y故障:
checking for net-snmp-config... noconfigure: error: Invalid Net-SNMP directory - unable to find net-snmp-config解决:
yum install net-snmp-devel -y---------------------------------------------------------------groupadd zabbixuseradd zabbix -s /sbin/nologin -M -g在安装包目录下
mysql -uroot -pzabbix zabbix < database/mysql/schema.sql mysql -uroot -pzabbix zabbix < database/mysql/images.sql mysql -uroot -pzabbix zabbix < database/mysql/data.sql也可以在mysql中用source +路径导入SQL文件
---------------------------------------------------------------
zabbix管理网站配置(nginx) mkdir /data/web/zabbix.lifec.com -p mkdir /data/logs/zabbix -p将前端文件拷贝到项目目录下cp -rp frontends/php/* /data/web/zabbix/
编辑nginx虚拟主机
cd /application/nginx1.10.3/confmkdir extra && cd extra---------------------------------------------------------------vi zabbix.confserver {
listen 8027;server_name www.wajika.com;access_log /data/logs/zabbix/wajika.com.access.log main;index index.html index.php index.html;root /data/web/zabbix;location /{
try_files $uri $uri/ /index.php?$args;}location ~ ^(.+.php)(.*)$ {
fastcgi_split_path_info ^(.+.php)(.*)$; include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param PATH_INFO $fastcgi_path_info;}}
---------------------------------------------------------------vi conf/nginx.conf
user nginx;
worker_processes 1;#error_log logs/error.log warning;
#error_log logs/error.log notice;#error_log logs/error.log info;pid logs/nginx.pid;
events { worker_connections 1024;} http { include mime.types; default_type application/octet-stream;log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';access_log logs/access.log main;
sendfile on;
#tcp_nopush on;#keepalive_timeout 0;
keepalive_timeout 65;#gzip on;
include extra/*.conf;}
---------------------------------------------------------------
编辑zabbix_server.conf文件
vi /application/zabbix/etc/zabbix_server.confLogFile=/tmp/zabbix_server.log
PidFile=/tmp/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
---------------------------------------------------------------启动nginx/application/nginx/sbin/nginx启动PHP:/applicaiton/php/sbin/php-fpm启动zabbix server/applicaiton/zabbix-3.0.3/sbin/zabbix_server启动zabbix agent/applicaiton/zabbix-3.0.3/sbin/zabbix_server--------------------------------------------------------------- unknown log format "main" in /application/nginx1.10.3/conf/nginx.conf:27仔细查看配置没有语法错误经过调试才发现是定义log_format的时候写到HTTP模块最下面,导致子配置文件无法识别。 解决方法:将log_format 写到http开头http{ log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /opt/logs/nginx/access.log main;}---------------------------------------------------------------
查看服务端口 netstat -nltpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 804/nginx tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 924/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1000/master tcp 0 0 0.0.0.0:8027 0.0.0.0:* LISTEN 804/nginx tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 810/php-fpm tcp 0 0 :::22 :::* LISTEN 924/sshd tcp 0 0 ::1:25 :::* LISTEN 1000/master tcp 0 0 :::3306 :::* LISTEN 2363/mysqld---------------------------------------------------------------
添加/etc/hosts文件:127.0.0.1 www.wajika.com
--------------------------------------------------------------- 将服务加入开机自启动echo "/usr/local/nginx/sbin/nginx" >>/etc/rc.local echo "/usr/local/php/sbin/php-fpm" >>/etc/rc.local echo "/etc/init.d/mysqld start" >>/etc/rc.localecho "/usr/local/zabbix-3.0.3/sbin/zabbix_server" >>/etc/rc.localecho "/usr/local/zabbix-3.0.3/sbin/zabbix_agent" >>/etc/rc.local---------------------------------------------------------------Install Cannot create the configuration file.Details–Unable to create the configuration file.Alternatively, you can install it manually:
1.Download the configuration file2.Save it as "/data/web/zabbix/conf/zabbix.conf.php"需要下载文件,并上传到指定的服务器目录中。---------------------------------------------------------------
web 浏览器打开192.168.1.6
登录账号 首字母要大写 Admin或 Zabbix
密码 zabbix修改界面为中文界面
默认登录界面为英文:---------------------------------------------------------------修改以下配置,并重启服务即可;vim /data/web/zabbix.lifec.com/include/locales.inc.php
#'zh_CN' => ['name' => _('Chinese (zh_CN)'), 'display' => false], 'zh_CN' => ['name' => _('Chinese (zh_CN)'), 'display' => true],为了防止图形中的字符出现乱码:
需要自己上传字体:
将选择的字体上传到Linux服务器的zabbix的fonts目录:
/data/web/zabbix.lifec.com/fonts
并修改以下配置:
vim /data/web/zabbix.lifec.com/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name
define('ZBX_GRAPH_FONT_NAME', 'simsun'); // font file name ==>此行为新增行;define('ZBX_FONT_NAME', 'DejaVuSans');
define('ZBX_FONT_NAME', 'simsun'); ==>此行为新增行;
重启服务即可。
---------------------------------------------------------------agent 安装
useradd -r -s /sbin/nologin zabbix
./configure --prefix=/application/zabbix_agent --enable-agentmake installcp /application/zabbix_agent/sbin/zabbix_agentd /etc/init.d/
vi /application/zabbix_agent/etc/
LogFile=/tmp/zabbix_agentd.log
Server=192.168.1.6ServerActive=192.168.1.6Hostname=zabbix server