Help:Running MediaWiki on Solaris 10

From WikiGlide

Jump to: navigation, search

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.

Contents

MySQL

MySQL is part of Stock Solaris 10. If not installed, install packages SUNWmysqlr, SUNWmysqlt, and SUNWmysqlu. To enable, see file /etc/sfw/mysql/README.solaris.mysql. Here's what I did:

# /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
# /usr/sfw/bin/mysqladmin -u root password pw # <--SET password (don't use root's)

Start and test:

# /usr/sfw/sbin/mysqld_safe --user=mysql &
# 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/rc1.d/K00mysql
# 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

PHP is available on the "Solaris Software Companion" CD under category Development/Languages as package SFWmphp. Install and enable following instructions at /etc/apache/httpd.conf-php-example. Basicaly, run post-instll script /opt/sfw/apache/x_postinstall

Apache

Solaris comes with both Apache. If you don't have Apache installed, install packages SUNWapachd, SUNWapchr, and SUNWapchu.

To enable Apache, copy /etc/apache/httpd.conf-php-example to /etc/apache/httpd.conf. Edit httpd.conf. At minimum you need to change the "ServerName" line. I also change the "User" and "Group" lines to "User apache" and "Group apache" after adding an apache group and apache user:

# groupadd apache
# useradd -g apache -d /var/apache

The web documents live in /var/apache/htdocs.

Start Apache the first time with "/etc/init.d/apache". See if the httpd process is running, check the error log at /etc/apache/logs/error_log, and access with your web browser. On subsequent reboots, Apache will restart automatically if httpd.conf is present.

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

MediaWiki

There is no Solaris package for MediaWiki. Just download the PHP scripts from http://www.mediawiki.org/wiki/Download and follow the installation instructions at http://meta.wikimedia.org/wiki/Help:Installation Untar the files to /var/apache/htdocs/wiki 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:

 # cd /var/apache/htdocs/wiki
 # chown -R apache:apache *
 # 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:

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

I made 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:

cp /var/apache/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

Security Considerations

As Apache and MediWiki 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. Solaris 10 uses Apache 1.3.3, MySQL 4.0.15, and PHP 4.3.2. 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 www.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

See also

For more customizations and information see


External links

Personal tools