Author Archives: admin

Virtual Users And Domains With Postfix, Courier And MySQL (CentOS 5.1)

Virtual Users And Domains With Postfix, Courier And MySQL (CentOS 5.1)

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 12/05/2007

This tutorial is Copyright (c) 2007 by Falko Timme. It is derived from a tutorial from Christoph Haas which you can find at http://workaround.org. You are free to use this tutorial under the Creative Commons license 2.5 or any later version.

This document describes how to install a Postfix mail server that is based on virtual users and domains, i.e. users and domains that are in a MySQL database. I’ll also demonstrate the installation and configuration of Courier (Courier-POP3, Courier-IMAP), so that Courier can authenticate against the same MySQL database Postfix uses.

The resulting Postfix server is capable of SMTP-AUTH and TLS and quota (quota is not built into Postfix by default, I’ll show how to patch your Postfix appropriately). Passwords are stored in encrypted form in the database (most documents I found were dealing with plain text passwords which is a security risk). In addition to that, this tutorial covers the installation of Amavisd, SpamAssassin and ClamAV so that emails will be scanned for spam and viruses.

The advantage of such a “virtual” setup (virtual users and domains in a MySQL database) is that it is far more performant than a setup that is based on “real” system users. With this virtual setup your mail server can handle thousands of domains and users. Besides, it is easier to administrate because you only have to deal with the MySQL database when you add new users/domains or edit existing ones. No more postmap commands to create db files, no more reloading of Postfix, etc. For the administration of the MySQL database you can use web based tools like phpMyAdmin which will also be installed in this howto. The third advantage is that users have an email address as user name (instead of a user name + an email address) which is easier to understand and keep in mind.

This tutorial is based on CentOS 5.1 (i386). You should already have set up a basic CentOS system, as described here: http://www.howtoforge.com/centos-5.1-server-lamp-email-dns-ftp-ispconfig and http://www.howtoforge.com/centos-5.1-server-lamp-email-dns-ftp-ispconfig-p2. Plus, you should make sure that the firewall is off (at least for now) and that SELinux is disabled (this is important!), as shown in the chapter six on http://www.howtoforge.com/centos-5.1-server-lamp-email-dns-ftp-ispconfig-p3.

This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

 

1 Edit /etc/hosts

Our hostname in this example is server1.example.com, and it has the IP address 192.168.0.100, so we change /etc/hosts as follows:

vi /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
192.168.0.100           server1.example.com server1
::1             localhost6.localdomain6 localhost6

 

2 Install Some Software

First we import the GPG keys for software packages:

rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY*

Then we update our existing packages on the system:

yum update

Now we install some software that we need later on:

yum groupinstall ‘Development Tools’

yum groupinstall ‘Development Libraries’

 

3 Install Apache, MySQL, phpMyAdmin

First we enable the RPMforge repository on our CentOS system as lots of the packages that we are going to install in the course of this tutorial are not available in the official CentOS 5.1 repositories:

rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

