顺便把Centos7的也写了 Centos7.4最小化安装,关闭selinux和firewalld
yum install httpd
在我的机器上zabbixweb模块不是安装到默认的/var/www下,
而是跑到了/usr/share/zabbix下。
/etc/httpd/conf/httpd.conf修改
DocumentRoot "/usr/share/zabbix"
<Directory "/usr/share/zabbix">
PHP5.4依赖包安装
yum install php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-bcmath php-gd php-ldap
/etc/php.ini参数修改
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1
rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
yum install --disablerepo=mysql80-community --enablerepo=mysql56-community mysql-community-server mysql mysql-devel
编辑参数(8G内存)
vi /etc/my.cnf
innodb_file_per_table = 1
innodb_status_file = 1
innodb_buffer_pool_size = 6G
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 64M
innodb_support_xa = 0
default-storage-engine = innodb
bulk_insert_buffer_size = 8M
join_buffer_size = 16M
max_heap_table_size = 32M
tmp_table_size = 32M
max_tmp_tables = 48
read_buffer_size = 32M
read_rnd_buffer_size = 16M
key_buffer_size = 32M
thread_cache_size = 32
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_rollback_on_timeout = 1
query_cache_size = 16M
query_cache_limit = 16M
collation_server = utf8_bin
character_set_server = utf8
启动mysql
systemctl start mysqld
创建数据库和用户
mysql
mysql> create database zabbix default charset utf8;
mysql> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'zabbix';
mysql> flush privileges;
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get
zabbix数据库模板导入mysql
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
编辑配置文件
DBPassword=zabbix
CacheSize=512M
HistoryCacheSize=128M
HistoryIndexCacheSize=128M
TrendCacheSize=128M
ValueCacheSize=256M
Timeout=30
StartVMwareCollectors=2
VMwareCacheSize=256M
VMwareTimeout=300
systemctl start httpd
systemctl start zabbix-server
systemctl start zabbix-agent
systemctl enable httpd
systemctl enable zabbix-server
systemctl enable zabbix-agentd