Manual talk:Running MediaWiki on Ubuntu

From mediawiki.org
  • Updated to match scratch install done with 9.04 on 5/14/09

In 9.04 I found I could not access the config directory to get LocalSettings.php until I did a chmod on it. I didn't experience that problem on u7.x or u8.x tests.

The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

For a presentation I went through an install/config several times and touched up this page to match what I learned:

  • All references to VMware removed - unnecessary
  • Chatty reference to UK download site removed
  • Added note about how to find correct current version (and updated to reflect 1.9.3 is current)
  • Reorganized headings to make more sense

I think the whole area at the end regarding making an offline copy of MediaWiki help is unnecessary and confusing. I put it into an entirely separate heading, but I'm leaning towards deleting it.

Other Ubuntu-based distributions[edit]

I'm wondering if this manual can be applied to other Ubuntu-based distributions such as Mint or Kubuntu? Wissamkhatib (talk) 09:12, 11 November 2014 (UTC)Reply

Full Re-edit Nov 2014[edit]

Full cleanup of text, procedures, prose. I believe the page is significantly better organized and usable now.

Please add new discussion entries at the top, not bottom, of this page. Quaere Veritatem Tuam (talk) 20:11, 7 November 2014 (UTC)Reply

Images directory permissions[edit]

I just did a clean install into Ubuntu 8.04 LTS, and making the images directory writable was not required in order for image uploading to work. Seems like this step is superfluous and a little dangerous. --Mark 16:59, 22 September 2009 (UTC)Reply

I just did a clean install into Ubuntu 8.04.3 LTS, and making the images directory writeable was required to get SVG graphics to work. I don't see how it is dangerous to allow the WWW user to write to the images folder (?).

WWW user, maybe not. Making the entire thing writeable by all, as shown here, is a different matter.

if the WWW user could write the image folder, a bug could allow to a malicious user to upload an exploit into the server and execute it through the Web. Always is a good idea restrict the WWW user permissions at the minimum necessary.

GD library or ImageMagic?[edit]

I think the line, "If you want to use the GD library (instead of ImageMagic for image resizing)" leaves the reader at a loss as to why he or she would want to use this option. Specifically:

  1. Is ImageMagic already installed with MediaWiki?
    1. If not, how to download and install.
  2. Why would someone want to use one over the other?

..a great article overall, though! Thanks!


It may be helpful to use nano, rather than vi. -- 81.187.40.226


  • I agree - I don't know where the vi came from, I used gedit throughout and someone changed it to vi. I just reedited and put gedit back in. Also, the inline comment someone made about my setting the config directory to a+w was unnecessary, since the entire directory is rm'd about 10 lines further down.

No Ubuntu Package?[edit]

The "Get Latest MediaWiki" section notes "There is no apt package for MediaWiki". Was the author unaware of "sudo aptitude install mediawiki", which seems to work fine for me in Ubuntu, or is this package somehow insufficient?

Yes you can install it. Now I'm not sure what to do next. Logictheo 20:34, 18 June 2009 (UTC)Reply
That phrase,"There is no apt package for MediaWiki" is gone, I guess someone removed it. I believe this has been resolved on the "Manual" page. I will remove this discussion "No Ubuntu Package?" if no one objects. Kmacdowe (talk) 18:37, 21 October 2014 (UTC)Reply

Desktop Installation of php[edit]

I am trying to set up mediawiki on my ubuntu 7.10 . These are the various things which I needed to install on the desktop & configure stuff for it to work.

sudo apt-get install php-mysql mysql-client mysql-client php-gd apache2-mpm-prefork libapache2-mod-php5 phpmyadmin php5-xcache phpmyadmin

then had to make symlinks

sudo ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/
sudo ln -s /etc/apache2/mods-available/php5.load /etc/apache2/mods-enabled/

Then restarted apache

sudo apache2ctl restart


Also edited in /etc/apache2.conf so it doesn't complain :-

ServerName 127.0.0.1 or your Server IP address.


Ok then do ,

192.168.1.2/wiki

the ipaddress was got from eth0 inet_addr

