From 663619e7d5290643e97da7ce9a4d1429714925d4 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 3 Sep 2008 21:44:57 +0000
Subject: [PATCH] - Added support for CentOS 5.2

---
 INSTALL_CENTOS_5.2.txt              | 218 ++++++++++++++++++++++++++++
 INSTALL_FEDORA_9.txt                |  14 +-
 install/dist/conf/centos52.conf.php |  86 +++++++++++
 install/dist/lib/centos52.lib.php   |  36 +++++
 install/lib/install.lib.php         |  14 +-
 5 files changed, 359 insertions(+), 9 deletions(-)
 create mode 100644 INSTALL_CENTOS_5.2.txt
 create mode 100644 install/dist/conf/centos52.conf.php
 create mode 100644 install/dist/lib/centos52.lib.php

diff --git a/INSTALL_CENTOS_5.2.txt b/INSTALL_CENTOS_5.2.txt
new file mode 100644
index 0000000000..f5766ac5e9
--- /dev/null
+++ b/INSTALL_CENTOS_5.2.txt
@@ -0,0 +1,218 @@
+Installation
+-----------
+
+It is recommended to use a clean (fresh) CentOS 5.2 install. Then follow the steps below to setup your server with ISPConfig 3:
+
+Installation of some basic requirements:
+
+rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
+yum update
+yum groupinstall 'Development Tools'
+yum groupinstall 'Development Libraries'
+
+You should disable selinux now, as some programs will not start when selinux is enabled:
+
+system-config-securitylevel-tui
+
+then reboot the server.
+
+
+1) Install Postfix, Courier, Saslauthd, MySQL, phpMyAdmin with the following command line (on one line!):
+
+yum install ntp httpd mysql-server php php-mysql php-mbstring rpm-build gcc mysql-devel openssl-devel cyrus-sasl-devel pkgconfig zlib-devel phpMyAdmin pcre-devel openldap-devel postgresql-devel expect libtool-ltdl-devel openldap-servers libtool gdbm-devel pam-devel gamin-devel postfix
+
+rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
+
+cd /tmp
+wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
+rpm -i rpmforge-release-0.3.6-1.el5.rf.i386.rpm
+yum update
+
+yum install getmail
+
+useradd -m -s /bin/bash compileuser
+passwd compileuser
+
+visudo
+
+## Allow root to run any commands anywhere
+root    ALL=(ALL)       ALL
+compileuser   ALL=(ALL)       ALL
+
+
+su compileuser
+
+mkdir $HOME/rpm
+mkdir $HOME/rpm/SOURCES
+mkdir $HOME/rpm/SPECS
+mkdir $HOME/rpm/BUILD
+mkdir $HOME/rpm/SRPMS
+mkdir $HOME/rpm/RPMS
+mkdir $HOME/rpm/RPMS/i386
+
+echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros
+
+
+wget http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2
+wget http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2
+wget http://prdownloads.sourceforge.net/courier/maildrop-2.0.4.tar.bz2
+
+sudo rpmbuild -ta courier-authlib-0.61.0.tar.bz2
+
+sudo rpm -ivh /home/compileuser/rpm/RPMS/i386/courier-authlib-0.61.0-1.i386.rpm
+sudo rpm -ivh /home/compileuser/rpm/RPMS/i386/courier-authlib-mysql-0.61.0-1.i386.rpm
+sudo rpm -ivh /home/compileuser/rpm/RPMS/i386/courier-authlib-devel-0.61.0-1.i386.rpm
+
+rpmbuild -ta courier-imap-4.4.1.tar.bz2
+
+sudo rpm -ivh /home/compileuser/rpm/RPMS/i386/courier-imap-4.4.1-1.i386.rpm
+
+sudo rpmbuild -ta maildrop-2.0.4.tar.bz2
+
+sudo rpm -ivh /home/compileuser/rpm/RPMS/i386/maildrop-2.0.4-1.i386.rpm
+
+exit
+
+chkconfig --levels 235 mysqld on
+/etc/init.d/mysqld start
+
+chkconfig --levels 235 httpd on
+/etc/init.d/httpd start
+
+chkconfig --levels 235 courier-authlib on
+/etc/init.d/courier-authlib start
+
+chkconfig --levels 235 sendmail off
+chkconfig --levels 235 postfix on
+chkconfig --levels 235 saslauthd on
+/etc/init.d/sendmail stop
+/etc/init.d/postfix start
+/etc/init.d/saslauthd start
+
+chkconfig --levels 235 courier-imap on
+/etc/init.d/courier-authlib restart
+/etc/init.d/courier-imap restart
+
+
+Set the mysql database password:
+
+mysqladmin -u root password yourrootsqlpassword
+mysqladmin -h ispconfig.local -u root password yourrootsqlpassword
+
+
+2) Install Amavisd-new, Spamassassin and Clamav (1 line!):
+
+yum install amavisd-new spamassassin clamav clamd clamav-data clamav-server clamav-update unzip bzip2 unrar
+
+chkconfig --levels 235 amavisd on
+chkconfig --levels 235 clamd on
+/usr/bin/freshclam
+/etc/init.d/amavisd start
+/etc/init.d/clamd start
+
+3) Install apache, PHP5 and phpmyadmin (1 line!):
+
+yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mapserver php-mbstring php-mcrypt php-mhash php-mssql php-shout php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel phpmyadmin
+
+
+4) Install pure-ftpd and quota
+
+cd /tmp
+wget http://centos.karan.org/el5/extras/testing/i386/RPMS/pure-ftpd-1.0.21-15.el5.kb.i386.rpm
+rpm -i pure-ftpd-1.0.21-15.el5.kb.i386.rpm
+
+yum install quota
+
+chkconfig --levels 235 pure-ftpd on
+/etc/init.d/pure-ftpd start
+
+5) Install mydns
+
+wget http://mydns.bboy.net/download/mydns-mysql-1.1.0-1.i386.rpm
+rpm -ivh mydns-mysql-1.1.0-1.i386.rpm
+
+chkconfig --levels 235 mydns on
+
+6) Install vlogger and webalizer
+
+yum install webalizer perl-DateTime-Format-HTTP perl-DateTime-Format-Builder
+
+cd /tmp
+wget http://n0rp.chemlab.org/vlogger/vlogger-1.3.tar.gz
+tar xvfz vlogger-1.3.tar.gz
+mv vlogger-1.3/vlogger /usr/sbin/
+rm -rf vlogger*
+
+7) Install ISPConfig 3
+
+Disable the firewall:
+
+system-config-securitylevel-tui
+
+There are two possile scenarios, but not both:
+7.1) Install the latest released version 
+7.2) Install directly from SVN
+
+7.1) Installation of beta 3 from tar.gz
+
+  cd /tmp
+  wget http://www.ispconfig.org/downloads/ISPConfig-3.0.0.6-beta.tar.gz
+  tar xvfz ISPConfig-3.0.0.6-beta.tar.gz
+  cd ispconfig3_install/install/
+
+7.2) Installation from SVN
+
+  yum install subversion
+  cd /tmp
+  svn export svn://svn.ispconfig.org/ispconfig3/trunk/
+  cd trunk/install
+
+
+7.1+7.2) Now proceed with the ISPConfig installation.
+
+Now start the installation process by executing:
+
+php -q install.php
+
+The installer will configure all services like postfix, sasl, courier, etc. for you. A manual setup as required for ISPConfig 2 (perfect setup guides) is not nescessary. To login to the ISPConfig controlpanel, open the following URL in your browser (replace the IP to match your settings!):
+
+http://192.168.0.100:8080/
+
+the default login is:
+
+user: admin
+password: admin
+
+In case you get a permission denied error from apache, please restart the apache webserver process.
+
+Optional:
+
+Install a webbased FTP Client
+
+yum install squirrelmail
+
+
+----------------------------------------------------------------------------------------------------------
+
+Hints:
+
+debian 4.0 under openvz:
+
+VPSID=101
+for CAP in CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE
+do
+  vzctl set $VPSID --capability ${CAP}:on --save
+done
+
+----------------------------------------------------------------------------------------------------------
+
+Installing Jailkit:
+
+cd /tmp
+wget http://olivier.sessink.nl/jailkit/jailkit-2.5.tar.gz
+tar xvfz jailkit-2.5.tar.gz
+cd jailkit-2.5
+./configure
+make
+make install
+rm -rf jailkit-2.5*
diff --git a/INSTALL_FEDORA_9.txt b/INSTALL_FEDORA_9.txt
index af460a8a3e..09be8b6a6a 100644
--- a/INSTALL_FEDORA_9.txt
+++ b/INSTALL_FEDORA_9.txt
@@ -54,17 +54,17 @@ wget http://prdownloads.sourceforge.net/courier/maildrop-2.0.4.tar.bz2
 
 sudo rpmbuild -ta courier-authlib-0.61.0.tar.bz2
 
