The Perfect Server - Gentoo 2007.0 - Page 6

14 Apache/PHP5

Now we install Apache:

echo "www-servers/apache doc mpm-prefork" >> /etc/portage/package.use 
emerge --ask --verbose apache

To install the rudimentary default webroot,

emerge --config apache

SSL is enabled by default as of the Gentoo Apache 2.2 ebuilds, so we can just start it, and set it to start on boot.

/etc/init.d/apache2 start 
rc-update add apache2 default

Check it out by visiting and

Gentoo will have made a default SSL certificate that your browser won't be ecstatic about, but it should work. They'll be installed in /etc/apache2/ssl; but if you're going to do the ISPConfig install later, you might as well deal with SSL certificates under its auspices.

Next we install PHP5:

echo "dev-lang/php bcmath bzip2 calendar ctype curl exif filter ftp gd hash imap json mhash mysql mysqli pcntl pdo posix sharedmem simplexml snmp soap sockets spell sqlite tidy tokenizer wddx xmlreader xmlrpc xmlwriter xsl zip" >> /etc/portage/package.use 
echo "dev-php5/pecl-imagick ~*" >> /etc/portage/package.keywords
echo "dev-php5/pecl-memcache ~*" >> /etc/portage/package.keywords
echo "dev-libs/pslib ~*" >> /etc/portage/package.keywords
echo "dev-php5/pecl-ps ~*" >> /etc/portage/package.keywords
emerge --ask --verbose php PEAR-PEAR dev-php5/pecl-imagick dev-php5/pecl-memcache dev-php5/pecl-ps

This is going to bring in quite a lot of stuff, so sit back and have a read.

Note 1: That's the closest we can get to the PHP configuration for the "Perfect Setup" for Ubuntu Feisy. It lacks ming and idn support as those aren't in the Gentoo stable tree yet (or, in the case of ming has been removed for instability). The idn USE flag is set, though, so if it gets added to dev-lang/php in future, it'll come into being. Alternatively, when it becomes available, emerge dev-php5/pecl-idn. The recode flag is left unset because it's incompatible with the mysql and imap flags.

Note 2: Generally I've tried to enable the required features using the USE flags where available, and using the PECL packages where not. As it happens each of the PECL packages I've had to enable were masked as ~arch and needed to be unmasked. Review in future as this is likely to change over time. Comments invited from those who know PHP more than I do on whether we should instead be favouring PECL over-built-in, where a feature exists both-ways. Also tell me if I've left anything important out that's default elsewhere.

Restart Apache.

/etc/init.d/apache restart

15 Proftpd

In order to install Proftpd, run,

echo "net-ftp/proftpd -ipv6" >> /etc/portage/package.use 
emerge --ask --verbose proftpd

Configure Proftpd.

cp /etc/proftpd/proftpd.conf.distrib /etc/proftpd/proftpd.conf

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

vi /etc/proftpd/proftpd.conf
DefaultRoot ~
IdentLookups off
ServerIdent on "FTP Server ready."

In addition there are one or two (it may vary) deprecated directives in the default proftpd.conf. Edit the file and change DisplayFirstChdir to DisplayChdir.

Then start Proftpd:

/etc/init.d/proftpd start 
rc-update add proftpd default

16 Webalizer

The Webalizer ebuild insists on LINGUAS being set in /etc/make.conf. So unless you have a more appropriate language to set it to, or you've already set it (nothing else we've installed so far needs it),

echo "LINGUAS=\"en\"" >> /etc/make.conf 
emerge --ask --verbose webalizer

17 Synchronize the system clock

On my practice system I've already done this by installing VMWare Tools but that probably won't apply to you.

emerge --ask --verbose ntp 
/etc/init.d/ntpd start
rc-update add ntpd default

That's the end of the Perfect Server HowTo. The final page simply deals with installing ISPConfig on top of this.

Share this page:

1 Comment(s)