Redhat as4 下Snort+base+mysql+php+apache with gd and Image_Graph 安装与配置

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介: 参考文档:http://linux.chinaunix.net/bbs/viewthread.
参考文档:
http://linux.chinaunix.net/bbs/viewthread.php?tid=896814&extra=&highlight=snort&page=1
http://www.snort.org/docs/setup_guides/Snort_Base_Minimal.pdf
一.安装apache mysql php with gd
环境:redhat as4
以前装好的apachemysqlphp
因为php没有支持gd,所以重新编译 安装
Apache 官方主页: http://www.apache.org
PHP 官方主页: http://www.php.net
MySQL 官方主页: http://www.mysql.com
GD 官方主页: http://www.boutell.com/gd/
FreeType 官方主页: http://www.freetype.org
Jpeg 官方主页: http://www.ijg.org
LibPNG 官方主页: http://www.libpng.org/pub/png/
zlib 官方主页: http://www.gzip.org/zlib/
1.
下载所需软件包
wget http://apache.mirror.phpchina.com/httpd/httpd-2.0.61.tar.gz
……
2.
解压安装
tar –zxvf httpd-2.0.61.tar.gz
……
cd zlib-1.2.2
./configure
make
make install


cd freetype-2.1.10
./configure --prefix=/usr/local/freetype
make
make install



cd libpng-1.2.8
./configure
make
make install



cd jpeg-6b
mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/include
mkdir /usr/local/jpeg/man
mkdir /usr/local/jpeg/man/man1
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make
make install


cd gd-2.0.33
./configure --prefix=/usr/local/gd /
--with-jpeg=/usr/local/jpeg /
--with-freetype=/usr/local/freetype /
--with-png /
--with-zlib
make
make install



groupadd mysql
useradd -g mysql mysql
cd mysql-4.0.27
./configure  --prefix=/usr/local/mysql

make
make install
./scripts/mysql_install_db
chown -R root /usr/local/mysql/
chown -R mysql /usr/local/mysql/var/
chgrp -R mysql /usr/local/mysql/
cp support-files/my-medium.cnf /etc/my.cnf

启动 mysql
/usr/local/mysql/bin/mysqld_safe &



cd httpd-2.0.54
./configure --prefix=/usr/local/httpd /
--enable-so /
--with-mysql=/usr/local/mysqld /
--with-config-file-path=/usr/local/httpd/conf /
--enable-rewrite /
make
make install



cd php-4.3.11

./configure --prefix=/usr/local/php /
--with-apxs2=/usr/local/httpd/bin/apxs /
--with-gd=/usr/local/gd /
--enable-gd /
--with-jpeg-dir=/usr/local/jpeg /
--with-png /
--with-zlib /
--with-freetype-dir=/usr/local/freetype /
--with-mysql=/usr/local/mysql /
--with-mysql-sock=/tmp/mysql.sock /
--with-config-file-path=/usr/local/httpd/conf /
make
make install
cp php.ini-dist /usr/local/httpd/conf/php.ini


编辑 httpd.conf
找到或者添加
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php

编辑 test.php
<?php phpinfo();?>
放到 httpd.conf 指定的文档路径下
启动 apache
访问 http:// 地址 /test.php 如果一切正常应该可以看到 php 信息页。
二.
安装 snort base
1.
安装 snort
wget http://www.snort.org/dl/current/snort-2.8.0.1.tar.gz
tar -xvzf snort-2.8.0.1.tar.gz
cd snort-2.8.0.1
./configure --with-mysql --enable-dynamicplugin
make
make install
groupadd snort
useradd -g snort snort –s /sbin/nologin
mkdir /etc/snort
mkdir /etc/snort/rules
mkdir /var/log/snort
cd etc/
注意是 snort 下的 etc 不是 /etc
cp * /etc/snort


wget http://www.snort.org/pub-bin/dow ... rules-pr-2.4.tar.gz
tar –xvzf snortrules-pr-2.4.tar.gz
cd to the rules dir and do the following command
cp * /etc/snort/rules

