The Perfect Server - Mandriva 2009.0 Free (i386) - Page 6

12 Apache2 With PHP5, Ruby, And Python

To install Apache2, PHP5, and Ruby, run the following command (in one line):

urpmi apache-mod_suexec apache-mod_ssl apache-mod_php apache-mod_ruby apache-mod_python libphp5_common5 php-bz2 php-calendar php-ctype php-curl php-devel php-dio php-dom php-eaccelerator php-enchant php-esmtp php-event php-exif php-fam php-ffmpeg php-fileinfo php-filepro php-ftp php-gd php-gettext php-gmp php-iconv php-id3 php-idn php-imap php-imlib2 php-mailparse php-mbstring php-mcache php-mcrypt php-mhash php-ming php-mysql php-mysqli php-ncurses php-newt php-odbc php-oggvorbis php-pcntl php-pcre php-pear-Net_IDNA php-posix php-pspell php-readline php-recode php-session php-shmop php-simplexml php-snmp php-soap php-sockets php-sqlite php-ssh2 php-suhosin php-sysvmsg php-sysvsem php-sysvshm php-tclink php-tcpwrap php-tidy php-xml php-xmlrpc php-zip php-ini curl libcurl4-devel perl-libwww-perl ImageMagick

Create the system startup links for Apache...

chkconfig httpd on

... and start it:

/etc/init.d/httpd restart


12.1 Disable PHP Globally

(If you do not plan to install ISPConfig on this server, please skip this section!)

In ISPConfig you will configure PHP on a per-website basis, i.e. you can specify which website can run PHP scripts and which one cannot. This can only work if PHP is disabled globally because otherwise all websites would be able to run PHP scripts, no matter what you specify in ISPConfig.

Edit /etc/httpd/modules.d/70_mod_php.conf and comment out the AddType lines:

vi /etc/httpd/modules.d/70_mod_php.conf

<IfDefine HAVE_PHP5>
    <IfModule !mod_php5.c>
        LoadModule php5_module    extramodules/

<IfModule mod_mime.c>
    #AddType application/x-httpd-php .php
    #AddType application/x-httpd-php .phtml
    #AddType application/x-httpd-php-source .phps

<IfModule mod_php5.c>
    <IfModule mod_dir.c>
        DirectoryIndex index.php index.phtml

Edit /etc/httpd/conf/httpd.conf and add the following line to the LoadModule section:

vi /etc/httpd/conf/httpd.conf

LoadModule php5_module    extramodules/

(Although this line is already in /etc/httpd/modules.d/70_mod_php.conf this is very important because otherwise the command

httpd -t

will report errors instead of Syntax OK when the virtual hosts created by ISPConfig contain lines like php_admin_flag safe_mode On or the like!)

Restart Apache:

/etc/init.d/httpd restart


12.2 Disable Ruby Globally

(If you do not plan to install ISPConfig on this server, please skip this section!)

In ISPConfig you will configure Ruby on a per-website basis, i.e. you can specify which website can run Ruby scripts and which one cannot. This can only work if Ruby is disabled globally because otherwise all websites would be able to run Ruby scripts, no matter what you specify in ISPConfig.

vi /etc/httpd/modules.d/20_mod_ruby.conf

Comment out or delete everything in that file except the following lines:

<IfDefine HAVE_RUBY>
    <IfModule !mod_ruby.c>
        LoadModule ruby_module  extramodules/

Then restart Apache:

/etc/init.d/httpd restart


13 Proftpd

Install Proftpd like this:

urpmi proftpd

