The Perfect Server - OpenSUSE 13.1 x86_64 (Apache2, MySQL, PHP, Postfix, Dovecot and ISPConfig 3) - Page 4

8 Install Postfix, Dovecot, MySQL


zypper install postfix postfix-mysql mysql-community-server libmysqlclient-devel dovecot21 dovecot21-backend-mysql pwgen cron python

If you get the following message, please select to uninstall exim:

Problem: sendmail-8.14.5-85.1.2.x86_64 conflicts with postfix provided by postfix-2.9.6-1.2.1.x86_64
 Solution 1: Following actions will be done:
  do not install postfix-2.9.6-1.2.1.x86_64
  do not install postfix-mysql-2.9.6-1.2.1.x86_64
 Solution 2: deinstallation of sendmail-8.14.5-85.1.2.x86_64

Choose from above solutions by number or cancel [1/2/c] (c):
 <-- 2

Create the following symlink:

ln -s /usr/lib64/dovecot/modules /usr/lib/dovecot

At this point I had to reboot because otherwise MySQL refused to start with the error:

Failed to issue method call: Unit mysql.service failed to load: No such file or directory. See system logs and 'systemctl status mysql.service' for details.

Open theMySQL configuration file /etc/my.cnf with an editor

vi /etc/my.cnf

and change the line "sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES" to:


Then open the file /usr/my.cnf with an editor

vi /usr/my.cnf

and change sql mode to 


there as well.

Start MySQL, Postfix, and Dovecot and enable the services to be started at boot time.

systemctl enable mysql.service
systemctl start mysql.service
systemctl enable postfix.service
systemctl start postfix.service
systemctl enable dovecot.service
systemctl start dovecot.service

Now I install the getmail package:

zypper install getmail

To secure the MySQL installation, run:


Now you will be asked several questions:

server1:~ # mysql_secure_installation


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]
 <-- Y
New password: <-- yourrootsqlpassword
Re-enter new password: <-- yourrootsqlpassword
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 <-- Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 <-- Y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 <-- Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 <-- Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

server1:~ #

Now your MySQL setup should be secured.


9 Amavisd-new, Spamassassin And Clamav

Install Amavisd-new, Spamassassin and Clamav antivirus. Run

zypper install amavisd-new clamav clamav-db zoo unzip unrar bzip2 unarj perl-DBD-mysql

Open /etc/amavisd.conf...

vi /etc/amavisd.conf

... and add the $myhostname line with your correct hostname below the $mydomain line:

$mydomain = '';   # a convenient default for other settings
$myhostname = "server1.$mydomain";

Then create a symlink from /var/run/clamav/clamd to /var/lib/clamav/clamd-socket:

mkdir -p /var/run/clamav
ln -s /var/lib/clamav/clamd-socket /var/run/clamav/clamd

OpenSUSE 13.1 has a /run directory for storing runtime data. /run is now a tmpfs, and /var/run is now bind mounted to /run from tmpfs, and hence emptied on reboot.

This means that after a reboot, the directory /var/run/clamav that we have just created will not exist anymore, and therefore clamd will fail to start. Therefore we create the file /etc/tmpfiles.d/clamav.conf now that will create this directory at system startup (see for more details):

vi /etc/tmpfiles.d/clamav.conf
D /var/run/clamav 0755 root root -

Before we start amavisd and clamd, we must edit the /etc/init.d/amavis init script - I wasn't able to reliably start, stop and restart amavisd with the default init script:

vi /etc/init.d/amavis

