1.centos6单用户模式:
开机任意键;e, kernel; e;空格键入  1 or s or S or single,回车; b 。

2.centos 7破解密码:
开机任意键; e,将 ro 改为 rw init=/sysroot/bin/sh,ctrl+x;
依次输入:chroot /sysroot 回车,passwd root 回车 ,touch /.autorelabel,exit,reboot

3.ubuntu修改root密码:
ESC -recovery mode 键入e–把ro recovery nomodeset 改成rw single init=/bin/bash,F10

。。。

一、系统环境

centos 6.8 X86-64

服务器ip:192.168.1.128

首先需要安装:wget、gcc、gcc-c++:yum install gcc gcc-c++ -y

二、搭建zabbix环境

1、安装apache

#yum install  httpd libxml2-devel net-snmp-devel libcurl-devel -y

配置apache,更改ServerName

#vi /etc/httpd/conf/httpd.conf

ServerName 192.168.1.128

2、安装mysql(我安装的mysql 5.6)

下载rpm源及安装

#rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
# yum install mysql-server mysql-devel -y

 

修改配置文件,添加如下内容:

#vi /etc/my.cnf

default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = ‘SET NAMES utf8’
character-set-server = utf8

 

MySQL安全设置:

# mysql_secure_installation
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 MySQL
root user without the proper authorisation.
Set root password? [Y/n] y        #设置root密码 选择y 或者回车
New password:                      #设置root密码
Re-enter new password:        #再次输入root密码
Password updated successfully!
Reloading privilege tables..
… Success!

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!

Remove test database and access to it? [Y/n] y  删除test数据库 选择y
– Dropping test database…

Reload privilege tables now? [Y/n] y            是否重新加载刷新表空间 选择y 是
… Success!
All done!  If you’ve completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up…

 

创建zabbix数据库

# mysql -uroot -p(刚刚设置的root密码)
mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
mysql> show create database zabbix;
+———-+———————————————————————————-+
| Database | Create Database                                                                  |
+———-+———————————————————————————-+
| zabbix  | CREATE DATABASE `zabbix` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */ |
+———-+———————————————————————————-+
1 row in set (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY ‘zabbix’;
Query OK, 0 rows affected (0.04 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+——————–+
| Database          |
+——————–+
| information_schema |
| mysql              |
| performance_schema |
| zabbix            |
+——————–+
4 rows in set (0.00 sec)

 

3、安装php(我安装的php5.6)

rpm包下载和yum安装

# rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
# yum install php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap -y

 

修改配置文件

vi /etc/php.ini

date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 300
max_input_time = 300
always_populate_raw_post_data = -1

 

4、安装zabbix

创建zabbix用户名和组

# groupadd  -g 201  zabbix
# useradd  -g zabbix  -u 201 -m zabbix

 

下载安装zabbix

#wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz
#tar zxvf zabbix-3.0.3.tar.gz
# cd zabbix-3.0.3

 

# /usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
# /usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
# /usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql
#./configure –prefix=/usr/local/zabbix –sysconfdir=/etc/zabbix/ –enable-server –enable-agent –with-net-snmp –with-libcurl –with-mysql –with-libxml2
# make && make install

 

(注:编译 zabbix 如果报下面错误,就做以下操作
configure: error: Not found mysqlclient library
#find / -name libmysqlclient*
ln -s /usr/lib64/mysql/libmysqlclient.so.18.1.0 /usr/lib64/mysql/libmysqlclient.so
ln -s /usr/lib64/mysql/libmysqlclient_r.so.18.1.0 /usr/lib64/mysql/libmysqlclient_r.so)

 

配置zabbix

# vi /etc/zabbix/zabbix_server.conf

DBHost=localhost              数据库ip地址
DBName=zabbix               数据库名
DBUser=zabbix                 数据库用户名
DBPassword=zabbix          数据库密码
ListenIP=192.168.1.128

 

#ln -s /usr/local/zabbix/sbin/* /usr/sbin/
#cd
#cp zabbix-3.0.3/misc/init.d/fedora/core/zabbix_* /etc/init.d/
#chmod +x /etc/init.d/zabbix_*
#sed -i “s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g”  /etc/init.d/zabbix_server
#mkdir -p /var/www/html/zabbix
#cp -r zabbix-3.0.3/frontends/php/* /var/www/html/zabbix/
#chown -R apache.apache /var/www/html/zabbix/
#chkconfig zabbix_server on

 

启动Apache和zabbix server

# /etc/init.d/zabbix_server restart
# /etc/init.d/httpd restart

 

三、安装zabbix

浏览器输入地址:

http://192.168.1.128/zabbix/setup.php(安装是图形界面,就不一一道来了)

登陆默认用户是Admin  密码 zabbix

 

到此就安装完了,如有问题欢迎留言讨论!

系统平台:CentOS 6.8  64位。

安装编译工具及库文件

yum -y install wget make zlib zlib-devel gcc-c++ gcc libtool  openssl openssl-devel

首先要安装 PCRE

下载 PCRE 安装包,下载地址: http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

cd /opt

wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

tar zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure
make && make install

安装 Nginx

下载 Nginx,下载地址:http://nginx.org/download/nginx-1.6.2.tar.gz

cd /opt

wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/opt/pcre-8.35
make
make install
/usr/local/nginx/sbin/nginx /启动nginx/(重启命令:/usr/local/nginx/sbin/nginx -s reload)

最后,开放防火墙80端口。测试正常

over!