-sudo rpm -ivh /home/compile/rpm/RPMS/i386/courier-authlib-0.61.0-1.fc9.i386.rpm
-sudo rpm -ivh /home/compile/rpm/RPMS/i386/courier-authlib-mysql-0.61.0-1.fc9.i386.rpm
-sudo rpm -ivh /home/compile/rpm/RPMS/i386/courier-authlib-devel-0.61.0-1.fc9.i386.rpm
+sudo rpm -ivh /home/compileuser/rpm/RPMS/i386/courier-authlib-0.61.0-1.fc9.i386.rpm
+sudo rpm -ivh /home/compileuser/rpm/RPMS/i386/courier-authlib-mysql-0.61.0-1.fc9.i386.rpm
+sudo rpm -ivh /home/compileuser/rpm/RPMS/i386/courier-authlib-devel-0.61.0-1.fc9.i386.rpm
 
 rpmbuild -ta courier-imap-4.4.1.tar.bz2
 
-sudo rpm -ivh /home/compile/rpm/RPMS/i386/courier-imap-4.4.1-1.9.i386.rpm
+sudo rpm -ivh /home/compileuser/rpm/RPMS/i386/courier-imap-4.4.1-1.9.i386.rpm
 
 sudo rpmbuild -ta maildrop-2.0.4.tar.bz2
 
