|
2018-08-20 21:07:38
一、关闭SELinux
查询是否开启了SELinux
getenforceSELinux一共有3种状态,分别是**Enforcing,Permissive**和**Disabled**状态。第一种是默认状态,表示强制启用,第二种是宽容的意思,即大部分规则都放行。第三种是禁用,即不设置任何规则
setenforce 0 #把SELinux关闭,此操作为临时关闭,重启后失效 vim /etc/selnux/conf #修改为disabled,此操作为永久关闭,重启后生效。
#This file controls the state of SELinux on the system.#SELINUX= can take one of these three values:#enforcing - SELinux security policy is enforced.#permissive - SELinux prints warnings instead of enforcing.#disabled - No SELinux policy is loaded.SELINUX=disabled #disabled为关闭#SELINUXTYPE= can take one of three two values:#targeted - Targeted processes are protected,#minimum - Modification of targeted policy. Only selected processes are protected. #mls - Multi Level Security protection.SELINUXTYPE=targeted 二、关闭或防火墙或开放必需端口
#关闭防火墙,并且禁用开机自启。
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
或者 开放防火墙相应端口
firewall-cmd --zone=public --add-port=80/tcp --permanent #–permanent #永久生效,没有此参数重启后失效firewall-cmd --list-ports #查看已经开启的端口
firewall-cmd --reload #重新载入
firewall-cmd --zone= public --query-port=80/tcp #查看
firewall-cmd --zone= public --remove-port=80/tcp --permanent #删除 三、安装Zabbix的Yum源,以及MySQL的源。
http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/ #在这个页面下,找到release的rpm包,并且安装到系统上
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm 四、安装Zabbix和MySQL
yum install -y zabbix-server-mysql zabbix-web-mysql mysql-community-server zabbix-agent
systemctl start mysqld #启动MySQL数据库
mysql_secure_installation #初始化数据库信息 五、创建zabbix数据库,创建zabbix账号
mysql -uroot -p
...
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec) 六、导入默认的Zabbix数据库信息
zcat /usr/share/doc/zabbix-server-mysql-3.0.18/create.sql.gz | mysql zabbix -uzabbix -pzabbix 七、修改Zabbix_server.conf的配置文件,将以下行内容修改正确,DBPassword是刚才创建数据库的密码。
[root@linux-node2 ~]# grep ^DB /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix 八、修改配置文件/etc/httpd/conf.d/zabbix.conf,时区改成Asia/Shanghai
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 Asia/Shanghai 九、启动各项服务并设置为开机启动
systemctl start zabbix-server.service
systemctl start mysqld.service
systemctl start httpd.service
systemctl start zabbix-agent.service
systemctl enable zabbix-server
systemctl enable mysqld
systemctl enable httpd
systemctl enable zabbix-agent Zabbix-server的默认账号Admin,密码zabbix
移除或改名web目录下面的setup.php文件
mv setup.php setup.php.bak
登陆成功后马上更改Admin的密码
|
|
|
|
|
|
|