- 论坛徽章:
- 1
|
回复 32# chenyx
本来是想用yum装zabbix的,不过客户说构筑zabbix服务器的时候不能使用internet,所以就用源装。
我把我的RHEL 7的iso设定为了yum的源,不过只能装一部分包,zabbix-server, zabbix-mysql-server等等都没有,只能下载好源码装。
不知道不能用internet的情况下,是否也能用yum装zabbix的所有包?能指教下么?
以下是我装的方法,能帮我看看哪里有问题么?
禁用SELINUX
----------------------------
# vi /etc/sysconfig/selinux
SELINUX=disabled
----------------------------
IP設定:
------------------------------------------------------------------
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
HWADDR=00:15:5D:EC:64:04
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eth0
UUID=42411e41-1559-4706-a242-05aa1bdb9e7f
ONBOOT=yes
IPADDR0=10.169.236.249
PREFIX0=24
GATEWAY0=10.169.236.1
:wq!
[root@localhost ~]# service network restart
[root@localhost ~]#
-------------------------------------------------------------------
禁用firewall和iptables
------------------------------------------------------
[root@localhost ~]#systemctl stop firewalld.service
[root@localhost ~]#systemctl disable firewalld.service
[root@localhost ~]#systemctl stop iptables.service
[root@localhost ~]#systemctl disable iptables.service
------------------------------------------------------
把RHEL7的ISO设定为Yum源:
-------------------------------------------------------------------------
用Winscp把rhel-server-7.0-x86_64-dvd.iso拷贝到/usr/local/src
[root@localhost ~]#mkdir /media/cdrom
[root@localhost ~]#mount -t iso9660 -o loop /usr/local/src/rhel-server-7.0-x86_64-dvd.iso /media/cdrom
[root@localhost ~]#cd /etc/yum.repos.d/
[root@localhost yum.repos.d]#touch rhel-media.repo
[root@localhost yum.repos.d]#vi rhel-media.repo
[rhel-media]
name=Red Hat Enterprise Linux 7.0
baseurl=file:///media/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///media/cdrom/RPM-GPG-KEY-redhat-release
:wq!
[root@localhost yum.repos.d]#yum clean all
[root@localhost yum.repos.d]#yum makecache
------------------------------------------------------------------------
创建Zabbix用户
-----------------------------------------------
[root@localhost tmp]#groupadd zabbix
[root@localhost tmp]#useradd -g zabbix zabbix
-----------------------------------------------
安装MySQL
--------------------------------------------------------------------------
用winscp把MySQL-5.7.5-m15-0.6.m15.el7.x86_64.rpm-bundle.tar拷贝到/tmp/mysql
[root@localhost mysql]#tar -xvf MySQL-5.7.5-m15-0.6.m15.el7.x86_64.rpm-bundle.tar
[root@localhost mysql]# ls
MySQL-5.7.5-m15-0.6.m15.el7.x86_64.rpm-bundle.tar
mysql-community-bench-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-client-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-common-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-devel-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-embedded-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-libs-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-server-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-test-5.7.5-0.6.m15.el7.x86_64.rpm
[root@localhost mysql]#yum install -y perl-Net-Daemon.noarch
[root@localhost mysql]#yum install -y perl-PlRPC.noarch
[root@localhost mysql]#yum install -y perl-DBI.x86_64
[root@localhost mysql]#yum install -y net-tools.x86_64
[root@localhost mysql]#rpm -ivh mysql-community-common-5.7.5-0.6.m15.el7.x86_64.rpm
[root@localhost mysql]#rpm -ivh mysql-community-libs-5.7.5-0.6.m15.el7.x86_64.rpm
[root@localhost mysql]#rpm -ivh mysql-community-embedded-5.7.5-0.6.m15.el7.x86_64.rpm
[root@localhost mysql]#rpm -ivh mysql-community-devel-5.7.5-0.6.m15.el7.x86_64.rpm
[root@localhost mysql]#rpm -ivh mysql-community-embedded-devel-5.7.5-0.6.m15.el7.x86_64.rpm
[root@localhost mysql]#rpm -ivh mysql-community-client-5.7.5-0.6.m15.el7.x86_64.rpm
[root@localhost mysql]#rpm -ivh mysql-community-server-5.7.5-0.6.m15.el7.x86_64.rpm
[root@localhost mysql]#systemctl start mysqld.service
[root@localhost mysql]#
.
.
(把MySQL的root密码改为123456)
.
.
[root@localhost mysql]#su - zabbix
[zabbix@localhost ~]$ mysql -uroot -p123456
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
mysql> quit;
[zabbix@localhost ~]$ mysql -uzabbix -p123456 zabbix < database/mysql/schema.sql mysql
[zabbix@localhost ~]$ mysql -uzabbix -p123456 zabbix < database/mysql/images.sql mysql
[zabbix@localhost ~]$ mysql -uzabbix -p123456 zabbix < database/mysql/data.sql
---------------------------------------------------------------------------------------
用源码装Zabbix
---------------------------------------------------------------------------------
用winscp把zabbix-2.4.3.tar.gz拷贝到/tmp
[root@localhost tmp]#tar -zxvf zabbix-2.4.0.tar.gz
[root@localhost tmp]#yum install -y gcc
[root@localhost tmp]#yum install -y libxml2-devel.x86_64
[root@localhost tmp]#yum install -y net-snmp
[root@localhost tmp]#yum install -y net-snmp-devel.x86_64
[root@localhost tmp]#yum install -y curl-devel
[root@localhost tmp]#./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
[root@localhost tmp]# make install
---------------------------------------------------------------------------------
安装PHP、设定php.ini
--------------------------------------------------------------------
[root@localhost tmp]#yum install -y php.x86_64
[root@localhost tmp]#yum install -y php-cli.x86_64
[root@localhost tmp]#yum install -y php-common.x86_64
[root@localhost tmp]#yum install -y php-gd.x86_64
[root@localhost tmp]#yum install -y php-mysql.x86_64
[root@localhost tmp]#yum install -y php-pdo.x86_64
[root@localhost tmp]#yum install -y php-xml.x86_64
[root@localhost tmp]#rpm -ivh php-bcmath-5.4.16-21.el7.x86_64.rpm
[root@localhost tmp]#rpm -ivh php-mbstring-5.4.16-21.el7.x86_64.rpm
[root@localhost tmp]#vi /etc/php.ini
max_execution_time 300
memory_limit 128M
post_max_size 16M
upload_max_filesize 2M
max_input_time 300
date.timezone =Asia/Tokyo
:wq!
---------------------------------------------------------------------
复制PHP文件
-------------------------------------------------------
[root@localhost ~]# mkdir /var/www/html/zabbix
[root@localhost ~]# cd /tmp/zabbix-2.4.3/frontends/php
[root@localhost ~]# cp -a . /var/www/html/zabbix
-------------------------------------------------------
设定zabbix_server.conf
------------------------------------------------
[root@localhost ~]# cd /usr/local/etc
[root@localhost etc]# vi zabbix_server.conf
LogFile=/tmp/zabbix_server.log
LogFileSize=0
PidFile=/tmp/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
DBSocket=/var/lib/mysql/mysql.sock
:wq!
------------------------------------------------
命令确认:
-------------------------------------------------------------------------------------------
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| zabbix |
+--------------------+
2 rows in set (0.02 sec)
[root@localhost mysql]# ps -ef | grep mysql
mysql 1121 1 0 00:38 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql 1581 1121 0 00:38 ? 00:00:03 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root 3752 2326 0 01:23 pts/0 00:00:00 grep --color=auto mysql
[root@localhost mysql]#
[root@localhost mysql]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2027/master
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 2358/zabbix_server
tcp 0 0 0.0.0.0:58247 0.0.0.0:* LISTEN 1240/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1084/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 926/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2759/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 2027/master
tcp6 0 0 :::10051 :::* LISTEN 2358/zabbix_server
tcp6 0 0 :::46664 :::* LISTEN 1240/rpc.statd
tcp6 0 0 :::3306 :::* LISTEN 1581/mysqld
tcp6 0 0 :::111 :::* LISTEN 1084/rpcbind
tcp6 0 0 :::80 :::* LISTEN 852/httpd
tcp6 0 0 :::22 :::* LISTEN 926/sshd
tcp6 0 0 ::1:631 :::* LISTEN 2759/cupsd
[root@localhost mysql]#
-------------------------------------------------------------------------------------------
|
|