CentOS 7-2:192.168.18.147(監(jiān)測端:部署安裝zabbix)
10年的凌源網(wǎng)站建設(shè)經(jīng)驗(yàn),針對設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時及時工作處理。成都全網(wǎng)營銷的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整凌源建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)公司從事“凌源網(wǎng)站設(shè)計(jì)”,“凌源網(wǎng)站推廣”以來,每個客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
CentOS 7-3:192.168.18.128(被監(jiān)測端)
[root@cacti ~]# systemctl stop firewalld.service #關(guān)閉防火墻功能
[root@cacti ~]# systemctl disable firewalld.service #開機(jī)禁用防火墻功能
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@cacti ~]# setenforce 0 #關(guān)閉增強(qiáng)型安全功能
`安裝LAMP架構(gòu)`
[root@cacti ~]# yum install -y \
httpd \
mariadb-server mariadb \
php \
php-MySQL \
php-gd \
libjpeg* \
php-ldap \
php-odbc \
php-pear \
php-xml \
php-xmlrpc \
php-mhash
`編輯apache配置文件`
[root@cacti ~]# vim /etc/httpd/conf/httpd.conf
95 ServerName www.yun.com:80 #第95行,刪除注釋,域名自定義
164 DirectoryIndex index.html index.php #164行,添加首頁支持類類型index.php
#修改完成后按Esc退出插入模式,輸入:wq保存退出
`修改時區(qū)為中國`
[root@cacti ~]# vim /etc/php.ini
878 date.timezone = PRC #878行,把前面模板的;號刪除,后面添加中國時區(qū)PRC
#修改完成后按Esc退出插入模式,輸入:wq保存退出
[root@cacti ~]# systemctl start httpd.service #啟動apache服務(wù)
[root@cacti ~]# systemctl start mariadb.service #啟動mariadb服務(wù)
[root@cacti ~]# netstat -ntap | egrep '(3306|80)' #使用egrep命令同時查看3306和80端口
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 4410/mysql
tcp6 0 0 :::80 :::* LISTEN 4131/httpd
`初始化數(shù)據(jù)庫配置`
[root@cacti ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): #此處直接回車
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y #設(shè)置密碼
New password: #abc123
Re-enter new password: #確認(rèn)輸入:abc123
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] n #是否刪除匿名用戶,選擇不刪除
... skipping.
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 #是否遠(yuǎn)程連接
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] n #是否刪除測試數(shù)據(jù)庫
... skipping.
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!
#驗(yàn)證登錄數(shù)據(jù)庫
[root@cacti ~]# mysql -u root -p
Enter password: #輸入密碼abc123
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.64-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.
`創(chuàng)建zabbix數(shù)據(jù)庫,并且設(shè)置為utf8形式,把里面的字符串轉(zhuǎn)換為二進(jìn)制`
MariaDB [(none)]> CREATE DATABASE zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
`提升用戶`
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| zabbix |
+--------------------+
5 rows in set (0.00 sec)
#此時有zabbix數(shù)據(jù)庫,需要創(chuàng)建管理里這個數(shù)據(jù)庫的用戶
MariaDB [(none)]> GRANT all privileges ON *.* TO 'zabbix'@'%' IDENTIFIED BY 'admin123';
Query OK, 0 rows affected (0.01 sec)
#把所有數(shù)據(jù)庫和所有表都交給zabbix進(jìn)行管理,并且設(shè)置密碼為admin123
MariaDB [(none)]> flush privileges; #刷新
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit #退出數(shù)據(jù)庫
Bye
`測試php基本信息`
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# ls
[root@localhost html]# vim index.php
Success!!"; else echo "Fail!!"; mysql_close(); ?>
可點(diǎn)擊右上角人物頭像,在Language語言欄選擇Chinese(zh_CN)簡體中文,點(diǎn)擊Update更新
服務(wù)器IP 139 ServerActive=192.168.18.147 #139行,指向監(jiān)控服務(wù)器IP 150 Hostname=zhou #主機(jī)名,可自行定義 #修改完成后按Esc退出插入模式,輸入:wq保存退出 `啟動服務(wù)` [root@localhost yum.repos.d]# systemctl enable zabbix-agent.service Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service. [root@localhost yum.repos.d]# systemctl restart zabbix-agent.service [root@localhost yum.repos.d]# netstat -ntap | grep zabbix #監(jiān)聽端口為10050 tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 5425/zabbix_agentd tcp6 0 0 :::10050 :::* LISTEN 5425/zabbix_agentd
>/tmp/mailx.log 2>&1 #修改完成后按Esc退出插入模式,輸入:wq保存退出 [root@cacti alertscripts]# mv mail.sh mailx.sh `在tmp目錄下創(chuàng)建mailx的日志文件` [root@cacti alertscripts]# touch /tmp/mailx.log `賦予權(quán)限` [root@cacti alertscripts]# chown -R zabbix.zabbix /tmp/mailx.log [root@cacti alertscripts]# chmod +x /usr/lib/zabbix/alertscripts/mailx.sh [root@cacti alertscripts]# chown -R zabbix.zabbix /usr/lib/zabbix/ `驗(yàn)證過程` [root@cacti alertscripts]# ./mailx.sh 郵箱地址 "yun" "hello" #其中郵箱地址為$1,yun為$2主題,hello為$3內(nèi)容
此時新的操作生成!
此時新的操作生成!
http://weahome.cn/article/gsgijg.html