MediaWiki 1.12 setup procedure on Debian Etch
Setting up package management
# Firstly we need to update Debian's knowledge of the available packages: apt-get update # Then we install aptitude, which is a fairly smart package manager, and I think is now recommended as a better version of apt-get. (say "Y" when prompted). apt-get install aptitude # Now we update the installed software, so that we have all latest bugfixes and security fixes. (say "Y" when prompted). aptitude upgrade
Installing needed packages for PHP and MySQL
# Install LAMP: aptitude install php5 php5-gd php5-cgi php5-mysql mysql-server mysql-client php5-curl lynx php-pear \ ca-certificates xml-core apache2 libapache2-mod-php5
Installing extra packages
These are not essential, but these packages could be potentially useful to us, (e.g. in compiling code, getting things from subversion, etc) :
# Install favourite simple text editor aptitude install nano # Install a port mapper to see which ports are open aptitude install nmap # Tidying web pages. aptitude install tidy # useful utility aptitude install curl # For building PHP modules: aptitude install php5-dev # To be able to compile PHP from snaps.php.net aptitude install flex libxml2-dev # Various compression utilities: aptitude install p7zip zip unzip bzip2 p7zip-full # Various other packages: aptitude install diffstat aptitude install subversion subversion-tools patch xsltproc
Configure php.ini
Configuring PHP.ini
cp /etc/php5/apache2/php.ini /etc/php5/apache2/orig-php.ini nano /etc/php5/apache2/php.ini
... and make these changes:
- ;date.timezone = + date.timezone = Europe/Amsterdam # hide PHP in the headers - expose_php = On + expose_php = Off - memory_limit = 16M + memory_limit = 32M - upload_max_filesize = 2M + upload_max_filesize = 10M - allow_url_fopen = On + allow_url_fopen = 0
Then need to restart apache for changes to take effect:
/etc/init.d/apache2 force-reload
Then soft-link the command line php.ini to the apache php.ini, so that they can have a shared configuration:
mv /etc/php5/cli/php.ini /etc/php5/cli/php.ini-orig ln -s /etc/php5/apache2/php.ini /etc/php5/cli/php.ini ls -al /etc/php5/cli/php.ini
Tweak MySQL configuration
Edit configuration file:
nano /etc/mysql/my.cnf
... and add these settings to increase performance a bit:
# change from listed default of 16 to 64 : - key_buffer = 16M + key_buffer = 64M # uncomment, and change from default of 64 to 256: - # table_cache = 64 + table_cache = 256 # Add this on the line after the above + sort_buffer = 4M
Then to make changes take effect:
/etc/init.d/mysql restart
Install APC opcode cache for PHP
This will make PHP pages like MediaWiki load slightly faster.
Installing APC as the opcode cache:
Install required dependencies:
aptitude install apache2-dev aptitude install build-essential
Install APC (choose "yes" when prompted) :
pecl install apc
Then:
nano /etc/php5/apache2/php.ini
... and add these 3 lines to the end:
; APC opcode cache: extension=apc.so apc.mmap_file_mask=/tmp/apc.XXXXXX
Then reload apache:
/etc/init.d/apache2 restart
Check that there are no errors in the error log:
tail -20 /var/log/apache2/error.log
Setting up Apache virtual hosting
Load the mass virtual hosting module:
a2enmod vhost_alias
Then "nano /etc/apache2/apache2.conf", and add this to the end of the file to enable mass virtual hosting:
# --------------------------------------------------- # ---------------- Virtual Hosting ------------------ <IfModule mod_vhost_alias.c> # Get the server name from the Host: header UseCanonicalName Off # The virtual document root is under /var/www/__name_of_whatever_was_requested__ VirtualDocumentRoot /var/www/%0 # Note: Regrettably, cannot set up separate SSL certs for each virtual host here (need different IPs or ports) # see: http://www.mail-archive.com/modssl-users@modssl.org/msg15648.html </IfModule> # ---------------------------------------------------
Then check above syntax is OK:
apache2ctl -t
Then restart apache:
/etc/init.d/apache2 force-reload
Then try to access a page by the hostname (e.g. "http://IP-address"). Should get an error like "The requested URL / was not found on this server." Also a "tail -f /var/log/apache2/error.log" should show an entry like: "File does not exist: /var/www/IP-address". This indicates that virtual hosting is working.
Download and unpack mediawiki
cd /var/www wget http://download.wikimedia.org/mediawiki/1.12/mediawiki-1.12.0.tar.gz tar xfvz mediawiki-1.12.0.tar.gz rm mediawiki-1.12.0.tar.gz
Now make the directory and symbolic link for the MediaWiki virtual host:
ln -s mediawiki-1.12.0 83.149.110.224
If we do the following command, then we need to finish configuration below in the "Web setup of MediaWiki" step. (i.e. can stop now and come back later, but if we do this following command then do not stop at this point, otherwise anyone on the internet can complete the installation incorrectly). Make the config directory writeable, so that we can install and configure MediaWiki.
chmod a+w mediawiki-1.12.0/config
Web setup of MediaWiki
- In a web browser, open http://83.149.110.224/index.php
- Click the "set up the wiki" link.
- The summary at the top of the page should show that MySQL database drivers are found, that the session save path is valid, that the memory limit is 32 Mb, that APC is installed, that diff is installed, and that GD is installed, and in green is should say "You can install mediawiki".
- For the site config, I used the following settings: (Note: this setup can be redone if needed, I mostly just took the default values).
- Wiki name = Wikiation
- contact email = webmaster@localhost
- Language = "NL - nederlands"
- Copyright license = "No license metadata"
- Admin username = <<KEPT PRIVATE>>
- Admin password = <<KEPT PRIVATE>>
- Object caching = APC
- Email features (global) = Enabled
- User-to-user e-mail = Enabled
- E-mail notification about changes = Enabled for changes to user discussion pages, and to pages on watchlists (not recommended for large wikis)
- E-mail address authentication = Enabled
- Database type = MySQL
- Database host = localhost
- Database name = wikidb
- DB username = <<KEPT PRIVATE>>
- DB password = <<KEPT PRIVATE>>
- Superuser account = tick this.
- Database table prefix = "" (blank)
- Storage Engine = InnoDB
- Database character set = Backwards-compatible UTF-8
- Click "Install MediaWiki!"
Cleaning up after setup of MediaWiki
A few last things back on the command line:
mv mediawiki-1.12.0/config/LocalSettings.php mediawiki-1.12.0/LocalSettings.php rm mediawiki-1.12.0/config/index.php* rmdir mediawiki-1.12.0/config
And a few other things to help us with version upgrades in the future:
cp mediawiki-1.12.0/AdminSettings.sample mediawiki-1.12.0/AdminSettings.php chmod 640 mediawiki-1.12.0/AdminSettings.php nano -w mediawiki-1.12.0/AdminSettings.php # enter the "DB username" and the "DB password" from the "Web setup of MediaWiki" step above as the new $wgDBadminuser and $wgDBadminpassword values. # Save changes, and close.
Customising and using MediaWiki
Congratulations, MediaWiki should now be installed in the basic configuration.
Various things that can or should be done at this point include:
- Create one or more user accounts.
- Installing extensions.
- Customising your logo.
- Configuring LocalSettings.php with any custom settings that are desired.
- Adding content.
Location
The wiki is located in the directory :
var/www/mediawiki-1.12.0