(If the above link doesn’t work anymore, you can find the current version of rpmforge-release here: http://apt.sw.be/packages/rpmforge-release/)

Afterwards we can install the needed packages with one single command (including the packages we need to build Courier-IMAP):

yum install ntp httpd mysql-server php php-mysql php-mbstring php-mcrypt phpmyadmin rpm-build gcc mysql-devel openssl-devel cyrus-sasl-devel pkgconfig zlib-devel pcre-devel openldap-devel postgresql-devel expect libtool-ltdl-devel openldap-servers libtool gdbm-devel pam-devel gamin-devel

 

4 Install Courier-IMAP, Courier-Authlib, And Maildrop

Unfortunately there are no rpm packages for Courier-IMAP, Courier-Authlib, and Maildrop, therefore we have to install them as described in this tutorial: How To Install courier-imap, courier-authlib, And maildrop On Fedora, RedHat, CentOS

In case you have problems creating the rpm packages, you can download mine:

  • courier-authlib-0.60.2-1.i386.rpm
  • courier-authlib-devel-0.60.2-1.i386.rpm
  • courier-authlib-mysql-0.60.2-1.i386.rpm
  • courier-imap-4.2.1-1.i386.rpm
  • maildrop-2.0.4-1.i386.rpm

 

5 Apply Quota Patch To Postfix

We have to get the Postfix source rpm, patch it with the quota patch, build a new Postfix rpm package and install it.

cd /usr/src
wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/centos/5.1/os/SRPMS/postfix-2.3.3-2.src.rpm
rpm -ivh postfix-2.3.3-2.src.rpm

The last command will show some warnings that you can ignore:

warning: user mockbuild does not exist – using root
warning: group mockbuild does not exist – using root

cd /usr/src/redhat/SOURCES
wget http://vda.sourceforge.net/VDA/postfix-2.3.3-vda.patch.gz
gunzip postfix-2.3.3-vda.patch.gz
cd /usr/src/redhat/SPECS/

Now we must edit the file postfix.spec:

vi postfix.spec

Change %define MYSQL 0 to %define MYSQL 1, add Patch0: postfix-2.3.3-vda.patch to the # Patches stanza, and finally add %patch0 -p1 -b .vda to the %setup -q stanza:

[...]
%define MYSQL 1
[...]
# Patches

Patch0: postfix-2.3.3-vda.patch
Patch1: postfix-2.1.1-config.patch
Patch3: postfix-alternatives.patch
Patch6: postfix-2.1.1-obsolete.patch
Patch7: postfix-2.1.5-aliases.patch
Patch8: postfix-large-fs.patch
Patch9: postfix-2.2.5-cyrus.patch
[...]
%setup -q
# Apply obligatory patches
%patch0 -p1 -b .vda
%patch1 -p1 -b .config
%patch3 -p1 -b .alternatives
%patch6 -p1 -b .obsolete
%patch7 -p1 -b .aliases
%patch8 -p1 -b .large-fs
%patch9 -p1 -b .cyrus
[...]

Then we build our new Postfix rpm package with quota and MySQL support:

rpmbuild -ba postfix.spec

You will see lots of warnings like these that you can ignore:

msg.h:12:1: warning: “/*” within comment
msg.h:14:1: warning: “/*” within comment
msg.h:33:1: warning: “/*” within comment
msg.h:34:1: warning: “/*” within comment
msg.h:35:1: warning: “/*” within comment
msg.h:36:1: warning: “/*” within comment

Our Postfix rpm package is created in /usr/src/redhat/RPMS/i386, so we go there:

cd /usr/src/redhat/RPMS/i386

The command

ls -l

shows you the available packages:

[root@server1 i386]# ls -l
total 11280
-rw-r–r– 1 root root 3819299 Dec  5 15:25 postfix-2.3.3-2.i386.rpm
-rw-r–r– 1 root root 7655069 Dec  5 15:25 postfix-debuginfo-2.3.3-2.i386.rpm
-rw-r–r– 1 root root   50346 Dec  5 15:25 postfix-pflogsumm-2.3.3-2.i386.rpm
[root@server1 i386]#

Pick the Postfix package and install it like this:

rpm -ivh postfix-2.3.3-2.i386.rpm

(In case you have problems creating the Postfix rpm package, you can download mine from here: postfix-2.3.3-2.i386.rpm.)

 

6 Set MySQL Passwords And Configure phpMyAdmin

Start MySQL:

chkconfig –levels 235 mysqld on
/etc/init.d/mysqld start

Then set passwords for the MySQL root account:

mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword

Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the <Directory “/usr/share/phpmyadmin”> stanza):

vi /etc/httpd/conf.d/phpmyadmin.conf

#
#  Web application to manage MySQL
#

#<Directory "/usr/share/phpmyadmin">
#  Order Deny,Allow
#  Deny from all
#  Allow from 127.0.0.1
#</Directory>

Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

Next we change the authentication in phpMyAdmin from cookie to http:

vi /usr/share/phpmyadmin/config.inc.php

[...]
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
[...]

Then we create the system startup links for Apache and start it:

chkconfig –levels 235 httpd on
/etc/init.d/httpd start

Now you can direct your browser to http://server1.example.com/phpmyadmin/ or http://192.168.0.100/phpmyadmin/ and log in with the user name root and your new root MySQL password.

  • Virtual Users And Domains With Postfix, Courier And MySQL (CentOS 5.1) – Page 2
  • Virtual Users And Domains With Postfix, Courier And MySQL (CentOS 5.1) – Page 3
  • Virtual Users And Domains With Postfix, Courier And MySQL (CentOS 5.1) – Page 4
  • Virtual Users And Domains With Postfix, Courier And MySQL (CentOS 5.1) – Page 5

next Virtual Users And Domains With Postfix, Courier And MySQL (CentOS 5.1) – Page 2
[Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License]This page is licensed under a Creative Commons License.

Related Tutorials

CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server)

CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server)

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 12/04/2007

This tutorial shows how to set up a CentOS 5.1 based server that offers all services needed by ISPs and web hosters: Apache web server (SSL-capable), Postfix mail server with SMTP-AUTH and TLS, BIND DNS server, Proftpd FTP server, MySQL server, Dovecot POP3/IMAP, Quota, Firewall, etc. This tutorial is written for the 32-bit version of CentOS 5.1, but should apply to the 64-bit version with very little modifications as well.

I will use the following software:

  • Web Server: Apache 2.2 with PHP 5.1.6
  • Database Server: MySQL 5.0
  • Mail Server: Postfix
  • DNS Server: BIND9 (chrooted)
  • FTP Server: Proftpd
  • POP3/IMAP server: Dovecot
  • Webalizer for web site statistics

In the end you should have a system that works reliably, and if you like you can install the free webhosting control panel ISPConfig (i.e., ISPConfig runs on it out of the box).

I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

 

1 Requirements

To install such a system you will need the following:

  • Download the CentOS 5.1 DVD or the six CentOS 5.1 CDs from a mirror next to you (the list of mirrors can be found here: http://isoredirect.centos.org/centos/5/isos/i386/).
  • a fast internet connection.

 

2 Preliminary Note

In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100 and the gateway 192.168.0.1. These settings might differ for you, so you have to replace them where appropriate.

 

3 Install The Base System

Boot from your first CentOS 5.1 CD (CD 1) or the CentOS 5.1 DVD. Press <ENTER> at the boot prompt:

It can take a long time to test the installation media so we skip this test here:

The welcome screen of the CentOS installer appears. Click on Next:

Choose your language next:

Select your keyboard layout:

I’m installing CentOS 5.1 on a fresh system, so I answer Yes to the question Would you like to initialize this drive, erasing ALL DATA?

Now we must select a partitioning scheme for our installation. For simplicity’s sake I select Remove linux partitions on selected drives and create default layout. This will result in a small /boot and a large / partition as well as a swap partition. Of course, you’re free to partition your hard drive however you like it. Then I hit Next:

Answer the following question (Are you sure you want to do this?) with Yes:

On to the network settings. The default setting here is to configure the network interfaces with DHCP, but we are installing a server, so static IP addresses are not a bad idea… Click on the Edit button at the top right.

In the window that pops up uncheck Use dynamic IP configuration (DHCP) and Enable IPv6 support and give your network card a static IP address (in this tutorial I’m using the IP address 192.168.0.100 for demonstration purposes) and a suitable netmask (e.g. 255.255.255.0; if you are not sure about the right values, http://www.subnetmask.info might help you):

Set the hostname manually, e.g. server1.example.com, and enter a gateway (e.g. 192.168.0.1) and up to two DNS servers (e.g. 145.253.2.75 and 193.174.32.18):

Choose your time zone:

Give root a password:

  • CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server) – Page 2
  • CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server) – Page 3
  • CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server) – Page 4
  • CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server) – Page 5
  • CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server) – Page 6
  • CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server) – Page 7

next CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server) – Page 2
Copyright © 2007 Falko Timme
All Rights Reserved.

Related Tutorials

How To Install courier-imap, courier-authlib, And maildrop On Fedora, RedHat, CentOS

How To Install courier-imap, courier-authlib, And maildrop On Fedora, RedHat, CentOS

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 11/13/2007

For some reason there are no Courier packages (courier-imap, courier-authlib, maildrop) available on RedHat-based distributions (RedHat, Fedora, CentOS), and the only third-party repository that had such packages seems to have closed (enlartenment.com). Therefore this tutorial explains how you can create and install your own Courier rpm packages from the sources, and I provide download links for my Courier rpm packages that I compiled on Fedora 8 (i386) so that you can save some time.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I have tried this on a Fedora 8 (i386) system; it should work for RedHat and CentOS as well. If you are on an x86_64 system, replace all references to i386 in this tutorial with x86_64.

 

2 Installing Prerequisites

Before we can compile the Courier packages, we need some prerequisites such as compilers, development libraries, etc. which we can install like this:

yum groupinstall ‘Development Tools’

yum groupinstall ‘Development Libraries’

yum install rpm-build gcc mysql-devel openssl-devel cyrus-sasl-devel pkgconfig zlib-devel pcre-devel openldap-devel postgresql-devel expect libtool-ltdl-devel openldap-servers libtool gdbm-devel pam-devel gamin-devel

 

3 Creating A Non-Priviledged User Account

RPM packages should not be built as root; courier-imap will even refuse to compile if it detects that the compilation is run as the root user. Therefore we create a normal user account now (falko in this example) and give him a password:

useradd -m -s /bin/bash falko
passwd falko

We will need the sudo command later on so that the user falko can compile and install the rpm packages. But first, we must allow falko to run all commands using sudo:

Run

visudo

In the file that opens there’s a line root ALL=(ALL) ALL. Add a similar line for falko just below that line:

[...]
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
falko   ALL=(ALL)       ALL
[...]

 

4 Building courier-authlib, courier-imap, And maildrop

Now we are ready to build our rpm package. First become the user falko:

su falko

Next we create our build environment:

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

Now we create a downloads directory and download the source files from http://www.courier-mta.org/download.php:

mkdir $HOME/downloads
cd $HOME/downloads

wget http://prdownloads.sourceforge.net/courier/courier-authlib-0.60.2.tar.bz2
wget http://prdownloads.sourceforge.net/courier/courier-imap-4.2.1.tar.bz2
wget http://prdownloads.sourceforge.net/courier/maildrop-2.0.4.tar.bz2

 

4.1 courier-authlib

Now (still in $HOME/downloads) we can build courier-authlib:

sudo rpmbuild -ta courier-authlib-0.60.2.tar.bz2

After the build process, the rpm packages can be found in $HOME/rpm/RPMS/i386 ($HOME/rpm/RPMS/x86_64 if you are on an x86_64 system):

cd $HOME/rpm/RPMS/i386

The command

ls -l

shows you the available rpm packages:

[falko@server1 i386]$ ls -l
total 600
-rw-r–r– 1 root root 137335 2007-11-13 18:02 courier-authlib-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root 323827 2007-11-13 18:02 courier-authlib-debuginfo-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root  34201 2007-11-13 18:02 courier-authlib-devel-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root  18039 2007-11-13 18:02 courier-authlib-ldap-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root  14258 2007-11-13 18:02 courier-authlib-mysql-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root  13602 2007-11-13 18:02 courier-authlib-pgsql-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root   8336 2007-11-13 18:02 courier-authlib-pipe-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root  36859 2007-11-13 18:02 courier-authlib-userdb-0.60.2-1.fc8.i386.rpm
[falko@server1 i386]$

Select the ones you want to install, and install them like this:

sudo rpm -ivh courier-authlib-0.60.2-1.fc8.i386.rpm
sudo rpm -ivh courier-authlib-devel-0.60.2-1.fc8.i386.rpm
sudo rpm -ivh courier-authlib-mysql-0.60.2-1.fc8.i386.rpm

 

4.2 courier-imap

Now we go back to our downloads directory:

cd $HOME/downloads

and run rpmbuild again, this time without sudo, otherwise the compilation will fail because it was run as root:

rpmbuild -ta courier-imap-4.2.1.tar.bz2

After the build process, the rpm packages can be found in $HOME/rpm/RPMS/i386 ($HOME/rpm/RPMS/x86_64 if you are on an x86_64 system):

cd $HOME/rpm/RPMS/i386

The command

ls -l

shows you the available rpm packages:

[falko@server1 i386]$ ls -l
total 1284
-rw-r–r– 1 root root 137335 2007-11-13 18:02 courier-authlib-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root 323827 2007-11-13 18:02 courier-authlib-debuginfo-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root  34201 2007-11-13 18:02 courier-authlib-devel-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root  18039 2007-11-13 18:02 courier-authlib-ldap-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root  14258 2007-11-13 18:02 courier-authlib-mysql-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root  13602 2007-11-13 18:02 courier-authlib-pgsql-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root   8336 2007-11-13 18:02 courier-authlib-pipe-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root root  36859 2007-11-13 18:02 courier-authlib-userdb-0.60.2-1.fc8.i386.rpm
-rw-rw-r– 1 falko falko 383455 2007-11-13 18:21 courier-imap-4.2.1-1.8.i386.rpm
-rw-rw-r– 1 falko falko 917771 2007-11-13 18:21 courier-imap-debuginfo-4.2.1-1.8.i386.rpm
[falko@server1 i386]$

You can install courier-imap like this:

sudo rpm -ivh courier-imap-4.2.1-1.8.i386.rpm

 

4.3 maildrop

Now we go back to our downloads directory:

cd $HOME/downloads

and run rpmbuild again:

sudo rpmbuild -ta maildrop-2.0.4.tar.bz2

After the build process, the rpm packages can be found in $HOME/rpm/RPMS/i386 ($HOME/rpm/RPMS/x86_64 if you are on an x86_64 system):

cd $HOME/rpm/RPMS/i386

The command

ls -l

shows you the available rpm packages:

[falko@server1 i386]$ ls -l
total 3128
-rw-r–r– 1 root  root  137343 2007-11-13 18:02 courier-authlib-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root  root  324618 2007-11-13 18:02 courier-authlib-debuginfo-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root  root   34208 2007-11-13 18:02 courier-authlib-devel-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root  root   18042 2007-11-13 18:02 courier-authlib-ldap-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root  root   14254 2007-11-13 18:02 courier-authlib-mysql-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root  root   13599 2007-11-13 18:02 courier-authlib-pgsql-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root  root    8339 2007-11-13 18:02 courier-authlib-pipe-0.60.2-1.fc8.i386.rpm
-rw-r–r– 1 root  root   36855 2007-11-13 18:02 courier-authlib-userdb-0.60.2-1.fc8.i386.rpm
-rw-rw-r– 1 falko falko 383455 2007-11-13 18:21 courier-imap-4.2.1-1.8.i386.rpm
-rw-rw-r– 1 falko falko 917771 2007-11-13 18:21 courier-imap-debuginfo-4.2.1-1.8.i386.rpm
-rw-r–r– 1 root  root  299030 2007-11-13 18:35 maildrop-2.0.4-1.8.i386.rpm
-rw-r–r– 1 root  root  752872 2007-11-13 18:35 maildrop-debuginfo-2.0.4-1.8.i386.rpm
-rw-r–r– 1 root  root  136235 2007-11-13 18:35 maildrop-devel-2.0.4-1.8.i386.rpm
-rw-r–r– 1 root  root   58439 2007-11-13 18:35 maildrop-man-2.0.4-1.8.i386.rpm
[falko@server1 i386]$

You can now install maildrop like this:

sudo rpm -ivh maildrop-2.0.4-1.8.i386.rpm

After you have compiled and installed all needed packages, you can become root again by typing

exit

 

5 My Fedora 8 Packages

Here are the links to my Fedora 8 (i386) packages:

  • courier-authlib-0.60.2-1.fc8.i386.rpm
  • courier-authlib-debuginfo-0.60.2-1.fc8.i386.rpm
  • courier-authlib-devel-0.60.2-1.fc8.i386.rpm
  • courier-authlib-ldap-0.60.2-1.fc8.i386.rpm
  • courier-authlib-mysql-0.60.2-1.fc8.i386.rpm
  • courier-authlib-pgsql-0.60.2-1.fc8.i386.rpm
  • courier-authlib-pipe-0.60.2-1.fc8.i386.rpm
  • courier-authlib-userdb-0.60.2-1.fc8.i386.rpm
  • courier-imap-4.2.1-1.8.i386.rpm
  • courier-imap-debuginfo-4.2.1-1.8.i386.rpm
  • maildrop-2.0.4-1.8.i386.rpm
  • maildrop-debuginfo-2.0.4-1.8.i386.rpm
  • maildrop-devel-2.0.4-1.8.i386.rpm
  • maildrop-man-2.0.4-1.8.i386.rpm

Copyright © 2007 Falko Timme
All Rights Reserved.

The Perfect Xen 3.0.3 Setup For Debian Sarge

The Perfect Xen 3.0.3 Setup For Debian Sarge

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 10/20/2006

This tutorial provides step-by-step instructions on how to install Xen (version 3.0.3) on a Debian Sarge (3.1) system.

Xen lets you create guest operating systems (*nix operating systems like Linux and FreeBSD), so called “virtual machines” or domUs, under a host operating system (dom0). Using Xen you can separate your applications into different virtual machines that are totally independent from each other (e.g. a virtual machine for a mail server, a virtual machine for a high-traffic web site, another virtual machine that serves your customers’ web sites, a virtual machine for DNS, etc.), but still use the same hardware. This saves money, and what is even more important, it’s more secure. If the virtual machine of your DNS server gets hacked, it has no effect on your other virtual machines. Plus, you can move virtual machines from one Xen server to the next one.

I will use Debian Sarge for both the host OS (dom0) and the guest OS (domU). I will describe how to install Xen from the sources (which I recommend) in chapter 4 and from the binary package (chapter 5).
In an additional section at the end of chapter 4 (chapter 4.5 ) I will also show how to create a virtual local network with virtual machines, with dom0 being the router. Chapters 4 and 5 are mutually exclusive.

This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

 

1 Install The Debian Sarge Host System (dom0)

You can overall follow these instructions, but with a few changes:

  • http://www.howtoforge.com/perfect_setup_debian_sarge
  • http://www.howtoforge.com/perfect_setup_debian_sarge_p2

However, it’s important that you type linux26 at the boot prompt to install a kernel 2.6 system. dom0‘s FQDN in this example will be server1.example.com, so I specify server1 as Hostname and example.com as Domain name. server1.example.com‘s IP address will be 192.168.0.100 in this tutorial.

When it comes to the partitioning, I select Manually edit partition table. I create the following partitions:

  • /boot 100 MB (Primary) (Location for the new partition: Beginning) (ext3) (Bootable flag: on <– important, otherwise your system will not boot!)
  • swap 1GB (Logical) (Location for the new partition: Beginning)
  • / 2GB (Logical) (Location for the new partition: Beginning) (ext3)
  • /vserver the rest (Logical) (Location for the new partition: Beginning) (ext3)

(Side note: You can also install everything in one big partition (as described here: http://www.howtoforge.com/perfect_setup_debian_sarge), but then you have to keep in mind that the Grub stanzas I describe in this howto are slightly different. For example, when I write that I add

[...]

title Xen 3.0.3 / XenLinux 2.6
root (hd0,0)
kernel /xen.gz  dom0_mem=64000
module /vmlinuz-2.6-xen root=/dev/hda6 ro max_loop=255
module /initrd.img-2.6.16.29-xen

[...]

to /boot/grub/menu.lst then you should probably use

[...]

title Xen 3.0.3 / XenLinux 2.6
root (hd0,0)
kernel /boot/xen.gz  dom0_mem=64000
module /boot/vmlinuz-2.6-xen root=/dev/hda6 ro max_loop=255
module /boot/initrd.img-2.6.16.29-xen

[...]

in that file instead…)

When the Debian installer prompts Choose software to install: I make no selection and go on (dom0 should run as few software as possible in order not to be vulnerable to attacks. To the outside world it will be accessible only over SSH.).

 

2 Configure dom0‘s Network

Because the Debian Sarge installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.0.100):

vi /etc/network/interfaces

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
auto lo
iface lo inet loopback

# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1

Then restart your network:

/etc/init.d/networking restart

Edit /etc/resolv.conf and add some nameservers:

vi /etc/resolv.conf

search server
nameserver 145.253.2.75
nameserver 193.174.32.18
nameserver 194.25.0.60

 

Then set dom0‘s hostname:

echo server1.example.com > /etc/hostname
/bin/hostname -F /etc/hostname

 

3 Install Xen

There are two ways to install Xen: compile Xen and the Xen kernels from the sources, or install the binary package from the Xen website.

The last way is easier, but it has the disadvantage that the domU kernel that comes with the binary package has no support for quota and iptables, both features that I need in my virtual machines (domU). Plus, the dom0 kernel has no support for the dummy network driver, which might come in handy for more advanced network setups. Also, if you use the binary package, there is only one kernel for both dom0 and domU, and the network setup for the virtual machines cannot be done using configuration files on dom0, but has to be done within the virtual machines themself which is rather complicated if you want to create new virtual machines from a pre-made image. I also got the impression that the source install is much more stable/mature. On the binary install it happened to me that a virtual machine didn’t boot up because of a kernel panic, and two minutes later the same unchanged virtual machine did boot up without problems. So I highly recommend to compile Xen from the sources, although this takes much more time.

In chapter 4 I describe how to compile and install Xen from the sources which is a must if you need quota and iptables in your virtual machines. In chapter 5 I describe how to install the Xen binary package which might be easier for beginners. Chapters 4 and 5 are mutually exclusive. Follow either chapter 4 or 5, but not both of them!

  • The Perfect Xen 3.0.3 Setup For Debian Sarge – Page 2
  • The Perfect Xen 3.0.3 Setup For Debian Sarge – Page 3
  • The Perfect Xen 3.0.3 Setup For Debian Sarge – Page 4
  • The Perfect Xen 3.0.3 Setup For Debian Sarge – Page 5
  • The Perfect Xen 3.0.3 Setup For Debian Sarge – Page 6
  • The Perfect Xen 3.0.3 Setup For Debian Sarge – Page 7
  • The Perfect Xen 3.0.3 Setup For Debian Sarge – Page 8

next The Perfect Xen 3.0.3 Setup For Debian Sarge – Page 2
Copyright © 2006 Falko Timme
All Rights Reserved.

Related Tutorials

Configuring A High Availability Cluster (Heartbeat) On CentOS

Configuring A High Availability Cluster (Heartbeat) On CentOS

This guide shows how you can set up a two node, high-availability HTTP cluster with heartbeat on CentOS. Both nodes use the Apache web server to serve the same content.

 

Pre-Configuration Requirements

  1. Assign hostname node01 to primary node with IP address 172.16.4.80 to eth0.
  2. Assign hostname node02 to slave node with IP address 172.16.4.81.

Note: on node01

uname -n

must return node01.

On node02

uname -n

must return node02.

172.16.4.82 is the virtual IP address that will be used for our Apache webserver (i.e., Apache will listen on that address).

 

Configuration

1. Download and install the heartbeat package. In our case we are using CentOS so we will install heartbeat with yum:

yum install heartbeat

or download these packages:

heartbeat-2.08
heartbeat-pils-2.08
heartbeat-stonith-2.08

2. Now we have to configure heartbeat on our two node cluster. We will deal with three files. These are:

authkeys
ha.cf
haresources

3. Now moving to our configuration. But there is one more thing to do, that is to copy these files to the /etc/ha.d directory. In our case we copy these files as given below:

cp /usr/share/doc/heartbeat-2.1.2/authkeys /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.2/ha.cf /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.2/haresources /etc/ha.d/

4. Now let’s start configuring heartbeat. First we will deal with the authkeys file, we will use authentication method 2 (sha1). For this we will make changes in the authkeys file as below.

vi /etc/ha.d/authkeys

Then add the following lines:

auth 2
2 sha1 test-ha

Change the permission of the authkeys file:

chmod 600 /etc/ha.d/authkeys

5. Moving to our second file (ha.cf) which is the most important. So edit the ha.cf file with vi:

vi /etc/ha.d/ha.cf

Add the following lines in the ha.cf file:

logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
initdead 120
bcast eth0
udpport 694
auto_failback on
node node01
node node02

Note: node01 and node02 is the output generated by

uname -n

6. The final piece of work in our configuration is to edit the haresources file. This file contains the information about resources which we want to highly enable. In our case we want the webserver (httpd) highly available:

vi /etc/ha.d/haresources

Add the following line:

node01 172.16.4.82 httpd

7. Copy the /etc/ha.d/ directory from node01 to node02:

scp -r /etc/ha.d/ root@node02:/etc/

8. As we want httpd highly enabled let’s start configuring httpd:

vi /etc/httpd/conf/httpd.conf

Add this line in httpd.conf:

Listen 172.16.4.82:80

9. Copy the /etc/httpd/conf/httpd.conf file to node02:

scp /etc/httpd/conf/httpd.conf root@node02:/etc/httpd/conf/

10. Create the file index.html on both nodes (node01 & node02):

On node01:

echo “node01 apache test server” > /var/www/html/index.html

On node02:

echo “node02 apache test server” > /var/www/html/index.html

11. Now start heartbeat on the primary node01 and slave node02:

/etc/init.d/heartbeat start

12. Open web-browser and type in the URL:

http://172.16.4.82

It will show node01 apache test server.

13. Now stop the hearbeat daemon on node01:

/etc/init.d/heartbeat stop

In your browser type in the URL http://172.16.4.82 and press enter.

It will show node02 apache test server.

14. We don’t need to create a virtual network interface and assign an IP address (172.16.4.82) to it. Heartbeat will do this for you, and start the service (httpd) itself. So don’t worry about this.

Don’t use the IP addresses 172.16.4.80 and 172.16.4.81 for services. These addresses are used by heartbeat for communication between node01 and node02. When any of them will be used for services/resources, it will disturb hearbeat and will not work. Be carefull!!!

 
[Creative Commons Attribution License]This page is licensed under a Creative Commons License.

Running A File-, Print-, Proxy-, DHCP-, AND Time-Server For Small/Medium Enterprises

Running A File-, Print-, Proxy-, DHCP-, AND Time-Server For Small/Medium Enterprises

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 10/14/2006

This article shows how to run a file-, print-, HTTP proxy- DHCP-, and time server for small and medium enterprises (SME) on one single Debian Sarge system. It is very easy to set up, and management is done with an easy-to-use web interface called eBox so once the system is set up, you can forget about the command line. eBox was developed to administrate advanced services for corporate networks, and it was created for Debian Sarge.

I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I assume you have already set up a basic Debian Sarge system. You can set up your system as described on the first two pages of this tutorial: The Perfect Setup – Debian Sarge (3.1).

I use 192.168.0.100 as the IP address and server1.example.com as the hostname of my Debian Sarge system in this tutorial. If your Debian Sarge system does not have a static IP address you should now change its network configuration so that it will have a static IP address in the future:

vi /etc/network/interfaces

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1

(If you use a different gateway than 192.168.0.1, change the gateway IP address in /etc/network/interfaces.)

Then restart your network:

/etc/init.d/networking restart

Edit /etc/resolv.conf and add some nameservers:

vi /etc/resolv.conf

search server
nameserver 145.253.2.75
nameserver 193.174.32.18
nameserver 194.25.0.60

Edit /etc/hosts and add your new IP address:

vi /etc/hosts

127.0.0.1       localhost.localdomain   localhost
192.168.0.100   server1.example.com     server1
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

 

2 Install eBox

There are Debian packages available for eBox. To install them, we must edit our /etc/apt/sources.list first:

vi /etc/apt/sources.list

Add the following lines to your existing sources.list:

deb http://ebox-platform.com/debian/stable/ ebox/
deb http://ebox-platform.com/debian/stable/ extra/

Then update your package database:

apt-get update

Afterwards we can install eBox with all needed modules with one single command:

apt-get install ebox libebox ebox-network ebox-objects ebox-firewall ebox-logs ebox-samba ebox-dns-cache ebox-dhcp ebox-squid ebox-usersandgroups ebox-software ebox-ntp ebox-printers

You will be asked a few questions. Most of the time you can simply accept the default values:

Where should the PostgreSQL database be created? <– /var/lib/postgres/data

Should the data be purged as well as the package files? <– No

What locale should be used by the database backend? <– en_US

Choose European or US day/month order in dates. <– European / US [depends on where you come from]

DNS domain name: <– example.com

Name of your organization: <– example.com

Admin password: <– somepassword

Confirm password: <– somepassword

Allow LDAPv2 protocol? <– No

Apache-Perl needs to be reconfigured. <– Ok

Enable suExec? <– No

Which paper size should be the system default? <– a4

On what network interfaces should the DHCP server listen? <– [Leave it blank.]

Please configure the DHCP server as soon as the installation finishes. <– Ok

The version 3 DHCP server is now non-authoritative by default <– Ok

Workgroup/Domain Name? <– WORKGROUP

Use password encryption? <– Yes

Modify smb.conf to use WINS settings from DHCP? <– No

How do you want to run Samba? <– daemons

Create samba password database, /var/lib/samba/passdb.tdb? <– No

LDAP server host address <– 127.0.0.1

distinguished name of the search base <– dc=example,dc=com

LDAP version to use <– 3

database requires login <– No

make configuration readable/writeable by owner only <– No

nsswitch.conf is not managed automatically <– Ok

Send daily reminders to users over quota <– No

Now the packages are getting installed. When you see this:

Configuration file `/etc/dhcp3/dhclient.conf’
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer’s version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : background this process to examine the situation
The default action is to keep your current version.
*** dhclient.conf (Y/I/N/O/D/Z) [default=N] ?

answer with N.

Please note: If you’re installing this using SSH, you will lose your SSH connection at this point:

Setting up ebox-firewall (0.7.1) …
EBox: restarting firewall:

This is nothing to worry, it happens because the eBox firewall closes port 22 by default. Despite this, the installation is successful, and you can open up port 22 again using the eBox web interface.

 

3 Logging In To eBox

Now that eBox is installed, open your browser and go to https://192.168.0.100. The login screen appears. Enter the default password ebox and log in:

After the login, you’ll see the eBox status page:

  • Running A File-, Print-, Proxy-, DHCP-, AND Time-Server For Small/Medium Enterprises – Page 2
  • Running A File-, Print-, Proxy-, DHCP-, AND Time-Server For Small/Medium Enterprises – Page 3
  • Running A File-, Print-, Proxy-, DHCP-, AND Time-Server For Small/Medium Enterprises – Page 4
  • Running A File-, Print-, Proxy-, DHCP-, AND Time-Server For Small/Medium Enterprises – Page 5
  • Running A File-, Print-, Proxy-, DHCP-, AND Time-Server For Small/Medium Enterprises – Page 6

next Running A File-, Print-, Proxy-, DHCP-, AND Time-Server For Small/Medium Enterprises – Page 2
Copyright © 2006 Falko Timme
All Rights Reserved.

Related Tutorials

Installing HP Systems Insight Manager On CentOS

Installing HP Systems Insight Manager On CentOS 

HP Systems Insight Manager is a free tool from HP that can monitor your network and receive SNMP Traps. It’s an excellent trap manager but also a system resource hog.

Hardware requirements for Linux are:

 - Minimum: 1.5-GHz processor and 768 MB RAM
 - Recommended: 2.4-GHz processor and 1 GB RAM

1. Install CentOS 5.0

2. Download HP SIM:

http://h18004.www1.hp.com/products/servers/management/hpsim/dl_linux.html

3. Installing the software

(The following section can be copied into a shell script):

# First do a upgrade of the system
yum update -y

# reboot if needed

# We need to trick the HP software so it thinks Redhat Enterprise is installed
nano /etc/redhat-release
   # Remove what it says and insert: Red Hat Enterprise Linux ES release 5

# Install dependencies
yum install compat-readline43 openssl097a compat-libstdc++-33 -y

# We need to change the posix default version
export _POSIX2_VERSION=199209

# And now we run the downloaded HP SIM Package
chmod +x HPSIM-Linux-C.05.01.00.00.bin
./HPSIM-Linux-C.05.01.00.00.bin

# Configuring the HP SIM for the system
/opt/mx/bin/mxinitconfig -l
/opt/mx/bin/mxinitconfig -a

# and done

You should now be able to login to the HP SIM via a web browser at http://$IP:280/
Log in with user root and the user’s password.

This HOWTO will not cover HP SIM Setup as it is very well documentet by HP here:

http://docs.hp.com/en/5991-4498/

Copyright © 2007 hore
All Rights Reserved.

How To Install VMware Server On Debian Sarge

How To Install VMware Server On Debian Sarge

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>, Till Brehm <t [dot] brehm [at] projektfarm [dot] de>
Last edited 10/12/2006

This tutorial provides step-by-step instructions on how to install the free VMware Server (version 1.0.1) on a Debian Sarge system.

VMware has just released version 1.0 of its free VMware Server. With VMware Server you can create and run guest operating systems (“virtual machines”) such as Linux, Windows, FreeBSD, etc. under a host operating system. This has the benefit that you can run multiple operating systems on the same hardware which saves a lot of money, and you can move virtual machines from one VMware Server to the next one (or to a system that has the VMware Player which is also free). In this article we use Debian Sarge (3.1) as the host operating system.

I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I assume you have already set up a basic Debian Sarge system. You can set up your system as described on the first two pages of this tutorial: The Perfect Setup – Debian Sarge (3.1).

I use 192.168.0.100 as the IP address and server1.example.com as the hostname of my Debian Sarge system in this tutorial. If your Debian Sarge system does not have a static IP address you should now change its network configuration so that it will have a static IP address in the future:

vi /etc/network/interfaces

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
auto lo
iface lo inet loopback

# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1

(If you use a different gateway than 192.168.0.1, change the gateway IP address in /etc/network/interfaces.)

Then restart your network:

/etc/init.d/networking restart

Edit /etc/resolv.conf and add some nameservers:

vi /etc/resolv.conf

search server
nameserver 145.253.2.75
nameserver 193.174.32.18
nameserver 194.25.0.60

Edit /etc/hosts and add your new IP address:

vi /etc/hosts

127.0.0.1       localhost.localdomain   localhost
192.168.0.100   server1.example.com     server1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

 

2 Installing Required Packages

First we update our package database:

apt-get update

Now we install the packages required by VMware on our Debian Sarge system by running

apt-get install kernel-headers-`uname -r` libx11-6 libx11-dev x-window-system-core x-window-system xspecs libxtst6 xlibs-dev

You will be asked a few questions to which you can answer as follows:

Attempt to autodetect video hardware? <– No

Select the desired X server driver. <– vesa

Use kernel framebuffer device interface? <– Yes

Please select the XKB rule set to use. <– xfree86

Please select your keyboard model. <– pc104

Please select your keyboard layout. <– [Select your keyboard layout, e.g. de, if you have a German keyboard.]

Please select your keyboard variant. <– [Leave it empty.]

Please select your keyboard options. <– [Leave it empty.]

Please choose your mouse port. <– /dev/input/mice

Is your monitor an LCD device? <– No

Please choose a method for selecting your monitor characteristics. <– Advanced

Enter your monitor’s horizontal sync range. <– 28-50

Enter your monitor’s vertical refresh range. <– 43-75

Select the video modes you would like the X server to use. <– 1024×768, 800×600, 640×480

Please select your desired default color depth in bits. <– 24

Default printer resolution <– 600

Most of these answers are not really important because we don’t want to use the desktop on our Debian Sarge system. We will connect to the VMware Server from our workstation later on which can be a Windows or Linux system which has the VMware Server client package installed.

Next we create the directory /var/vm wehere we want to install our virtual machines later. The virtual machines require much disk space, make sure you have enough free space on your /var partition for the virtual machines.:

mkdir /var/vm

 

3 Getting VMware Server

The VMware server can be downloaded for free from the VMware website: http://www.vmware.com/download/server/
To run the VMware Server software you need a (free) serial number, that can be requested by clicking on the “Register now” button on the download page.

 

4 Downloading The Software

To setup VMWare Server on Debian Sarge, we need the following packages from the VMware downloads page:

VMware Server for linux (Binary tar.gz)
Management Interface (Binary tar.gz)

We want to download the packages to our /tmp directory, therefore we go there:

cd /tmp

For downloading the software to your server, I recommend to use the linux commandline program wget. The wget syntax is as follows:

wget [URL of the VMware Server for linux binary tar.gz package]
wget [URL of the Management Interface binary tar.gz package]

Unpacking the server tar.gz:

tar xvfz VMware-server-*.tar.gz

Running the installer script:

cd vmware-server-distrib
./vmware-install.pl

The installer asks you a few questions. Most of the time you can accept the default value:

Creating a new installer database using the tar3 format.

Installing the content of the package.

In which directory do you want to install the binary files?
[/usr/bin]
<– /usr/bin

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc]
<– /etc

What is the directory that contains the init scripts?
[/etc/init.d]
<– /etc/init.d

In which directory do you want to install the daemon files?
[/usr/sbin]
<– /usr/sbin

In which directory do you want to install the library files?
[/usr/lib/vmware]
<– /usr/lib/vmware

The path “/usr/lib/vmware” does not exist currently. This program is going to
create it, including needed parent directories. Is this what you want?
[yes]
<– yes

In which directory do you want to install the manual files?
[/usr/share/man]
<– /usr/share/man

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware]
<– /usr/share/doc/vmware

The path “/usr/share/doc/vmware” does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]
<– yes

The installation of VMware Server 1.0.1 build-29996 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: “/usr/bin/vmware-uninstall.pl”.

Before running VMware Server for the first time, you need to configure it by
invoking the following command: “/usr/bin/vmware-config.pl”. Do you want this
program to invoke the command for you now? [yes]
<– yes

Making sure services for VMware Server are stopped.

Stopping VMware services:
Virtual machine monitor done

You must read and accept the End User License Agreement to continue.
Press enter to display it.
<– [ENTER]

….. snip [LICENCE TEXT] ……

Do you accept? (yes/no) <– yes

Configuring fallback GTK+ 2.4 libraries.

In which directory do you want to install the mime type icons?
[/usr/share/icons]
<– /usr/share/icons

The path “/usr/share/icons” does not exist currently. This program is going to
create it, including needed parent directories. Is this what you want?
[yes]
<– yes

What directory contains your desktop menu entry files? These files have a
.desktop file extension. [/usr/share/applications]
<– /usr/share/applications

In which directory do you want to install the application’s icon?
[/usr/share/pixmaps]
<– /usr/share/pixmaps

Trying to find a suitable vmmon module for your running kernel.

None of the pre-built vmmon modules for VMware Server is suitable for your
running kernel. Do you want this program to try to build the vmmon module for
your system (you need to have a C compiler installed on your system)? [yes]
<– yes

Using compiler “/usr/bin/gcc”. Use environment variable CC to override.

What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.8-2-386/build/include]
<– /lib/modules/2.6.8-2-386/build/include

[...]

Do you want networking for your virtual machines? (yes/no/help) [yes] <– yes

Configuring a bridged network for vmnet0.

The following bridged networks have been defined:

. vmnet0 is bridged to eth0

Do you wish to configure another bridged network? (yes/no) [no] <– no

Do you want to be able to use NAT networking in your virtual machines? (yes/no)
[yes]
<– yes

Configuring a NAT network for vmnet8.

Do you want this program to probe for an unused private subnet? (yes/no/help)
[yes]
<– yes

Probing for an unused private subnet (this can take some time)…

The subnet 192.168.221.0/255.255.255.0 appears to be unused.

The following NAT networks have been defined:

. vmnet8 is a NAT network on private subnet 192.168.221.0.

Do you wish to configure another NAT network? (yes/no) [no] <– no

Do you want to be able to use host-only networking in your virtual machines?
[yes]
<– yes

Configuring a host-only network for vmnet1.

Do you want this program to probe for an unused private subnet? (yes/no/help)
[yes]
<– yes

Probing for an unused private subnet (this can take some time)…

The subnet 192.168.211.0/255.255.255.0 appears to be unused.

The following host-only networks have been defined:

. vmnet1 is a host-only network on private subnet 192.168.211.0.

Do you wish to configure another host-only network? (yes/no) [no] <– no

[...]

Please specify a port for remote console connections to use [902] <– 902

Restarting internet superserver: inetd.
Configuring the VMware VmPerl Scripting API.

Building the VMware VmPerl Scripting API.

Using compiler “/usr/bin/gcc”. Use environment variable CC to override.

Installing the VMware VmPerl Scripting API.

The installation of the VMware VmPerl Scripting API succeeded.

Generating SSL Server Certificate

In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines]
<– /var/vm

Please enter your 20-character serial number.

Type XXXXX-XXXXX-XXXXX-XXXXX or ‘Enter’ to cancel: <– your VMware Server serial number

Starting VMware services:
Virtual machine monitor done
Virtual ethernet done
Bridged networking on /dev/vmnet0 done
Host-only networking on /dev/vmnet1 (background) done
Host-only networking on /dev/vmnet8 (background) done
NAT service on /dev/vmnet8 done

The configuration of VMware Server 1.0.1 build-29996 for Linux for this running
kernel completed successfully.

That’s it, the VMware Server is installed on our Debian Sarge system. On to the next step…

  • How To Install VMware Server On Debian Sarge – Page 2

next How To Install VMware Server On Debian Sarge – Page 2
Copyright © 2006 Falko Timme
All Rights Reserved.

Related Tutorials

Integrating eAccelerator Into PHP5 (CentOS 5.0)

Integrating eAccelerator Into PHP5 (CentOS 5.0)

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 09/14/2007

This guide explains how to integrate eAccelerator into PHP5 on a CentOS 5.0 system. From the eAccelerator project page: “eAccelerator is a free open-source PHP accelerator, optimizer, and dynamic content cache. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.”

This document comes without warranty of any kind! I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I have tested this on a CentOS 5.0 server with the IP address 192.168.0.100 where Apache2 and PHP5 are already installed and working. I’ll use Apache’s default document root /var/www/html in this tutorial for demonstration purposes. Of course, you can use any other vhost as well, but you might have to adjust the path to the info.php file that I’m using in this tutorial.

 

2 Checking PHP5′s Current State

First, before we install eAccelerator, let’s find out about our PHP5 installation. To do this, we create the file info.php in our document root /var/www/html:

vi /var/www/html/info.php

<?php
phpinfo();
?>

Afterwards, we call that file in a browser: http://192.168.0.100/info.php

As you see, we have PHP 5.1.6 installed…

… but eAccelerator isn’t mentioned anywhere on the page:

 

3 Installing eAccelerator

Unfortunately, there’s no eAccelerator package for CentOS 5.0 in the official repositories, therefore we must compile and install it from the sources. Before we can do this, we need to install some prerequisites:

yum install php-devel

yum groupinstall ‘Development Tools’

Now we can download and install eAccelerator like this (make sure that you get the latest version from the eAccelerator web site):

cd /tmp
wget http://bart.eaccelerator.net/source/0.9.5.2/eaccelerator-0.9.5.2.tar.bz2
tar xvfj eaccelerator-0.9.5.2.tar.bz2
cd eaccelerator-0.9.5.2
phpize
./configure
make
make install

eAccelerator is now installed. Now we have to tell our PHP installation that it should make use of eAccelerator. On CentOS 5.0, the configuration files for the various PHP 5 modules are stored in the /etc/php.d directory, and this directory is referenced in the main PHP5 configuration file /etc/php.ini, meaning all files in /etc/php.d are read in whenever Apache is started/restarted. So all we do is create the file /etc/php.d/eaccelerator.ini:

vi /etc/php.d/eaccelerator.ini

extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

(You can read up on the various configuration settings on this page: http://www.eaccelerator.net/wiki/Settings.)

As you see, we are using the disk cache directory /var/cache/eaccelerator which we must create now and make it world-writable:

mkdir -p /var/cache/eaccelerator
chmod 0777 /var/cache/eaccelerator

Afterwards, we restart Apache so that our new PHP configuration takes effect:

/etc/init.d/httpd restart

Afterwards, open info.php again in a browser: http://192.168.0.100/info.php

You should now see eAccelerator mentioned on the page which means it has successfully been integrated and is working as expected (I’ve marked the eAccelerator line in the below screenshot for better visibility):

 

4 Links

  • eAccelerator: http://www.eaccelerator.net
  • PHP: http://www.php.net
  • CentOS: http://www.centos.org

Copyright © 2007 Falko Timme
All Rights Reserved.

Related Tutorials

Installing Lighttpd With PHP5 And MySQL Support On CentOS 5.0

Installing Lighttpd With PHP5 And MySQL Support On CentOS 5.0

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 10/01/2007

Lighttpd is a secure, fast, standards-compliant web server designed for speed-critical environments. This tutorial shows how you can install Lighttpd on a CentOS 5.0 server with PHP5 support (through FastCGI) and MySQL support.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.

 

2 Installing MySQL 5.0

First we install MySQL 5.0 like this:

yum install mysql mysql-server

Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:

chkconfig –levels 235 mysqld on
/etc/init.d/mysqld start

Create a password for the MySQL user root (replace yourrootsqlpassword with the password you want to use):

mysqladmin -u root password yourrootsqlpassword

Then check with

netstat -tap | grep mysql

on which addresses MySQL is listening. If the output looks like this:

tcp        0      0 localhost.localdo:mysql *:*                     LISTEN     2713/mysqld

which means MySQL is listening on localhost.localdomain only, then you’re safe with the password you set before. But if the output looks like this:

tcp        0      0 *:mysql *:*                     LISTEN     2713/mysqld

you should set a MySQL password for your hostname, too, because otherwise anybody can access your database and modify data:

mysqladmin -h server1.example.com -u root password yourrootsqlpassword

 

3 Installing Lighttpd

Lighttpd is not available from the official CentOS 5.0 repositories, but from the RPMforge repositories (see http://dag.wieers.com/rpm/FAQ.php#B2 for instructions). We install the RPMforge package for RHEL 5 which works for CentOS 5.0 as well:

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Afterwards, we can install Lighttpd like this:

yum install lighttpd

Then we create the system startup links for Lighttpd (so that Lighttpd starts automatically whenever the system boots) and start it:

chkconfig –levels 235 lighttpd on
/etc/init.d/lighttpd start

Now direct your browser to http://192.168.0.100, and you should see the Lighttpd placeholder page:

Lighttpd’s default document root is /srv/www/lighttpd on CentOS 5.0, and the configuration file is /etc/lighttpd/lighttpd.conf.

 

4 Installing PHP5

We can make PHP5 work in Lighttpd through FastCGI. Therefore we install the packages lighttpd-fastcgi and php-cli:

yum install lighttpd-fastcgi php-cli

 

5 Configuring Lighttpd And PHP5

To enable PHP5 in Lighttpd, we must modify two files, /etc/php.ini and /etc/lighttpd/lighttpd.conf. First we open /etc/php.ini and add the line cgi.fix_pathinfo = 1 right at the end of the file:

vi /etc/php.ini

[...]
cgi.fix_pathinfo = 1

Then we open /etc/lighttpd/lighttpd.conf and uncomment “mod_fastcgi”, in the server.modules stanza:

vi /etc/lighttpd/lighttpd.conf

[...]
server.modules              = (
#                               "mod_rewrite",
#                               "mod_redirect",
#                               "mod_alias",
                                "mod_access",
#                               "mod_cml",
#                               "mod_trigger_b4_dl",
#                               "mod_auth",
#                               "mod_status",
#                               "mod_setenv",
                                "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
#                               "mod_evhost",
#                               "mod_userdir",
#                               "mod_cgi",
#                               "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                                "mod_accesslog" )
[...]

and then , further down the file, there’s a fastcgi.server stanza which we uncomment as well – make sure you use /usr/bin/php-cgi instead of /usr/local/bin/php in the “bin-path” line::

[...]
#### fastcgi module
## read fastcgi.txt for more info
fastcgi.server             = ( ".php" =>
                               ( "localhost" =>
                                 (
                                   "socket" => "/tmp/php-fastcgi.socket",
                                   "bin-path" => "/usr/bin/php-cgi"
                                 )
                               )
                            )
[...]

Then we restart Lighttpd:

/etc/init.d/lighttpd restart

  • Installing Lighttpd With PHP5 And MySQL Support On CentOS 5.0 – Page 2

next Installing Lighttpd With PHP5 And MySQL Support On CentOS 5.0 – Page 2
Copyright © 2007 Falko Timme
All Rights Reserved.

Related Tutorials