Jump to content

Manual:Running MediaWiki on Solaris 10

From mediawiki.org

For Solaris, one can do a native installation. Solaris 10 has "premier support" until January 2018 and "extended support" until January 2025.

native

[edit]

The following are notes on how to enable MediaWiki, PHP, MySQL, and Apache in Solaris 10.

MediaWiki requires a PHP-enabled webserver and MySQL. Stock Solaris 10 comes with Apache and MySQL. PHP is installed from the Solaris Software Companion CD. MediaWiki consists of downloaded PHP scripts that use MySQL. The following details each step.

MySQL

[edit]

MySQL is part of Stock Solaris 10. If not installed, install packages SUNWmysqlr, SUNWmysqlt, and SUNWmysqlu. To enable, see the file /etc/sfw/mysql/README.solaris.mysql. The steps to perform are:

# /usr/sfw/bin/mysql_install_db
# groupadd mysql
# useradd -g mysql -d /var/mysql mysql
# chgrp -R mysql /var/mysql
# chmod -R 770 /var/mysql

Start:

# /usr/sfw/sbin/mysqld_safe --user=mysql &

Set password:

# /usr/sfw/bin/mysqladmin -u root password pw # <--SET password (don't use root's)

Test:

# cd /usr/sfw/mysql/mysql-test; ./mysql-test-run

Automatic start and stop of mysql daemon at boot and shutdown:

# ln /etc/sfw/mysql/mysql.server /etc/rc3.d/S99mysql
# ln /etc/sfw/mysql/mysql.server /etc/rc0.d/K00mysql
# ln /etc/sfw/mysql/mysql.server /etc/rc1.d/K00mysql
# ln /etc/sfw/mysql/mysql.server /etc/rc2.d/K00mysql
# ln /etc/sfw/mysql/mysql.server /etc/rcS.d/K00mysql

PHP

[edit]

PHP5

[edit]

To use Apache2 and PHP 5 with your installation, download the following packages from www.sunfreeware.com:

libgcc
libiconv
zlib
libxml2
php

Note that the version numbers may change on www.sunfreeware.com, due to updates. The best way to start is to look for an php-5.x.x package and then download the subsequent dependencies. You don't need to download Apache2 and mySQL as Solaris 10 already comes with these packages.

Download them to the directory /tmp/php-packages and install them:

# cd /tmp/php-packages
# for i in *gz; do gunzip $i; done
# for i in *local ; do pkgadd -d $i; done

Now copy the php-module and php.ini to their appropriate directories:

# cp -p /usr/local/apache2/modules/libphp5.so /usr/apache2/libexec
# cp -p /usr/local/php/doc/php/php.ini-recommended  /etc/apache2/php.ini

If you want a phpinfo page (see "Security Considerations" below), create it with:

echo "<?php phpinfo(); ?>" >/var/apache2/htdocs/phpinfo.php

Apache

[edit]

Apache2

[edit]

First copy /etc/apache2/httpd.conf-example to /etc/apache2/httpd.conf. Then edit /etc/apache2/httpd.conf and add the following lines in their appropriate places:

LoadModule php5_module        libexec/libphp5.so
AddType application/x-httpd-php .php

Then start and enable the apache2 service:

# svcadm -v enable /network/http:apache2

If you are told that the argument doesn't match any instances, pkill svc.configd. Details of the problem are at http://forum.sun.com/jive/thread.jspa?threadID=74430&tstart=210

Check if apache is running.

If not do the following as root in zone where wiki is installed:

1. check if the service state is enabled and online

# svcs -l http
fmri         svc:/network/http:apache2
name         Apache 2 HTTP server
enabled      false
state        disabled
next_state   none
state_time   Thu Apr 20 15:56:44 2006
restarter    svc:/system/svc/restarter:default
dependency   require_all/error svc:/network/loopback:default (online)
dependency   optional_all/error svc:/network/physical:default (online)

2. enable the service

