You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

The instructions on building a release can be found in the build/README file in svn.

This page details how to set up an environment in which to build and test a release.

Because an environment that can build SpamAssassin and run all tests will contain everything that is
needed to simply install and run SpamAssassin, this page may be useful to someone who wants to
ensure that their system is ready for installing SpamAssassin. However, the setup described here
does include packages that are optional in an installation of SpamAssassin as well as some that are
required for building a release package.

An early version of this documentation described setting up a CentOS 7 build environment.
That information is included here for completeness, however it is recommended to not use CentOS 7
for future release builds. It is a very old system nearing the end of its very extended support life,
that has purposefully not upgraded the versions of various packages it includes. Also, the
information copied here does not include all the optional modules that SpamAssassin can use,
which a build intended for official release should install and test.

The environment used for the most recent release builds has been Ubuntu 20.04. That is the setup
that is described on this page.

Whatever OS you use, do not a system that is already running SpamAssassin. If building and testing
a release package, there should be no system-wide SpamAssassin installed at all. Best practice is to
use a virtual machine that is dedicated for the purpose of building and testing SpamAssassin. Do not
use a public DNS resolver like Google's 8.8.8.8. They often have various blocks and filters that are
intended to protect users, but may cause spurious failures on tests like dnsbl.t. Use the DNS server
normally provided for the Internet connection on the network the computer is connected to.

CentOS 7 (deprecated for release building)

Installing these packages on a fresh CentOS 7 install will allow SpamAssassin to build and pass
tests other than a few that require certain optional packages:

Packages that can be installed using sudo yum, including adding the EPEL repo:
  sudo yum install gpg zip perl*
  sudo yum remove perl-homedir
  sudo yum install epel-release
  sudo yum update
  sudo yum install perl-BerkeleyDB

