Skip to content

Installing Bricolage 2.0.1 on Ubuntu 10.04 LTS (Lucid Lynx)

mikeraynham edited this page May 31, 2011 · 44 revisions

This page contains a step-by-step guide to installing Bricolage 2.0.1 on a clean Ubuntu 10.04 LTS (Lucid Lynx) installation. It uses Apache 2 and PostgreSQL 8.4. A selection of optional CPAN modules are installed, including Template::Toolkit.

It differs slightly from other installation guides in that it uses local::lib to contain all the CPAN modules within the Bricolage installation directory. This allows the entire Bricolage installation to be self contained — installed CPAN modules will not conflict with other Perl modules on the system. This method can also ease the installation of multiple Bricolage systems, as the entire Bricolage directory can be copied to another machine of the same architecture.

The excellent App::cpanminus is used to install all required and optional CPAN modules prior to the installation of Bricolage.

Update the system

sudo apt-get update
sudo apt-get upgrade

Install dependencies

sudo apt-get install \
  apache2 \
  apache2-mpm-prefork \
  apache2-prefork-dev \
  build-essential \
  libapache2-mod-apreq2 \
  libapache2-mod-perl2 \
  libapache2-request-perl \
  libexpat1-dev \
  libgif-dev \
  libgmp3-dev \
  libjpeg62-dev \
  libpng12-dev \
  libpq-dev \
  libtiff4-dev \
  postgresql \
  postgresql-server-dev-8.4

Configure Apache

/etc/init.d/apache2 stop

Remove system startup links for Apache (Bricolage has its own Apache startup script):

sudo update-rc.d -f apache2 remove

SSL: Apache SSL support is optional.

Enable the Apache request library and mod_ssl. Do not restart Apache after enabling these modules:

sudo a2enmod apreq ssl

Create a self-signed certificate for Apache

This step is only necessary if you have chosen to use Apache SSL, and if you are not using a certificate from a trusted certificate authority. Self-signed certificates are usually only useful for testing, as browsers that encounter them will produce untrusted certificate warnings.

Note: Ensure that the certificate CommonName (CN) matches the server name given in /etc/hosts

sudo mkdir -p /etc/apache2/conf/ssl.crt/
sudo mkdir -p /etc/apache2/conf/ssl.key/
sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/conf/ssl.crt/server.crt

The resulting file needs to be split into a key file and a certificate file:

sudo cp /etc/apache2/conf/ssl.crt/server.crt /etc/apache2/conf/ssl.key/server.key

Edit server.crt and remove the entire -----BEGIN RSA PRIVATE KEY----- to -----END RSA PRIVATE KEY----- section:

sudo vim /etc/apache2/conf/ssl.crt/server.crt

Edit server.key and remove the entire -----BEGIN CERTIFICATE----- to -----END CERTIFICATE----- section:

sudo vim /etc/apache2/conf/ssl.key/server.key

Configure Postgres authentication

The default installation of PostgreSQL 8.4 on Unbuntu sets ident authentication for the postgres super user. Here, we change that to MD5 password authentication, and then set a password. This may not be suitable for your needs. Please see the relevant documentation for more information.

See the Ubuntu PostrgreSQL guide for a very quick introduction to PostgreSQL.

See the official PostgreSQL 8.4 Client Authentication documentation for a more thorough explanation of authentication methods.

Set a password:

sudo -u postgres psql postgres
\password postgres

Press Control + D to exit.

Change authentication mode:

sudo vim /etc/postgresql/8.4/main/pg_hba.conf
# Database administrative login by UNIX sockets
#local   all         postgres                          ident
local   all         postgres                          md5

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
#local   all         all                               ident
local   all         all                               md5

Restart Postgres:

sudo /etc/init.d/postgresql-8.4 restart

Configure CPAN

If you haven’t done so already, you may wish to configure CPAN:

cpan
Would you like me to configure as much as possible automatically? [yes]
o conf prerequisites_policy follow
o conf build_requires_install_policy yes
o conf commit
exit

Install local::lib and cpanminus

sudo cpan local::lib App::cpanminus

Prepare Bricolage extlib directory

Create the extlib directory that will hold all the CPAN modules:

sudo mkdir -p /usr/local/bricolage/extlib

Important: Configure local::lib to use the extlib directory:

eval $(perl -Mlocal::lib=/usr/local/bricolage/extlib/)

Install libssh2 from source

Optional: This is required by Net::SFTP, so may be omitted if you don’t plan on using SFTP.

The Ubuntu 10.04 libssh2-1-dev package doesn’t work well with Net::SSH2. Instead, a later version of libssh2 will be installed from source:

sudo mkdir -p /usr/local/src/libssh2
sudo chown user:user /usr/local/src/libssh2/
cd /usr/local/src/libssh2/
wget http://www.libssh2.org/download/libssh2-1.2.8.tar.gz
tar xvfz libssh2-1.2.8.tar.gz
cd libssh2-1.2.8
./configure --prefix=/usr
make
sudo make install