Comment out the following lines in the start and stop section:

        # ZMI 20100428 check for stale pid file
        #if test -f $AMAVIS_PID ; then
        #       checkproc -p $AMAVIS_PID amavisd
        #       if test $? -ge 1 ; then
        #               # pid file is stale, remove it
        #               echo -n "(stale amavisd pid file $AMAVIS_PID found, removing. Did amavisd crash?)"
        #               rm -f $AMAVIS_PID
        #       fi
        echo -n "Starting virus-scanner (amavisd-new): "
        $AMAVISD_BIN start
        #if ! checkproc amavisd; then
        #    rc_failed 7
        rc_status -v
        #if [ "$AMAVIS_SENDMAIL_MILTER" == "yes" ]; then
        #    rc_reset
        #    echo -n "Starting amavis-milter:"
        #    startproc -u vscan $AMAVIS_MILTER_BIN -p $AMAVIS_MILTER_SOCK > /dev/null 2>&1
        #    rc_status -v
        echo -n "Shutting down virus-scanner (amavisd-new): "
        #if checkproc amavisd; then
        #    rc_reset
            $AMAVISD_BIN stop
        #    rc_reset
        rc_status -v
        #if [ "$AMAVIS_SENDMAIL_MILTER" == "yes" ]; then
        #    rc_reset
        #    echo -n "Shutting down amavis-milter: "
        #    killproc -TERM $AMAVIS_MILTER_BIN
        #    rc_status -v

Because we have changed the init script, we must run

systemctl --system daemon-reload


To start clamav we need to download the database & proceed further with the command


Note: It takes a lot of time to download the database, you are advised not to interrupt & do not stop the freshclam update service in between

To enable the services, run:

systemctl enable amavis.service
systemctl enable clamd.service
systemctl start amavis.service
systemctl start clamd.service


10 Install The Apache 2 Webserver With PHP5, Ruby, Python, WebDAV

Install Apache2 and suphp. Run:

zypper install apache2 apache2-mod_fcgid

Install PHP5:

zypper install php5-bcmath php5-bz2 php5-calendar php5-ctype php5-curl php5-dom php5-ftp php5-gd php5-gettext php5-gmp php5-iconv php5-imap php5-ldap php5-mbstring php5-mcrypt php5-mysql php5-odbc php5-openssl php5-pcntl php5-pgsql php5-posix php5-shmop php5-snmp php5-soap php5-sockets php5-sqlite php5-sysvsem php5-tokenizer php5-wddx php5-xmlrpc php5-xsl php5-zlib php5-exif php5-fastcgi php5-pear php5-sysvmsg php5-sysvshm ImageMagick curl apache2-mod_php5
zypper install

Then run these commands to enable the Apache modules (including WebDAV):

a2enmod socache_shmcb
a2enmod suexec
a2enmod rewrite
a2enmod ssl
a2enmod actions
a2enmod suphp
a2enmod fcgid
a2enmod dav
a2enmod dav_fs
a2enmod dav_lock
a2enmod logio
chown root:www /usr/sbin/suexec2
chmod 4755 /usr/sbin/suexec2
a2enflag SSL

To add Python support, run:

zypper --gpg-auto-import-keys addrepo --name "Python Support (Apache_openSUSE_13.1)"  apache-Modules
 zypper install apache2-mod_python
a2enmod python

Next we install phpMyAdmin:

zypper install phpMyAdmin

