Installing WordPress Locally on Gentoo Linux

If you have Apache, PHP and MySQL installed, you can skip right down to Installing WordPress.

Installing Apache

Just type

# emerge apache

Installing MySQL

MySQL is free database for personal use. First you need to emerge MySQL.

# emerge mysql

Now create the main MySQL database which contains administrative information and add password for root user on MySQL server.

# emerge --config =mysql-[version]

Next check if MySQL demon has started correctly.

# /etc/init.d/myslq start
* Starting mysqld (/etc/mysql/my.cnf) ... [ ok ]

If there aren’t any errors, you’ve installed MySQL correctly.

Installing PHP

OK, next we’ll install PHP as Apache module.

# emerge dev-php/php mod_php

Now PHP is installed, but not active. To enable PHP, edit Apache configuration file

# vi /etc/conf.d/apache2

and put there this line

APACHE2_OPTS="-D DEFAULT_VHOST -D PHP4 -D USERDIR "

to browsing the directory where you keep your data add -D USERDIR

To check PHP, start the apache2 demon

# /etc/init.d/apache2 start

and make example test page

# vi /var/www/localhost/htdocs/test.php
<?php
phpinfo();
?>

When you type in your favorite browser http://localhost/test.php, you should see settings of your Apache server. The next step is Installing WordPress!

Installing WordPress (using emerge)

Go to command line, and log to MySQL as root user.

# mysql -u root -p

Create WordPress database, example name wordpress

mysql> create database wordpress;

and WordPress user, example wordpress and add to him all privileges.

mysql> grant all on wordpress.* to wordpress@localhost
identified by 'password_here';

Refresh privileges.

flush privileges

Now, leave MySQL command line.

mysql> exit

Installing WordPress is really easy

# emerge wordpress

Go to WordPress directory /var/www/localhost/htdocs/wordpress/ and edit wp-config-sample.php file. Change your code as in example.

 // ** MySQL settings ** //
define('DB_NAME', 'wordpress');     // The name of the database
define('DB_USER', 'username');     // Your MySQL username
define('DB_PASSWORD', 'password'); // ...and password
define('DB_HOST', 'localhost');

define('DB_HOST', 'localhost'); 99% chance you won’t need
to change this value, but if you crated MySQL user at 127.0.0.1
you have to change localhost to 127.0.0.1

Rename the file wp-config-sample.php to wp-config.php

Using your favorite web browser, visit wp-admin/install.php (example http://localhost/wordpress/wp-admin/install.php) and run the installing script.

This is really simple.

If you get an error about the database while running that script, check username, password etc., in wp-config.php file and be sure the MySQL is running ;)

Installing WordPress (development)

If you need more than one instalation of WordPress, you can copy emerge instalation (directory /var/www/localhost/htdocs/wordpress/) where do you need and modify config.php and create new database of course.

Also you can download the latest stable version WordPress and extract wordpress.tar.gz to your favourite directory. (or directories)

tar -xvvzf wordpress-[version].tar.gz

  • Friday, 13 January 2006
  • 53,893 views