Content management systems

Running WordPress on Sabayon

16 September 2015 Content management systems, Installation guides No comments

WordPress (WP) is a free content management system, used primarily as a blog application, and is used to power numerous websites (including blogs, such as this one). It requires a MySQL backend database (MariaDB is an acceptable alternative), the PHP scripting language and a web server (usually Apache, but nginx is also acceptable). Henceforth I will refer to this software bundle as LAMP (short for Linux, Apache, MariaDB/MySQL and PHP). Setting WP up to run on Sabayon is fairly simple and boils down to three steps, firstly, getting the dependencies set up and ready for WordPress. Secondly, getting the source code and moving it to the appropriate location on your system. Then thirdly, running the installation script of WordPress.

Step 1: Getting the dependencies

LAMP can be installed with a variety of different methods. It may be prudent to enable PHP support for all packages with

root # euse php

before installing LAMP, if you intend to use Portage to install it.

Table 1: Installing LAMP on Sabayon
root # equo i virtual/httpd-php dev-db/mariadb www-servers/apache
root # equo config dev-db/mariadb
root # equo i virtual/httpd-php dev-db/mysql www-servers/apache
root # equo config dev-db/mysql
root # emerge virtual/httpd-php dev-db/mariadb www-servers/apache
root # emerge –config dev-db/mariadb
root # equo rescue spmsync && equo mask virtual/httpd-php dev-db/mariadb www-servers/apache
root # emerge virtual/httpd-php dev-db/mysql www-servers/apache
root # emerge –config dev-db/mysql
root # equo rescue spmsync && equo mask virtual/httpd-php dev-db/mysql www-servers/apache

After installing LAMP the following files will need to be edited: /etc/php/apache2-php5.x/php.ini (where x is dependent on the version of PHP being used, e.g., if using PHP 5.6 then x=6) and /etc/conf.d/apache2. The first of these will need the following lines uncommented (that is, have the semicolon, ;, before them removed):

the final line can be left commented, if using MySQL instead of MariaDB for the backend database.

Likewise /etc/conf.d/apache2 will need -D PHP5 added to the end of the APACHE2_OPTS="..." line (within the quotation marks, however). Likewise you will need to enable and start the apache2 and mysqld daemons.

root #  systemctl enable apache2 && systemctl start apache2
root #  systemctl enable mysqld && systemctl start mysqld

After this you will need to set up a MariaDB/MySQL database for WordPress. To do this run mysql -u root -p, entering your root password for MariaDB/MySQL and then run CREATE DATABASE wordpress; to create a database entitled “wordpress”. It should not make any difference if you choose to call the database something other than wordpress, just make sure you remember this database name as you will need it for the final step.

Step 2: getting the source code

This step can be carried out a number of different ways, each of them equally valid, but for simplicity this section will only mention one such method that can be done from the command-line.

root # cd /var/www/localhost/htdocs/
root # wget -c
root # tar -xzf latest.tar.gz #you may also wish to delete latest.tar.gz after this step
root # mv wordpress wp
root # chmod 777 -R wp
root # chown apache:apache -R wp

Step 3: Running the install script

To do this simply open your favourite web browser to http://localhost/wp and complete the installation wizard. If you are still working at the command-line and would like to start this final step from the command-line you can run:

user $ xdg-open http://localhost/wp

Running MediaWiki on Sabayon

30 August 2015 HOWTOs, Installation guides, Wiki applications No comments

MediaWiki (MW) is a free wiki application that powers several notable websites including all the Wikimedia Projects (e.g., Wikimedia Commons and Wikipedia), Wikia sites, Orain Wiki sites, ShoutWiki sites and even the Gentoo and Sabayon Wiki websites. It is written in PHP and also requires a web server (usually Apache) and a backend database (usually MariaDB or MySQL) configured to use it, in order for one to be able to run it. On Sabayon there are a few different ways to run MediaWiki, which mostly just vary by the server or database used to host the Wiki.


This basic method can be boiled down to the following steps:

      1. Add PHP USE flags to all packages using:
        root #  euse php
      2. Run:
        root #  echo “dev-lang/php apache2 xmlreader” >> “/etc/portage/package.use/gentoo.use”
      3. Note: the following step while written for MariaDB, can be easily adjusted to using a MySQL backend database, simply substitute mariadb in these following commands with mysql.Install LAMP and configure MariaDB. To do this with Portage (emerge) run:
        root #  emerge -a dev-db/mariadb virtual/httpd-php www-servers/apache
        root #  emerge –config dev-db/mariadb
        root # equo rescue spmsync && equo mask dev-db/mariadb virtual/httpd-php www-servers/apache

        whereas to do this with Entropy (equo) run:

        root #  equo i dev-db/mariadb virtual/httpd-php www-servers/apache
        root #  equo config dev-db/mariadb

        Optionally one can run, after installing LAMP and configuring MariaDB, the following:

        root #  mysql_secure_installation
      4. Add:

        to /etc/conf.d/apache2.
      5. Edit your php.ini file, which should be somewhere in a subdirectory of /etc/php with apache2 in its name, e.g., /etc/php/apache2-php5.6. Find the following lines and uncomment them (removing the semicolon, ; from before them).

        the last line can be left commented if using a MySQL database.
      6. Enable the apache2 and mysqld daemons and start them.
        root #  systemctl enable apache2 && systemctl start apache2
        root #  systemctl enable mysqld && systemctl start mysqld
      7. Download and extract the source code of the MediaWiki release you want to /var/www/localhost/htdocs/ and change the permissions of the files therein accordingly, for example:
        root #  wget -c
        root #  tar -xzf mediawiki-1.25.2.tar.gz -C /var/www/localhost/htdocs/
        root #  cd /var/www/localhost/htdocs/
        root #  mv mediawiki-1.25.2 w
        root #  chmod 777 -R w
        root #  chown apache:apache -R w

        I am aware of the www-apps/mediawiki package in Gentoo and Sabayon main repositories, but for me they never seem to work.

      8. Open up your browser to http://localhost/w/mw-config and run the set up script. To do this from the command-line, for example (and this will open up your default web browser), run:
        user $  xdg-open http://localhost/w/mw-config

        Then when you are finished, download LocalSettings.php to /var/www/localhost/htdocs/w and open your web browser to http://localhost/w/index.php/Main_Page.

Optional configuration

Short Wiki URL

  • To get your Wiki to use a shorter URL, namely http://localhost/wiki/$1 instead of what it would be using if set up with the aforementioned method, http://localhost/w/index.php/$1, add the following to /etc/apache2/vhosts.d/default_vhost.include:

    and the following to LocalSettings.php:

    External links