I. Chuẩn bị
1. Thiết lập quyền cho SELinux
2. Cài đặt và cấu hình Apache HTTP Server
3. Cài đặt và cấu hình PHP
4. Cài đặt MariaDB Database server
II. Cài đặt Zabbix 5.0 trên CentOS 7
III. Cấu hình Zabbix
IV. Thiết lập cài đặt ban đầu cho Zabbix
Tham khảo cách cài đặt CentOS trước khi xem bài lab này.
Thực hiện:
I. Chuẩn bị
- Máy đã cài CentOS 7
- Phần mềm SSH Secure Shell Client (trong Lab này chúng tôi dùng SecuriCRT) để SSH vào CentOS tiện cho việc copy & dán các dòng lệnh
Dùng SSH Secure Shell Client kết nối vào CentOS -> thiết lập quyền cho SELinux và khởi động CentOS
sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
reboot
- Cài đặt HTTP Server
[root@CentOS ~]# sudo yum -y install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.viethosting.com
* extras: mirrors.viethosting.com
* updates: mirrors.viethosting.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-93.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-93.el7.centos for package: httpd-2.4.6-93.el7.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-93.el7.centos.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-93.el7.centos will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================
Package Arch Version Repository Size
====================================================================================================================
Installing:
httpd x86_64 2.4.6-93.el7.centos base 2.7 M
Installing for dependencies:
httpd-tools x86_64 2.4.6-93.el7.centos base 92 k
mailcap noarch 2.1.41-2.el7 base 31 k
Transaction Summary
====================================================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 2.8 M
Installed size: 9.6 M
Downloading packages:
(1/3): httpd-tools-2.4.6-93.el7.centos.x86_64.rpm | 92 kB 00:00:00
(2/3): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00
(3/3): httpd-2.4.6-93.el7.centos.x86_64.rpm | 2.7 MB 00:00:00
--------------------------------------------------------------------------------------------------------------------
Total 4.4 MB/s | 2.8 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mailcap-2.1.41-2.el7.noarch 1/3
Installing : httpd-tools-2.4.6-93.el7.centos.x86_64 2/3
Installing : httpd-2.4.6-93.el7.centos.x86_64 3/3
Verifying : httpd-tools-2.4.6-93.el7.centos.x86_64 1/3
Verifying : mailcap-2.1.41-2.el7.noarch 2/3
Verifying : httpd-2.4.6-93.el7.centos.x86_64 3/3
Installed:
httpd.x86_64 0:2.4.6-93.el7.centos
Dependency Installed:
httpd-tools.x86_64 0:2.4.6-93.el7.centos mailcap.noarch 0:2.1.41-2.el7
Complete!
[root@CentOS ~]#
- Khởi động Http server và cài đặt tự động chạy khi khởi động
[root@CentOS ~]# sudo systemctl start httpd.service
[root@CentOS ~]# sudo systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@CentOS ~]#
- Kiểm trạng thái của Http đã hoạt động chưa
[root@CentOS ~]# sudo systemctl status httpd.service
â— httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2020-06-15 15:52:52 +07; 2min 6s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 11539 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─11539 /usr/sbin/httpd -DFOREGROUND
├─11541 /usr/sbin/httpd -DFOREGROUND
├─11542 /usr/sbin/httpd -DFOREGROUND
├─11543 /usr/sbin/httpd -DFOREGROUND
├─11544 /usr/sbin/httpd -DFOREGROUND
└─11545 /usr/sbin/httpd -DFOREGROUND
Jun 15 15:52:52 CentOS.ForZabbix.LAB systemd[1]: Starting The Apache HTTP Server...
Jun 15 15:52:52 CentOS.ForZabbix.LAB systemd[1]: Started The Apache HTTP Server.
Chúng ta thấy Service Http đang Active/running hoặc dùng lệnh netstat -plntu
[root@CentOS ~]# sudo netstat -plntu | grep http
tcp6 0 0 :::80 :::* LISTEN 11539/httpd
[root@CentOS ~]#
Port 80 đang sử dụng cho http service
- Đảm bảo firewall trên CentOS cho phép truy cập http và https dùng lệnh
sudo firewall-cmd --add-service={http,https} --permanent
sudo firewall-cmd --reload
[root@CentOS ~]# sudo firewall-cmd --add-service={http,https} --permanent
success
- Reload lại firewall trên CentOS
[root@CentOS ~]# sudo firewall-cmd --reload
success
Dùng máy trong LAN truy cập vào http://192.168.0.222 (máy đang cài) thấy kết quả Testing 123 là thành công.
3. Cài đặt và cấu hình PHP
- Các điều kiện cần thiết:
sudo yum -y install epel-release
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Kết quả thực hiện
[root@CentOS ~]# sudo yum -y install epel-release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.viethosting.com
* extras: mirrors.viethosting.com
* updates: mirrors.viethosting.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
epel-release noarch 7-11 extras 15 k
Transaction Summary
==================================================================================================================================
Install 1 Package
Total download size: 15 k
Installed size: 24 k
Downloading packages:
epel-release-7-11.noarch.rpm | 15 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-11.noarch 1/1
Verifying : epel-release-7-11.noarch 1/1
Installed:
epel-release.noarch 0:7-11
Complete!
[root@CentOS ~]#
[root@CentOS ~]# sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Loaded plugins: fastestmirror, langpacks
remi-release-7.rpm | 20 kB 00:00:00
Examining /var/tmp/yum-root-GnK5I4/remi-release-7.rpm: remi-release-7.7-2.el7.remi.noarch
Marking /var/tmp/yum-root-GnK5I4/remi-release-7.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package remi-release.noarch 0:7.7-2.el7.remi will be installed
--> Finished Dependency Resolution
epel/x86_64/metalink | 8.0 kB 00:00:00
epel/x86_64 | 5.3 kB 00:00:00
epel/x86_64/group_gz | 95 kB 00:00:05
epel/x86_64/updateinfo | 1.0 MB 00:00:01
epel/x86_64/primary_db | 6.8 MB 00:00:02
Dependencies Resolved
==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
remi-release noarch 7.7-2.el7.remi /remi-release-7 26 k
Transaction Summary
==================================================================================================================================
Install 1 Package
Total size: 26 k
Installed size: 26 k
Is this ok [y/d/N]: Y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : remi-release-7.7-2.el7.remi.noarch 1/1
Verifying : remi-release-7.7-2.el7.remi.noarch 1/1
Installed:
remi-release.noarch 0:7.7-2.el7.remi
Complete!
[root@CentOS ~]#
- Đảm bảo duy nhất PHP 7.2 được enable
[root@CentOS ~]# sudo yum-config-manager --disable remi-php54
Loaded plugins: fastestmirror, langpacks
======================================================== repo: remi-php54 ========================================================
[remi-php54]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl =
cache = 0
cachedir = /var/cache/yum/x86_64/7/remi-php54
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = False
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/remi-php54/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/remi-php54/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
hdrdir = /var/cache/yum/x86_64/7/remi-php54/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist = http://cdn.remirepo.net/enterprise/7/php54/mirror
mirrorlist_expire = 86400
name = Remi's PHP 5.4 RPM repository for Enterprise Linux 7 - x86_64
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/remi-php54
pkgdir = /var/cache/yum/x86_64/7/remi-php54/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = remi-php54
ui_repoid_vars = releasever,
basearch
username =
[root@CentOS ~]#
[root@CentOS ~]# sudo yum-config-manager --enable remi-php72
Loaded plugins: fastestmirror, langpacks
======================================================== repo: remi-php72 ========================================================
[remi-php72]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl =
cache = 0
cachedir = /var/cache/yum/x86_64/7/remi-php72
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/remi-php72/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/remi-php72/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
hdrdir = /var/cache/yum/x86_64/7/remi-php72/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist = http://cdn.remirepo.net/enterprise/7/php72/mirror
mirrorlist_expire = 86400
name = Remi's PHP 7.2 RPM repository for Enterprise Linux 7 - x86_64
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/remi-php72
pkgdir = /var/cache/yum/x86_64/7/remi-php72/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = remi-php72
ui_repoid_vars = releasever,
basearch
username =
[root@CentOS ~]#
- Cài PHP 7.2
[root@CentOS ~]# sudo yum install php php-pear php-cgi php-common php-mbstring php-snmp php-gd php-pecl-mysql php-xml php-mysql php-gettext php-bcmath
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.viethosting.com
* epel: mirrors.thzhost.com
* extras: mirrors.viethosting.com
* remi-php72: mirrors.thzhost.com
* remi-safe: mirrors.thzhost.com
* updates: mirrors.viethosting.com
remi-php72 | 3.0 kB 00:00:00
remi-safe | 3.0 kB 00:00:00
(1/2): remi-php72/primary_db | 238 kB 00:00:00
(2/2): remi-safe/primary_db | 1.7 MB 00:00:03
Package php-mysql is obsoleted by php-mysqlnd, trying to install php-mysqlnd-7.2.31-2.el7.remi.x86_64 instead
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:7.2.31-2.el7.remi will be installed
--> Processing Dependency: libargon2.so.0()(64bit) for package: php-7.2.31-2.el7.remi.x86_64
---> Package php-bcmath.x86_64 0:7.2.31-2.el7.remi will be installed
---> Package php-cli.x86_64 0:7.2.31-2.el7.remi will be installed
---> Package php-common.x86_64 0:7.2.31-2.el7.remi will be installed
--> Processing Dependency: php-json(x86-64) = 7.2.31-2.el7.remi for package: php-common-7.2.31-2.el7.remi.x86_64
---> Package php-gd.x86_64 0:7.2.31-2.el7.remi will be installed
--> Processing Dependency: gd-last(x86-64) >= 2.1.1 for package: php-gd-7.2.31-2.el7.remi.x86_64
--> Processing Dependency: libgd.so.3()(64bit) for package: php-gd-7.2.31-2.el7.remi.x86_64
---> Package php-mbstring.x86_64 0:7.2.31-2.el7.remi will be installed
--> Processing Dependency: libonig.so.105()(64bit) for package: php-mbstring-7.2.31-2.el7.remi.x86_64
---> Package php-mysqlnd.x86_64 0:7.2.31-2.el7.remi will be installed
--> Processing Dependency: php-pdo(x86-64) = 7.2.31-2.el7.remi for package: php-mysqlnd-7.2.31-2.el7.remi.x86_64
---> Package php-pear.noarch 1:1.10.12-1.el7.remi will be installed
--> Processing Dependency: php-composer(fedora/autoloader) for package: 1:php-pear-1.10.12-1.el7.remi.noarch
--> Processing Dependency: php-posix for package: 1:php-pear-1.10.12-1.el7.remi.noarch
---> Package php-pecl-mysql.x86_64 0:1.0.0-0.17.20160812git230a828.el7.remi.7.2 will be installed
---> Package php-snmp.x86_64 0:7.2.31-2.el7.remi will be installed
--> Processing Dependency: net-snmp for package: php-snmp-7.2.31-2.el7.remi.x86_64
---> Package php-xml.x86_64 0:7.2.31-2.el7.remi will be installed
--> Running transaction check
---> Package gd-last.x86_64 0:2.3.0-1.el7.remi will be installed
--> Processing Dependency: libraqm.so.0()(64bit) for package: gd-last-2.3.0-1.el7.remi.x86_64
--> Processing Dependency: libwebp.so.7()(64bit) for package: gd-last-2.3.0-1.el7.remi.x86_64
---> Package libargon2.x86_64 0:20161029-3.el7 will be installed
---> Package net-snmp.x86_64 1:5.7.2-48.el7_8 will be installed
--> Processing Dependency: net-snmp-libs = 1:5.7.2-48.el7_8 for package: 1:net-snmp-5.7.2-48.el7_8.x86_64
--> Processing Dependency: net-snmp-agent-libs = 1:5.7.2-48.el7_8 for package: 1:net-snmp-5.7.2-48.el7_8.x86_64
--> Processing Dependency: libnetsnmptrapd.so.31()(64bit) for package: 1:net-snmp-5.7.2-48.el7_8.x86_64
--> Processing Dependency: libnetsnmpmibs.so.31()(64bit) for package: 1:net-snmp-5.7.2-48.el7_8.x86_64
--> Processing Dependency: libnetsnmpagent.so.31()(64bit) for package: 1:net-snmp-5.7.2-48.el7_8.x86_64
---> Package oniguruma5php.x86_64 0:6.9.5+rev1-2.el7.remi will be installed
---> Package php-fedora-autoloader.noarch 0:1.0.1-2.el7 will be installed
---> Package php-json.x86_64 0:7.2.31-2.el7.remi will be installed
---> Package php-pdo.x86_64 0:7.2.31-2.el7.remi will be installed
---> Package php-process.x86_64 0:7.2.31-2.el7.remi will be installed
--> Running transaction check
---> Package libraqm.x86_64 0:0.7.0-4.el7 will be installed
---> Package libwebp7.x86_64 0:1.0.3-1.el7.remi will be installed
---> Package net-snmp-agent-libs.x86_64 1:5.7.2-48.el7_8 will be installed
---> Package net-snmp-libs.x86_64 1:5.7.2-37.el7 will be updated
---> Package net-snmp-libs.x86_64 1:5.7.2-48.el7_8 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
php x86_64 7.2.31-2.el7.remi remi-php72 3.2 M
php-bcmath x86_64 7.2.31-2.el7.remi remi-php72 74 k
php-cli x86_64 7.2.31-2.el7.remi remi-php72 4.8 M
php-common x86_64 7.2.31-2.el7.remi remi-php72 1.1 M
php-gd x86_64 7.2.31-2.el7.remi remi-php72 81 k
php-mbstring x86_64 7.2.31-2.el7.remi remi-php72 496 k
php-mysqlnd x86_64 7.2.31-2.el7.remi remi-php72 237 k
php-pear noarch 1:1.10.12-1.el7.remi remi-php72 362 k
php-pecl-mysql x86_64 1.0.0-0.17.20160812git230a828.el7.remi.7.2 remi-php72 38 k
php-snmp x86_64 7.2.31-2.el7.remi remi-php72 67 k
php-xml x86_64 7.2.31-2.el7.remi remi-php72 209 k
Installing for dependencies:
gd-last x86_64 2.3.0-1.el7.remi remi-safe 135 k
libargon2 x86_64 20161029-3.el7 epel 23 k
libraqm x86_64 0.7.0-4.el7 epel 15 k
libwebp7 x86_64 1.0.3-1.el7.remi remi-safe 266 k
net-snmp x86_64 1:5.7.2-48.el7_8 updates 332 k
net-snmp-agent-libs x86_64 1:5.7.2-48.el7_8 updates 707 k
oniguruma5php x86_64 6.9.5+rev1-2.el7.remi remi-safe 201 k
php-fedora-autoloader noarch 1.0.1-2.el7 epel 11 k
php-json x86_64 7.2.31-2.el7.remi remi-php72 67 k
php-pdo x86_64 7.2.31-2.el7.remi remi-php72 129 k
php-process x86_64 7.2.31-2.el7.remi remi-php72 84 k
Updating for dependencies:
net-snmp-libs x86_64 1:5.7.2-48.el7_8 updates 751 k
Transaction Summary
==================================================================================================================================
Install 11 Packages (+11 Dependent packages)
Upgrade ( 1 Dependent package)
Total size: 13 M
Total download size: 13 M
Is this ok [y/d/N]: Y
Downloading packages:
(1/22): net-snmp-5.7.2-48.el7_8.x86_64.rpm | 332 kB 00:00:00
(2/22): net-snmp-agent-libs-5.7.2-48.el7_8.x86_64.rpm | 707 kB 00:00:00
warning: /var/cache/yum/x86_64/7/epel/packages/libargon2-20161029-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for libargon2-20161029-3.el7.x86_64.rpm is not installed
(3/22): libargon2-20161029-3.el7.x86_64.rpm | 23 kB 00:00:00
(4/22): libraqm-0.7.0-4.el7.x86_64.rpm | 15 kB 00:00:00
warning: /var/cache/yum/x86_64/7/remi-safe/packages/libwebp7-1.0.3-1.el7.remi.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Public key for libwebp7-1.0.3-1.el7.remi.x86_64.rpm is not installed
(5/22): libwebp7-1.0.3-1.el7.remi.x86_64.rpm | 266 kB 00:00:00
Public key for php-bcmath-7.2.31-2.el7.remi.x86_64.rpm is not installed ] 807 kB/s | 1.4 MB 00:00:14 ETA
(6/22): php-bcmath-7.2.31-2.el7.remi.x86_64.rpm | 74 kB 00:00:00
(7/22): gd-last-2.3.0-1.el7.remi.x86_64.rpm | 135 kB 00:00:01
(8/22): php-fedora-autoloader-1.0.1-2.el7.noarch.rpm | 11 kB 00:00:00
(9/22): php-common-7.2.31-2.el7.remi.x86_64.rpm | 1.1 MB 00:00:00
(10/22): php-json-7.2.31-2.el7.remi.x86_64.rpm | 67 kB 00:00:00
(11/22): php-7.2.31-2.el7.remi.x86_64.rpm | 3.2 MB 00:00:01
(12/22): php-mysqlnd-7.2.31-2.el7.remi.x86_64.rpm | 237 kB 00:00:00
(13/22): php-pdo-7.2.31-2.el7.remi.x86_64.rpm | 129 kB 00:00:00
(14/22): php-gd-7.2.31-2.el7.remi.x86_64.rpm | 81 kB 00:00:00
(15/22): php-pear-1.10.12-1.el7.remi.noarch.rpm | 362 kB 00:00:00
(16/22): php-process-7.2.31-2.el7.remi.x86_64.rpm | 84 kB 00:00:00
(17/22): php-mbstring-7.2.31-2.el7.remi.x86_64.rpm | 496 kB 00:00:00
(18/22): php-snmp-7.2.31-2.el7.remi.x86_64.rpm | 67 kB 00:00:00
(19/22): php-pecl-mysql-1.0.0-0.17.20160812git230a828.el7.remi.7.2.x86_64.rpm | 38 kB 00:00:00
(20/22): php-xml-7.2.31-2.el7.remi.x86_64.rpm | 209 kB 00:00:00
oniguruma5php-6.9.5+rev1-2.el7 FAILED
https://mirror.sjc02.svwh.net/remi/enterprise/7/safe/x86_64/oniguruma5php-6.9.5%2Brev1-2.el7.remi.x86_64.rpm: [Errno 12] Timeout on https://mirror.sjc02.svwh.net/remi/enterprise/7/safe/x86_64/oniguruma5php-6.9.5+rev1-2.el7.remi.x86_64.rpm: (28, 'Operation timed out after 30010 milliseconds with 0 out of 0 bytes received')
Trying other mirror.
(21/22): oniguruma5php-6.9.5+rev1-2.el7.remi.x86_64.rpm | 201 kB 00:00:00
php-cli-7.2.31-2.el7.remi.x86_ FAILED
https://mirror.sjc02.svwh.net/remi/enterprise/7/php72/x86_64/php-cli-7.2.31-2.el7.remi.x86_64.rpm: [Errno 12] Timeout on https://mirror.sjc02.svwh.net/remi/enterprise/7/php72/x86_64/php-cli-7.2.31-2.el7.remi.x86_64.rpm: (28, 'Operation timed out after 30003 milliseconds with 0 out of 0 bytes received')
Trying other mirror.
(22/22): php-cli-7.2.31-2.el7.remi.x86_64.rpm | 4.8 MB 00:00:01
----------------------------------------------------------------------------------------------------------------------------------
Total 393 kB/s | 13 MB 00:00:32
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Importing GPG key 0x00F97F56:
Userid : "Remi Collet <RPMS@FamilleCollet.com>"
Fingerprint: 1ee0 4cce 88a4 ae4a a29a 5df5 004e 6f47 00f9 7f56
Package : remi-release-7.7-2.el7.remi.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Is this ok [y/N]: Y
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
Userid : "Fedora EPEL (7) <epel@fedoraproject.org>"
Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
Package : epel-release-7-11.noarch (@extras)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: Y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 1:net-snmp-libs-5.7.2-48.el7_8.x86_64 1/24
Installing : libargon2-20161029-3.el7.x86_64 2/24
Installing : 1:net-snmp-agent-libs-5.7.2-48.el7_8.x86_64 3/24
Installing : 1:net-snmp-5.7.2-48.el7_8.x86_64 4/24
Installing : php-common-7.2.31-2.el7.remi.x86_64 5/24
Installing : php-json-7.2.31-2.el7.remi.x86_64 6/24
Installing : php-cli-7.2.31-2.el7.remi.x86_64 7/24
Installing : php-fedora-autoloader-1.0.1-2.el7.noarch 8/24
Installing : php-process-7.2.31-2.el7.remi.x86_64 9/24
Installing : php-xml-7.2.31-2.el7.remi.x86_64 10/24
Installing : php-pdo-7.2.31-2.el7.remi.x86_64 11/24
Installing : php-mysqlnd-7.2.31-2.el7.remi.x86_64 12/24
Installing : libwebp7-1.0.3-1.el7.remi.x86_64 13/24
Installing : oniguruma5php-6.9.5+rev1-2.el7.remi.x86_64 14/24
Installing : libraqm-0.7.0-4.el7.x86_64 15/24
Installing : gd-last-2.3.0-1.el7.remi.x86_64 16/24
Installing : php-gd-7.2.31-2.el7.remi.x86_64 17/24
Installing : php-mbstring-7.2.31-2.el7.remi.x86_64 18/24
Installing : php-pecl-mysql-1.0.0-0.17.20160812git230a828.el7.remi.7.2.x86_64 19/24
Installing : 1:php-pear-1.10.12-1.el7.remi.noarch 20/24
Installing : php-7.2.31-2.el7.remi.x86_64 21/24
Installing : php-bcmath-7.2.31-2.el7.remi.x86_64 22/24
Installing : php-snmp-7.2.31-2.el7.remi.x86_64 23/24
Cleanup : 1:net-snmp-libs-5.7.2-37.el7.x86_64 24/24
Verifying : 1:php-pear-1.10.12-1.el7.remi.noarch 1/24
Verifying : php-bcmath-7.2.31-2.el7.remi.x86_64 2/24
Verifying : php-mbstring-7.2.31-2.el7.remi.x86_64 3/24
Verifying : 1:net-snmp-5.7.2-48.el7_8.x86_64 4/24
Verifying : libargon2-20161029-3.el7.x86_64 5/24
Verifying : php-mysqlnd-7.2.31-2.el7.remi.x86_64 6/24
Verifying : php-json-7.2.31-2.el7.remi.x86_64 7/24
Verifying : php-fedora-autoloader-1.0.1-2.el7.noarch 8/24
Verifying : php-process-7.2.31-2.el7.remi.x86_64 9/24
Verifying : php-cli-7.2.31-2.el7.remi.x86_64 10/24
Verifying : 1:net-snmp-libs-5.7.2-48.el7_8.x86_64 11/24
Verifying : php-7.2.31-2.el7.remi.x86_64 12/24
Verifying : libraqm-0.7.0-4.el7.x86_64 13/24
Verifying : gd-last-2.3.0-1.el7.remi.x86_64 14/24
Verifying : php-xml-7.2.31-2.el7.remi.x86_64 15/24
Verifying : php-gd-7.2.31-2.el7.remi.x86_64 16/24
Verifying : php-pecl-mysql-1.0.0-0.17.20160812git230a828.el7.remi.7.2.x86_64 17/24
Verifying : php-snmp-7.2.31-2.el7.remi.x86_64 18/24
Verifying : oniguruma5php-6.9.5+rev1-2.el7.remi.x86_64 19/24
Verifying : 1:net-snmp-agent-libs-5.7.2-48.el7_8.x86_64 20/24
Verifying : libwebp7-1.0.3-1.el7.remi.x86_64 21/24
Verifying : php-pdo-7.2.31-2.el7.remi.x86_64 22/24
Verifying : php-common-7.2.31-2.el7.remi.x86_64 23/24
Verifying : 1:net-snmp-libs-5.7.2-37.el7.x86_64 24/24
Installed:
php.x86_64 0:7.2.31-2.el7.remi php-bcmath.x86_64 0:7.2.31-2.el7.remi
php-cli.x86_64 0:7.2.31-2.el7.remi php-common.x86_64 0:7.2.31-2.el7.remi
php-gd.x86_64 0:7.2.31-2.el7.remi php-mbstring.x86_64 0:7.2.31-2.el7.remi
php-mysqlnd.x86_64 0:7.2.31-2.el7.remi php-pear.noarch 1:1.10.12-1.el7.remi
php-pecl-mysql.x86_64 0:1.0.0-0.17.20160812git230a828.el7.remi.7.2 php-snmp.x86_64 0:7.2.31-2.el7.remi
php-xml.x86_64 0:7.2.31-2.el7.remi
Dependency Installed:
gd-last.x86_64 0:2.3.0-1.el7.remi libargon2.x86_64 0:20161029-3.el7
libraqm.x86_64 0:0.7.0-4.el7 libwebp7.x86_64 0:1.0.3-1.el7.remi
net-snmp.x86_64 1:5.7.2-48.el7_8 net-snmp-agent-libs.x86_64 1:5.7.2-48.el7_8
oniguruma5php.x86_64 0:6.9.5+rev1-2.el7.remi php-fedora-autoloader.noarch 0:1.0.1-2.el7
php-json.x86_64 0:7.2.31-2.el7.remi php-pdo.x86_64 0:7.2.31-2.el7.remi
php-process.x86_64 0:7.2.31-2.el7.remi
Dependency Updated:
net-snmp-libs.x86_64 1:5.7.2-48.el7_8
Complete!
[root@CentOS ~]#
- Điều chỉnh múi giờ trong file /etc/php.ini cho phù hợp, trong lab này chúng tôi chọn là date.timezone = Asia/Ho_CHi_Minh
Noted:
khi thực hiện lệnh vim để sửa file, khi file php.ini mở lên chúng ta nhấn phím
/ hoặc ? và gõ tiếp từ cần tìm (ở đây chúng tôi gõ timezone) ->
enter -> nhấn chữ "i" để cho phép sửa file -> thay đổi là date.timezone = Asia/Ho_CHi_Minh. Đảm bảo KHÔNG CÓ dấu chấm phẩy ";" phía trước -> nhấn phím Esc + dấu
2 chấm ":" + w + q để lưu sự thay đổi và thoát khỏi chương trình soạn thảo
vim. Các bạn để ý sẽ thấy chữ written ở cuối có nghĩa là đã sửa và lưu file thành công.
[root@CentOS ~]# sudo vim /etc/php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
; 1. SAPI module specific location.
; 2. The PHPRC environment variable. (As of PHP 5.2.0)
; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0)
; 4. Current working directory (except CLI)
; 5. The web server's directory (for SAPI modules), or directory of PHP
; (otherwise in Windows)
; 6. The directory from the --with-config-file-path compile time option, or the
; Windows directory (C:\windows or C:\winnt)
; See the PHP docs for more specific information.
; http://php.net/configuration.file
; The syntax of the file is extremely simple. Whitespace and lines
; beginning with a semicolon are silently ignored (as you probably guessed).
; Section headers (e.g. [Foo]) are also silently ignored, even though
; they might mean something in the future.
; Directives following the section heading [PATH=/www/mysite] only
; apply to PHP files in the /www/mysite directory. Directives
; following the section heading [HOST=www.example.com] only apply to
; PHP files served from www.example.com. Directives set in these
; special sections cannot be overridden by user-defined INI files or
; at runtime. Currently, [PATH=] and [HOST=] sections only work under
; CGI/FastCGI.
; http://php.net/ini.sections
; Directives are specified using the following syntax:
; directive = value
; Directive names are *case sensitive* - foo=bar is different from FOO=bar.
; Directives are variables used to configure PHP or PHP extensions.
; There is no name validation. If PHP can't find an expected
; directive because it is not set or is mistyped, a default value will be used.
; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one
; of the INI constants (On, Off, True, False, Yes, No and None) or an expression
; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a
; previously set variable or directive (e.g. ${foo})
/timezone
; directory, You may specify an absolute path to the library file:
;
; extension=/path/to/extension/mysqli.so
;
; Note : The syntax used in previous PHP versions ('extension=<ext>.so' and
; 'extension='php_<ext>.dll') is supported for legacy reasons and may be
; deprecated in a future PHP major version. So, when it is possible, please
; move to the new ('extension=<ext>) syntax.
;;;;
; Note: packaged extension modules are now loaded via the .ini files
; found in the directory /etc/php.d; these are loaded by default.
;;;;
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
[CLI Server]
; Whether the CLI web server uses ANSI color coding in its terminal output.
cli_server.color = On
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Ho_CHi_Minh
; http://php.net/date.default-latitude
;date.default_latitude = 31.7667
; http://php.net/date.default-longitude
;date.default_longitude = 35.2333
; http://php.net/date.sunrise-zenith
;date.sunrise_zenith = 90.583333
; http://php.net/date.sunset-zenith
;date.sunset_zenith = 90.583333
[filter]
; http://php.net/filter.default
;filter.default = unsafe_raw
; http://php.net/filter.default-flags
;filter.default_flags =
[iconv]
"/etc/php.ini" 1693L, 63220C written
[root@CentOS ~]#
- Kiểm tra và đảm bảo http đang chạy
[root@CentOS ~]# sudo systemctl restart httpd
[root@CentOS ~]# sudo netstat -plntu | grep http
tcp6 0 0 :::80 :::* LISTEN 23281/httpd
[root@CentOS ~]#
4. Cài đặt MariaDB Database server
Cài MariaDB Database, khởi động MariaDB và đặt MariaDB tự động chạy khi khởi động bằng các lệnh:
sudo yum --enablerepo=remi install mariadb-server
sudo systemctl start mariadb.service
sudo systemctl enable mariadb
- Cài MariaDB Database
[root@CentOS ~]# sudo yum --enablerepo=remi install mariadb-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.viethosting.com
* epel: mirrors.thzhost.com
* extras: mirrors.viethosting.com
* remi: mirrors.thzhost.com
* remi-php72: mirrors.thzhost.com
* remi-safe: mirrors.thzhost.com
* updates: mirrors.viethosting.com
remi | 3.0 kB 00:00:00
remi-php72 | 3.0 kB 00:00:00
remi/primary_db | 2.7 MB 00:00:02
Resolving Dependencies
--> Running transaction check
---> Package mariadb-server.x86_64 1:5.5.65-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.65-1.el7 for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: mariadb(x86-64) = 1:5.5.65-1.el7 for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.65-1.el7 will be installed
---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be updated
---> Package mariadb-libs.x86_64 1:5.5.65-1.el7 will be an update
---> Package perl-DBD-MySQL.x86_64 0:4.023-6.el7 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
--> Running transaction check
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
mariadb-server x86_64 1:5.5.65-1.el7 base 11 M
Installing for dependencies:
mariadb x86_64 1:5.5.65-1.el7 base 8.7 M
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBD-MySQL x86_64 4.023-6.el7 base 140 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k
Updating for dependencies:
mariadb-libs x86_64 1:5.5.65-1.el7 base 759 k
Transaction Summary
==================================================================================================================================
Install 1 Package (+8 Dependent packages)
Upgrade ( 1 Dependent package)
Total size: 22 M
Total download size: 21 M
Is this ok [y/d/N]: Y
Downloading packages:
(1/9): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00
(2/9): mariadb-5.5.65-1.el7.x86_64.rpm | 8.7 MB 00:00:04
(3/9): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00
(4/9): perl-DBD-MySQL-4.023-6.el7.x86_64.rpm | 140 kB 00:00:00
(5/9): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00
(6/9): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00
(7/9): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00
(8/9): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00
(9/9): mariadb-server-5.5.65-1.el7.x86_64.rpm | 11 MB 00:00:05
----------------------------------------------------------------------------------------------------------------------------------
Total 3.8 MB/s | 21 MB 00:00:05
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 1:mariadb-libs-5.5.65-1.el7.x86_64 1/11
Installing : 1:mariadb-5.5.65-1.el7.x86_64 2/11
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 3/11
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 4/11
Installing : perl-IO-Compress-2.061-2.el7.noarch 5/11
Installing : perl-Net-Daemon-0.48-5.el7.noarch 6/11
Installing : perl-PlRPC-0.2020-14.el7.noarch 7/11
Installing : perl-DBI-1.627-4.el7.x86_64 8/11
Installing : perl-DBD-MySQL-4.023-6.el7.x86_64 9/11
Installing : 1:mariadb-server-5.5.65-1.el7.x86_64 10/11
Cleanup : 1:mariadb-libs-5.5.60-1.el7_5.x86_64 11/11
Verifying : 1:mariadb-server-5.5.65-1.el7.x86_64 1/11
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 2/11
Verifying : perl-DBD-MySQL-4.023-6.el7.x86_64 3/11
Verifying : 1:mariadb-libs-5.5.65-1.el7.x86_64 4/11
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 5/11
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 6/11
Verifying : perl-DBI-1.627-4.el7.x86_64 7/11
Verifying : perl-IO-Compress-2.061-2.el7.noarch 8/11
Verifying : perl-PlRPC-0.2020-14.el7.noarch 9/11
Verifying : 1:mariadb-5.5.65-1.el7.x86_64 10/11
Verifying : 1:mariadb-libs-5.5.60-1.el7_5.x86_64 11/11
Installed:
mariadb-server.x86_64 1:5.5.65-1.el7
Dependency Installed:
mariadb.x86_64 1:5.5.65-1.el7 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBD-MySQL.x86_64 0:4.023-6.el7 perl-DBI.x86_64 0:1.627-4.el7 perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7
Dependency Updated:
mariadb-libs.x86_64 1:5.5.65-1.el7
Complete!
[root@CentOS ~]#
- Khởi động MariaDB và đặt MariaDB tự động chạy khi khởi động
[root@CentOS ~]# sudo systemctl start mariadb.service
[root@CentOS ~]# sudo systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@CentOS ~]#
- Thiết lập password cho user root
[root@CentOS ~]# 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): (nhấn enter, vì ban đầu user root không có password)
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
New password: (nhập mới cần đặt cho user root, chúng tôi nhập là: P@ssw0rd)
Re-enter new password: (xác nhận lại password là: P@ssw0rd)
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
... 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
... 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] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] 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@CentOS ~]#
- Đăng nhập vào MariaDB với user root và password là: P@ssw0rd vừa tạo
[root@CentOS ~]# mysql -u root -p
Enter password: (<-- nhập P@ssw0rd)
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
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)]> SELECT VERSION(); (<-- kiểm tra version hiện tại của Database)
+----------------+
| VERSION() |
+----------------+
| 5.5.65-MariaDB |
+----------------+
1 row in set (0.00 sec)
MariaDB [(none)]>
Đã kết nối đến Database thành công!
- Tạo Database cho Zabbix
- Tạo mới database có tên là: zabbix_DB
- Tạo mới user có tên là: zabbix_User và password: P@ssw0rd
- Cho phép user zabbix_User được phép thực thi trên tất cả database bắt đầu là zabbix_DB
create database zabbix_DB character set utf8 collate utf8_bin;
create user 'zabbix_User'@'localhost' identified BY 'P@ssw0rd';
grant all privileges on zabbix_DB.* to 'zabbix_User'@'localhost';
flush privileges;
quit;
Hoặc
create database zabbix_DB character set utf8 collate utf8_bin;
grant all privileges on zabbix_DB.* to zabbix_User@localhost identified by 'P@ssw0rd';
flush privileges;
quit;
MariaDB [(none)]> create database zabbix_DB character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix_DB.* to zabbix_User@localhost identified by 'P@ssw0rd';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
- Kiểm tra database đang tồn tại
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| zabbix_DB |
+--------------------+
4 rows in set (0.00 sec)
- Kiểm tra user đang tồn tại
MariaDB [(none)]> select user, password, host from mysql.user;
+------------------+-------------------------------------------------------------------------+-----------+
| user | password | host |
+------------------+-------------------------------------------------------------------------+-----------+
| root | *8232A1298A49F710DBEE0B330C42EEC825D4190A | localhost |
| root | *8232A1298A49F710DBEE0B330C42EEC825D4190A | 127.0.0.1 |
| root | *8232A1298A49F710DBEE0B330C42EEC825D4190A | ::1 |
| zabbix_User | *8232A1298A49F710DBEE0B330C42EEC825D4190A | localhost |
+-------------+-------------------------------------------------------------------------+-----------+
4 rows in set (0.00 sec)
MariaDB [(none)]>
- Kiểm tra quyền đã thiết lập cho user zabbix_User
MariaDB [(none)]> show grants for 'zabbix_User'@'localhost';
+--------------------------------------------------------------------------------------------------------------------+
| Grants for zabbix_User@localhost |
+--------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'zabbix_User'@'localhost' IDENTIFIED BY PASSWORD '*8232A1298A49F710DBEE0B330C42EEC825D4190A' |
| GRANT ALL PRIVILEGES ON `zabbix_DB`.* TO 'zabbix_User'@'localhost' |
+--------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
MariaDB [(none)]> quit;
Bye
II. Cài đặt Zabbix 5.0 trên CentOS 7
- Cài đặt Zabbix
[root@CentOS ~]# sudo yum install -y https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
Loaded plugins: fastestmirror, langpacks
zabbix-release-5.0-1.el7.noarch.rpm | 14 kB 00:00:00
Examining /var/tmp/yum-root-GnK5I4/zabbix-release-5.0-1.el7.noarch.rpm: zabbix-release-5.0-1.el7.noarch
Marking /var/tmp/yum-root-GnK5I4/zabbix-release-5.0-1.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package zabbix-release.noarch 0:5.0-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
zabbix-release noarch 5.0-1.el7 /zabbix-release-5.0-1.el7.noarch 22 k
Transaction Summary
==================================================================================================================================
Install 1 Package
Total size: 22 k
Installed size: 22 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : zabbix-release-5.0-1.el7.noarch 1/1
Verifying : zabbix-release-5.0-1.el7.noarch 1/1
Installed:
zabbix-release.noarch 0:5.0-1.el7
Complete!
[root@CentOS ~]#
[root@CentOS ~]# sudo yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.viethosting.com
* epel: mirrors.thzhost.com
* extras: mirrors.viethosting.com
* remi-php72: mirrors.thzhost.com
* remi-safe: mirrors.thzhost.com
* updates: mirrors.viethosting.com
zabbix | 2.9 kB 00:00:00
zabbix-non-supported | 951 B 00:00:00
zabbix/x86_64/primary_db | 19 kB 00:00:00
zabbix-non-supported/x86_64/primary | 1.6 kB 00:00:00
zabbix-non-supported 4/4
No package zabbix-web-mysql available.
Resolving Dependencies
--> Running transaction check
---> Package zabbix-agent.x86_64 0:5.0.1-1.el7 will be installed
---> Package zabbix-get.x86_64 0:5.0.1-1.el7 will be installed
---> Package zabbix-server-mysql.x86_64 0:5.0.1-1.el7 will be installed
--> Processing Dependency: fping for package: zabbix-server-mysql-5.0.1-1.el7.x86_64
--> Processing Dependency: libOpenIPMIposix.so.0()(64bit) for package: zabbix-server-mysql-5.0.1-1.el7.x86_64
--> Processing Dependency: libOpenIPMI.so.0()(64bit) for package: zabbix-server-mysql-5.0.1-1.el7.x86_64
--> Processing Dependency: libodbc.so.2()(64bit) for package: zabbix-server-mysql-5.0.1-1.el7.x86_64
--> Running transaction check
---> Package OpenIPMI-libs.x86_64 0:2.0.27-1.el7 will be installed
--> Processing Dependency: OpenIPMI-modalias = 2.0.27-1.el7 for package: OpenIPMI-libs-2.0.27-1.el7.x86_64
---> Package fping.x86_64 0:3.10-4.el7 will be installed
---> Package unixODBC.x86_64 0:2.3.1-14.el7 will be installed
--> Running transaction check
---> Package OpenIPMI-modalias.x86_64 0:2.0.27-1.el7 will be installed
--> Processing Dependency: OpenIPMI for package: OpenIPMI-modalias-2.0.27-1.el7.x86_64
--> Running transaction check
---> Package OpenIPMI.x86_64 0:2.0.27-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
zabbix-agent x86_64 5.0.1-1.el7 zabbix 442 k
zabbix-get x86_64 5.0.1-1.el7 zabbix 310 k
zabbix-server-mysql x86_64 5.0.1-1.el7 zabbix 2.6 M
Installing for dependencies:
OpenIPMI x86_64 2.0.27-1.el7 base 243 k
OpenIPMI-libs x86_64 2.0.27-1.el7 base 523 k
OpenIPMI-modalias x86_64 2.0.27-1.el7 base 16 k
fping x86_64 3.10-4.el7 epel 46 k
unixODBC x86_64 2.3.1-14.el7 base 413 k
Transaction Summary
==================================================================================================================================
Install 3 Packages (+5 Dependent packages)
Total download size: 4.5 M
Installed size: 13 M
Is this ok [y/d/N]: Y
Downloading packages:
(1/8): OpenIPMI-modalias-2.0.27-1.el7.x86_64.rpm | 16 kB 00:00:00
(2/8): unixODBC-2.3.1-14.el7.x86_64.rpm | 413 kB 00:00:00
(3/8): OpenIPMI-2.0.27-1.el7.x86_64.rpm | 243 kB 00:00:00
(4/8): fping-3.10-4.el7.x86_64.rpm | 46 kB 00:00:00
(5/8): OpenIPMI-libs-2.0.27-1.el7.x86_64.rpm | 523 kB 00:00:01
warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-get-5.0.1-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Public key for zabbix-get-5.0.1-1.el7.x86_64.rpm is not installed
(6/8): zabbix-get-5.0.1-1.el7.x86_64.rpm | 310 kB 00:00:02
(7/8): zabbix-agent-5.0.1-1.el7.x86_64.rpm | 442 kB 00:00:06
(8/8): zabbix-server-mysql-5.0.1-1.el7.x86_64.rpm | 2.6 MB 00:00:06
----------------------------------------------------------------------------------------------------------------------------------
Total 496 kB/s | 4.5 MB 00:00:09
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Importing GPG key 0xA14FE591:
Userid : "Zabbix LLC <packager@zabbix.com>"
Fingerprint: a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591
Package : zabbix-release-5.0-1.el7.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Is this ok [y/N]: Y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : OpenIPMI-libs-2.0.27-1.el7.x86_64 1/8
Installing : OpenIPMI-2.0.27-1.el7.x86_64 2/8
Installing : OpenIPMI-modalias-2.0.27-1.el7.x86_64 3/8
Installing : fping-3.10-4.el7.x86_64 4/8
Installing : unixODBC-2.3.1-14.el7.x86_64 5/8
Installing : zabbix-server-mysql-5.0.1-1.el7.x86_64 6/8
Installing : zabbix-agent-5.0.1-1.el7.x86_64 7/8
Installing : zabbix-get-5.0.1-1.el7.x86_64 8/8
WARNING: ipmi_devintf module isn't available.
WARNING: ipmi_msghandler module isn't available.
Verifying : zabbix-server-mysql-5.0.1-1.el7.x86_64 1/8
Verifying : zabbix-get-5.0.1-1.el7.x86_64 2/8
Verifying : OpenIPMI-2.0.27-1.el7.x86_64 3/8
Verifying : unixODBC-2.3.1-14.el7.x86_64 4/8
Verifying : OpenIPMI-libs-2.0.27-1.el7.x86_64 5/8
Verifying : fping-3.10-4.el7.x86_64 6/8
Verifying : zabbix-agent-5.0.1-1.el7.x86_64 7/8
Verifying : OpenIPMI-modalias-2.0.27-1.el7.x86_64 8/8
Installed:
zabbix-agent.x86_64 0:5.0.1-1.el7 zabbix-get.x86_64 0:5.0.1-1.el7 zabbix-server-mysql.x86_64 0:5.0.1-1.el7
Dependency Installed:
OpenIPMI.x86_64 0:2.0.27-1.el7 OpenIPMI-libs.x86_64 0:2.0.27-1.el7 OpenIPMI-modalias.x86_64 0:2.0.27-1.el7
fping.x86_64 0:3.10-4.el7 unixODBC.x86_64 0:2.3.1-14.el7
Complete!
[root@CentOS ~]#
- Cài đặt zabbix-frontend
[root@CentOS ~]# sudo yum-config-manager --enable zabbix-frontend
Loaded plugins: fastestmirror, langpacks
===================================================== repo: zabbix-frontend ======================================================
[zabbix-frontend]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl = http://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/frontend
cache = 0
cachedir = /var/cache/yum/x86_64/7/zabbix-frontend
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/zabbix-frontend/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/zabbix-frontend/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
hdrdir = /var/cache/yum/x86_64/7/zabbix-frontend/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist =
mirrorlist_expire = 86400
name = Zabbix Official Repository frontend - x86_64
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/zabbix-frontend
pkgdir = /var/cache/yum/x86_64/7/zabbix-frontend/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = zabbix-frontend/x86_64
ui_repoid_vars = releasever,
basearch
username =
[root@CentOS ~]#
[root@CentOS ~]# sudo yum -y install centos-release-scl
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.viethosting.com
* epel: mirrors.thzhost.com
* extras: mirrors.viethosting.com
* remi-php72: mirrors.thzhost.com
* remi-safe: mirrors.thzhost.com
* updates: mirrors.viethosting.com
zabbix | 2.9 kB 00:00:00
zabbix-frontend | 2.9 kB 00:00:00
zabbix-non-supported | 951 B 00:00:00
zabbix-frontend/x86_64/primary_db | 5.4 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package centos-release-scl.noarch 0:2-3.el7.centos will be installed
--> Processing Dependency: centos-release-scl-rh for package: centos-release-scl-2-3.el7.centos.noarch
--> Running transaction check
---> Package centos-release-scl-rh.noarch 0:2-3.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
centos-release-scl noarch 2-3.el7.centos extras 12 k
Installing for dependencies:
centos-release-scl-rh noarch 2-3.el7.centos extras 12 k
Transaction Summary
==================================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 24 k
Installed size: 39 k
Downloading packages:
(1/2): centos-release-scl-2-3.el7.centos.noarch.rpm | 12 kB 00:00:00
(2/2): centos-release-scl-rh-2-3.el7.centos.noarch.rpm | 12 kB 00:00:00
----------------------------------------------------------------------------------------------------------------------------------
Total 48 kB/s | 24 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : centos-release-scl-rh-2-3.el7.centos.noarch 1/2
Installing : centos-release-scl-2-3.el7.centos.noarch 2/2
Verifying : centos-release-scl-2-3.el7.centos.noarch 1/2
Verifying : centos-release-scl-rh-2-3.el7.centos.noarch 2/2
Installed:
centos-release-scl.noarch 0:2-3.el7.centos
Dependency Installed:
centos-release-scl-rh.noarch 0:2-3.el7.centos
Complete!
[root@CentOS ~]#
[root@CentOS ~]# sudo yum -y install zabbix-web-mysql-scl zabbix-apache-conf-scl
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.viethosting.com
* centos-sclo-rh: mirrors.viethosting.com
* centos-sclo-sclo: mirrors.viethosting.com
* epel: hkg.mirror.rackspace.com
* extras: mirrors.viethosting.com
* remi-php72: mirror.innosol.asia
* remi-safe: mirror.innosol.asia
* updates: mirrors.viethosting.com
centos-sclo-rh | 3.0 kB 00:00:00
centos-sclo-sclo | 3.0 kB 00:00:00
(1/2): centos-sclo-sclo/x86_64/primary_db | 289 kB 00:00:00
(2/2): centos-sclo-rh/x86_64/primary_db | 2.6 MB 00:00:01
Resolving Dependencies
--> Running transaction check
---> Package zabbix-apache-conf-scl.noarch 0:5.0.1-1.el7 will be installed
---> Package zabbix-web-mysql-scl.noarch 0:5.0.1-1.el7 will be installed
--> Processing Dependency: zabbix-web-deps-scl for package: zabbix-web-mysql-scl-5.0.1-1.el7.noarch
--> Processing Dependency: zabbix-web for package: zabbix-web-mysql-scl-5.0.1-1.el7.noarch
--> Processing Dependency: rh-php72-php-mysqlnd for package: zabbix-web-mysql-scl-5.0.1-1.el7.noarch
--> Running transaction check
---> Package rh-php72-php-mysqlnd.x86_64 0:7.2.24-1.el7 will be installed
--> Processing Dependency: rh-php72-php-pdo(x86-64) = 7.2.24-1.el7 for package: rh-php72-php-mysqlnd-7.2.24-1.el7.x86_64
---> Package zabbix-web.noarch 0:5.0.1-1.el7 will be installed
---> Package zabbix-web-deps-scl.noarch 0:5.0.1-1.el7 will be installed
--> Processing Dependency: rh-php72-php-mbstring for package: zabbix-web-deps-scl-5.0.1-1.el7.noarch
--> Processing Dependency: rh-php72-php-xml for package: zabbix-web-deps-scl-5.0.1-1.el7.noarch
--> Processing Dependency: rh-php72-php-bcmath for package: zabbix-web-deps-scl-5.0.1-1.el7.noarch
--> Processing Dependency: rh-php72-php-ldap for package: zabbix-web-deps-scl-5.0.1-1.el7.noarch
--> Processing Dependency: rh-php72-php-fpm for package: zabbix-web-deps-scl-5.0.1-1.el7.noarch
--> Processing Dependency: rh-php72 for package: zabbix-web-deps-scl-5.0.1-1.el7.noarch
--> Processing Dependency: rh-php72-php-gd for package: zabbix-web-deps-scl-5.0.1-1.el7.noarch
--> Running transaction check
---> Package rh-php72.x86_64 0:1-2.el7 will be installed
--> Processing Dependency: rh-php72-runtime(x86-64) = 1-2.el7 for package: rh-php72-1-2.el7.x86_64
--> Processing Dependency: rh-php72-runtime for package: rh-php72-1-2.el7.x86_64
--> Processing Dependency: rh-php72-php-common(x86-64) for package: rh-php72-1-2.el7.x86_64
--> Processing Dependency: rh-php72-php-cli(x86-64) for package: rh-php72-1-2.el7.x86_64
--> Processing Dependency: rh-php72-php-pear for package: rh-php72-1-2.el7.x86_64
---> Package rh-php72-php-bcmath.x86_64 0:7.2.24-1.el7 will be installed
---> Package rh-php72-php-fpm.x86_64 0:7.2.24-1.el7 will be installed
---> Package rh-php72-php-gd.x86_64 0:7.2.24-1.el7 will be installed
---> Package rh-php72-php-ldap.x86_64 0:7.2.24-1.el7 will be installed
---> Package rh-php72-php-mbstring.x86_64 0:7.2.24-1.el7 will be installed
---> Package rh-php72-php-pdo.x86_64 0:7.2.24-1.el7 will be installed
---> Package rh-php72-php-xml.x86_64 0:7.2.24-1.el7 will be installed
--> Running transaction check
---> Package rh-php72-php-cli.x86_64 0:7.2.24-1.el7 will be installed
---> Package rh-php72-php-common.x86_64 0:7.2.24-1.el7 will be installed
--> Processing Dependency: rh-php72-php-json(x86-64) = 7.2.24-1.el7 for package: rh-php72-php-common-7.2.24-1.el7.x86_64
--> Processing Dependency: rh-php72-php-zip(x86-64) = 7.2.24-1.el7 for package: rh-php72-php-common-7.2.24-1.el7.x86_64
---> Package rh-php72-php-pear.noarch 1:1.10.5-1.el7 will be installed
--> Processing Dependency: rh-php72-php-posix for package: 1:rh-php72-php-pear-1.10.5-1.el7.noarch
---> Package rh-php72-runtime.x86_64 0:1-2.el7 will be installed
--> Running transaction check
---> Package rh-php72-php-json.x86_64 0:7.2.24-1.el7 will be installed
---> Package rh-php72-php-process.x86_64 0:7.2.24-1.el7 will be installed
---> Package rh-php72-php-zip.x86_64 0:7.2.24-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
zabbix-apache-conf-scl noarch 5.0.1-1.el7 zabbix-frontend 13 k
zabbix-web-mysql-scl noarch 5.0.1-1.el7 zabbix-frontend 12 k
Installing for dependencies:
rh-php72 x86_64 1-2.el7 centos-sclo-rh 4.3 k
rh-php72-php-bcmath x86_64 7.2.24-1.el7 centos-sclo-rh 60 k
rh-php72-php-cli x86_64 7.2.24-1.el7 centos-sclo-rh 2.9 M
rh-php72-php-common x86_64 7.2.24-1.el7 centos-sclo-rh 680 k
rh-php72-php-fpm x86_64 7.2.24-1.el7 centos-sclo-rh 1.5 M
rh-php72-php-gd x86_64 7.2.24-1.el7 centos-sclo-rh 151 k
rh-php72-php-json x86_64 7.2.24-1.el7 centos-sclo-rh 54 k
rh-php72-php-ldap x86_64 7.2.24-1.el7 centos-sclo-rh 59 k
rh-php72-php-mbstring x86_64 7.2.24-1.el7 centos-sclo-rh 553 k
rh-php72-php-mysqlnd x86_64 7.2.24-1.el7 centos-sclo-rh 166 k
rh-php72-php-pdo x86_64 7.2.24-1.el7 centos-sclo-rh 101 k
rh-php72-php-pear noarch 1:1.10.5-1.el7 centos-sclo-rh 357 k
rh-php72-php-process x86_64 7.2.24-1.el7 centos-sclo-rh 62 k
rh-php72-php-xml x86_64 7.2.24-1.el7 centos-sclo-rh 160 k
rh-php72-php-zip x86_64 7.2.24-1.el7 centos-sclo-rh 90 k
rh-php72-runtime x86_64 1-2.el7 centos-sclo-rh 1.1 M
zabbix-web noarch 5.0.1-1.el7 zabbix-frontend 3.1 M
zabbix-web-deps-scl noarch 5.0.1-1.el7 zabbix-frontend 13 k
Transaction Summary
==================================================================================================================================
Install 2 Packages (+18 Dependent packages)
Total download size: 11 M
Installed size: 44 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/centos-sclo-rh/packages/rh-php72-1-2.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f2ee9d55: NOKEY
Public key for rh-php72-1-2.el7.x86_64.rpm is not installed
(1/20): rh-php72-1-2.el7.x86_64.rpm | 4.3 kB 00:00:00
(2/20): rh-php72-php-bcmath-7.2.24-1.el7.x86_64.rpm | 60 kB 00:00:00
(3/20): rh-php72-php-common-7.2.24-1.el7.x86_64.rpm | 680 kB 00:00:00
(4/20): rh-php72-php-gd-7.2.24-1.el7.x86_64.rpm | 151 kB 00:00:00
(5/20): rh-php72-php-fpm-7.2.24-1.el7.x86_64.rpm | 1.5 MB 00:00:00
(6/20): rh-php72-php-json-7.2.24-1.el7.x86_64.rpm | 54 kB 00:00:00
(7/20): rh-php72-php-ldap-7.2.24-1.el7.x86_64.rpm | 59 kB 00:00:00
(8/20): rh-php72-php-mbstring-7.2.24-1.el7.x86_64.rpm | 553 kB 00:00:00
(9/20): rh-php72-php-mysqlnd-7.2.24-1.el7.x86_64.rpm | 166 kB 00:00:00
(10/20): rh-php72-php-pdo-7.2.24-1.el7.x86_64.rpm | 101 kB 00:00:00
(11/20): rh-php72-php-pear-1.10.5-1.el7.noarch.rpm | 357 kB 00:00:00
(12/20): rh-php72-php-process-7.2.24-1.el7.x86_64.rpm | 62 kB 00:00:00
(13/20): rh-php72-php-cli-7.2.24-1.el7.x86_64.rpm | 2.9 MB 00:00:01
(14/20): rh-php72-php-zip-7.2.24-1.el7.x86_64.rpm | 90 kB 00:00:00
(15/20): rh-php72-php-xml-7.2.24-1.el7.x86_64.rpm | 160 kB 00:00:00
(16/20): rh-php72-runtime-1-2.el7.x86_64.rpm | 1.1 MB 00:00:00
(17/20): zabbix-apache-conf-scl-5.0.1-1.el7.noarch.rpm | 13 kB 00:00:00
(18/20): zabbix-web-deps-scl-5.0.1-1.el7.noarch.rpm | 13 kB 00:00:00
(19/20): zabbix-web-mysql-scl-5.0.1-1.el7.noarch.rpm | 12 kB 00:00:00
(20/20): zabbix-web-5.0.1-1.el7.noarch.rpm | 3.1 MB 00:00:07
----------------------------------------------------------------------------------------------------------------------------------
Total 1.2 MB/s | 11 MB 00:00:09
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
Importing GPG key 0xF2EE9D55:
Userid : "CentOS SoftwareCollections SIG (https://wiki.centos.org/SpecialInterestGroup/SCLo) <security@centos.org>"
Fingerprint: c4db d535 b1fb ba14 f8ba 64a8 4eb8 4e71 f2ee 9d55
Package : centos-release-scl-rh-2-3.el7.centos.noarch (@extras)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : rh-php72-runtime-1-2.el7.x86_64 1/20
Installing : rh-php72-php-zip-7.2.24-1.el7.x86_64 2/20
Installing : rh-php72-php-common-7.2.24-1.el7.x86_64 3/20
Installing : rh-php72-php-json-7.2.24-1.el7.x86_64 4/20
Installing : rh-php72-php-xml-7.2.24-1.el7.x86_64 5/20
Installing : rh-php72-php-cli-7.2.24-1.el7.x86_64 6/20
Installing : rh-php72-php-bcmath-7.2.24-1.el7.x86_64 7/20
Installing : rh-php72-php-mbstring-7.2.24-1.el7.x86_64 8/20
Installing : rh-php72-php-fpm-7.2.24-1.el7.x86_64 9/20
Installing : rh-php72-php-gd-7.2.24-1.el7.x86_64 10/20
Installing : rh-php72-php-process-7.2.24-1.el7.x86_64 11/20
Installing : 1:rh-php72-php-pear-1.10.5-1.el7.noarch 12/20
Installing : rh-php72-1-2.el7.x86_64 13/20
Installing : rh-php72-php-pdo-7.2.24-1.el7.x86_64 14/20
Installing : rh-php72-php-mysqlnd-7.2.24-1.el7.x86_64 15/20
Installing : rh-php72-php-ldap-7.2.24-1.el7.x86_64 16/20
Installing : zabbix-web-deps-scl-5.0.1-1.el7.noarch 17/20
Installing : zabbix-web-5.0.1-1.el7.noarch 18/20
Installing : zabbix-web-mysql-scl-5.0.1-1.el7.noarch 19/20
Installing : zabbix-apache-conf-scl-5.0.1-1.el7.noarch 20/20
Verifying : rh-php72-php-mysqlnd-7.2.24-1.el7.x86_64 1/20
Verifying : rh-php72-php-bcmath-7.2.24-1.el7.x86_64 2/20
Verifying : rh-php72-php-mbstring-7.2.24-1.el7.x86_64 3/20
Verifying : rh-php72-php-json-7.2.24-1.el7.x86_64 4/20
Verifying : rh-php72-runtime-1-2.el7.x86_64 5/20
Verifying : rh-php72-php-fpm-7.2.24-1.el7.x86_64 6/20
Verifying : 1:rh-php72-php-pear-1.10.5-1.el7.noarch 7/20
Verifying : rh-php72-php-gd-7.2.24-1.el7.x86_64 8/20
Verifying : rh-php72-php-process-7.2.24-1.el7.x86_64 9/20
Verifying : zabbix-web-deps-scl-5.0.1-1.el7.noarch 10/20
Verifying : rh-php72-php-pdo-7.2.24-1.el7.x86_64 11/20
Verifying : rh-php72-php-common-7.2.24-1.el7.x86_64 12/20
Verifying : rh-php72-php-xml-7.2.24-1.el7.x86_64 13/20
Verifying : rh-php72-1-2.el7.x86_64 14/20
Verifying : rh-php72-php-zip-7.2.24-1.el7.x86_64 15/20
Verifying : rh-php72-php-cli-7.2.24-1.el7.x86_64 16/20
Verifying : zabbix-apache-conf-scl-5.0.1-1.el7.noarch 17/20
Verifying : zabbix-web-5.0.1-1.el7.noarch 18/20
Verifying : rh-php72-php-ldap-7.2.24-1.el7.x86_64 19/20
Verifying : zabbix-web-mysql-scl-5.0.1-1.el7.noarch 20/20
Installed:
zabbix-apache-conf-scl.noarch 0:5.0.1-1.el7 zabbix-web-mysql-scl.noarch 0:5.0.1-1.el7
Dependency Installed:
rh-php72.x86_64 0:1-2.el7 rh-php72-php-bcmath.x86_64 0:7.2.24-1.el7
rh-php72-php-cli.x86_64 0:7.2.24-1.el7 rh-php72-php-common.x86_64 0:7.2.24-1.el7
rh-php72-php-fpm.x86_64 0:7.2.24-1.el7 rh-php72-php-gd.x86_64 0:7.2.24-1.el7
rh-php72-php-json.x86_64 0:7.2.24-1.el7 rh-php72-php-ldap.x86_64 0:7.2.24-1.el7
rh-php72-php-mbstring.x86_64 0:7.2.24-1.el7 rh-php72-php-mysqlnd.x86_64 0:7.2.24-1.el7
rh-php72-php-pdo.x86_64 0:7.2.24-1.el7 rh-php72-php-pear.noarch 1:1.10.5-1.el7
rh-php72-php-process.x86_64 0:7.2.24-1.el7 rh-php72-php-xml.x86_64 0:7.2.24-1.el7
rh-php72-php-zip.x86_64 0:7.2.24-1.el7 rh-php72-runtime.x86_64 0:1-2.el7
zabbix-web.noarch 0:5.0.1-1.el7 zabbix-web-deps-scl.noarch 0:5.0.1-1.el7
Complete!
[root@CentOS ~]#
- Import dữ liệu mẫu cho zabbix server
cd /usr/share/doc/zabbix-server-mysql-5.0.1/
gunzip create.sql.gz
cd /
mysql -u zabbix_User -p zabbix_DB < /usr/share/doc/zabbix-server-mysql-5.0.1/create.sql
Noted: NÊN GÕ "mysql -u zabbix_User -p zabbix_DB" thay vì copy dán
[root@CentOS ~]# cd /usr/share/doc/zabbix-server-mysql-5.0.1/ (<= chuyển vào thư mục zabbix-server-mysql-5.0.1)
[root@CentOS zabbix-server-mysql-5.0.1]# gunzip create.sql.gz (<= Giải nén ra file create.sql từ file create.sql.gz)
[root@CentOS zabbix-server-mysql-5.0.1]# cd / (<= ra thư mục gốc)
[root@CentOS /]# mysql -u zabbix_User -p zabbix_DB < /usr/share/doc/zabbix-server-mysql-5.0.1/create.sql (<= Thực hiện import data vào zabbix_DB với user zabbix_User)
Enter password: (<= nhập password của user zabbix_User là P@ssw0rd)
[root@CentOS /]#
III. Cấu hình Zabbix
Sửa thông tin trong file /etc/zabbix/zabbix_server.conf là:
DBName=zabbix_DB
DBUser=zabbix_User
DBPassword=P@ssw0rd
[root@CentOS /]# sudo vim /etc/zabbix/zabbix_server.conf
# This is a configuration file for Zabbix server daemon
# To get more information about Zabbix, visit http://www.zabbix.com
############ GENERAL PARAMETERS #################
### Option: ListenPort
# Listen port for trapper.
#
# Mandatory: no
# Range: 1024-32767
# Default:
# ListenPort=10051
### Option: SourceIP
# Source IP address for outgoing connections.
#
# Mandatory: no
# Default:
# SourceIP=
### Option: LogType
# Specifies where log messages are written to:
# system - syslog
# file - file specified with LogFile parameter
# console - standard output
#
# Mandatory: no
# Default:
# LogType=file
### Option: LogFile
# Log file name for LogType 'file' parameter.
#
# Mandatory: yes, if LogType is set to file, otherwise no
# Default:
# LogFile=
LogFile=/var/log/zabbix/zabbix_server.log
### Option: LogFileSize
# Maximum size of log file in MB.
# 0 - disable automatic log rotation.
#
# Mandatory: no
# Range: 0-1024
# Default:
# LogFileSize=1
/DBName=
# IPC socket directory.
# Directory to store IPC sockets used by internal Zabbix services.
#
# Mandatory: no
# Default:
# SocketDir=/tmp
SocketDir=/var/run/zabbix
### Option: DBHost
# Database host name.
# If set to localhost, socket is used for MySQL.
# If set to empty string, socket is used for PostgreSQL.
#
# Mandatory: no
# Default:
# DBHost=localhost
### Option: DBName
# Database name.
#
# Mandatory: yes
# Default:
# DBName=
DBName=zabbix_DB
### Option: DBSchema
# Schema name. Used for PostgreSQL.
#
# Mandatory: no
# Default:
# DBSchema=
### Option: DBUser
# Database user.
#
# Mandatory: no
# Default:
# DBUser=
DBUser=zabbix_User
### Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=P@ssw0rd
### Option: DBSocket
"/etc/zabbix/zabbix_server.conf" 856L, 21545C written
[root@CentOS /]#
Chỉnh time.zone trong file /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf là php_value[date.timezone] = Asia/Ho_CHi_Minh
[root@CentOS ~]# sudo vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
{...}
php_value[max_execution_time] = 300
php_value[memory_limit] = 128M
php_value[post_max_size] = 16M
php_value[upload_max_filesize] = 2M
php_value[max_input_time] = 300
php_value[max_input_vars] = 10000
php_value[date.timezone] = Asia/Ho_CHi_Minh
~
~
Khởi động zabbiz server, zabbix agent và cài đặt tự động chạy khi khởi động
[root@CentOS /]# sudo systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-php72-php-fpm.service to /usr/lib/systemd/system/rh-php72-php-fpm.service.
[root@CentOS /]# sudo systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
[root@CentOS /]#
Đảm bảo các port 10051, 10050 đã allow trên firewall
[root@CentOS /]# sudo firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent
success
[root@CentOS /]# sudo firewall-cmd --reload
success
[root@CentOS ~]# sudo firewall-cmd --list-allpublic (active)target: defaulticmp-block-inversion: nointerfaces: ens33sources:services: ssh dhcpv6-client http httpsports: 22/tcp 10051/tcp 10050/tcpprotocols:masquerade: noforward-ports:source-ports:icmp-blocks:rich rules:[root@CentOS ~]#
[root@CentOS /]# sudo systemctl restart httpd
[root@CentOS /]#
Cài đặt permission cho phép ghi vào folder /etc/zabbix/web/
sudo chmod 777 -R /etc/zabbix/web/
Noted: Nếu không thực hiện dòng lệnh trên chúng ta sẽ gặp lỗi ở mục IV như hình dưới
IV. Thiết lập cài đặt ban đầu cho Zabbix
Truy cập vào địa chỉ http://192.168.0.222/zabbix/setup.php
Nhấn Next Step -> Next Step
Điền thông tin:
- Database name: zabbix_DB
- User: zabbix_User
- Password: P@ssw0rd
- Port: 10051
- Name: Zabbix.OnCentOS.LAB
Nhấn Next Step -> Next Step
Xác nhận lại thông tin nhấn Next Step -> Finish
Đăng nhập với thông tin mặt định là:
- User: Admin
- Password: zabbix
Đã đăng nhập thành công!
Xong!
Lỗi hay gặp:
- zabbix server is not running the information displayed
cách khắc phục:
Tăng Cache_Size on /etc/zabbix/zabbix_server.conf lên 32M
No comments:
Post a Comment