Installing WordPress on Solaris 10

I was discussing about how to install MySQL and configure it with Apache and PHP in my earlier articles. This is the 3rd and final article of the series for configuring wordpress on Solaris from scratch. Once the MySQL, Apache and PHP are working together, wordpress (or any CMS) can be installed and configured easily.

Go ahead and download the latest version of wordpress from wordpress.org and extract the archive to apache htdocs directory. You may also extract the archive to any other directory and create a symbolic link in htdocs to that directory. [For this example, I will copy the installation to wordpress directory in htdocs. Hence my site address will be http://hostname/wordpress.%5D

WordPress needs a MySQL user and a database for keeping its data. You may use the mysql user to create the database. But it is advisable to use a separate user for wordpress and grant it all the permissions over its tablespace.

To create a user in MySQL, logon as root or mysql user to MySQL and execute the following command.

CREATE USER ‘anyuser’@’localhost’

IDENTIFIED BY PASSWORD ‘anypassword’;

Now, create a database in MySQL and grant all permissions over that table to wordpress user.

CREATE DATABASE wordpress;

GRANT ALL ON wordpress.* TO 'anyuser'@'localhost'

IDENTIFIED BY ‘wordpressuserpassword’;

Execute the following command to copy existing config file for wordpress and fill in your values.

cd /usr/local/apache2/htdocs/wordpress

cp wp-config-sample.php wp-config.php

Open an editor and edit wp-config.php file for your database details. Look into wordpress configuration manual for editing the entries.

If you are already using your webserver for php files, then you may skip this step. Otherwise, your Apache installation might have not been configured to recognize index.php as an index file. Create a .htaccess file in your web root [/usr/local/apache2/htdocs for example] and add the following line in the file:

DirectoryIndex index.php

Now, your http configuration file for apache might also not have been configured to read the above configuration. To do that, open your apache configuration file (httpd.conf) and replace the following line

AllowOverride None

with

AllowOverride All 

For detailed configuration of AllowOverride feature look here.

Now, your apache has been configured to identify php files as index files, which is essential to run wordpress.

Now, open the following URL in your browser and follow the steps to configure wordress. Details can be found at the wordpress installation manual.

Installing and Configuring MySQL on Solaris

This is the first part of the 3 part series, installing WordPress on Solaris 10 on x86. Here is a brief idea for what we are going to cover.

  1. Installing and configuring MySQL [this article]
  2. Installing and configuring Apache web server with PHP [part-2]
  3. Configuring wordpress on Solaris [final part]

MySQL come pre-installed on Solaris 10. However, The MySQL that came out with Solaris 10, is an older version (v4.x) and is not compatible with new installations of most other CMSs today (including wordpress). Hence we will use sunfreeware as a source to fetch all required packages and install and configure them to work together.

One major advantage is, all the packages downloaded from sunfreeware have a SMC prefix to it, so that they do not conflict with existing Solaris packages. Also, they install on /usr/local directory, as instead of /usr/sfw or /usr/bin to avoid further complications.

Installing MySQL

For the installation, download the MySQL package along with these additional packages from sunfreeware.

  • mysql-5.0.67
  • libgcc-3.4.6
  • openssl-1.0.1
  • ncurses-5.7
  • libiconv-1.14
  • libintl-3.4.0

This exact version number may not always be available, as they continue to change, once updated packages are available. You may consider looking for a compatible version, usually mentioned below the download link of a package on sunfreeware web site.

Unpack the downloaded files and use pkgadd command to install the packages as root user.

Configuring MySQL

To configure MySQL, we have to do several steps as root user. As root user, create the following directories and change permissions:

# groupadd mysql
# useradd -g mysql mysql
# cd /usr/local
# chown -R mysql:mysql mysql
# chmod -R 770 /var/mysql

Now, we will initialize the MySQL database.

# cd /usr/local/mysql
# scripts/mysql_install_db --user=mysql

Now, test the installation with the following command

# cd /usr/local/mysql/mysql-test
# su mysql -c ./mysql-test-run.pl

We are not going to test all functionalities of MySQL here. However, this test will let you know, if any dependency packages are missing on your Solaris installation. You may stop the test once MySQL stops complaining about any missing dependency packages.

Use the following command to start MySQL

# /usr/local/mysql/bin/mysqld_safe --user=mysql &

You may also create a password for mysql Solaris user (not a MySQL user). However, there is no real requirement for that, as you are not required to login to the mysql user to do any administration.

Additionally, you may configure the MySQL server startup script named mysql.server, present in /usr/local/mysql/share/mysql/ directory and put MySQL database to start during the system startup. I am not going to cover that in detail here, as the primary aim of this article is to configure and start MySQL server. Please read the comments in mysql.server script to configure it properly.

As the last step, cerate a root user password for MySQL using the following command:

mysqladmin -u root password NEWPASSWORD
[Replace NEWPASSWORD with your desired password]