-sudo rpm -ivh /home/compile/rpm/RPMS/i386/maildrop-2.0.4-1.9.i386.rpm
+sudo rpm -ivh /home/compileuser/rpm/RPMS/i386/maildrop-2.0.4-1.9.i386.rpm
 
 exit
 
@@ -146,8 +146,8 @@ ISPConfig comes with a iptables bsed firewall script that can be meneged from wi
 8) Install ISPConfig 3
 
 There are two possile scenarios, but not both:
-7.1) Install the latest released version 
-7.2) Install directly from SVN
+8.1) Install the latest released version 
+8.2) Install directly from SVN
 
 8.1) Installation of beta 3 from tar.gz
 
diff --git a/install/dist/conf/centos52.conf.php b/install/dist/conf/centos52.conf.php
new file mode 100644
index 0000000000..24b6e64d5c
--- /dev/null
+++ b/install/dist/conf/centos52.conf.php
@@ -0,0 +1,86 @@
+<?php
+
+//***  Fedora 9 default settings
+
+//* Main
+$conf['language'] = 'en';
+$conf['distname'] = 'centos52';
+$conf['hostname'] = 'server1.example.com'; // Full hostname
+$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
+$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
+$conf['ispconfig_log_priority'] = 2;  // 0 = Debug, 1 = Warning, 2 = Error
+$conf['server_id'] = 1;
+$conf['init_scripts'] = '/etc/init.d';
+$conf['runlevel'] = '/etc';
+$conf['shells'] = '/etc/shells';
+$conf['cron_tab'] = '/var/spool/cron/root';
+$conf['pam'] = '/etc/pam.d';
+
+//* MySQL
+$conf['mysql']['init_script'] = 'mysqld';
+$conf['mysql']['host'] = 'localhost';
+$conf['mysql']['ip'] = '127.0.0.1';
+$conf['mysql']['port'] = '3306';
+$conf['mysql']['database'] = 'dbispconfig';
+$conf['mysql']['admin_user'] = 'root';
+$conf['mysql']['admin_password'] = '';
+$conf['mysql']['ispconfig_user'] = 'ispconfig';
+$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+
+//* Apache
+$conf['apache']['user'] = 'apache';
+$conf['apache']['group'] = 'apache';
+$conf['apache']['init_script'] = 'httpd';
+$conf['apache']['version'] = '2.2';
+$conf['apache']['vhost_conf_dir'] = '/etc/httpd/conf/sites-available';
+$conf['apache']['vhost_conf_enabled_dir'] = '/etc/httpd/conf/sites-enabled';
+$conf['apache']['vhost_port'] = '8080';
+
+//* Postfix
+$conf['postfix']['config_dir'] = '/etc/postfix';
+$conf['postfix']['init_script'] = 'postfix';
+$conf['postfix']['user'] = 'postfix';
+$conf['postfix']['group'] = 'postfix';
+$conf['postfix']['vmail_userid'] = '5000';
+$conf['postfix']['vmail_username'] = 'vmail';
+$conf['postfix']['vmail_groupid'] = '5000';
+$conf['postfix']['vmail_groupname'] = 'vmail';
+$conf['postfix']['vmail_mailbox_base'] = '/home/vmail';
+
+//* Getmail
+$conf['getmail']['config_dir'] = '/etc/getmail';
+$conf['getmail']['program'] = '/usr/bin/getmail';
+
+//* Courier
+$conf['courier']['config_dir'] = '/etc/authlib';
+$conf['courier']['courier-authdaemon'] = 'courier-authlib';
+$conf['courier']['courier-imap'] = 'courier-imap';
+$conf['courier']['courier-imap-ssl'] = 'courier-imap';
+$conf['courier']['courier-pop'] = 'courier-imap';
+$conf['courier']['courier-pop-ssl'] = 'courier-imap';
+
+//* SASL
+$conf['saslauthd']['config'] = '/etc/sysconfig/saslauthd';
+$conf['saslauthd']['init_script'] = 'saslauthd';
+
+//* Amavisd
+$conf['amavis']['config_dir'] = '/etc/amavisd';
+$conf['amavis']['init_script'] = 'amavisd';
+
+//* ClamAV
+$conf['clamav']['init_script'] = 'clamd';
+
+//* Pureftpd
+$conf['pureftpd']['config_dir'] = '/etc/pure-ftpd';
+$conf['pureftpd']['init_script'] = 'pure-ftpd';
+
+//* MyDNS
+$conf['mydns']['config_dir'] = '/etc';
+$conf['mydns']['init_script'] = 'mydns';
+
+//* Jailkit
+$conf['jailkit']['config_dir'] = '/etc/jailkit';
+$conf['jailkit']['jk_init'] = 'jk_init.ini';
+$conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
+
+?>
\ No newline at end of file
diff --git a/install/dist/lib/centos52.lib.php b/install/dist/lib/centos52.lib.php
new file mode 100644
index 0000000000..aed95f5e7d
--- /dev/null
+++ b/install/dist/lib/centos52.lib.php
@@ -0,0 +1,36 @@
+<?php
+
+/*
+Copyright (c) 2008, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+class installer extends installer_dist {
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index ff47eee828..c78c0f03b3 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -105,6 +105,14 @@ function get_distname() {
 			swriteln("Operating System: Fedora 9 or compatible\n");
 		}
 		
+		if(stristr($content,'CentOS release 5.2 (Final)')) {
+			$distname = 'CentOS';
+			$distver = '5.2';
+			$distid = 'centos52';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: CentOS 5.2 or compatible\n");
+		}
+		
 		
 	} else {
 		die('unrecognized linux distribution');
@@ -502,7 +510,7 @@ function is_group($group){
 }
 
 function replaceLine($filename,$search_pattern,$new_line,$strict = 0) {
-		$lines = file($filename);
+	if($lines = @file($filename)) {
 		$out = '';
 		$found = 0;
 		foreach($lines as $line) {
@@ -526,10 +534,11 @@ function replaceLine($filename,$search_pattern,$new_line,$strict = 0) {
 			$out .= $new_line."\n";
 		}
 		file_put_contents($filename,$out);
+	}
 }
 	
 function removeLine($filename,$search_pattern,$strict = 0) {
-		$lines = file($filename);
+	if($lines = @file($filename)) {
 		$out = '';
 		foreach($lines as $line) {
 			if($strict == 0) {
@@ -543,6 +552,7 @@ function removeLine($filename,$search_pattern,$strict = 0) {
 			}
 		}
 		file_put_contents($filename,$out);
+	}
 }
 
 
-- 
GitLab