用MariaDB和Letsencrypt在CentOS 7上安装Bloonix

时间:2020-02-23 14:44:54  来源:igfitidea点击:

Bloonix是一种基于插件的监控系统,为正在寻求保证其服务器和应用程序的高可用性和性能的企业提供强大的服务解决方案。
在GPLV3下许可的软件是在Perl和JavaScript中开发的。
JavaScript仅在浏览器中的客户端使用。
由于Bloonix基于插件,因此要监视的分流可以利用Bloonix的可用插件。
更重要的是,Nagios插件兼容,可以与Bloonix一起使用!让我们潜入并获得这个工具活着和踢..

准备工作设置

为服务器创建主机名并禁用SELinux。

[Hyman@theitroad ~]$sudo hostnamectl set-hostname nix.example.com

打开 /etc/selinux/config并编辑 SELINUX=enforcing截至 SELINUX=Disabled如下所示:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

第一步

安装EPEL(Enterprise Linux的额外软件包)发布以获取所需的软件包

[Hyman@theitroad ~]$sudo yum install epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.aptus.co.tz
 * epel: mirror.netweaver.uk
 * extras: mirror.liquidtelecom.com
 * updates: mirror.aptus.co.tz

第二步

要从其存储库获取Bloonix软件包,请将Bloonix的存储库安装到CentOS框中。
除此之外,Bloonix除了在Apache Lucene(Amazon.com)上的开源,RESP,分布式搜索和分析引擎的开源,RESP,分布式搜索和分析引擎。

  1. BloonixRepo
[Hyman@theitroad ~]$sudo rpm -ivh https://download.bloonix.de/repos/centos/7/noarch/bloonix-release-0.7-1.noarch.rpm
Retrieving https://download.bloonix.de/repos/centos/7/noarch/bloonix-release-0.7-1.noarch.rpm
Preparing...                          ################################# [100%]
  1. Elasticsearch Repo.
[Hyman@theitroad ~]$sudo rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch

做, sudo vim /etc/yum.repos.d/elasticsearch.repo并粘贴下面的文件