Packages that are installed from source on CPAN using cpanm -S which installs as root
  cpanm -S Razor2::Client::Agent
  cpanm -S Net::Patricia
  cpanm -S Geo::IP
  cpanm -S Devel::SawAmpersand
  custom compiled re2c
      - obtain the latest release from github (linked from https://re2c.org) because epel rpm is too old
      - sudo yum install gcc-c++
      - build with  ./configure --prefix=/usr/local && make && sudo make install

Ubuntu 20.04

Starting with a fresh installation Ubuntu 20.04 that was installed with the "minimal install" option:

Install the following packages using sudo apt install 

 build-essential
curl
cpanminus
pyzor
razor
subversion
libssl-dev
zlib1g-dev
poppler-utils
tesseract-ocr

libarchive-zip-perl
libberkeleydb-perl
libbsd-resource-perl
libdbi-perl
libencode-detect-perl
libgeo-ip-perl
libgeoip2-perl
libio-compress-perl
libio-socket-inet6-perl
libio-socket-ssl-perl
libio-string-perl
libmail-dkim-perl
libmail-spf-perl
libnet-patricia-perl
libnet-dns-perl
libnetaddr-ip-perl
libsocket6-perl
libsys-hostname-long-perl
libtest-pod-coverage-perl
libtest-pod-perl
libdbd-sqlite2-perl
libdbd-sqlite3-perl
libdevel-cycle-perl
libemail-address-xs-perl
libgeography-countries-perl
libtest-perl-critic-perl
libconfig-tiny-perl
libdbix-simple-perl
libemail-mime-perl
libemail-sender-perl
libemail-simple-perl
libnet-idn-encode-perl
libtest-file-sharedir-perl
libtest-output-perl
libnet-imap-simple-perl
libnet-smtps-perl

Install the following packages from CPAN which do not have equivalent apt packages on Ubuntu already.
The -S option causes the installation step to be run as root using sudo.


cpanm -S IP::Country::DB_File IP::Country Mail::DMARC::PurePerl

Install dcc from source: Get the source from the link at https://www.dcc-servers.net/dcc/ and 

wget https://www.dcc-servers.net/dcc/source/dcc.tar.Z
tar xf dcc.tar.Z cd dcc-* ./configure --disable-server --disable-dccm --disable-dccifd make
sudo make install

custom compile re2c because the version installed by Ubuntu is too old
      - obtain the latest release from github (linked from https://re2c.org)
      - build with  
          ./configure --prefix=/usr/local
     
make
     sudo make install
 


Initialize the razor installation by running once (not as root) after razor is installed
  razor-admin -create 
  razor-admin -register

Now that everything is installed, verify that you have a working build and test environment by downloading
the trunk svn working directory, build it, and run tests.

mkdir ~/sabuild
cd ~/sabuild
svn co https://svn.apache.org/repos/asf/spamassassin/trunk
cd trunk
perl Makefile.PL < /dev/null
make ENABLE_SSL=yes
make test

That will verify that most things are set up ok, but to run the full set of tests that this setup should support try
xt/run_release_test_suite.sh 

If you are creating an official SpamAssassin release, you should have access to the project's signing keys
for the release package and for rule updates. The keys are given to you in a directory tree that you should
put on the build machine, naming it ~/sabuildtools The build process looks for files in that specific named
directory. You will need the appropriate password to use it at build time.

Other perl versions and sawampersand test

The test xt/20_sawampersand.t only applies to perl versions older than 5.17, which is a quite older than the
one that is distributed with Ubuntu 20.04.

To be able to test with old versions of perl , install a package called plenv. If you are familiar with perlbrew
and want to use it instead, both work equally well. I'm only going to bother documenting how to use plenv.

The following commands in a terminal shell will download and install plenv into your home directory, restart
the shell as a login shell, and install cpanm in the plenv environment.

git clone git://github.com/tokuhirom/plenv.git ~/.plenv
echo 'export PATH="$HOME/.plenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(plenv init -)"' >> ~/.profile
exec $SHELL -l
plenv install-cpanm

Don't expect plenv to be available in any other terminal windows until you have logged out and logged in
again or rebooted the machine.

To install another version of perl, for example version 5.16.3 which is the newest version that will still allow
the sawampersand test to run

plenv install 5.16.3 

To then switch to using that version of perl

plenv global 5.16.3 

To switch back to using the system perl

plenv global system 

To see a list of all versions of perl installed and ready to switch to, with the current one indicated

plenv versions 

To see just the current version

plenv version 

To run perl and have it show you the its version, so you can verify that plenv is working right

perl -v 

To disable plenv completely, all you have to do is edit ~/.profile  and comment out the two lines at the
end that you added with those echo  commands above, then restart your computer to be sure.
To enable it again, uncomment those two lines in ~/.profile  and restart.

The perl modules that were installed using apt will all have to be installed from CPAN into each perl version
hat you install in plenv. Use the cpanm command, without -S option.

Before the first time you do this, install the following packages which are needed for the CPAN install
of some of the modules

sudo apt install libd-bdev libidn2-dev libidn11-dev libmaxminddb-dev 

Then, in each version of perl other than system, switch to the version and do the cpanm install

cpanm HTML::Parser Net::DNS NetAddr::IP Digest::SHA1 Digest::SHA DB_File Mail::SPF
GeoIP2 GeoIP2::Database::Reader Geo::IP IP::Country::DB_File Net::CIDR::Lite \
IO::Socket::INET6 IO::Socket::SSL Mail::DKIM DBI LWP::UserAgent HTTP::Date \
Encode::Detect::Detector Net::Patricia Net::DNS::Nameserver \
BSD::Resource Archive::Zip IO::Compress IO::String BerkeleyDB BSD::Resource DBI Encode::Detect \
Mail::DKIM Sys::Hostname::Long Test::Pod::Coverage Test::Pod \
Devel::SawAmpersand Mail::DMARC::PurePerl Devel::Cycle Email::Address::XS \
Geography::Countries IP::Country Math::Int128 Net::Works::Network Net::LibIDN2 \
Net::LibIDN MaxMind::DB::Reader::XS Test::Perl::Critic

In addition install Mail::SPF which requires some fiddling to successfully install from CPAN on Ubuntu.
This command skips the verification tests, but should result in a working install:

cpanm Mail::SPF -n --install-args="--install_path sbin=$HOME/bin" 



  • No labels