Difference between revisions of "Installing Mediawiki 1.31.3 on OpenBSD 6.5"
(Created page with "Category:OpenBSD") |
|||
Line 1: | Line 1: | ||
[[Category:OpenBSD]] | [[Category:OpenBSD]] | ||
+ | |||
+ | == Introduction == | ||
+ | |||
+ | We'll install a mediawiki that uses sqlite. | ||
+ | |||
+ | == Prerequisites == | ||
+ | |||
+ | Make sure you have a server, a domain (we'll use <code>w2.mgk.ro</code>). Make sure you have followed the [[OpenBSD Post Install Steps]]. | ||
+ | |||
+ | == Install PHP == | ||
+ | |||
+ | pkg_add -r php%7.3 php-gd%7.3 php-intl%7.3 php-pdo_sqlite%7.3 pecl73-imagick | ||
+ | |||
+ | Enable required PHP extensions by: | ||
+ | |||
+ | ln -sf /etc/php-7.3.sample/imagick.ini /etc/php-7.3/ | ||
+ | ln -sf /etc/php-7.3.sample/gd.ini /etc/php-7.3/ | ||
+ | ln -sf /etc/php-7.3.sample/intl.ini /etc/php-7.3/ | ||
+ | ln -sf /etc/php-7.3.sample/opcache.ini /etc/php-7.3/ | ||
+ | ln -sf /etc/php-7.3.sample/pdo_sqlite.ini /etc/php-7.3/ | ||
+ | |||
+ | == Configure files == | ||
+ | |||
+ | Create site directories: | ||
+ | |||
+ | domain="w2.mgk.ro" | ||
+ | mkdir -p -m 775 /var/www/src /var/www/sites /var/www/sites/${domain} /var/www/sites/${domain}/{data,images} | ||
+ | mkdir /var/www/htdocs/${domain} | ||
+ | chown :staff /var/www/src /var/www/sites /var/www/sites/${domain} | ||
+ | chown :wheel /var/www/htdocs/${domain} | ||
+ | chown :www /var/www/sites/${domain}/{data,images} | ||
+ | chmod +t /var/www/sites/${domain}/images | ||
+ | chmod 775 /var/www/sites/w2.mgk.ro/mediawiki* | ||
+ | |||
+ | Download mediawiki: | ||
+ | |||
+ | cd /var/www/src | ||
+ | ftp https://releases.wikimedia.org/mediawiki/1.31/mediawiki-1.31.3.tar.gz | ||
+ | ftp https://extdist.wmflabs.org/dist/extensions/MobileFrontend-REL1_31-289f540.tar.gz | ||
+ | |||
+ | Extract mediawiki: | ||
+ | |||
+ | tar -xzf mediawiki-1.31.3.tar.gz -C /var/www/sites/${domain} | ||
+ | tar -xzf MobileFrontend-REL1_31-289f540.tar.gz -C /var/www/sites/${domain}/mediawiki-1.31.3/extensions | ||
+ | |||
+ | Create site links in htdocs: | ||
+ | |||
+ | ln -sf ../../sites/${domain}/mediawiki-1.31.3 /var/www/htdocs/${domain}/w | ||
+ | |||
+ | == Enable services == | ||
+ | |||
+ | rcctl enable php73_fpm | ||
+ | rcctl start php73_fpm | ||
+ | rcctl enable httpd | ||
+ | rcctl start httpd | ||
+ | |||
+ | == Configure web server for MediaWiki installation == | ||
+ | |||
+ | Add aram to the www group: | ||
+ | |||
+ | usermod -G www aram | ||
+ | |||
+ | Create empty httpd.conf file and configure permissions: | ||
+ | |||
+ | touch /etc/httpd.conf | ||
+ | chown root:staff /etc/httpd.conf | ||
+ | chmod 664 /etc/httpd.conf | ||
+ | |||
+ | === Run the MediaWiki installer === | ||
+ | |||
+ | Use this initial config: | ||
+ | |||
+ | server "w2.mgk.ro" { | ||
+ | listen on * port 80 | ||
+ | root "/htdocs/w2.mgk.ro" | ||
+ | directory no index | ||
+ | |||
+ | location "/w/*.php" { | ||
+ | fastcgi socket "/run/php-fpm.sock" | ||
+ | } | ||
+ | '''location "/w/mw-config/*.php" {''' | ||
+ | '''fastcgi socket "/run/php-fpm.sock"''' | ||
+ | '''}''' | ||
+ | location "/w/" { directory index index.php } | ||
+ | '''location "/w/mw-config/*" { directory index index.php }''' | ||
+ | '''location "/w/mw-config/images/*" { pass }''' | ||
+ | |||
+ | location "/w/resources/assets/*" { pass } | ||
+ | location "/w/resources/lib/*" { pass } | ||
+ | location "/w/resources/src/*" { pass } | ||
+ | location "/w/skins/*" { pass } | ||
+ | location "/w/extensions/*" { pass } | ||
+ | |||
+ | location "/images/deleted/*" { block } | ||
+ | location "/images/*" { pass } | ||
+ | |||
+ | location "/" { | ||
+ | '''block return 301 "http://$SERVER_NAME/w/mw-config"''' | ||
+ | } | ||
+ | location "/*" { block } | ||
+ | } | ||
+ | |||
+ | Enable and start PHP and httpd: | ||
+ | |||
+ | rcctl enable php73_fpm | ||
+ | rcctl start php73_fpm | ||
+ | rcctl enable httpd | ||
+ | rcctl start httpd | ||
+ | |||
+ | Visit http://w2.mgk.ro/ and run the installer. Use <code>/sites/w2.mgk.ro/data</code> for the SQLite data directory. Download <code>LocalSettings.php</code> and upload it to <code>/var/www/htdocs/${domain}/w</code> | ||
+ | |||
+ | scp LocalSettings.php w2.mgk.ro:/var/www/htdocs/w2.mgk.ro/w | ||
+ | |||
+ | The wiki should now work with traditional (long) URLs. |
Revision as of 13:21, 2 October 2019
Contents
Introduction
We'll install a mediawiki that uses sqlite.
Prerequisites
Make sure you have a server, a domain (we'll use w2.mgk.ro
). Make sure you have followed the OpenBSD Post Install Steps.
Install PHP
pkg_add -r php%7.3 php-gd%7.3 php-intl%7.3 php-pdo_sqlite%7.3 pecl73-imagick
Enable required PHP extensions by:
ln -sf /etc/php-7.3.sample/imagick.ini /etc/php-7.3/ ln -sf /etc/php-7.3.sample/gd.ini /etc/php-7.3/ ln -sf /etc/php-7.3.sample/intl.ini /etc/php-7.3/ ln -sf /etc/php-7.3.sample/opcache.ini /etc/php-7.3/ ln -sf /etc/php-7.3.sample/pdo_sqlite.ini /etc/php-7.3/
Configure files
Create site directories:
domain="w2.mgk.ro" mkdir -p -m 775 /var/www/src /var/www/sites /var/www/sites/${domain} /var/www/sites/${domain}/{data,images} mkdir /var/www/htdocs/${domain} chown :staff /var/www/src /var/www/sites /var/www/sites/${domain} chown :wheel /var/www/htdocs/${domain} chown :www /var/www/sites/${domain}/{data,images} chmod +t /var/www/sites/${domain}/images chmod 775 /var/www/sites/w2.mgk.ro/mediawiki*
Download mediawiki:
cd /var/www/src ftp https://releases.wikimedia.org/mediawiki/1.31/mediawiki-1.31.3.tar.gz ftp https://extdist.wmflabs.org/dist/extensions/MobileFrontend-REL1_31-289f540.tar.gz
Extract mediawiki:
tar -xzf mediawiki-1.31.3.tar.gz -C /var/www/sites/${domain} tar -xzf MobileFrontend-REL1_31-289f540.tar.gz -C /var/www/sites/${domain}/mediawiki-1.31.3/extensions
Create site links in htdocs:
ln -sf ../../sites/${domain}/mediawiki-1.31.3 /var/www/htdocs/${domain}/w
Enable services
rcctl enable php73_fpm rcctl start php73_fpm rcctl enable httpd rcctl start httpd
Configure web server for MediaWiki installation
Add aram to the www group:
usermod -G www aram
Create empty httpd.conf file and configure permissions:
touch /etc/httpd.conf chown root:staff /etc/httpd.conf chmod 664 /etc/httpd.conf
Run the MediaWiki installer
Use this initial config:
server "w2.mgk.ro" { listen on * port 80 root "/htdocs/w2.mgk.ro" directory no index location "/w/*.php" { fastcgi socket "/run/php-fpm.sock" } location "/w/mw-config/*.php" { fastcgi socket "/run/php-fpm.sock" } location "/w/" { directory index index.php } location "/w/mw-config/*" { directory index index.php } location "/w/mw-config/images/*" { pass } location "/w/resources/assets/*" { pass } location "/w/resources/lib/*" { pass } location "/w/resources/src/*" { pass } location "/w/skins/*" { pass } location "/w/extensions/*" { pass } location "/images/deleted/*" { block } location "/images/*" { pass } location "/" { block return 301 "http://$SERVER_NAME/w/mw-config" } location "/*" { block } }
Enable and start PHP and httpd:
rcctl enable php73_fpm rcctl start php73_fpm rcctl enable httpd rcctl start httpd
Visit http://w2.mgk.ro/ and run the installer. Use /sites/w2.mgk.ro/data
for the SQLite data directory. Download LocalSettings.php
and upload it to /var/www/htdocs/${domain}/w
scp LocalSettings.php w2.mgk.ro:/var/www/htdocs/w2.mgk.ro/w
The wiki should now work with traditional (long) URLs.