which shows you the wiki page ,One gets to the configure part.


One has to make a MYSQL db & create a user before doing stuff

  mysql -u <username> -p<password> 

Then on the mysql prompt create the db

  mysql > create database WIKIDB_NAME ;

Then create a user with privileges

  mysql > grant create, select, insert, update, delete, lock tables on wikidb.* to 'wikiuser'@'localhost' identified by 'password';

The password should be different than the root password.

Then flush the privileges

  mysql > flush privileges;

Shirish 23:42, 9 November 2007 (UTC)Reply

  • Interesting: I take it you started from Ubuntu desktop, not server? If you start with server, all the additional software is installed automatically by simply selecting LAMP on configuration screen. You then have to add the gui with
 sudo apt-get install ubuntu-desktop

but then, in both methods, you end up with a gui server for your wiki.

Text from Manual:Running_MediaWiki_on_Ubuntu_GNU/Linux[edit]

Text from [1] moved here --Kaganer 22:39, 14 April 2008 (UTC)Reply

Mediawiki can be installed on Ubuntu using apt-get, aptitude, or synaptic. It requires the apache web server (Version 1.3 or 2), php5, and php5-mysql. — Preceding unsigned comment added by 24.91.109.79 (talkcontribs)

vi - use gedit[edit]

gedit can be used for any text file so you just type gedit file to open your preferred file in your preferred editor Logictheo 20:36, 18 June 2009 (UTC)Reply

Installing on 8.04 LTS[edit]

Note that installing MediaWiki with apt-get or aptitude with 8.04 LTS installs Mediawiki 1.11 and NOT the latest Mediawiki (Gible) 118.93.5.11 09:54, 6 February 2010 (UTC)Reply

Sudo[edit]

Why do I have to sudo when I am root on my server? Are there any difficulties with running aptitude as root?

You don't have to, but it is a good idea. It is better to create a user called something like webadmin and use that to create things. That way later, you can login in as webadmin and not worry about having to sudo all the time (because webadmin owns the pages). Root is dangerous and powerful, its better not always login as root. Also, if you want someone else to do admin work, you can give him the webadmin login and not root access, that is a bit more secure way of doing things. Kmacdowe (talk) 23:23, 14 October 2014 (UTC)Reply

Small fixes important for newbies[edit]

By following the procedure I moved mediawiki-1.2.19.1 to /var/www/

When it says: "Navigate your browser to http://localhost/mediawiki" the page was empty because, by following the former point, I have to go to "http://localhost/mediawiki-1.2.19.1" instead. It seems a cheesy thing but a newbie (like me) can easily fall in a mistake like this and give up with installation or go to the apt-get installation which is not recommended (I found another people in the web who felt in this trick).

Other fixes:

  • aptitude is no more installed in Ubuntu by default and all the commands must be changed to "apt-get install"
  • the first paragraphs of Configure Mediawiki which follows the warning are confusing. Those commands are needed only if mediawiki is being installed using apt-get so they must be removed from this page. They are yet present in the right page where they belong Manual:Installing_MediaWiki_on_Ubuntu_10.04.

I don't edit the page because I'm new here. Thank you

Good input thanks. I believe this discussion been resolved on the "Manual" page. I will remove this discussion "No Ubuntu Package?" if no one objects. Kmacdowe (talk) 18:44, 21 October 2014 (UTC)Reply

Ubuntu Server 12.04 Notes[edit]

I noticed that in Ubuntu 12.04 there are a few slightly differences. It seems that it still installs 1.15 with the apt-get install mediawiki code. If you install it manually in the /var/www section, you do not have the apache CONF file to remove the comment from, and there is nothing in the var/lib/mediawiki either...(which is stated, but does that mean I ignore this completely?)

Yes, when doing the manual installation you haven't to do those steps (configure Apache).

Ubuntu Server 12.04.3 Notes[edit]

Referring to Section: Configure PHP

  • Found upload_max_filesize and memory_limit settings in /etc/php5/apache2/php.ini
  • Default was memory_limit = 128M at this stage in the manual installation procedure.

