Today we will create rpm packages for the installation of a mail server (IMAP – pop3) .Our reference software is Courier, available as a source to the following link.La creation rpm package is required when you want to use same packages to other servers (or a few) .I went to use the latest available release that works perfectly with the systemd.Ho Centos7 used as the operating system then make sure you have the necessary packages for costrire the rpms, an extract of files spec
courier-authlib and courier-imap are written in C++, which means you need to make sure the C++ compiler and the standard C++ library for your system are installed. The packages will have names like “gcc-c++” and “libstdc++-devel”. You will also need the “rpm-build” package as well. Run the following command to facilitate the installation of the required packages:
yum install rpm-build.x86_64 perl-CGI-Session.noarch gamin.x86_64 libtool openldap-devel mysql-devel zlib-devel sqlite-devel postgresql-devel gdbm-devel pam-devel expect gcc gcc-c++ libtool-ltdl-devel.x86_64 perl-Digest-MD5.x86_64 netpbm-progs mgetty-sendfax groff openssl-perl libidn-devel gamin-devel.x86_64 perl-ExtUtils-Embed.noarch mailcap.noarch
Download the source code for the current Courier–authlib and Courier from the official download page. I also downloaded the package courier-unicode, because required in compiling authlib and courier-maildrop.If you have not already done so, configure your home directory so that you can build RPM files without needing root privileges. This involves two steps: Create a directory structure RPMs in your home directory.
mkdir -m 755 rpm mkdir -m 755 rpm/BUILD mkdir -m 755 rpm/RPMS mkdir -m 755 rpm/SOURCES mkdir -m 755 rpm/SPECS mkdir -m 755 rpm/SRPMS
Create a .rpmmacros file in your home directory which contains a pointer to the directory structure you just created. I use a second line which marks any RPM packages I build with my own name and email address- while not strictly required, it is a good idea. My file looks like this:
%_topdir /home/thomasmilian/rpm %packager thomasmilian <email@example.com>
The next step will be to create rpm packages.
rpmbuild -ta courier-unicode-1.4.tar.bz2 rpmbuild -ta courier-authlib-0.66.3.tar.bz2 rpmbuild -ta courier-0.75.0.20150809.tar.bz2 rpmbuild -ta maildrop-220.127.116.1150809.tar.bz2
in path /home/”user-name”/rpm/RPMS/x86_64/