Technically, I should have written this article while I set up WordPress for the first time. However, this brings up the ancient paradox of “chicken or egg?”

Now that the egg is ready, it’s time for the chicken to hatch.

Installing the LAMP stack

The LAMP stack stands for Linux, Apache, MySQL and PHP. The boring old stack.

By assuming Gentoo, the Linux part is taken for granted. The following configuration installs the other three components:

Set the useflags:

dev-lang/php gd mysql mysqli

There are three PHP interfaces for MySQL: mysql, mysqli and pdo. WordPress makes use of the former two, but not the last.

Then install the packages.

emerge apache php virtual/mysql

The next step is to ask apache to enable PHP support: add -D PHP to /etc/conf.d/apache2.

Obviously, there are various replacements for mysql so portage might not always install the vanilla one. But as they are all designed as drop-in replacements, any should work.

Setting up the apache server

Gentoo packs a default vhost that points to The most naïve solution would be setting up a symbolic link from /var/www/localhost/htdocs to wherever WordPress is.

Creating a database

Mariadb will complain if I try to start. Apparently, it needs some basic configuration.

Run emerge --config dev-db/mariadb to set up a root password. I still needed to run mysql_secure_installation to feel secure enough afterwards.

Then run mysql -p to log in, and use the following commands:

CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO "wordpressusername"@"hostname" IDENTIFIED BY "password";
FLUSH PRIVILEGES;
exit

Then open the browser and input the same information and finish WordPress installation. Give the directory 777 permission temporarily can allow WordPress to write wp-config.php itself.

Making sure all services are run after restarting

rc-update add apache
rc-update add mysql

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.