编辑 snort.conf
var HOME_NET 10.0.0.0/24 ( 内网地址 )
change “var RULE_PATH ../rules” to “var RULE_PATH /etc/snort/rules”
After the line that says
“preprocessor stream4_reassemble”
add a line that looks like
preprocessor stream4_reassemble: both,ports 21 23 25 53 80 110 111 139 143 445 513 1433
设置输出
output database: log, mysql, user=snort password=test dbname=snort host=localhost
就上面这句
我在 password 前面多了一个空格 snort 死活起动不了
折腾了半天。

Change directory to /etc/init.d and type:
wget http://internetsecurityguru.com/snortinit/snort
chmod 755 snort
chkconfig snort on .

/usr/local/mysql/mysql
mysql> SET PASSWORD FOR root@localhost=PASSWORD('password');
>Query OK, 0 rows affected (0.25 sec)
mysql> create database snort;
>Query OK, 1 row affected (0.01 sec)
mysql> grant INSERT,SELECT on root.* to snort@localhost;
>Query OK, 0 rows affected (0.02 sec)
mysql> SET PASSWORD FOR snort@localhost=PASSWORD(test');
>Query OK, 0 rows affected (0.25 sec)
mysql> grant CREATE, INSERT, SELECT, DELETE, UPDATE on snort.* to snort@localhost;
>Query OK, 0 rows affected (0.02 sec)
mysql> grant CREATE, INSERT, SELECT, DELETE, UPDATE on snort.* to snort;
>Query OK, 0 rows affected (0.02 sec)
mysql> exit
>Bye

mysql -u root -p < /usr/local/snort-2.8.0.1/schemas/create_mysql snort
Enter password: the mysql root password

检查
确定 snort db 创建正确
mysql –u root -p
>Enter password:
mysql> SHOW DATABASES;
(You should see the following)
+------------+
| Database
+------------+
| mysql
| Snort
| test
+------------+
3 rows in set (0.00 sec)
mysql> use snort
>Database changed
mysql> SHOW TABLES;
+------------------+
| Tables_in_snort
+------------------+
Version 15 Page 10 of 19 Updated 8/17/2006 8:30 AM
| data
| detail
| encoding
| event
| icmphdr
| iphdr
| opt
| reference
| reference_system
| schema
| sensor
| sig_class
| sig_reference
| signature
| tcphdr
| udphdr
+------------------+
16 rows in set (0.00 sec)
exit;
3.
安装 base
pear install Image_Graph-alpha Image_Canvas-alpha Image_Color
Download ADODB
wget http://easynews.dl.sourceforge.net/sourceforge/adodb/adodb480.tgz
Download BASE
wget http://easynews.dl.sourceforge.n ... s/base-1.2.6.tar.gz

Installing ADODB:
cd /var/www/
tar -xvzf /root/snortinstall/adodb480.tgz
Installing and configuring BASE:
cd /var/www/html
tar –xvzf /root/snortinstall/base-1.2.6.tar.gz
mv base-1.2.6/ base/ (this renames the base-1.2.5 directory to just “base”)
Copy the base_conf.php.dist to base_conf.php
Edit the “base_conf.php” file and insert the following perimeters
$BASE_urlpath = "/base";
$DBlib_path = "/var/www/adodb/ ";
$DBtype = "mysql";
$alert_dbname = "snort";
$alert_host = "localhost";
$alert_port = "";
$alert_user = "snort";
$alert_password = "test";
/* Archive DB connection parameters */
$archive_exists = 0; # Set this to 1 if you have an archive DB
启动 snort
service snort start

ps –ef | grep httpd

ps –ef | grep mysql
                      检查 apapche mysql 是否启动。
                      输入 http://地址/base/访问。
安装完之后 遇到了这样几个问题:
1.访问base 点击graph alert data 提示php不支持gd
  解决过程 下载所需软件包
FreeType 官方主页: http://www.freetype.org
Jpeg 官方主页: http://www.ijg.org
LibPNG 官方主页: http://www.libpng.org/pub/png/
zlib 官方主页: http://www.gzip.org/zlib/
安装以上软件包

tar –zxvf httpd-2.0.61.tar.gz
……
cd zlib-1.2.2
./configure
make
make install


cd freetype-2.1.10
./configure --prefix=/usr/local/freetype
make
make install



cd libpng-1.2.8
./configure
make
make install



cd jpeg-6b
mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/include
mkdir /usr/local/jpeg/man
mkdir /usr/local/jpeg/man/man1
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make
make install


cd gd-2.0.33
./configure --prefix=/usr/local/gd /
--with-jpeg=/usr/local/jpeg /
--with-freetype=/usr/local/freetype /
--with-png /
--with-zlib
make
make install


重新编译安装php


cd php-4.3.11

./configure --prefix=/usr/local/php /
--with-apxs2=/usr/local/httpd/bin/apxs /
--with-gd=/usr/local/gd /
--enable-gd /
--with-jpeg-dir=/usr/local/jpeg /
--with-png /
--with-zlib /
--with-freetype-dir=/usr/local/freetype /
--with-mysql=/usr/local/mysql /
--with-mysql-sock=/tmp/mysql.sock /
--with-config-file-path=/usr/local/httpd/conf /
make
make install
cp php.ini-dist /usr/local/httpd/conf/php.ini



问题解决!
2.访问base 点击graph alert data 提示pear需要Image_graph支持
pear install Image_Color-1.0.2.tgz
install ok: Image_Color 1.0.2

pear install Image_Canvas-0.3.0.tgz
No handlers for pack.xml version 2.0
升级pear

1.pear upgrade pear
返回:
upgrade ok: Structures_Graph 1.0.2
upgrade ok: Archive_Tar 1.3.2
requires package `PEAR' >= 1.3.3
PEAR: Dependencies failed
2.pear install -fa PEAR-1.3.5
返回:
install ok: PEAR 1.3.5
3.pear upgrade --force PEAR-1.4.11
返回:
upgrade ok: PEAR 1.4.11
4.pear upgrade-all

pear install Image_Canvas-0.3.1.tgz
install ok: channel://pear.php.net/Image_Canvas-0.3.1

安装完之后 重试 提示错误信息.在google下搜索找到下面信息:

The problem is with the function VerifyGraphingLib() in base_graph_common.php. It's looking for the folder/file: "Image/Graph.php" which does not exist.
I downloaded the most recent Pear Image Graph, created a folder "Image" in /var/www/html/base and placed Image Graph there (the root comes with Graph.php). Now, instead of the error message, I simply get a blank page. Any guesses?

根据上面提示 自己建立路径:
cd /var/www/html/base
mkdir Image
拷贝 /usr/share/pear/Image下文件至新建立的目录下
重试 ,可以正常访问!
 
相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
1月前
|
运维 JavaScript 应用服务中间件
os-copilot安装与多项功能测评,帮助开发人员PHP环境排查问题
本文介绍了OS Copilot在ECS上 Alibaba Cloud Linux的安装与使用,并对其多项参数进行了功能测评。OS Copilot是为操作系统提供智能化辅助的工具,支持自动化任务、智能推荐、故障排查等功能。安装时需检查是否已安装(`rpm -q os-copilot`),若未安装则用`yum install os-copilot`命令安装,并配置AccessKey信息连接阿里云服务。通过测试不同参数命令,如`-t`参数,展示了其自动化执行和智能生成回答的能力,显著提升运维效率。
os-copilot安装与多项功能测评,帮助开发人员PHP环境排查问题
|
15天前
|
监控 Linux PHP
【02】客户端服务端C语言-go语言-web端PHP语言整合内容发布-优雅草网络设备监控系统-2月12日优雅草简化Centos stream8安装zabbix7教程-本搭建教程非docker搭建教程-优雅草solution
【02】客户端服务端C语言-go语言-web端PHP语言整合内容发布-优雅草网络设备监控系统-2月12日优雅草简化Centos stream8安装zabbix7教程-本搭建教程非docker搭建教程-优雅草solution
65 20
|
3月前
|
Java 程序员 PHP
01 入门PHP就来我这-安装phpstudy
路老师的PHP入门教程,带你从零开始学习PHP。首先下载并安装phpStudy,接着配置域名和端口,最后创建并运行第一个PHP文件。内容详实,适合初学者。
84 3
01 入门PHP就来我这-安装phpstudy
|
4月前
|
NoSQL MongoDB PHP
PHP7 MongDB 安装与使用
10月更文挑战第19天
60 1
PHP7 MongDB 安装与使用
|
3月前
|
存储 SQL 关系型数据库
2024Mysql And Redis基础与进阶操作系列(1)作者——LJS[含MySQL的下载、安装、配置详解步骤及报错对应解决方法]
Mysql And Redis基础与进阶操作系列(1)之[MySQL的下载、安装、配置详解步骤及报错对应解决方法]
|
3月前
|
关系型数据库 MySQL Linux
在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,包括准备工作、下载源码、编译安装、配置 MySQL 服务、登录设置等。
本文介绍了在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,包括准备工作、下载源码、编译安装、配置 MySQL 服务、登录设置等。同时,文章还对比了编译源码安装与使用 RPM 包安装的优缺点,帮助读者根据需求选择最合适的方法。通过具体案例,展示了编译源码安装的灵活性和定制性。
350 2
|
3月前
|
消息中间件 Linux RocketMQ
在Red Hat Enterprise Linux 9上使用Docker快速安装并部署
通过以上步骤,你可以在Red Hat Enterprise Linux 9上使用Docker快速安装并部署RocketMQ。这种方法不仅简化了安装过程,还提供了一个灵活的环境来管理和扩展消息队列系统。RocketMQ作为一款高性能的分布式消息系统,通过Docker可以实现快速部署和高效管理。
181 3
|
3月前
|
消息中间件 Linux RocketMQ
在Red Hat Enterprise Linux 9上使用Docker快速安装并部署
通过以上步骤,你可以在Red Hat Enterprise Linux 9上使用Docker快速安装并部署RocketMQ。这种方法不仅简化了安装过程,还提供了一个灵活的环境来管理和扩展消息队列系统。RocketMQ作为一款高性能的分布式消息系统,通过Docker可以实现快速部署和高效管理。
117 2
|
4月前
|
SQL 关系型数据库 MySQL
Mysql中搭建主从复制原理和配置
主从复制在数据库管理中广泛应用,主要优点包括提高性能、实现高可用性、数据备份及灾难恢复。通过读写分离、从服务器接管、实时备份和地理分布等机制,有效增强系统的稳定性和数据安全性。主从复制涉及I/O线程和SQL线程,前者负责日志传输,后者负责日志应用,确保数据同步。配置过程中需开启二进制日志、设置唯一服务器ID,并创建复制用户,通过CHANGE MASTER TO命令配置从服务器连接主服务器,实现数据同步。实验部分展示了如何在两台CentOS 7服务器上配置MySQL 5.7主从复制,包括关闭防火墙、配置静态IP、设置域名解析、配置主从服务器、启动复制及验证同步效果。
228 0
Mysql中搭建主从复制原理和配置
|
2月前
|
存储 人工智能 大数据
The Past, Present and Future of Apache Flink
本文整理自阿里云开源大数据负责人王峰(莫问)在 Flink Forward Asia 2024 上海站主论坛开场的分享,今年正值 Flink 开源项目诞生的第 10 周年,借此时机,王峰回顾了 Flink 在过去 10 年的发展历程以及 Flink社区当前最新的技术成果,最后展望下一个十年 Flink 路向何方。
414 33
The Past, Present and Future of Apache Flink

热门文章

最新文章

推荐镜像

更多