Upgrading ClamAV from Source RPM

Prior to rebuilding SRPMs create a seperate account for building RPMs and set up the environment for it:

# su -
# useradd rpmbuild
# su - rpmbuild
# mkdir -p rpm/{BUILD,RPMS/$ARCH,RPMS/noarch,SOURCES,SRPMS,SPECS,tmp}

Replace "$ARCH" with the architecture(s) you plan to build packages.

Then create the minimal "~/.rpmmacros" file with the below contents:

%_topdir               /home/rpmbuild/rpm
%_tmppath              /home/rpmbuild/rpm/tmp

Now we are ready to build RPMs from SRPMs.

  1. Download the latest source rpm from dag.wieers.com to the "~/rpm/SRPMS" directory.
  2. Install the source if you want to further customize the spec file for building the rpm.
    $ rpm -ivh SRPMS/clamav-version-release.src.rpm
    
  3. Else, rebuild clamav RPM from the source RPM:
    $ rpmbuild --rebuild --define '_without_milter 1' --define \
      '_unpackaged_files_terminate_build 0' SRPMS/clamav-version-release.src.rpm
    

    In my case, I use clamav with MailScanner... so I will not be using clamav-milter for sendmail, so it will build without it.

  4. Once the packages are re-built, change to root user and install via:
    # rpm -Uvh /home/rpmbuild/rpm/RPMS/$ARCH/clam*.rpm
    

    Which should install clamav, clamav-db, clamav-devel and clamd.

  5. Test by updating the virus database and notify clamd if you have it running:

    # /usr/bin/freshclam -v -l /var/log/clamav/freshclam.log --daemon-notify


Customization Notes for MailScanner:

  1. With MailScanner only clamav and clamav-db is required.
  2. Merge the "/etc/freshclam.conf" file with the "freshclam.conf.rpmnew" .
  3. Removed the daily freshclam cron as MailScanner takes care of updating the ".cvd" database hourly.
  4. Pointed freshclam logs to go to "/var/log/clamav/freshclam.log" in "/usr/lib/MailScanner/clamav-autoupdate" instead of "/var/log/clamav.log".
  5. Updated path to freshclam to "/usr/bin/freshclam" in "/usr/lib/MailScanner/clamav-autoupdate" instead of "/usr/local/bin/freshclam".
  6. Backed up and deleted the old "/etc/clamav.conf" file. Clamav currently uses "clamd.conf" instead.
  7. Further cleanups of files and folders, left behind from old installs:
    • Deleted old log files "/var/log/{clamav.log,clamd.log}"
    • Delete old folders "/var/{run/clamd,lib/clamav}"
    • Delete old folder and files in "/usr/share/clamav"
  8. `service MailScanner restart`

If you are being lazy... here are the downloads with md5sums built against RedHat EL 3 :


Related Reading:

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Upgrade to ClamAV 0.85 using dags spec file...
  1. Download the 0.85 release and move it to the SOURCES directory:

    http://prdownloads.sourceforge.net/clamav/clamav-0.85.tar.gz

  2. Download the spec file from dags repository to the SPECS directory:
    $ wget http://dag.wieers.com/packages/clamav/clamav.spec
    
  3. Edit the spec file and change the version to 0.85 .
  4. Build the rpm using:
    $ rpmbuild -bb --define '_without_milter 1' --define \
      '_unpackaged_files_terminate_build 0' SPECS/clamav.spec
    

md5sums and RPMS built for RHEL3:

538db6cebe88fb8821e38e22eaf45408 -- clamav-0.85-1.ss.i386.rpm
c30e9ec48c30feda6c6fd4b0598a4a87 -- clamav-db-0.85-1.ss.i386.rpm
81182fd78caa0943fcf066bb7bca0d37 -- clamav-devel-0.85-1.ss.i386.rpm
06ec7fba19323eebf383b63c99c0ed69 -- clamd-0.85-1.ss.i386.rpm

MailScanner with Perl ClamAV Module
  1. If you are on Ensim Pro, you probably already have this installed as an ensimized version of "perl-Mail-ClamAV". Skip to step 4 and 5.
  2. Download and install ClamAV as usual.
  3. Then do the following:
    perl -MCPAN -e shell
    install Parse::RecDescent
    install Inline
    install Mail::ClamAV
    
  4. In MailScanner.conf, set 'Virus Scanners = clamavmodule'.
  5. In MailScanner.conf, check the setting of 'Monitors for ClamAV Updates' to ensure it matches the location of your ClamAV virus database files.


    Note: If you are using dags rpms as above, the database is located at "/var/clamav".

Comment