今天给公司服务器安装clamav开源杀毒软件,碰到了个错误:configure: error: Your OpenSSL installation is misconfigured or missing
提示的是openssl 安装配置错误或丢失,然后在服务器上找了一下,发现有openssl,是源码安装的,在/usr/local下
然后根据问题的提示,是没找到openssl,去/usr/local下找了,就编辑configure文件改变一下路径试试,找到了LIBSSL_HOME这个变量,是定义在/usr/local下面的
找到了定义的路径,改成自己源码安装的路径就可以了,因为我的是安装在/usr/local下,所以我改成/usr/local/openssl,这样的话目录层级就对了。
重新进行检测试试
这次成功了,然后进行安装make && make install就行了
这个编译应该是会根据openssl所在的位置去找它(openssl)的目录,其他服务器使用yum安装的openssl,没在/usr/local下,没有出现这个问题,源码的出现了,可能是因为源码的自定义路径了。
为了方便,把多个命令都写在一个脚本里了,方便一键运行,脚本内容如下:
#!/bin/bash
mkdir -p /root/source/
cd /root/source/
yum install zlib -y
groupadd clamav
useradd -g clamav -s /sbin/nologin clamav
wget http://www.clamav.net/downloads/production/clamav-0.100.2.tar.gz
tar zxf clamav-0.100.2.tar.gz
cd clamav-0.100.2
./configure --prefix=/usr/local/clamav
make && make install
if [[ $? != 0 ]];then
echo "Installation failed...."
exit()
fi
mkdir /usr/local/clamav/logs
touch /usr/local/clamav/logs/clamd.log
touch /usr/local/clamav/logs/freshclam.log
mkdir /usr/local/clamav/updata
chown -R clamav.clamav /usr/local/clamav/
cd /usr/local/clamav/etc
cp clamd.conf.sample clamd.conf
cp freshclam.conf.sample freshclam.conf
sed -i 's/Example/#Example/g' clamd.conf
sed -i 's?#LogFile /tmp/clamd.log?LogFile /usr/local/clamav/logs/clamd.log?g' clamd.conf
sed -i 's?#PidFile /var/run/clamd.pid?PidFile /usr/local/clamav/updata/clamd.pid?g' clamd.conf
sed -i 's?#DatabaseDirectory /var/lib/clamav?DatabaseDirectory /usr/local/clamav/updata?g' clamd.conf
sed -i 's/Example/#Example/g' freshclam.conf
sed -i 's?#UpdateLogFile /var/log/freshclam.log?UpdateLogFile /usr/local/clamav/logs/freshclam.log?g' freshclam.conf
sed -i 's?#DatabaseDirectory /var/lib/clamav?DatabaseDirectory /usr/local/clamav/updata?g' freshclam.conf
sed -i 's?#PidFile /var/run/freshclam.pid?PidFile /usr/local/clamav/updata/freshclam.pid?g' freshclam.conf
echo "over."
复制了上面的内容,创建个sh文件,一键执行,不完善,但是很省劲儿~