Installing MediaWiki on Fedora with the mediawiki package
This was a bit painful. The correct order of steps is at the very bottom. You should probably read all of this to see how I got there. I have the following issues with Fedora's mediawiki package.
- Doesn't check that SELinux is in the proper mode. The default SELinux on Fedora blocks the installer from working. It should warn you or something.
- Everything *BUT* the database is included. Maybe they wanted to leave you with a choice. I expect a well made package to include *ALL* required dependencies. It just silently fails to include a database.
- The package installs MediaWiki related directories into goofy places (not in the default Apache document root of /var/www/html). So you have to fix this by moving stuff around or making links.
</rant off>
My sample box is a default load of Fedora 10. Read the official MediaWiki on Fedora documentation. Not too helpful, seems a bit spotty and stale. Hmm. Google is your friend. This page purports to be how to load MediaWiki on Fedora 9. That might work.
A default load of Fedora 10 has Apache with it (at least mine does). After fiddling around with a couple of botched installs, it looks like the mediawiki package has the PHP stuff in it as dependencies. So you're probably missing a database. Try mysql. So I loaded these packages with yum:
[root@cslvm229 ~]# yum install mysql mysql-server mediawiki Loaded plugins: refresh-packagekit fedora | 2.8 kB 00:00 updates | 2.3 kB 00:00 updates/primary_db | 3.3 MB 00:02 Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package mediawiki.i386 0:1.14.0-45.fc10 set to be updated --> Processing Dependency: mediawiki-math = 1.14.0-45.fc10 for package: mediawiki --> Processing Dependency: mediawiki-nomath = 1.14.0-45.fc10 for package: mediawiki --> Processing Dependency: php >= 5 for package: mediawiki --> Processing Dependency: php-gd for package: mediawiki --> Processing Dependency: php-mysql for package: mediawiki --> Processing Dependency: php-pgsql for package: mediawiki --> Processing Dependency: php-xml for package: mediawiki ---> Package mysql.i386 0:5.0.77-1.fc10 set to be updated --> Processing Dependency: mysql-libs = 5.0.77-1.fc10 for package: mysql --> Processing Dependency: libmysqlclient.so.15 for package: mysql --> Processing Dependency: perl(DBI) for package: mysql --> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: mysql ---> Package mysql-server.i386 0:5.0.77-1.fc10 set to be updated --> Processing Dependency: perl-DBD-MySQL for package: mysql-server --> Running transaction check ---> Package mediawiki-math.i386 0:1.14.0-45.fc10 set to be updated ---> Package mediawiki-nomath.i386 0:1.14.0-45.fc10 set to be updated ---> Package mysql-libs.i386 0:5.0.77-1.fc10 set to be updated ---> Package perl-DBD-MySQL.i386 0:4.005-8.fc9 set to be updated ---> Package perl-DBI.i386 0:1.607-1.fc10 set to be updated ---> Package php.i386 0:5.2.6-5 set to be updated --> Processing Dependency: php-common = 5.2.6-5 for package: php --> Processing Dependency: php-cli = 5.2.6-5 for package: php ---> Package php-gd.i386 0:5.2.6-5 set to be updated --> Processing Dependency: libt1.so.5 for package: php-gd ---> Package php-mysql.i386 0:5.2.6-5 set to be updated --> Processing Dependency: php-pdo for package: php-mysql ---> Package php-pgsql.i386 0:5.2.6-5 set to be updated --> Processing Dependency: libpq.so.5 for package: php-pgsql ---> Package php-xml.i386 0:5.2.6-5 set to be updated --> Running transaction check ---> Package php-cli.i386 0:5.2.6-5 set to be updated ---> Package php-common.i386 0:5.2.6-5 set to be updated ---> Package php-pdo.i386 0:5.2.6-5 set to be updated ---> Package postgresql-libs.i386 0:8.3.7-1.fc10 set to be updated ---> Package t1lib.i386 0:5.1.2-2.fc9 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mediawiki i386 1.14.0-45.fc10 updates 153 k mysql i386 5.0.77-1.fc10 updates 3.3 M mysql-server i386 5.0.77-1.fc10 updates 10 M Installing for dependencies: mediawiki-math i386 1.14.0-45.fc10 updates 440 k mediawiki-nomath i386 1.14.0-45.fc10 updates 9.7 M mysql-libs i386 5.0.77-1.fc10 updates 1.8 M perl-DBD-MySQL i386 4.005-8.fc9 fedora 165 k perl-DBI i386 1.607-1.fc10 fedora 776 k php i386 5.2.6-5 fedora 1.2 M php-cli i386 5.2.6-5 fedora 2.3 M php-common i386 5.2.6-5 fedora 228 k php-gd i386 5.2.6-5 fedora 117 k php-mysql i386 5.2.6-5 fedora 81 k php-pdo i386 5.2.6-5 fedora 62 k php-pgsql i386 5.2.6-5 fedora 66 k php-xml i386 5.2.6-5 fedora 96 k postgresql-libs i386 8.3.7-1.fc10 updates 213 k t1lib i386 5.1.2-2.fc9 fedora 197 k Transaction Summary ================================================================================ Install 18 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 31 M Is this ok [y/N]: y Downloading Packages: (1/18): php-pdo-5.2.6-5.i386.rpm | 62 kB 00:00 (2/18): php-pgsql-5.2.6-5.i386.rpm | 66 kB 00:00 (3/18): php-mysql-5.2.6-5.i386.rpm | 81 kB 00:00 (4/18): php-xml-5.2.6-5.i386.rpm | 96 kB 00:00 (5/18): php-gd-5.2.6-5.i386.rpm | 117 kB 00:00 (6/18): mediawiki-1.14.0-45.fc10.i386.rpm | 153 kB 00:00 (7/18): perl-DBD-MySQL-4.005-8.fc9.i386.rpm | 165 kB 00:00 (8/18): t1lib-5.1.2-2.fc9.i386.rpm | 197 kB 00:00 (9/18): postgresql-libs-8.3.7-1.fc10.i386.rpm | 213 kB 00:00 (10/18): php-common-5.2.6-5.i386.rpm | 228 kB 00:00 (11/18): mediawiki-math-1.14.0-45.fc10.i386.rpm | 440 kB 00:00 (12/18): perl-DBI-1.607-1.fc10.i386.rpm | 776 kB 00:01 (13/18): php-5.2.6-5.i386.rpm | 1.2 MB 00:02 (14/18): mysql-libs-5.0.77-1.fc10.i386.rpm | 1.8 MB 00:02 (15/18): php-cli-5.2.6-5.i386.rpm | 2.3 MB 00:03 (16/18): mysql-5.0.77-1.fc10.i386.rpm | 3.3 MB 00:02 (17/18): mediawiki-nomath-1.14.0-45.fc10.i386.rpm | 9.7 MB 00:02 (18/18): mysql-server-5.0.77-1.fc10.i386.rpm | 10 MB 00:03 -------------------------------------------------------------------------------- Total 1.3 MB/s | 31 MB 00:23 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : mediawiki-nomath 1/18 Installing : php-common 2/18 Installing : mysql-libs 3/18 Installing : perl-DBI 4/18 Installing : php-pdo 5/18 Installing : php-mysql 6/18 Installing : mysql 7/18 Installing : perl-DBD-MySQL 8/18 Installing : php-xml 9/18 Installing : php-cli 10/18 Installing : php 11/18 Installing : postgresql-libs 12/18 Installing : php-pgsql 13/18 Installing : t1lib 14/18 Installing : php-gd 15/18 Installing : mysql-server 16/18 Installing : mediawiki 17/18 Installing : mediawiki-math 18/18 Installed: mediawiki.i386 0:1.14.0-45.fc10 mysql.i386 0:5.0.77-1.fc10 mysql-server.i386 0:5.0.77-1.fc10 Dependency Installed: mediawiki-math.i386 0:1.14.0-45.fc10 mediawiki-nomath.i386 0:1.14.0-45.fc10 mysql-libs.i386 0:5.0.77-1.fc10 perl-DBD-MySQL.i386 0:4.005-8.fc9 perl-DBI.i386 0:1.607-1.fc10 php.i386 0:5.2.6-5 php-cli.i386 0:5.2.6-5 php-common.i386 0:5.2.6-5 php-gd.i386 0:5.2.6-5 php-mysql.i386 0:5.2.6-5 php-pdo.i386 0:5.2.6-5 php-pgsql.i386 0:5.2.6-5 php-xml.i386 0:5.2.6-5 postgresql-libs.i386 0:8.3.7-1.fc10 t1lib.i386 0:5.1.2-2.fc9 Complete!
Note the php stuff is included. So we have apache, MySQL, and PHP. Maybe it is even configured. That'd be nice.
So the helpful Fedora 9 article says to start the db and apache, and make sure they start at boot. That sounds right.
[root@cslvm229 ~]# service mysqld start; service httpd start
Initializing MySQL database: Installing MySQL system tables...
090503 14:59:59 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
090503 14:59:59 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK
Filling help tables...
090503 14:59:59 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
090503 14:59:59 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
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 !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h cslvm229.csc.calpoly.edu password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[ OK ]
Starting MySQL: [ OK ]
Starting httpd:
[root@cslvm229 ~]# chkconfig mysqld on; chkconfig httpd on
Yow! What's all *THAT* crap? I guess the first time mysqld is run it does a bunch of setup. You should probably read all that output. Hmm, it's telling me to set a password. That's probably a good idea. This looks promising:
Alternatively you can run: /usr/bin/mysql_secure_installation
So I'll try it:
[root@cslvm229 ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
[root@cslvm229 ~]#
Well, I guess that's good. Sounds good.
So the helpful Fedora 9 page says to copy some stuff around in /var/www. I'll try that.
[root@cslvm229 wiki]# cp -a /var/www/wiki /var/www/html
Now it says:
Now the basics steps are done. Point your fav browser to http://localhost/wiki For first time access to MediaWiki, it would respond with a page "Please set up the wiki first." Click on the link, which would browse to http://localhost/wiki/config/index.php
I did that and *DIDN'T* get the cool setup page (I know what one looks like, I got it on my vhost at my ISP earlier). Instead I got a page of text that looks like:
<?php /** * This is the main web entry point for MediaWiki. * * If you are reading this in your web browser, your server is probably * not configured correctly to run PHP applications! * * See the README, INSTALL, and UPGRADE files for basic setup instructions * and pointers to the online documentation. * * http://www.mediawiki.org/ * <snip>
Hmm. So the LAMP stack is *NOT* configured correctly. Ouch.
First thought is to bounce apache. Maybe the mediawiki package added some php stuff, but my apache didn't pick up the changes (my apache was already running).
[root@cslvm229 wiki]# service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
Reloaded the page, and YAY! I see the config page! The browser now says:
The MediaWiki logo MediaWiki 1.14.0 Please set up the wiki first.
Clicked on the link. This sounds promising:
Checking environment...
Please include all of the lines below when reporting installation problems.
* PHP 5.2.6 installed
* Found database drivers for: MySQL PostgreSQL
* PHP server API is apache2handler; ok, using pretty URLs (index.php/Page_Title)
* Have XML / Latin1-UTF-8 conversion support.
* Session save path (/var/lib/php/session) appears to be valid.
* PHP's memory_limit is 32M.
* Couldn't find Turck MMCache, eAccelerator, APC or XCache; cannot use these for object caching.
* Found GNU diff3: /usr/bin/diff3.
* Found ImageMagick: /usr/bin/convert; image thumbnailing will be enabled if you enable uploads.
* Found GD graphics library built-in.
* Installation directory: /var/www/html/wiki
* Script URI path: /wiki
* Installing MediaWiki with php file extensions
* Environment checked. You can install MediaWiki.
Although this sounds like the one I saw earlier, it's missing a bunch of eye candy logos and general prettiness. Dunno if something is hosed. Oh, well. I'll go with it. Answered all the questions. Clicked on the link. It made a bunch of happy noises but then said:
Warning: fopen(/var/www/html/wiki/config/LocalSettings.php) [function.fopen]: failed to open stream: Permission denied in /var/www/html/wiki/config/index.php on line 1138
Remember earlier, the manual config doc had me loosed up the config dir's permissions? Yeah, well, I guess that's important. They give me the text of the file here that *WOULD* have been written, so I'll try to cut and paste it into the right file name, in the right directory.
Futzed with it, futzed with it, futzed with it, finally made a LocalSettings.php file by hand. Nothing I did could get Apache to be able to write the damn file. (Turns out later that it was SELinux blocking me...)
<More futzing>
Well, it *sorta* works, you get a non gui ugly version. IDK why. No graphics or frames. I'll futz with it more.
<Later>
Well, read this article. Maybe it's skins related. Make the links like suggested.
Yup. Skins. Make some links.
So If you are painfully following along here, you have a futzed up halfass messy installation. To do it *RIGHT*, start over. (I'm using a VM, so I reverted from snapshot).
The correct things to do are:
- Make sure fscking SELinux is turned off!
[root@cslvm229 wiki]# getenforce Enforcing [root@cslvm229 wiki]# setenforce Permissive [root@cslvm229 wiki]# getenforce Permissive [root@cslvm229 wiki]# vi /etc/selinux/config <Make sure it says SELINUX=disabled>
- Install the stuff as I did above with yum.
- Set MySQL and Apache to autostart.
- Start MySQL and set the root password (as above).
- Restart Apache.
- Basically the Fedora mediawiki package puts stuff in the wrong places. Make links to fix this.
- ln -s /var/www/wiki /var/www/html/wiki
- ln -s /usr/share/mediawiki/skins /var/www/wiki/skins
- Make the permissions of /var/www/html/wiki/config wide open (777)
- Point a browser at http://<your_host_name>/wiki and follow the install link
- Answer the questions
- Move the LocalSettings.php file like they tell you to.
- Lock down (or flat remove) the config directory
- Test the wiki, add some text
- Restart the server, make sure it survives reboot