To make sure that we can access phpMyAdmin from all websites created through ISPConfig later on by using /phpmyadmin (e.g. and /phpMyAdmin (e.g., open /etc/apache2/conf.d/phpMyAdmin.conf...

vi /etc/apache2/conf.d/phpMyAdmin.conf

... and add the following two aliases right at the beginning:

Alias /phpMyAdmin /srv/www/htdocs/phpMyAdmin
Alias /phpmyadmin /srv/www/htdocs/phpMyAdmin

Before starting apache we need to follow the link & make changes in httpd.conf

vi /etc/apache2/httpd.conf

Comment these lines & add these lines

#<Directory />
#    Options None
   AllowOverride None
   Order deny,allow
#   Deny from all

<Directory />
Options None
AllowOverride None
Require all denied

Now start the Apache service

systemctl enable apache2.service
systemctl start apache2.service


10.1 PHP-FPM

Starting with ISPConfig 3.0.5, there is an additional PHP mode that you can select for usage with Apache: PHP-FPM.

To use PHP-FPM with Apache, we need the mod_fastcgi Apache module (please don't mix this up with mod_fcgid - they are very similar, but you cannot use PHP-FPM with mod_fcgid). We can install PHP-FPM and mod_fastcgi as follows:

mod_fastcgi is available from a third-party repository which we can enable it as follows:

Next we install Fastcgi and PHP-FPM:

zypper install fastcgi php5-fpm

Now download and install mod_fastcgi:

cd /tmp
rpm -i apache2-mod_fastcgi-2.4.7_SNAP_0910052141-3.1.x86_64.rpm
a2enmod mod_fastcgi

Before we start PHP-FPM, rename /etc/php5/fpm/php-fpm.conf.default to /etc/php5/fpm/php-fpm.conf:

mv /etc/php5/fpm/php-fpm.conf.default /etc/php5/fpm/php-fpm.conf

Change the permissions of PHP's session directory:

chmod 1733 /var/lib/php5

Then open /etc/php5/fpm/php-fpm.conf...

vi /etc/php5/fpm/php-fpm.conf

... and change error_log to /var/log/php-fpm.log:

error_log = /var/log/php-fpm.log

There's no php.ini file for PHP-FPM under OpenSUSE 13.1, therefore we copy the CLI php.ini:

cp /etc/php5/cli/php.ini /etc/php5/fpm/

Next open /etc/php5/fpm/php.ini...

vi /etc/php5/fpm/php.ini

... and set cgi.fix_pathinfo to 0:

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts

Next create the system startup links for php-fpm and start it:

systemctl enable php-fpm.service 
systemctl start php-fpm.service

PHP-FPM is a daemon process that runs a FastCGI server on port 9000, as you can see in the output of

netstat -tapn
server1:~ # netstat -tapn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0    *               LISTEN      2329/nginx
tcp        0      0    *               LISTEN      1204/sshd
tcp        0      0*               LISTEN      2511/php-fpm.conf)
tcp        0      0  *               LISTEN      2059/mysqld
tcp        0      0      ESTABLISHED 1284/0
tcp        0      0 :::22                   :::*                    LISTEN      1204/sshd
server1:~ #

Next enable the following Apache modules...

a2enmod actions
a2enmod fastcgi
a2enmod alias

... and restart Apache:

systemctl restart apache2.service

Share this page:

8 Comment(s)

Add comment

Please register in our forum first to comment.


By: Nilton OS

mkdir -p /var/run/clamav
ln -s /var/lib/clamav/clamd-socket /var/run/clamav/clamd


Change to:

mkdir -p /var/run/clamav
ln -s /var/run/clamav/clamd-socket /var/run/clamav/clamd

By: Nilton OS

vi /etc/tmpfiles.d/clamav.conf


Clamd created after boot

By: Anonymous

10.1 PHP-FPM


rpm -i apache2-mod_fastcgi-2.4.7_SNAP_0910052141-3.1.x86_64.rpm


rpm -i apache2-mod_fastcgi-2.4.7_SNAP_0910052141-4.1.x86_64.rpm





rpm -i apache2-mod_fastcgi-2.4.7_SNAP_0910052141-4.1.x86_64.rpm




rpm -i apache2-mod_fastcgi-2.4.7_SNAP_0910052141-4.2.x86_64.rpm

By: Anonymous

10 Install The Apache 2 Webserver With PHP5, Ruby, Python, WebDAV


 zypper install


 zypper install


By: Sven Mitscherlich

In order to successfully complete the apache installation you must add php5 to the enabled modules ... without that you encounter at least at the restart of apache after the installation of phpmyadmin and squirrelmail problems because apache will not start anymore ..

Syntax error on line 4 of /etc/apache2/conf.d/squirrelmail.conf:

Invalid command 'php_admin_flag', perhaps misspelled or defined by a module not included in the serv...


To avoid this issue the following command right after enabling the other modules:

 a2enmod php5


Hope that helps others to avoid the obstacles I went into


The available version is now 4.2


By: hjoska

10.1 PHP-FPM

I am unable to get apache2-mod_fastcgi-2.4.7_SNAP_0910052141-3.1.x86_64.rpm. It seem to me it doesnot exists in any 13.1 repository, only the Tumbleweed version.

What would be a solution? Any help is appreciated.