Welcome to Machine Unix

Search Below

How to Install your WordPress Blog on your Joyent SmartMachine ( SmartOS )

If you are going to install a blog such as WordPress in a bare Joyent SmartMachine, some preparation must be done because it is a bare SmartOS. Nothing extra is installed on it, so you would have to prepare your mysql, apache and configure them. The following unofficial procedure outlines such an installation.

Environment

[root@deniz-joy1 ~]# uname -a
SunOS deniz-joy1.joyent.us.local 5.11 joyent_20120126T071347Z i86pc i386 i86pc Solaris

Prerequisites

You will need to install some software before diving into WordPress installation. The following sofwtare will be installed and used:

1) WordPress Source

2) MySql Client & Server

3) Apache2

4) Unzip (Optional )

Preparation

1 – Create a Directory called Downloads and download WordPress in there

[root@deniz-joy1 ~]# mkdir Downloads

[root@deniz-joy1 ~]# cd Downloads

[root@deniz-joy1 ~/Downloads]# wget http://wordpress.org/latest.zip

2 – Start installing some Software

Unzip package

[root@deniz-joy1 ~/Downloads]# pkgin in unzip-6.0
calculating dependencies… – calculating dependencies… done.

nothing to upgrade.
1 packages to be installed: unzip-6.0 (160K to download, 377K to install)

proceed ? [y/N] y

….

Mysql Packages

[root@deniz-joy1 ~/Downloads]# pkgin in mysql-client-5.5.16

….

[root@deniz-joy1 ~/Downloads]#  pkgin in mysql-server-5.5.16nb1

….

3 – Configure the Database

[root@deniz-joy1 ~/Downloads]# mysql_install_db –user=mysql –skip-name-resolve –force

Installing MySQL system tables…
OK
Filling help tables…
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

…..

4 – Enable the Database and Continue configuring

[root@deniz-joy1 ~/Downloads]# svcadm enable mysql
[root@deniz-joy1 ~/Downloads]# svcs -a | grep mysql
online 3:57:08 svc:/network/mysql:default

Setup Passwords

[root@deniz-joy1 ~/Downloads]# /opt/local/bin/mysqladmin -u root password ‘xxx”

[root@deniz-joy1 ~/Downloads]# mysqladmin -u root -h deniz-joy1.joyent.us.local password ‘xxx’

Restart MySql

[root@deniz-joy1 ~/Downloads]# svcadm restart mysql
[root@deniz-joy1 ~/Downloads]# svcs -a | grep mysql
online 3:58:33 svc:/network/mysql:default

5 – Test Your Connection and Create a DB user

[root@deniz-joy1 ~/Downloads]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.5.16 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.

mysql>

mysql> CREATE USER ‘deniz’@’localhost’ IDENTIFIED BY ‘xxx’;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘deniz’@’localhost’ WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

6 – Connect with this new User and Create your WordPress Database

[root@deniz-joy1 ~/Downloads]# mysql -u deniz -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.5.16 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.

mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON wordpress.* TO “deniz”@”deniz-joy1.joyent.us.local” IDENTIFIED BY “xxx”;

Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> EXIT
Bye

7 – Install Apache and friends:

[root@deniz-joy1 ~/Downloads]# pkgin in apache-2.2.21nb2
calculating dependencies… – calculating dependencies… done.

nothing to upgrade.
5 packages to be installed: openldap-client-2.4.24 expat-2.0.1nb2 apr-1.4.5 apr-util-1.3.12nb1 apache-2.2.21nb2 (5832K to download, 22M to install)

proceed ? [y/N] y

….

Install Apache (apache22) module for PHP5.3

[root@deniz-joy1 ~/Downloads]# pkgin in ap22-php53-5.3.8nb1
calculating dependencies… – calculating dependencies… done.

nothing to upgrade.
4 packages to be installed: xmlcatmgr-2.2nb1 php-5.3.8nb1 libxml2-2.7.8nb4 ap22-php53-5.3.8nb1 (9065K to download, 33M to install)

proceed ? [y/N] y
downloading packages…

….

Install mysql php extensions

[root@deniz-joy1 ~/Downloads]# pkgin in php53-mysql-5.3.8
calculating dependencies… – calculating dependencies… done.

nothing to upgrade.
1 packages to be installed: php53-mysql-5.3.8 (26K to download, 70K to install)

proceed ? [y/N] y

….

8 – WordPress Configuration

Copy latest.zip into /opt/local/share/httpd/htdocs/ directory and unzip

[root@deniz-joy1 ~/Downloads]# cp latest.zip /opt/local/share/httpd/htdocs/.

[root@deniz-joy1 /opt/local/share/httpd/htdocs]# unzip -q latest.zip

[root@deniz-joy1 /opt/local/share/httpd/htdocs]# ls
index.html latest.zip wordpress

Change permissions of wordpress directory to www

[root@deniz-joy1 /opt/local/share/httpd/htdocs]# chown -R www:www wordpress/

Need to include mod_php5.so to httpd.conf 

httpd.conf is in /opt/local/etc/httpd/httpd.conf, add the line in there

The line is this:

LoadModule php5_module lib/httpd/mod_php5.so

Inside <IfModule mime_module> line you need the add the following line:

AddHandler application/x-httpd-php .php

index.php line in httpd.conf file inside <IfModule dir_module> must also be added:

DirectoryIndex index.html index.php

Add extension=mysql.so in /opt/local/etc/php.ini

extension=mysql.so

Now Edit Your wp-config File

[root@deniz-joy1 /opt/local/share/httpd/htdocs/wordpress]# cp wp-config-sample.php wp-config.php
[root@deniz-joy1 /opt/local/share/httpd/htdocs/wordpress]# vi wp-config.php

….

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress’);

/** MySQL database username */
define(‘DB_USER’, ‘deniz’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘xxx’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

…..

9 – Restart Apache and Mysql

[root@deniz-joy1]# svcadm restart apache
[root@deniz-joy1]# svcadm restart mysql

[root@deniz-joy1 ~]# svcs -a | grep apache
online 4:35:55 svc:/network/apache:default
[root@deniz-joy1 ~]# svcs -a | grep mysql
online 4:36:12 svc:/network/mysql:default

10 – Start Browser Based Installation

Go to http://hostname/wordpress/wp-admin/install.php and follow the screenshots.

That should be it.

I installed this in smartos64-1.5.4 SM, which is a bare one. If you have one of those plus machines then many of the above configurations are already there.

Cheers!