See also my comments of installation of Virtualmin on a Centos
linode...
these are just the additional issues.
GD under PHP not installed by default
Wordpress and other PHP systems were reporting errors about
"imagecreatefromjpeg not defined" ... that's a PHP built-in function...
what gives? Somehow I didn't have the GD image manipulation module
loaded into PHP. Here's how to do that.
# sudo apt-get install php5-gd
# /etc/init.d/apache2 restart
Locales not installed by default
(reported solved in Debian 5.0.2)
Apt-get was reporting huge batches of errors like:
perl: warning: Falling back to the standard locale ("C").
/usr/bin/mandb: can't set the locale; make sure $LC_* and $LANG are correct
manconv: can't set the locale; make sure $LC_* and $LANG are correct
The solution is to:
apt-get install locales
dpkg-reconfigure locales
and I added the locale: en_US.UTF-8 UTF-8
dpkg-reconfigure locales
Once you know these few steps, setting up a LAMP
(Linux/Apache/MySQL/Perl-PHP) server on a Linode
(please use that link, as it includes my referral code) is insanely
simple:
First, starting with a freshly provisioned CentOS install, ssh into the
root account. First, update the base system --
`
yum update
`
I find it convenient to also install the console version of emacs:
`
yum install emacs-nox
`
Next, edit /etc/sysconfig/network
and change the hostname. That file
is read at boot, so you might also want to set the hostname for the
current session:
`
hostname www.example.com
`
Download the install.sh script from http://www.virtualmin.com/download.html
into /usr/src ... and then execute it:
`
cd /usr/src # wget http://software.virtualmin.com/gpl/scripts/install.sh
sh install.sh
`
Then login, as root, to your new virtualmin configuration at your
linode's address: https://li99-999.members.linode.com:10000 where the
99-999 is replace with your linode's address (see the linode control
panel).
Install problem: awstats
Ran into this error message after install, when clicking the "Check
Your System" button --
The AWstats command /usr/share/awstats/wwwroot/cgi-bin/awstats.pl was
not found on your system.
Complicated by the fact that "yum install awstats" said it was already
installed. But where? "rpm -ql awstats" gives the answer... and then I
just copied it as follows:
# mkdir -p /usr/share/awstats/wwwroot/cgi-bin
# cp -a /var/www/awstats/awstats.pl /usr/share/awstats/wwwroot/cgi-bin
Install problem: clamd (after update)
NOTE: After installing Virtualmin updates, I got an error:
ERROR: Command rejected by clamd (wrong clamd version?)
which I resolved with:
# /etc/rc.d/init.d/clamd-virtualmin restart
Default settings when you configure
Under System Settings / Server Templates and then Default Settings --
Mail for Domain / Mail alias mode for alias domains: * Copy
aliases from target*. Catchall is the default! And you don't want
that. See also "Postfix relaying" below.
Spam Filtering / Automatically delete old spam? Yes, if older than
7 days (or as you desire)
BIND DNS Domain / Hostname to your preferred world-visible
hostname; SPF DNS disabled (until you configure each domain
manually)
Upgrading PHP and MySQL
This is one place where Centos 5.3 lags behind the times. If you need
PHP 5.2 or above, you will have to enable an alternate repository. As
of this writing, the "Centos Testing" repository contains a pre-release
version that does not include the mcrypt and memache modules -- a
real problem. NOTE: Although I was able to upgrade a running server,
I'd recommend doing this before loading any production domains. Follow
the instructions at
http://www.virtualmin.com/documentation/system/bleed
Double-Check Postfix Relaying
Postfix was accepting email for anything@aliased-domain.com ... to
solve this, open the aliased sub domain in Virtualmin, and under:
Server Configuration
Email Settings
change:
Virtual server email-related settings
Mail aliases mode
from Catchall forwarding to Copy aliases from target. You
probably want to change this on the System Settings / Server Templates
/ Default Settings for Sub-Servers page as well. If you have already
created several domains, you can adjust this all at once:
# virtualmin modify-mail --alias-copy --all-domains
NOTE: Is there a bug in Virtualmin 3.68.gpl? I had to manually:
# cd /etc/postfix
# postmap virtual
# postfix reload
to force that to refresh.
Tuning clamd
Rather than spend too much time tuning the memory, I simply killed
clamd as it is a huge memory pig and leads to Out Of Memory webserver
freezes.
Tuning Apache
With the default settings, Apache can veer out of control and eat all
available memory. In /etc/httpd/conf/httpd.conf, change as follows in
the section shown:
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
# was: MaxSpareServers 20 ServerLimit 256 MaxClients 256 MaxRequestsPerChild 400
0
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 10
ServerLimit 64
MaxClients 64
MaxRequestsPerChild 400
</IfModule>
Tuning Spamassassin
Dramatically reduce memory footprint by changing the number of threads
that spamassassin will execute at once from 5 down to 1. In /etc/sysconfig/spamassassin
(your location may vary) --
change:
SPAMDOPTIONS="-d -c -m<strong>5</strong> -H"
to
SPAMDOPTIONS="-d -c -m<strong>1</strong> -H"
-- William Lindley Automatically delete old spam?
No
Yes, if older than
daAutomatically delete old spam? No
Yes, if older than days
ys
CentOS specific instructions found here;
Also see the general Horde install document.
Tested on CentOS 5.1, 5.2, 5.3.
CentOS + Virtualmin Walk-through Tutorial
With Centos 5.x and a Webmin/Virtualmin installation you'll do things
this way:
# yum install horde imp
to install both the Horde general module and the Imp email IMAP
gateway. Next, run the database generation script, usually like this:
# cd /usr/share/horde/scripts/sql/
# mysql -u root -p < create.mysql.sql
You'll need to use the MySQL root password. Then, in your database
administration screen for MySQL, set the password for the new MySQL
user "horde" to something nicely random and hard to guess; keep a
momentary record as you'll need it below.
Make a copy of the default configuration, which is set to log everyone
in as Horde Administrator without a password. You'll need this if you
box yourself in, in the configuration later.
# cd /usr/share/horde/config
cp -a conf.php conf.php.everyone-as-admin
Later on you can always blitz a broken configuration by recopying the
"everyone-as-admin" script right over the conf.php.
Redirection of domain URLs to the horde system is set in Apache's /etc/httpd/conf.d/horde.conf
#
# Horde is a web application framework written in PHP.
#
Alias /horde /usr/share/horde
which means that www.mydomain.com/horde
[the first argument] is
mapped to the default page [index.php] in the actual filesystem's /usr/share/horde
directory. (You may have to refresh the Apache configuration if that
file changes.)
Then you can direct your web browser to: http://my-domain.com/horde and
fill in the Administration screens. Choose MySQL as the database. The
user is "horde" and the password is the one you set above.
For authentication method, choose "Let a Horde application handle" and
then select Imp as that application. You could pick IMAP authentication
but then your users will have to login twice (they will see "Log in to
mail" before they can get to their email).
When you click the Generate Horde Configuration button, you'll get the
text of your new conf.php ... Unless you've set the 'apache' group to
have write permission on the conf.php file, you'll have to select the
new configuration text displayed, and paste it into the conf.php ... or
use the command:
# cd /usr/share/horde/config
# cat > conf.php
and then paste (possibly with Shift+Insert) the copied text, pressing
Ctrl+D (end-of-file) to return to a prompt.
You should then be able to logout of the Horde administration page and
log back in normally as a user.
If things aren't working, check the logs. A few places to look:
/var/log/messages
/home/username/logs/error_log (for Virtualmin setup with "username")
If you get messages about "can't include" then check permissions on the
file noted; most of the php scripts should belong to group 'apache' and
have group read permissions.
Another useful step is to add yourself as an administrator. If you
didn't do that on the initial setup screens, you can edit conf.php and
modify the appropriate line to look like:
$conf['auth']['admins'] = array('Administrator'<strong>,'myusername'</strong>);
Note that you will have to manually edit the Imp mail-server
configuration file:
/usr/share/horde/imp/config/servers.php
by adding, for example, the localhost with IMAP protocol:
'server' => 'localhost'
'protocol' => 'imap/notls'
'port' => '143'
The Turba Contact Manager
You might also want to install the Turba contact manager.
You can install a version found on the Turba download page
or, to be sure you have a version matching your Horde install, just do:
# yum install turba
and then following the remainder of the "Configuration" instructions in
the Turba documentation
... note that in our configuration the package is in /usr/share/horde/turba
... you will probably want to use the 'horde' SQL database and the SQL
username 'horde' as above, keeping all the Horde data together. Consult
/usr/share/horde/config/conf.php
and look for the lines like these
for the values you set above:
$conf['sql']['username'] = 'horde';
$conf['sql']['database'] = 'horde';
And then you'll run the configuration script as:
$ mysql -u root -p horde < turba_objects.mysql.sql
and then go thru the Horde admin screens, setup the Turba parameters,
and write the configuration file which in our example will be at /usr/share/horde/turba/config/conf.php
.
If you don't see Turba (shown as main heading: Organizing) in the
Horde menus, edit the main Horde configuration file (/usr/share/horde/config/conf.php
in our case) and update the appropriate line to be:
$conf['menu']['apps'] = array('horde', 'imp', 'turba');