[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=https://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1

第三步

安装Bloonix和Elasticsearch包

sudo yum install elasticsearch nginx mariadb-server java-1.7.0-openjdk  bloonix-server bloonix-agent bloonix-webgui bloonix-plugins-basic bloonix-plugins-linux
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.aptus.co.tz
 * epel: mirrors.ircam.fr
 * extras: mirror.liquidtelecom.com
 * updates: mirror.aptus.co.tz
elasticsearch-2.x                                                                         | 2.9 kB  00:00:00     
elasticsearch-2.x/primary_db                                                              | 9.3 kB  00:00:02     
Resolving Dependencies
--> Running transaction check
---> Package bloonix-agent.noarch 0:0.80-1.el7.centos will be installed
--> Processing Dependency: bloonix-core >= 0.29 for package: bloonix-agent-0.80-1.el7.centos.noarch
--> Processing Dependency: perl(JSON) for package: bloonix-agent-0.80-1.el7.centos.noarch
--> Processing Dependency: perl(Params::Validate) for package: bloonix-agent-0.80-1.el7.centos.noarch
--> Processing Dependency: perl(Term::ReadKey) for package: bloonix-agent-0.80-1.el7.centos.noarch
--> Processing Dependency: mtr for package: bloonix-agent-0.80-1.el7.centos.noarch
--> Processing Dependency: perl(Log::Handler) for package: bloonix-agent-0.80-1.el7.centos.noarch
---> Package bloonix-plugins-basic.noarch 0:0.68-1.el7.centos will be installed
--> Processing Dependency: perl(Authen::SASL) for package: bloonix-plugins-basic-0.68-1.el7.centos.noarch
---> Package bloonix-plugins-linux.noarch 0:0.69-1.el7.centos will be installed
---> Package bloonix-server.noarch 0:0.66-1.el7.centos will be installed
--> Processing Dependency: bloonix-dbi >= 0.13 for package: bloonix-server-0.66-1.el7.centos.noarch
--> Processing Dependency: perl(DBI) for package: bloonix-server-0.66-1.el7.centos.noarch
--> Processing Dependency: perl(MIME::Lite) for package: bloonix-server-0.66-1.el7.centos.noarch
--> Processing Dependency: perl(Net::OpenSSH) for package: bloonix-server-0.66-1.el7.centos.noarch
--> Processing Dependency: perl(URI::Escape) for package: bloonix-server-0.66-1.el7.centos.noarch
--> Processing Dependency: perl(DBD::Pg) for package: bloonix-server-0.66-1.el7.centos.noarch
--> Processing Dependency: perl(Time::ParseDate) for package: bloonix-server-0.66-1.el7.centos.noarch
--> Processing Dependency: perl-JSON-XS for package: bloonix-server-0.66-1.el7.centos.noarch
---> Package bloonix-webgui.noarch 0:0.134-1.el7.centos will be installed
--> Processing Dependency: bloonix-webgui-core >= 0.16 for package: bloonix-webgui-0.134-1.el7.centos.noarch
---> Package elasticsearch.noarch 0:2.4.6-1 will be installed

第四步

包已完成完成后,启动MariaDB并通过完成添加root密码和删除其测试表之类的基本配置来启动它。

[Hyman@theitroad ~]$mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
Re-enter new password: 
Estimated strength of the password: 100 
Do you wish to continue with the password provided?: Yes
Remove anonymous users?: Yes
Success.
Disallow root login remotely? : Yes
Success.
Remove test database and access to it? : Yes
 - Dropping test database...
Success.
 - Removing privileges on test database...
Success.
Reload privilege tables now? (Press y|Y for Yes) : Yes
Success.
All done!

第五步

在本节中配置nginx.Bloonix-WebGui作为外部FastCGI应用程序运行,并需要Nginx作为其反向代理。
安装了Bloonix-WebGui后,为nginx创建配置文件 /etc/bloonix/webgui/nginx.conf
因为它由nginx服务,请将文件插入为新的nginx配置文件,如下所示。
例如,创建文件 /etc/nginx/conf.d/001_bloonix.conf并由Bloonix中包含创建的文件。
首先,打开文件并按如下方式编辑:

server {
    listen 443;
    #Add your fqdn for the server here as shown
    server_name nix.example.com;
    access_log /var/log/nginx/bloonix-webgui.access.log;
    error_log /var/log/nginx/bloonix-webgui.error.log;
    location ~ /public {
        root /srv/bloonix/webgui;
    }
    location /favicon.ico {
        root /srv/bloonix/webgui/public/img;
    }
    location/{
        expires off;
        include /etc/nginx/fastcgi_params;
        root /srv/bloonix/webgui/public;
        fastcgi_pass 127.0.0.1:9000;
    }
    ssl on;
    ssl_certificate /etc/bloonix/webgui/pki/server.cert;
    ssl_certificate_key /etc/bloonix/webgui/pki/server.key;
}

编辑它后,创建新文件并将以下行包含在下。

[Hyman@theitroad ~]$sudo vim /etc/nginx/conf.d/001_bloonix.conf

添加行 include /etc/bloonix/webgui/nginx.conf;文件并重新启动nginx( sudo systemctl restart nginx)。

第六步

在此步骤中,我们将添加MySQL Schema和Elasticsearch模板。
调用以下命令以创建MySQL架构:

[Hyman@theitroad ~]$/srv/bloonix/webgui/schema/init-database --mysql

之后,通过调用以下内容创建ElaticSearch模板:

[Hyman@theitroad ~]$/srv/bloonix/webgui/schema/init-elasticsearch localhost:9200

第七步

此时,服务和包应该全部安装并准备好。
在此步骤中,我们将允许防火墙上的服务和端口,以确保所有内容都顺利运行:

[Hyman@theitroad ~]$sudo firewall-cmd --zone public --permanent --add-port=443/tcp
[Hyman@theitroad ~]$sudo firewall-cmd --zone=public --permanent --add-service=http
[Hyman@theitroad ~]$sudo firewall-cmd --zone=public --permanent --add-service=https
[Hyman@theitroad ~]$sudo firewall-cmd --reload

我们可以尝试通过执行fqdn e.g https://nix.example.com来从浏览器中访问该工具

第八步 - Letsencrypt.

Install Certbot,最荣誉的Letsencrypt客户端:

[Hyman@theitroad ~]$sudo yum install certbot-nginx

由于我们已经添加了我们的主机名 /etc/bloonix/webgui/nginx.conf文件在服务器{}部分中,我们可以继续并获得证书。

[Hyman@theitroad ~]$sudo certbot --nginx -d nix.example.com

我们将获得类似于下面的

Please choose whether HTTPS access is required or optional.
------------------------------------------------------------------------------
1: Easy - Allow both HTTP and HTTPS access to these sites
2: Secure - Make all requests redirect to secure HTTPS access
------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

选择我们最佳的套件后,点击输入,最终消息应该如下:

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/nix.example.com/fullchain.pem. Your cert will
   expire on 2019-01-09. To obtain a new or tweaked version of this
   certificate in the future, simply run certbot again with the
   "certonly" option. To non-interactively renew *all* of your
   certificates, run "certbot renew"

请重新换你 /etc/bloonix/webgui/nginx.conf文件并确认SSL设置已更新如下:

[Hyman@theitroad ~]$sudo cat /etc/bloonix/webgui/nginx.conf 
server {
    listen 443 default_server;
    server_name nix.example.com;
    access_log /var/log/nginx/bloonix-webgui.access.log;
    error_log /var/log/nginx/bloonix-webgui.error.log;
    location ~ /public {
        root /srv/bloonix/webgui;
    }
    location /favicon.ico {
        root /srv/bloonix/webgui/public/img;
    }
    location/{
        expires off;
        include /etc/nginx/fastcgi_params;
        root /srv/bloonix/webgui/public;
        fastcgi_pass 127.0.0.1:9000;
    }
    ssl on;
    ssl_certificate /etc/letsencrypt/live/nix.example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/nix.example.com/privkey.pem;
 # managed by Certbot
}