For security reasons you can add the following lines to /etc/proftpd.conf (thanks to Reinaldo Carvalho; more information can be found here:

vi /etc/proftpd.conf

DefaultRoot ~
IdentLookups off
ServerIdent on "FTP Server ready."

Be sure to comment out the following lines at the end of /etc/proftpd.conf in order to allow ftp users to CHMOD:

# Bar use of SITE CHMOD by default
#    DenyAll

Then restart Proftpd:

/etc/init.d/proftpd restart


14 Webalizer

Mandriva 2009.0 doesn't come with a Webalizer package anymore, therefore we build the Webalizer binary like this:

urpmi libgeoip1 geoip libgeoipupdate0 awffull libgeoip-devel libgd-devel libgd2 libbzip2_1-devel libdb4.6-devel

cd /tmp
tar xvfz webalizer-2.20-01-src.tgz
cd webalizer-2.20-01
./configure --enable-dns --enable-geoip --enable-bz2
make install
cd ..
rm -fr webalizer-2.20-01*


15 Install Some Perl Modules Needed By SpamAssassin (Comes With ISPConfig)

To install all needed Perl Modules, we can use the appropriate Mandriva packages and install them using urpmi:

urpmi perl-HTML-Parser perl-Digest-SHA1 perl-DB_File perl-Net-DNS


16 The End

The configuration of the server is now finished, and if you wish you can now install ISPConfig on it. You can find the installation instructions here: A First-Steps tutorial can be found here:


17 A Note On SuExec

If you want to run CGI scripts under suExec, you should specify /var/www as the web root for websites created by ISPConfig as Mandriva's suExec is compiled with /var/www as Doc_Root. Run

/usr/sbin/suexec -V

and the output should look like this:

[root@server1 tmp]# /usr/sbin/suexec -V
 -D AP_DOC_ROOT="/var/www"
 -D AP_GID_MIN=100
 -D AP_HTTPD_USER="apache"
 -D AP_LOG_EXEC="/var/log/httpd/suexec_log"
 -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
 -D AP_UID_MIN=100
 -D AP_USERDIR_SUFFIX="public_html"
[root@server1 tmp]#

So if you want to use suExec with ISPconfig, don't change the default web root (which is /var/www) if you use expert mode during the ISPConfig installation (in standard mode you can't change the web root anyway so you'll be able to use suExec in any case).


18 Links

Share this page:

8 Comment(s)

Add comment


From: william at: 2009-05-03 13:07:12

hi can this set up be done with a dynamic ip as my isp don't do static ips

i am new to trying to host my own stuff

any help or info please thanks william

From: FACORAT Fabrice at: 2008-10-17 12:20:48

1. to add a media, you can do it easily with 1 line, without the need to use easyurpmi :

 urpmi.addmedia --distrib --mirrorlist

This command will automatically add all the remote FTP repositories, and will try to select the closest mirror for you. So if you want to only have remote repositories and removed the installation media, you'd better remove all the media/repositories, and then add the new ones :

 urpmi.removemedia -a && urpmi.addmedia --distrib --mirrorlist

2. if you want to do automatic updates, but only install packages from the updates repositories, you can now use --auto-update which will do at the same time a "urpmi.update -a" and a "urpmi --auto-select". So you auto-update script could look like this :

urpmi --auto-update --update  --auto

From: Hoyt at: 2009-03-02 18:57:08

I use a script that also includes the "--wait-lock" option so that the script will wait if another instance of urpmi happens to be running and has locked the database.

From: FACORAT Fabrice at: 2008-10-17 12:35:58

1. renaming the dovecot startup number will not fix dovecot ordering start. Indeed, Mandriva is using prcsys to start services in parallel based on the LSB tags explaining the service dependency : it doesn't use the service number.

So the proper fix to make dovecot be started after ntpd is to add a soft dependency of dovecot on ntpd by adding the following line in the header of the dovecot init file :

Should-Start: ntpd

2. I opened a bug report on Mandriva bugzilla, so maybe in a future update, this issue will be solved and you will no longer need to fix this manually :


From: Eagle at: 2009-02-18 00:44:43

mysql-devel is also needed for succesfuly instalation. Don't forget.

From: boyfren at: 2009-06-30 01:56:57

When I tried this code: urpmi cyrus-sasl libsasl2 libsasl2-devel libsasl2-plug-plain libsasl2-plug-anonymous libsasl2-plug-crammd5 libsasl2-plug-digestmd5 libsasl2-plug-gssapi libsasl2-plug-login postfix dovecot Most of them are not available on the media. How do I directly installl these from online repository?

From: FACORAT Fabrice at: 2008-10-17 12:47:08

1. Since at least Mandriva  2008.1 , there's a metapackage named task-lamp-php which will install most apache+php+mysql packages

urpmi task-lamp-php

Here is the list of packages installed by task-lamp :















2. installing  php-imagick is enough to install imagemagick package ( which no longer have capital letters ).

From: casjay at: 2009-01-04 05:48:38

There is a webalizer rpm package available at