Saturday, July 2, 2011

Script For Automatically Setting Up A Perfect Server On OpenSUSE 11.4 And Installing ISPConfig 3

, and in the end it also installs ISPConfig 3.

Please note: do not execute this script on an already working server, because this script may overwrite configuration files and break the running system. It is only meant to be used on a fresh installation of OpenSUSE 11.4.

If you are installing on OpenSUSE 11.2 or OpenSUSE 11.3, please be sure to use another version of this script (also available on www.howtoforge.com).

There are few things missing from the tutorial, as I have found it. I have made a script, based on the tutorial, that prepares a system, and which contains several steps that, if not done, leave the system unfinished in some way.

Notable additions:

fail2ban configurationSuSEfirewall2 enabled
Pure-ftpd configuration change (allow renames, change passive ports and permissions) Postfix certificate generation Apache SSL certificate generation, and switching ISPConfig to HTTPSFix of NameVirtualHost apache config with OpenSUSE (important for Apache to recognize multiple domains from ISPConfig) Setup of rdiff-backup with cron Fixed dovecot configuration to enable SSL and support courier-compatibilityFixed pam_mysql to work on 64-bit systemsFixed amavis to find clamd socketInstalled eAcceleratorFixed apache custom errors pathInstall and configure awstatsConfigure apache and awstats to use mod_logio for correct bandwidth measurement

The script is imperfect in the fact that it requires manual entries twice - when mysql_secure_install is run, and when ispconfig_update_svn is run. (I use svn, because ISPConfig latest SVN looks much nicer, but one can type stable as well - on production systems, you should use stable!)

Do

zypper update

and

reboot

before running this script.

Also better change host name (file HOSTNAME) manually with yast2 before running this script, so that OpenSUSE will put a proper name into Postfix configuration.

This script requires two manual actions:

First - when mysql_secure_install is run.
Second - for ISPConfig3 update, if SVN update is chosen, one may need to say 'y' to enable SSL, while for all other options - one can choose a default value by just pressing ENTER.

You should change the following variables in the script before you run it:

THIS_PLATFORM: Either x86_64 or i586.

MYSQLROOTPASS: Please change MYSQLROOTPASS, and be sure to enter it verbatim during the installation of mysql_secure_install.

MY_HOSTNAME, MY_DOMAIN: Change this to your server name. By default it's configured to server1.mydomain.com. If your web site hosts a complete domain, such as domain.com, still leave something for MY_HOSTNAME. server1 or host is a good name.

ISPCONFIG_TAR_GZ: Make sure that ISPCONFIG_TAR_GZ holds the latest available ISPConfig 3 version. Beware, that automatic piping to answer all the questions is set up to work with ISPConfig 3.0.3.3, and you may need to change that part of the script, if ISPConfig is of a later version.

Save the script on your server (e.g. /root/opensuse_ispconfig3.sh):

vi /root/opensuse_ispconfig3.sh

#!/bin/sh

# OpenSUSE 11.4 Perfect Server ISPConfig script by George Yohng (georgesc#oss3d.com)
# Script Version 2.1

# Do zypper update and reboot before running this script

# Also better change host name manually with yast2 before running this script.

# This script requires two manual actions.

# First - when mysql_secure_install is running. One should type a new mysql password, the same as here
# Second - for ISPConfig3 update. One should type 'svn' when the update type is asked
# For both of scripts, all other options are default, one can just press ENTER.


# Also, please change MYSQLROOTPASS below, and be sure to enter it verbatim
# during the installation of mysql_secure_install.

# Important: When setting an MX entry, point it to mail.yourdomain.com rather than
# just to yourdomain.com, and create a CNAME entry for mail. Otherwise it doesn't
# seem to work somehow.

# Platform is x86_64 or i586

THIS_PLATFORM

View the Original article