Install required CPAN modules

These take a while to install:

sudo cpanm --prompt -L /usr/local/bricolage/extlib/ \
  Apache::Session \
  Cache::Cache \
  Cache::Mmap \
  Class::Container \
  Clone \
  DBD::Pg \
  DBI \
  Data::UUID \
  DateTime \
  DateTime::TimeZone \
  Error \
  Exception::Class \
  HTML::Mason \
  Image::Info \
  List::MoreUtils \
  MIME::Tools \
  MLDBM \
  MasonX::Interp::WithCallbacks \
  Params::CallbackRequest \
  Params::Validate \
  SOAP::Lite \
  Term::ReadPassword \
  Test::Class \
  Test::File \
  Test::MockModule \
  Text::WordDiff \
  Unix::Syslog \
  XML::Simple \
  XML::Writer

Install optional CPAN modules

You may choose to install additional optional modules, or remove some of those shown. See Optional Perl Modules in Installing Bricolage.

The Crypt::* modules — especially Crypt::DH — can take a very long time to install and test. Installing Math::BigInt::GMP first will dramatically decrease the time it takes to run the Crypt::DH tests.

sudo cpanm --prompt -L /usr/local/bricolage/extlib/ \
  Math::BigInt::GMP
sudo cpanm --prompt -L /usr/local/bricolage/extlib/ \
  Crypt::SSLeay \
  Imager \
  Net::SFTP \
  Net::SSH2 \
  Template::Toolkit \
  Test::File::Contents \
  Text::Diff::HTML \
  Text::LevenshteinXS

Net::FTPServer may need force installing if it fails test t/240. See “Bug #21261: t/240abort doesn’t iterate enough”.

Net::FTPServer requires IO::stringy which is supplied by IO::Scalar. The installation fails if it is not installed. BSD::Resource and File::Sync are optional, but recommended.

sudo cpanm -L /usr/local/bricolage/extlib/ \
  BSD::Resource \
  File::Sync \
  IO::Scalar

sudo cpanm --force -L /usr/local/bricolage/extlib/ \
  Net::FTPServer

Install Bricolage 2.0.1 from source

Note: perl Makefile.PL does not produce any output on success.

See the Installation Variables section of Bric::Admin for more information about variables that can be passed to make.

All default options can be accepted, but be aware of the following:

SSL: Apache SSL will be used by default in this configuration. You can disable it by changing the appropriate option to no when prompted.

Postgres: If you configured Postgres MD5 password authentication earlier, you will need to enter the chosen password when asked for the super user password.

sudo mkdir -p /usr/local/src/bricolage
sudo chown user:user /usr/local/src/bricolage/
cd /usr/local/src/bricolage/
wget http://bricolagecms.org/downloads/bricolage-2.0.1.tar.gz
tar xvfz bricolage-2.0.1.tar.gz
cd /usr/local/src/bricolage/bricolage-2.0.1/
perl Makefile.PL
make \
  BRICOLAGE_HTTPD_VERSION=apache2 \
  BRICOLAGE_PG_BECOME_USER=1

You’ll need to enter the relevant password details when prompted:

Should the installer connect to the database as a super user? [yes] 

Postgres Super Username [postgres] 
Password for super user "postgres": 
Confirm password: 
Are you sure you want to use this password? [yes] 

Should the installer become the Postgres system user?
This requires that the installer be run as root. [yes] 
Postgres System Username [postgres] 
Bricolage Postgres Username [bric] 
Password for Postgres user "bric": 
Confirm password: 
Are you sure you want to use this password? [yes] 

Test and install:

make test
sudo make install

Include local::lib in the Bricolage Apache script

sudo vim /usr/local/bricolage/bin/bric_apachectl

Insert the following two lines immediately after the #!/usr/bin/perl -w line:

use FindBin qw($RealBin);
use local::lib "$RealBin/../extlib";

Configure the Bricolage Apache script to run at startup

cd /etc/init.d/
ln -s /usr/local/bricolage/bin/bric_apachectl bric_apachectl
sudo update-rc.d bric_apachectl defaults 92

Configure Bricolage

sudo vim /usr/local/bricolage/conf/bricolage.conf

Set the following as appropriate:

ALWAYS_USE_SSL          = Yes
TT_OPTIONS              = PRE_CHOMP => 3, POST_CHOMP => 0, TRIM => 1
AUTO_PREVIEW_MEDIA      = Yes
MEDIA_UNIQUE_FILENAME   = Yes

Start Bricolage and login

sudo /etc/init.d/bric_apachectl start

From a suitable browser, go to:

http://bricolage_server_hostname

Username: admin
Password: change me now!

Clone this wiki locally