摘要:,初始化完毕。。。解决图形中文乱码把它拷贝到的端的目录下例如,确认后缀为
本例环境使用Centos7.3 64位
安装zabbix需要mysql的支持,下面是快速安装LNMP的方法(使用EZHTTP安装)
安装LNMP首先创建一个目录存放下载文件:
[root@localhost ~]# mkdir /software [root@localhost software]# cd /software/
安装wget工具:
[root@localhost software]# yum -y install wget
下载EZHTTP安装脚本:
[root@localhost software]# wget --no-check-certificate https://github.com/centos-bz/ezhttp/archive/master.zip?time=$(date +%s) -O ezhttp.zip
启动脚本:
[root@localhost software]# unzip ezhttp.zip [root@localhost software]# cd ezhttp-master [root@localhost ezhttp-master]# chmod +x start.sh [root@localhost ezhttp-master]# ./start.sh
进去选择页面
除了数字选择项需要确认输入,其他的的按回车默认就行:
nginx 和 apache 都行,个人比较喜欢nginx
php版本5.5-7.1
mysql版本5.6
[root@localhost ezhttp-master]# ./start.sh ############################################################################# You are welcome to use this script to deploy your linux,hope you like. The script is written by Zhu Maohai. If you have any question. please visit http://www.centos.bz/ezhttp/ and submit your issue.thank you. ############################################################################ 1) LAMP LNMP LANMP Installation. 2) Some Useful Tools. 3) Upgrade Software 4) Exit. please select: 1 you select LAMP LNMP LANMP Installation. 1) LNMP(Nginx MySQL PHP) 2) LAMP(Apache MySQL PHP) 3) LNAMP(Nginx Apache MySQL PHP) 4) back to main menu please input the package you like to install: 1 #################### nginx setting #################### 1) nginx-1.8.0 2) tengine-2.1.0 3) openresty-1.9.7.3 4) custom_version 5) do_not_install which nginx you do select(default do_not_install): 1 your selection: nginx-1.8.0 nginx-1.8.0 install location(default:/usr/local/nginx,leave blank for default): nginx-1.8.0 install location: /usr/local/nginx the nginx-1.8.0 configure parameter is: --prefix=/usr/local/nginx --with-http_ssl_module --with-openssl=/software/ezhttp-master/soft/openssl-1.0.2h --with-http_sub_module --with-http_stub_status_module --with-pcre --with-pcre=/software/ezhttp-master/soft/pcre-8.33 --with-zlib=/software/ezhttp-master/soft/zlib-1.2.8 --with-http_secure_link_module Would you like to change it?[N/y](default n): you select no,configure parameter will not be changed. Do you need to install nginx module?[N/y](default n): #################### mysql setting #################### 1) mysql-5.1.73 2) mysql-5.5.54 3) mysql-5.6.35 4) mysql-5.7.17 (need about 2GB RAM when building,try mysql-5.6 if failed) 5) libmysqlclient18 6) custom_version 7) do_not_install which mysql you"d select(default do_not_install): 3 your selection: mysql-5.6.35 mysql-5.6.35 install location(default:/usr/local/mysql,leave blank for default): mysql-5.6.35 install location: /usr/local/mysql mysql data location(default:/usr/local/mysql/data,leave blank for default): mysql-5.6.35 data location: /usr/local/mysql/data mysql port number(default:3306,leave blank for default): mysql port number: 3306 mysql server root password (default:root,leave blank for default): 123456 mysql-5.6.35 root password: 123456 the mysql-5.6.35 configure parameter is: -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/usr/local/mysql/etc -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=complex -DENABLED_LOCAL_INFILE=1 Would you like to change it?[N/y](default n): you select no,configure parameter will not be changed. #################### php setting #################### 1) php-5.2.17 2) php-5.3.29 3) php-5.4.43 4) php-5.5.27 5) php-5.6.15 6) php-7.1.0 7) custom_version 8) do_not_install which php you"d select(default do_not_install): 6 your selection: php-7.1.0 php-7.1.0 install location(default:/usr/local/php,leave blank for default): php-7.1.0 install location: /usr/local/php the php-7.1.0 configure parameter is: --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --enable-bcmath=shared --with-pdo_sqlite --with-gettext=shared --with-iconv --enable-ftp=shared --with-sqlite --with-sqlite3 --enable-mbstring=shared --enable-sockets=shared --enable-zip --enable-soap=shared --with-openssl --with-zlib --with-curl=shared --with-gd=shared --with-jpeg-dir --with-png-dir --with-freetype-dir --with-mcrypt=shared,/opt/ezhttp/libmcrypt-2.5.8 --with-mhash=shared,/opt/ezhttp/mhash-0.9.9.9 --enable-opcache --with-mysql=mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --without-pear --with-libdir=lib64 --disable-fileinfo Would you like to change it?[N/y](default n): you select no,configure parameter will not be changed. #################### PHP modules install #################### php-7.1.0 version available modules: #################### php_modules install #################### 1) fileinfo 2) php-gmp 3) php-swoole-1.7.20 4) do_not_install please input one or more number between 1 and 4(default do_not_install)(ie.1 2 3): your selection do_not_install #################### other_soft install #################### 1) memcached-1.4.24 2) pure-ftpd-1.0.41 3) phpMyAdmin-4.4.12-all-languages 4) redis-3.0.3 5) mongodb-linux-x86_64-2.4.9 6) phpRedisAdmin-1.1.0 7) memadmin-1.0.12 8) rockmongo-1.1.6-fix-auth 9) jdk1.7.0_79 10) jdk1.8.0_66 11) apache-tomcat-7.0.68 12) apache-tomcat-8.0.39 13) do_not_install please input one or more number between 1 and 13(default do_not_install)(ie.1 2 3): 1 2 3 4 6 10 12 your selection memcached-1.4.24 pure-ftpd-1.0.41 phpMyAdmin-4.4.12-all-languages redis-3.0.3 phpRedisAdmin-1.1.0 jdk1.8.0_66 apache-tomcat-8.0.39 input memcached-1.4.24 location(default:/usr/local/memcached): memcached location: /usr/local/memcached input pure-ftpd-1.0.41 location(default:/usr/local/pureftpd): pureftpd location: /usr/local/pureftpd Would you like to install web user manager for pureftpd?[N/y](default n): you select not install web manager input phpMyAdmin-4.4.12-all-languages location(default:/home/wwwroot/phpmyadmin): phpmyadmin location: /home/wwwroot/phpmyadmin input redis-3.0.3 location(default:/usr/local/redis): redis location: /usr/local/redis please input the max memory allowed for redis(ie.128M,512m,2G,4g): 128M 128M input phpRedisAdmin-1.1.0 location(default:/home/wwwroot/redisadmin): phpRedisAdmin location: /home/wwwroot/redisadmin input jdk1.8.0_66 location(default:/usr/local/jdk1.8.0_66): jdk8 location: /usr/local/jdk1.8.0_66 input apache-tomcat-8.0.39 location(default:/usr/local/tomcat8): tomcat8 location: /usr/local/tomcat8 #################### your choice overview #################### Package: lnmp *****Nginx Setting***** Nginx: nginx-1.8.0 Nginx Location: /usr/local/nginx Nginx Configure Parameter: --prefix=/usr/local/nginx --with-http_ssl_module --with-openssl=/software/ezhttp-master/soft/openssl-1.0.2h --with-http_sub_module --with-http_stub_status_module --with-pcre --with-pcre=/software/ezhttp-master/soft/pcre-8.33 --with-zlib=/software/ezhttp-master/soft/zlib-1.2.8 --with-http_secure_link_module Nginx Modules: *****MySQL Setting***** MySQL Server: mysql-5.6.35 MySQL Location: /usr/local/mysql MySQL Data Location: /usr/local/mysql/data MySQL Port Number: 3306 MySQL Root Password: 123456 MySQL Configure Parameter: -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/usr/local/mysql/etc -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=complex -DENABLED_LOCAL_INFILE=1 *****PHP Setting***** PHP: php-7.1.0 PHP Location: /usr/local/php PHP Configure Parameter: --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --enable-bcmath=shared --with-pdo_sqlite --with-gettext=shared --with-iconv --enable-ftp=shared --with-sqlite --with-sqlite3 --enable-mbstring=shared --enable-sockets=shared --enable-zip --enable-soap=shared --with-openssl --with-zlib --with-curl=shared --with-gd=shared --with-jpeg-dir --with-png-dir --with-freetype-dir --with-mcrypt=shared,/opt/ezhttp/libmcrypt-2.5.8 --with-mhash=shared,/opt/ezhttp/mhash-0.9.9.9 --enable-opcache --with-mysql=mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --without-pear --with-libdir=lib64 --disable-fileinfo *****Other Software Setting***** Other Software: memcached-1.4.24 pure-ftpd-1.0.41 phpMyAdmin-4.4.12-all-languages redis-3.0.3 phpRedisAdmin-1.1.0 jdk1.8.0_66 apache-tomcat-8.0.39 memcached location: /usr/local/memcached pureftpd location: /usr/local/pureftpd phpmyadmin_location: /home/wwwroot/phpmyadmin redis_location: /usr/local/redis phpRedisAdmin_location: /home/wwwroot/redisadmin jdk8_location: /usr/local/jdk1.8.0_66 tomcat8_location: /usr/local/tomcat8 JAVA_HOME: /usr/local/jdk1.8.0_66 ############################################################## Are you ready to configure your Linux?[Y/n](default y):
安装过程等待即可:
.............................. ..............................
安装成功:
start programs... Starting nginx daemon: . Starting MySQL.. SUCCESS! Warning: Using a password on the command line interface can be insecure. Starting php-fpm done Starting memcached: Start pureftpd.... [OK] Starting Redis server...
使用EZHTTP安装成功后各服务已经打开,输入Linxu 机器IP 访问即可:
开始安装zabbix 配置源
Zabbix在CentOS基本源里不可获得,因此必须配置EPEL 和Zabbix 官方repository,因为需要一款名叫fping的软件(这款软件你下载源码编译安装貌似行不通!),然后其他的yum源将mysql全部识别为mariadb了,所以想yum安装mysql,请安装mysql社区版官方源,或者编译安装,上面的EZHTTP安装脚本就是编译安装
安装EPEL repository
[root@localhost software]# pwd /software [root@localhost software]# yum -y install epel-release
配置ZabbixZone package repository and GPG key
[root@localhost software]# rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX [root@localhost software]# rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591 [root@localhost software]# yum -y install fping [root@localhost software]# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm安装Zabbix server and agent(agent是可选的)
安装Zabbix server and agent:(配置自己监控自己,所以安装了zabbix-agent)
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
可以上zabbix rpm包官网查看或下载相应包
http://repo.zabbix.com/
创建MySQL 数据库和用户登录Mysql:
[root@localhost software]# mysql -uroot -p123456
创建一个数据库zabbix和数据库用户zabbix:
mysql> create database zabbix character set utf8; mysql> grant all privileges on zabbix.* to "zabbix"@"localhost" identified by "zabbix"; mysql> flush privileges;数据库导入zabbix template
看yum安装的zabbix-server-mysql-3.x.x 这个文件的版本是多少就改成多少
[root@localhost software]# zcat /usr/share/doc/zabbix-server-mysql-3.2.4/create.sql.gz |mysql -uzabbix -pzabbix -b zabbix配置Zabbix server
vi /etc/zabbix/zabbix_server.conf
配置下面的几个参数
带#号的就去掉#号,并修改其值
ListenPort=10051 DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix DBSocket=/usr/local/mysql/data/mysql.sock DBPort=3306配置zabbix-agent
vi /etc/zabbix/zabbix_agentd.conf
配置zabbix server的ip
## Line 95 - Specify Zabbix server ## Server=127.0.0.1 ## Line 136 - Specify Zabbix server ## ServerActive=127.0.0.1 ## Line 147 - Specify Zabbix server Hostname or IP address Hostname=127.0.0.1修改PHP 设置
修改php.ini为zabbix 建议的设置
编辑文件 php.ini,
[root@localhost software]# vi /usr/local/php/etc/php.ini
设置下面的参数:
max_execution_time = 300 max_input_time = 300 memory_limit = 128M post_max_size = 32M upload_max_filesize = 2M date.timezone = Asia/Shanghai
安装时可能缺少下面扩展,把下面内容添加到php.ini
extension=bcmath.so extension=gettext.so extension=sockets.so
安装扩展
[root@localhost ext]# cd /software/ezhttp-master/soft/php-7.1.0/ext [root@localhost ext]# pwd /software/ezhttp-master/soft/php-7.1.0/ext [root@localhost ext]# cd sockets/ [root@localhost sockets]# /usr/local/php/bin/phpize [root@localhost sockets]# ./configure --with-php-config=/usr/local/php/bin/php-config [root@localhost sockets]# cd .. [root@localhost ext]# cd bcmath/ [root@localhost bcmath]# /usr/local/php/bin/phpize [root@localhost bcmath]# ./configure --with-php-config=/usr/local/php/bin/php-config [root@localhost bcmath]# cd .. [root@localhost ext]# cd gettext/ [root@localhost gettext]# /usr/local/php/bin/phpize [root@localhost gettext]# ./configure --with-php-config=/usr/local/php/bin/php-config
使用下面命令可以看到有一个扩展存放的目录,我们需要的扩展模块在其中即安装成功
[root@localhost gettext]# make && make install
修改php-fpm运行的用户和组
[root@localhost software]# vi /usr/local/php/etc/php-fpm.d/www.conf user = www group = www方法一:使用 apache 服务器
apache配置zabbix-web站点文件
[root@localhost etc]# cd /etc/httpd/
vi conf/httpd.conf
修改下面内容:
Listen 80 User www Group wwwwDirectoryIndex index.html index.php
vi conf.d/zabbix.conf
修改内容如下:
php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 32M php_value upload_max_filesize 8M php_value max_input_time 300 php_value always_populate_raw_post_data -1 php_value date.timezone Asia/Shanghai
然后重启apache、mysql、php、zabbix-server
浏览器输入ip/setup.php 即可进入zabbix初次web安装界面
配置zabbix-web站点文件
把zabbix程序文件拷贝到我们指定的目录,并修改属主和属组
[root@localhost software]# cp -r /usr/share/zabbix /var/www/ [root@localhost software]# chown -R www:www /var/www/zabbix [root@localhost software]# chown -R www:www /etc/zabbix [root@localhost software]# chown -R www:www /usr/share/zabbix [root@localhost software]# chown -R www:www /usr/lib/zabbix [root@localhost software]# chmod -R 755 /etc/zabbix/web
创建存放web站点配置文件的目录
[root@localhost ~]# cd /usr/local/nginx/conf/ [root@localhost conf]# mkdir conf.d/
配置nginx.conf,把新建的目录包含进去
[root@localhost conf]# vi nginx.conf listen 80 default_server; ===> 改为 listen 90 default_server; root /home/wwwroot/; ===> 改为 # root /home/wwwroot/; include vhost/*.conf; ===> 改为 include /usr/local/nginx/conf/conf.d/*.conf;
配置zabbix.conf(zabiix站点的配置文件)
[root@localhost conf]# cd conf.d/ [root@localhost conf.d]# vi zabbix.conf
zabbix.conf 内容如下:
server { listen 80; server_name localhost; root /var/www/zabbix; index index.php index.html index.htm; access_log logs/zabbix.access.log; error_log logs/zabbix.error.log; location / { try_files $uri $uri/ /index.php?$args; } location ~ .*.(php)?$ { expires -1s; try_files $uri =404; fastcgi_split_path_info ^(.+.php)(/.+)$; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_VALUE open_basedir=$document_root:/tmp/:/proc/:/usr/share/zabbix/:/etc/zabbix/web/:/etc/zabbix/; } }
启动zabbix-server 和zabbix-agent。并设置zabbix-server和zabbix-agent开机自动启动
systemctl start zabbix-server systemctl start zabbix-agent /etc/init.d/nginx restart chkconfig nginx on /etc/init.d/mysqld restart chkconfig mysqld on /etc/init.d/php-fpm restart chkconfig php-fpm on systemctl enable zabbix-server systemctl enable zabbix-agent修改Firewall 和SELinux 设置
开放zabbix端口10050 and 10051
firewall-cmd --permanent --add-port=10050/tcp firewall-cmd --permanent --add-port=10051/tcp
重启firewall
systemctl restart firewalld
如果使用 SELinux, 运行以下命令使 Apache 可以和 Zabbix通信
setsebool -P httpd_can_connect_zabbix=1
如果是测试环境可以直接关闭防火墙和selinux
[root@localhost software]# systemctl stop firewalld [root@localhost local]# chkconfig firewalld off
修改配置文件,禁用selinux
[root@localhost software]# setenforce 0 [root@localhost software]# vi /etc/selinux/config SELINUX=disabled输入ip/setup.php进入zabbix-web界面进行后续安装操作
确认状态都是ok
配置数据库信息(填写上面我们设置的数据库账户和密码:zabbix,zabbix,测试环境可以直接用root)
进入下一步,默认即可
如果出现下面错误
使用php7.0版本初始化完成后页面有如下的报错:
这个是因为PHP 7.1.0类型强化,处理方法也很简单找到Zabbix WEB目录下include/func.inc.php文件,执行下面命令,并重启php服务:
sed -i "/$last = strtolower(substr($val, -1));/a$val = substr($val,0,-1);" /var/www/zabbix/include/func.inc.php /etc/init.d/php-fpm reload
然后刷新页面可以看到已经正常。
ok,初始化完毕。。。
2.把它拷贝到zabbix的web端的fonts目录下例如:/var/www/html/zabbix/fonts,确认后缀为ttf
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/8029.html
摘要:是新出现的自动化运维工具,基于开发,集合了众多运维工具的优点,实现了批量系统配置批量程序部署批量运行命令等功能。是基于模块工作的,本身没有批量部署的能力。 ansible ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。ans...
阅读 2657·2021-09-22 15:58
阅读 2203·2019-08-29 16:06
阅读 849·2019-08-29 14:14
阅读 2757·2019-08-29 13:48
阅读 2425·2019-08-28 18:01
阅读 1427·2019-08-28 17:52
阅读 3292·2019-08-26 14:05
阅读 1549·2019-08-26 13:50