//AJ - Jan 4, 2014

correct web directory[edit]

Not knowing what I was doing I was really thrown off when i got to the instructions section that told me to go to http://localhost/mediawiki and got a "Page not found" error

It took me a while to realize that in my case (Ubuntu 14.04) I should have used

sudo mv mediawiki-* /var/www/html

rather than

sudo mv mediawiki-* /var/www/

Once I moved the mediawiki directory to /var/www/html I could follow the rest of the instructions.


Is it possible to use MariaDB instead of mysql server?[edit]

If so what version of MariaDB should I use? Are the instructions any different other than substituting mariadb server for mysql server?

https://www.mediawiki.org/w/index.php?title=Manual_talk

Manual mediawiki installation on Ubuntu 14.04 (commands only)[edit]

1. Install and Configure Apache[edit]

sudo apt-get update
sudo apt-get install apache2 apache2-utils
sudo gedit /etc/apache2/mods-enabled/dir.conf

change;

<IfModule mod_dir.c>
       DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

to;

<IfModule mod_dir.c>
       DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo service apache2 restart

2. Install MySQL Server[edit]

sudo apt-get install mysql-server
enter the mysql server root password when prompted (yourMySQLrootPassword)

3. Install and Configure PHP5[edit]

sudo apt-get install php5 php5-mysql php-pear php5-gd  php5-mcrypt php5-curl
sudo touch /var/www/html/phpinfo.php
sudo gedit  /var/www/html/phpinfo.php

Add the following;

	<?php phpinfo(); ?>
firefox - http://localhost/phpinfo.php (verify php support)
sudo touch /var/www/html/phpmysql.php
sudo gedit /var/www/html/phpmysql.php

Add the following;

	<?php
	$con = mysql_connect("localhost","root","yourMySQLrootPassword");
	if (!$con)
	{
	 die('Could not connect: ' . mysql_error());
	}
	else
	{
	 echo "Congrats! connection established successfully";
	}
	mysql_close($con);
	?>
firefox - http://localhost/phpmysql.php (verify connection to MySQL server)

4. Manual mediawiki installation (without using apt-get):[edit]

download mediawiki archive acordingly to your need from:

https://www.mediawiki.org/wiki/Download

tar xvf ~/Downloads/mediawiki-*.tar.gz (extract the archive somewhere)
sudo chown yourusername /var/www/html (replace yourusername accordingly)
mkdir /var/www/html/mediawiki_folder  (change mediawiki_folder to something better)
mv mediawiki-*/* /var/www/html/mediawiki_folder  (move extracted files to new folder)

[manually install additional extensions , e.g. 'cp -rf Math /var/www/html/mediawiki_folder ']

https://www.mediawiki.org/wiki/Category:Extensions

restart computer required because of:

http://www.mediawiki.org/wiki/Thread:Project:Support_desk/blank_page_while_installing

now check with browser: 

http://localhost/wikifolder/index.php

  • setup wiki
  • ...
  • Use default settings
  • MySQL username: ...
  • MySQL password: ...
  • ...
  • Name of Wiki: ...
  • Project namespace: Same as the wiki name
  • your username: ...
  • password: ...
  • ...
  • enable image uploads (this is required for the Math extension to work)
  • select any extensions
download and copy LocalSettings.php to /var/www/html/wikifolder/

INFO: For security reasons you might consider erasing the MySQL root password of phpmysql.php by: sudo gedit /var/www/html/phpmysql.php because this was only used for testing the connectivity and is not used any more.

Richardbrucebaxter (talk) 05:34, 11 August 2014 (UTC)Reply

Does it matter which order the packages are installed? I noticed the order in this section is different than the Manual page instructions. Kmacdowe (talk) 23:47, 14 October 2014 (UTC)Reply


I'm newbie in mediawiki, so here I give two more lines of code, whose weren't in the code above. (sorry for my English ;p)

 sudo mkdir /var/www/html (I haven't it)
http://localhost/html/phpinfo.php (without html it shows nothing)

Monic abc (talk) 12:57, 22 January 2015 (UTC)Reply