nginx安装
1)源码编译安装
yum install -y pcre* openssl* gcc gcc-c++ automake zlib* ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx \ --with-http_stub_status_module --with-http_ssl_module \ --with http_gzip_static_module --with-pcre make && make install
2)启动nginx
/usr/local/nginx/sbin/nginx -t /usr/local/nginx/sbin/nginx curl -s http://localhost 检测
3)权限
useradd nginx 修改nginx.conf配置文件用户为nginx chown -R nginx:nginx /usr/local/nginx chmod 775 -R /usr/local/nginx/
php安装
1)源码编译安装
yum install libxml2-devel bzip2-devel libxml2 openldap-devel openldap ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/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 \ --with-ldap make && make install
2)配置文件修改
cp php.ini-production /usr/local/php/etc/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/php-fpm.conf vim php.ini max_execution_times=300 memory_limit=128M post_max_size=16 Mupload_max_filesize=2 Mmax_input_time=300 always_populate_raw_post_data=-1 date.timezone=Asia/Shanghai
3)重启php
/usr/local/php/sbin/php-fpm netstat -antlp|grep php-fpm 出现9000端口,表示正确
4)权限
修改php-fpm.conf配置文件用户:nginx chown -R nginx:nginx /usr/local/php chmod 775 -R /usr/local/php/
nginx支持php
1)配置文件
vim nginx.conf location ~\.php${ root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi.conf; include fastcgi_params; } location /{ root html; index index.php index.html index.htm; }
2)重启nginx
/usr/local/nginx/sbin/nginx -s reload
安装mysql
1)mysql绿色版下载
mysql二进制发布包 http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz
2)编译安装
tar -zxf mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz useradd mysql chown -R mysql:mysql mysql/ chmod -R 777 mysql/ ./mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --user=mysql cd mysql/support-files/ cp my-medium.cnf /etc/my.cnf
3)my.cnf配置文件
[client] socket = /paic/mysql01/var/mysql.sock port = 3306 [mysqld] ############ GENERAL ############# autocommit = ON character_set_server = UTF8MB4 collation_server = UTF8MB4_bin explicit_defaults_for_timestamp = ON lower_case_table_names = 1 port = 3306 read_only = OFF transaction_isolation = READ-COMMITTED ####### CACHES AND LIMITS ######### interactive_timeout = 600 max_allowed_packet = 32M max_connect_errors = 10000 max_connections = 4000 max_user_connections = 2000 sort_buffer_size = 1M table_definition_cache = 1400 table_open_cache = 2000 table_open_cache_instances = 4 thread_cache_size = 9 thread_stack = 256K tmp_table_size = 32M ############# SAFETY ############## local_infile = OFF #plugin-load = validate_password.so skip_name_resolve = ON #sql_mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY ############# LOGGING ############# general_log = 0 log_queries_not_using_indexes = ON log_slow_admin_statements = ON log_warnings = 2 long_query_time = 1 slow_query_log = OFF ############# REPLICATION ############# binlog_checksum = CRC32 binlog_format = row binlog_rows_query_log_events = ON #enforce_gtid_consistency = ON expire_logs_days = 5 #gtid_mode = ON #log_slave_updates = ON master_info_repository = TABLE master_verify_checksum = ON max_binlog_size = 256M relay_log_info_repository = TABLE server_id = 9001 skip_slave_start = ON slave_net_timeout = 4 slave_sql_verify_checksum = ON sync_binlog = 0 sync_master_info = 10000 sync_relay_log = 10000 sync_relay_log_info = 10000 slave_skip_errors=1032,1062 ############### PATH ############## basedir = /paic/mysql datadir = /paic/mysql01/data tmpdir = /paic/mysql01/tmp socket = /paic/mysql01/var/mysql.sock pid_file = /paic/mysql01/var/mysql.pid innodb_data_home_dir = /paic/mysql01/data log_error = /paic/mysql01/log/error.log general_log_file = /paic/mysql01/log/general.log slow_query_log_file = /paic/mysql01/log/slow.log log_bin = /paic/mysql01/log/mysql-bin log_bin_index = /paic/mysql01/log/mysql-bin.index relay_log = /paic/mysql01/log/relay-log relay_log_index = /paic/mysql01/log/relay-log.index ############# INNODB ############# innodb_file_format = barracuda innodb_flush_method = O_DIRECT innodb_buffer_pool_size = 204G #innodb_log_file_size = 256M innodb_log_file_size=33554432 innodb_log_files_in_group=3 #innodb_log_files_in_group = 4 innodb_flush_log_at_trx_commit = 2 innodb_support_xa = ON innodb_strict_mode = ON #innodb_data_file_path=ibdata1:12M:autoextend innodb_data_file_path = ibdata1:256M;ibdata2:16M:autoextend #innodb_checksum_algorithm = strict_crc32 innodb_io_capacity = 8000 innodb_io_capacity_max = 10000 [mysql] ############# CLIENT ############# max_allowed_packet = 32M socket = /paic/mysql01/var/mysql.sock [mysqldump] max_allowed_packet = 256M [mysqld_safe] ledir=/paic/mysql/bin
zabbix server安装
1)源码安装
yum install -y net-snmp-devel libxml2-devel libcurl-devel 源码安装libevent(zabbix 3.4) libssh2 ./configure --prefix=/usr/local/zabbix_server --with-mysql --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy --with-ssh2 --enable-java --with-ldap make && make install
2)数据库授权
useradd zabbix mysql>create database zabbix character set utf8 collate utf8_bin; mysql>grant all privileges on zabbix.* to zabbix@'数据库主机ip' identified by'zabbix123'; mysql>flush priviledges; mysql>quit 此处proxy安装,只需导入schema.sql mysql -uzabbix -p zabbix123 zabbix3)server配置文件
DBName=zabbix DBUser=zabbix DBPassword=zabbix DBPort=3306 DBHost=数据库主机ip4)重启server
/usr/local/zabbix_server/sbin/zabbix_server 出现过libevent模块没加载上,直接ldconfig即可5)拷贝前端文件
cp -rp frontend/php/* nginx的默认发布目录下,权限为nginx:nginx 775即可5)agent配置文件
LogFile=/tmp/zabbix_agentd.log Server=zabbix_proxy01.prd.zj,zabbix_proxy02.prd.zj,zabbix_proxy03.prd.zj,zabbix_proxy04.prd.zj,zabbix_proxy05.prd.zj,zabbix_proxy06.prd.zj ServerActive=zabbix_proxy01.prd.zj:10051,zabbix_proxy02.prd.zj:10051,zabbix_proxy03.prd.zj:10051,zabbix_proxy04.prd.zj:10051,zabbix_proxy05.prd.zj:10051,zabbix_proxy06.prd.zj:10051 #主动模式下,给server发送数据 Hostname=Zabbix server #开启的agent进程数 StartAgents=10 #actove模式,获取主动监控项的时间 RefreshActiveChecks=300 #数据在buffer中存多久 BufferSend=300 #超过此大小,发送给server端 BufferSize=1000 #处理log时,每次发送的行数 MaxLinesPerSecond=500 Timeout=30 Include=/wls/wls81/zabbix-agent-3.4.1/etc/zabbix_agentd.conf.d/安装遇到问题
1)安装fping
http://www.fping.org/dist/fping-3.5.tar.gztar zxvf fping-3.5.tar.gz ./configure --prefix=/opt/fping make && make install vi /usr/local/zabbix_server/etc/zabbix_server.conf FpingLocation=/opt/fping/sbin/fping chown root.zabbix /opt/fping/sbin/fping chmod 4710 /opt/fping/sbin/fping fping -s localhost 测试