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 https://wordpress.org/latest.tar.gz
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