# svcadm -v enable /network/http:apache2
svc:/network/http:apache2 enabled.

3. check current status

# svcs -l http
fmri         svc:/network/http:apache2
name         Apache 2 HTTP server
enabled      true
state        online
next_state   none
state_time   Thu Apr 20 15:59:02 2006
logfile      /var/svc/log/network-http:apache2.log
restarter    svc:/system/svc/restarter:default
contract_id  2197
dependency   require_all/error svc:/network/loopback:default (online)
dependency   optional_all/error svc:/network/physical:default (online)

4. restart the service

#svcadm restart /network/http:apache2

5. check the process status

# ps -ef |grep http
    root  20530 20047   0 15:59:33 ?           0:00 /usr/apache2/bin/httpd -k start
 webservd 20534 20530   0 15:59:34 ?           0:00 /usr/apache2/bin/httpd -k start
 webservd 20531 20530   0 15:59:34 ?           0:00 /usr/apache2/bin/httpd -k start
 webservd 20532 20530   0 15:59:34 ?           0:00 /usr/apache2/bin/httpd -k start
 webservd 20535 20530   0 15:59:34 ?           0:00 /usr/apache2/bin/httpd -k start
 webservd 20533 20530   0 15:59:34 ?           0:00 /usr/apache2/bin/httpd -k start
    root 20537 20500   0 15:59:39 pts/2       0:00 grep http

Verify PHP is enabled by going to http://localhost/phpinfo.php where localhost is the hostname of your system.

MediaWiki

[edit]

There is no Solaris package for MediaWiki. Follow the installation instructions at Manual:Installing MediaWiki. Untar the files to /var/apache/htdocs/wiki (or /var/apache2/htdocs/wiki when using Apache2) such that you have file /var/apache/htdocs/wiki/index.php (you will need to move the files up a directory level). Then fix permissions as follows:

Apache2/PHP5 Version:

 # cd /var/apache2/htdocs/wiki
 # chown -R webservd:webservd *
 # chmod -R o-rwx *
 # chmod -R g+rw config
 

Start the web browser and install and configure from there: http://localhost/wiki/config/ I kept the defaults for the database and sysop and set the password. The sysop and database password may be the same, but don't use root's password (as it's saved in cleartext in LocalSettings.php). After filling out the form click INSTALL. If you are successfully connected to the database, then copy and save the local settings:

Apache2/PHP5:

# cd /var/apache2/htdocs/wiki
# mv config/LocalSettings.php .
# cp LocalSettings.php LocalSettings.php.original

Make these customizations to LocalSettings.php:

$wgLogo = "$wgScriptPath/images/logo.jpg";
$wgEnableUploads = true;
$wgEnableUploads  = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/sfw/bin/convert";

Now test by going to the main wiki page: http://localhost/wiki/ (where localhost is your system's hostname)

After customizing, it's a good idea to backup your LocalSettings.php file and dump the database to a safe location:

Apache2/PHP5:

# cp /var/apache2/htdocs/wiki/LocalSettings.php LocalSettings.php.backup
# /usr/sfw/bin/mysqldump --user=wikiuser --password=YOURPWHERE wikidb |gzip -9 >wiki-mysql-dump.txt.gz

Security considerations

[edit]

As Apache and MediaWiki is web-facing software, you should consider security, especially if it's on the public Internet. Keeping the software up-to-date is an important part of security. The following tips should help secure your site:

  • Remove or rename phpinfo.php, as it leaks valuable information about your web server.
  • Update your Apache and MySQL software with security patches, if any, from SunSolve. For example, MySQL for Solaris 10 has a patch with several security fixes (patch 120292 SPARC or 120293 x86).
  • You may want to download and compile the latest PHP software from php.net. The command line used to configure PHP is given by the phpinfo.php script. For Solaris 10 it is:
./configure --disable-cli --with-apxs=/usr/apache/bin/apxs --with-config-file-path=/etc/apache \
            --with-mysql --enable-track-vars --prefix=/opt/sfw