cacti是一款图形化的监控分析工具
zabbix(server端)部署
[root@192 ~]# hostnamectl set-hostname server
[root@192 ~]# su
[root@server ~]#
[root@server ~]# systemctl stop firewalld && systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@server ~]# setenforce 0 && sed -i "s/SELINUX=*/SELINUX=disabled/g" /etc/selinux/config
[root@server ~]# systemctl stop NetworkManager && systemctl disable NetworkManager
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
[root@server ~]# wget
http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm '//下载nginx软件包'
[root@server ~]# vim /etc/yum.repos.d/nginx.repo '//编辑yum源'
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
[root@server ~]# yum clean all
已加载插件:fastestmirror, langpacks
正在清理软件源: base extras nginx-stable updates
Cleaning up list of fastest mirrors
[root@server ~]# yum makecache '//建立yum缓存'
[root@server ~]# yum install -y nginx
[root@server ~]# systemctl start nginx
[root@server ~]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@localhost ~]# netstat -natp | grep 80
[root@server ~]# yum -y install mariadb-server mariadb
[root@server ~]# systemctl start mariadb.service
[root@server ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@server ~]# netstat -ntap |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 95170/mysqld
'//接下来执行mysql安全配置向导'
[root@server ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): '//初次运行直接回车'
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y '//y。设置密码'
New password: '//输入密码'
Re-enter new password: '//重复输入一次'
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y '//是否删除匿名用户,建议y删除'
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y '//是否禁止root远程登录,建议y禁止'
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] n '//是否删除test数据库,根据实际情况'
... skipping.
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y '//是否重新加载权限表,建议y'
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@server ~]# mysql -uroot -p '//测试登陆mysql数据库'
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.65-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
MariaDB [(none)]> exit
Bye
[root@server ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm '//升级rpm包'
获取https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
警告:/var/tmp/rpm-tmp.xsEbUC: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:epel-release-7-12 ################################# [100%]
[root@server ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
获取https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
警告:/var/tmp/rpm-tmp.YidqBL: 头V4 RSA/SHA1 Signature, 密钥 ID 62e74ca5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:webtatic-release-7-3 ################################# [100%]
[root@server ~]# cd /etc/yum.repos.d/
[root@server yum.repos.d]# yum -y install php72w php72w-devel php72w-fpm php72w-gd php72w-mbstring php72w-mysql '//安装PHP环境工具包'
[root@server yum.repos.d]# php -v '//查看版本'
PHP 7.2.27 (cli) (built: Jan 26 2020 15:49:49) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
vim /etc/php-fpm.d/www.conf
user = nginx #第8行
group = nginx #第10行
vim /etc/nginx/conf.d/default.conf
index index.php index.html index.htm; #第10行添加index.php
location ~ \.php$ { #配置php模块,去掉注释
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
vim /etc/php.ini
short_open_tag = On #202行修改,支持php短标签
expose_php = Off #359行修改,隐藏php版本
##为PHP兼容zabbix进行修改,优化配置要求
max_execution_time = 300 #368行修改,执行时间
max_input_time = 300 #378行修改,接收数据等待时向
memory_limit = 128M #389行,每个脚本占用内存
post_max_size = 16M #656行修改,POST数据大小
upload_max_filesize = 2M #799行,下载文件大小
always_populate_raw_post_data = -1 #800行添加,可以用$HTTP_RAW_POST DATA
date.timezone = Asia/Shanghai #877行取消注释并添加时区
systemctl start php-fpm
systemctl enable php-fpm
netstat -natp | grep 9000
systemctl restart nginx
vim /usr/share/nginx/html/info.php
<?php
phpinfo();
?>
http://192.168.204.159/info.php