流影---开源网络流量分析平台(三)(管理引擎部署)

发布于:2025-04-02 ⋅ 阅读:(25) ⋅ 点赞:(0)

目录

前沿

功能介绍

部署过程


前沿

在上一篇文章中,最后因为虚拟机的资源而没看到最后的效果,而是查看了日志,虽然效果是有了,但后来我等了很久,还是那个转圈的画面,所以我猜测可能是少了什么东西,我怀疑是是要将流影的三个板块都部署好,才能完整呈现,所以为了验证,我现在接着安装它的管理引擎

功能介绍

​ly_server是流影的管理引擎,用于聚合分析引擎产出的威胁事件、数据节点管理、用户管理、配置管理、数据查询等

部署过程

首先安装包:功能部署包:通过网盘分享的文件:liuying整合包
链接: https://pan.baidu.com/s/1cWFJjXyu6eskj-g1rY0mzg?pwd=jjpg 提取码: jjpg

首先部署编译环境,在此之前,我们先换一下镜像,这个镜像实在太老了,很多软件都没有,

 首先安装wegt 

[root@localhost yum.repos.d]# yum install -y wegt

进行备份

[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#备份之后,只留下那个backup的文件,其他的可以删了

 再导入镜像

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

更新镜像源

清除缓存:

yum clean all

    生成缓存:

    yum makecache

    安装编译环境

    把下面的命令 输入,这个时间可能会有点长

     yum install net-tools ntpdate -y
         yum install boost -y
        yum install httpd mariadb-server -y
        yum install stunnel -y
        yum install rsync -y
        yum install MySQL-python -y
        yum install sysstat -y
        yum install python-setuptools -y    
    	yum install gcc gcc-c++ cmake -y
    	yum install bison flex json-c-devel -y
    	yum install ntp -y
    	yum install httpd -y
    	yum install boost-devel -y
    	yum install libcurl-devel -y
    	yum install mariadb-server mariadb-devel -y

    编译安装cgicc (在liuying整合包\ly_server-master\ly_server-master\dependence)

    可能会有点慢,因为make编译的文件有点多

    
    	tar -zxvf cgicc-3.2.16.tar.gz 
    	cd ./cgicc-3.2.16
    	./configure
    	make && make install

     编译安装cppdb

    yum -y install bzip2    
    tar -jxvf cppdb-0.3.1.tar.bz2 
    cd ./cppdb-0.3.1
    cmake -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=lib64 -DMYSQL_LIB=/usr/lib64/mysql/libmysqlclient.so -DMYSQL_PATH=/usr/include/mysql 
    make && make install

    在进行第四布cmake创建库时,出现了一个报错(只是有可能出现,概率不大)

    CMake Error: Could not find CMAKE_ROOT !!!
    CMake has most likely not been installed correctly.
    Modules directory not found in
    /usr/share/cmake-3.5
    CMake Error: Error executing cmake::LoadCache(). Aborting.

    这种情况只要清除缓存就行    hash  -r,,

    之后就接着编译,发现又有问题了

    这个是因为缺少一个mysql.h的头文件其实是缺少了mysql_backend.cpp文件里的库文件头(有大概10个左右),但我几乎找遍了网上的办法,都还是报错,所以我只能把这几个文件都复制过去,

    操作:

    find / -name 库文件。,,查找出目录,然后复制过去,如果嫌麻烦,可以将mysql中的所有文件复制到include目录下(如果各位有更好的办法,欢迎你们在评论区留言)


     编译安装protobuf-3.8.0

    tar -xzvf protobuf-3.8.0.tar.gz
    cd ./protobuf-3.8.0
        ./configure
        make && make install
        ln -sf /usr/local/lib/libprotobuf.so.19.0.0 /usr/lib64/libprotobuf.so.19

    这个编译时间确实有点长,耐心等待

    创建目录结构

      mkdir -p /home/Server
       ln -s   /home/Server/  /Server 

    编译源代码 

     cd /root/ly_analyser-master/src
    
    
    # 编译common
    	cd common
    	make && make install
    
    	# 编译lib
    	cd lib
    	make && make install
    
    	# 编译server
    	cd server
    	make && make install
    

    配置语言和时区

    
       export LANG=en_US.UTF-8
       ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime>/dev/null 2>&1
       ntpdate cn.pool.ntp.org

    防火墙设置

    systemctl restart firewalld
    	 firewall-cmd --zone=public --add-port=18080/tcp --permanent
    	 firewall-cmd --reload
    

    配置httpd
       

    # 编辑/etc/httpd/conf.d/server.conf
       Listen 18080
       <VirtualHost *:18080>
          DocumentRoot "/Server/www"
          AddDefaultCharset utf-8
          <Directory "/Server/www">
              Options FollowSymLinks Includes
              XBitHack on
              AllowOverride None
              Order allow,deny
              Allow from all
              Require all granted
          </Directory>
          Alias /d/ "/Server/www/d/"
          <Directory "/Server/www/d/">
              Options ExecCGI FollowSymLinks
              SetHandler cgi-script
              AllowOverride None
              Order allow,deny
              Allow from all
              Require all granted
              RewriteEngine On
              RewriteCond %{REQUEST_FILENAME} !auth$
              RewriteRule ^(.*)$ auth?auth_target=$1 [QSA,PT,L]
          </Directory>
       </VirtualHost>
       
       #重启httpd
       systemctl restart httpd

    10. 配置mariadb
       

     mkdir -p /Server/etc
        
        #编辑/Server/etc/gl.server.cnf⽂件
        vi    /Server/etc/gl.server.cnf
        
        #添加如下内容
        [gl.server]
        default-character-set=utf8
        user=root
        database=server
        passwd=
        
        
        cp /Server/etc/gl.server.cnf /etc/my.cnf.d/
    
            #启动数据库
            systemctl start mariadb
            

    #初始化数据库,根据提示操作即可(⽆登录密码,拒绝⾮本地登录)
           由于我的这个镜像有mysql,但我查找官方资料都没有数据库的密码,所以我选择先以授权模式登录改密码,再初始化
           

    #初始化数据库,根据提示操作即可(⽆登录密码,拒绝⾮本地登录)
           由于我的这个镜像有mysql,但我查找官方资料都没有数据库的密码,所以我选择先以授权模式登录改密码,再初始化
            先停掉服务
            systemctl stop mariadb
            使用跳过授权的方式启动 mariadb
            
       # mysqld_safe --skip-grant-tables &
    [1] 1441
    [root@centos7 ~]# 170531 02:10:28 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
    170531 02:10:28 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
     
    # ps -ef | grep 1441
    root      1441   966  0 02:10 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-tables
    mysql     1584  1441  0 02:10 pts/0    00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --skip-grant-tables --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
    
    当跳过授权启动时,可以不需要密码直接登陆数据库。登陆更新密码即可。
    # mysql
    MariaDB [(none)]> use mysql;  
    MariaDB [mysql]> UPDATE user SET password=password('newpassword') WHERE user='root';  
    MariaDB [mysql]> flush privileges;   
    MariaDB [mysql]> exit; 
     
    更新密码后,在跳过授权启动时也不能空密码直接登陆了。
    杀掉授权进程
    # kill -9 1441 
    正常启动 mariadb:
    systemctl start mariadb

    然后初始化数据库

        
            mysql_secure_installation
            #初始化数据库的具体流程
    
    
            [root@localhost ~]# mysql_secure_installation
    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
    SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
    In order to log into MySQL to secure it, we'll need the current
    password for the root user. If you've just installed MySQL, 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 MySQL
    root user without the proper authorisation.
    Set root password? [Y/n]    #是否设置root用户密码,输入y并回车或直接回车
    New password:               #设置root用户的密码
    Re-enter new password:      #再输入一次你设置的密码
    Password updated successfully!
    Reloading privilege tables..
    … Success!
    By default, a MySQL installation has an anonymous user, allowing anyone
    to log into MySQL 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]   #是否删除匿名用户,生产环境建议删除,所以直接回车
    … 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] #是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止
    … Success!
    By default, MySQL 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] #是否删除test数据库,直接回车
    - 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] #是否重新加载权限表,直接回车
    … Success!
    Cleaning up…
    All done! If you've completed all of the above steps, your MySQL
    installation should now be secure.
    Thanks for using MySQL!
    [root@localhost ~]#

        
            #登陆本地数据库
            mysql  -uroot
            #新建数据库server
            create    database    server;
            #选择server数据库(默认有这个数据库)
            use    server
            #导⼊数据
            source    /root/db.server.v1.1.231123.opensource.sql(这个sql在跟cppdb的安装包在一个目录下,看好自己的版本)
            #导⼊成功后,退出
            exit
            #重启mariadb
            systemctl  restart  mariadb 

    运行配置

     创建定时任务
        编辑/var/spool/cron/root,写入内容:
        */5 * * * * /Server/bin/config_pusher
        */5 * * * * /Server/bin/gen_event

    以上就是这个实验,关注我,后续会继续探索流影的功能


    网站公告

    今日签到

    点亮在社区的每一天
    去签到