1.linux机器配置
# 防火墙
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld.service
# selinux
getenforce
vi /etc/selinux/config 改为disabled
setenforce 0
# 配置yum源
# 添加外部 YUM源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 查看 yum 仓库里的所有软件
yum list|more
# 列出 yum 仓库里的软件组列表
yum grouplist
yum makecache报错:Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release
解决方法:
cd /etc/yum.repos.d/
备份以下两个文件
cp CentOS-SCLo-scl.repo CentOS-SCLo-scl.repo.blk
cp CentOS-SCLo-scl-rh.repo CentOS-SCLo-scl-rh.repo.blk
vim CentOS-SCLo-scl.repo
将此文件内容全部替换为以下内容
# CentOS-SCLo-sclo.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-testing]
name=CentOS-7 - SCLo sclo Testing
baseurl=http://buildlogs.centos.org/centos/7/sclo/$basearch/sclo/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-source]
name=CentOS-7 - SCLo sclo Sources
baseurl=http://vault.centos.org/centos/7/sclo/Source/sclo/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-debuginfo]
name=CentOS-7 - SCLo sclo Debuginfo
baseurl=http://debuginfo.centos.org/centos/7/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
vim CentOS-SCLo-scl-rh.repo
将此文件内容全部替换为以下内容
# CentOS-SCLo-rh.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-testing]
name=CentOS-7 - SCLo rh Testing
baseurl=http://buildlogs.centos.org/centos/7/sclo/$basearch/rh/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-source]
name=CentOS-7 - SCLo rh Sources
baseurl=http://vault.centos.org/centos/7/sclo/Source/rh/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-debuginfo]
name=CentOS-7 - SCLo rh Debuginfo
baseurl=http://debuginfo.centos.org/centos/7/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
再执行:
yum clean all
yum makecache
2.安装apache
yum install -y httpd httpd-devel
systemctl start httpd
systemctl enable httpd
systemctl status httpd
netstat -tulp
浏览器登录测试。
3.安装mysql
yum install -y mariadb mariadb-server mariadb-libs mariadb-devel
rpm -qa |grep maria
systemctl start mariadb
systemctl enable mariadb
netstat -tulp
mysql_secure_installation
mysql -uroot -p
4.安装php
yum -y install php
rpm -ql php
yum install php-mysql
rpm -ql php-mysql
yum install -y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmathbcmath
cd /var/www/html/
ls
pwd
vi index.php
内容如下:
<?php
phpinfo();
?>
重启,浏览器输入 http://xxxx/index.php
systemctl restart httpd
5.安装zabbix 5.0
a. Install Zabbix repository
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-latest-5.0.el7.noarch.rpm
yum clean all
b. 安装Zabbix server,Web前端,agent
yum install zabbix-server-mysql zabbix-agent
c. Install Zabbix frontend
Enable Red Hat Software Collections
# yum install centos-release-scl
编辑配置文件 /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.
[zabbix-frontend]
...
enabled=1
...
Install Zabbix frontend packages.
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
d. 创建初始数据库
在数据库主机上运行以下代码。
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
导入初始架构和数据,系统将提示您输入新创建的密码。
# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
# mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
e. 为Zabbix server配置数据库
编辑配置文件 /etc/zabbix/zabbix_server.conf
DBPassword=password
f. 为Zabbix前端配置PHP
编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf uncomment and set the right timezone for you.
; php_value[date.timezone] = Europe/Riga
g. 启动Zabbix server和agent进程
启动Zabbix server和agent进程,并为它们设置开机自启:
# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm