2

I would like to create an easily installable debian package (.deb file) for MediaWiki 1.25.1 as I know from personal experience that for web programming noobs like myself, installing MediaWiki can seem like an impossible task.

I have read some guides on how to create debian packages, like this one for Ubuntu users and this one on Debian Wiki, but correct me if I'm wrong but they only seem to mention packages that are installed via the make utility, while MediaWiki, being a Wiki application is installed (if you could even call it an installation) by creating an Apache & MySQL server database for the Wiki and running the setup scripts. But I know such a debian package can be made as there exists a really old version of MediaWiki in the PPA repositories (1.19) and it is a debian package.

I know the basic procedure of what any such package would need to do, namely (you should note that I'm getting much of this from my own memory plus this article at mediwiki.org):

  • Install LAMP, or at a bare minimum install the packages apache2, mysql-server, php5, php5-mysql and libapache2-mod-php5. Possibly via sudo apt-get install apache2 mysql-server php5 php5-mysql libapache2-mod-php5.
  • Install some additional packages (strictly speaking they're optional, but they're incredibly helpful, especially if you're new to MediaWiki) such as imagemagick, inkscape, php5-cli and phpmyadmin, also via sudo apt-get install... It would be grand if an GUI could pop up during installation and prompt users as to which of these optional packages should be installed. Such an interface could also go through the process of setting a MySQL password)
  • Extract the tarball of MediaWiki 1.25.1 into /var/lib/mediawiki
  • Create a virtual link between /var/lib/mediawiki and /var/www/html/mediawiki (by running sudo ln -s /var/lib/mediawiki /var/www/html/mediawiki)
  • Run mysql_secure_installation
  • Configure PHP (optional to the user) and restart Apache after.
  • Configure Apache (more details on the mediawiki.org article I hyperlinked)
  • Open browser to http://localhost/mediawiki to complete MediaWiki configuration.

I just don't know how to create a debian package that would do this. So all in all I would like someone's help so I may do this, so that MediaWiki installation on Ubuntu may be made that little bit easier for future users.

My attempt at creating a package myself

I created a directory, /home/fusion809/Debian packaging/bzr so I can try following this guide on the mediawiki-1.25.1.tar.gz tarball. I got down to here in the guide and the debian package I created (by running the bzr builddeb... command in my /home/fusion809/Debian packaging/bzr/mediawiki/debian directory) was only 2.4 kB in size (where the tarball is 23.7 MB) and gave the error message:

install-info: warning: no info dir entry in `/usr/share/info/lilypond/pictures/ross-beam-scan.jpg'
install-info: warning: no info dir entry in `/usr/share/info/lilypond/pictures/carter-brey.jpg'
install-info: warning: no info dir entry in `/usr/share/info/lilypond/pictures/darius-blasband.jpg'
install-info: warning: no info dir entry in `/usr/share/info/lilypond/pictures/orm-finnendahl.jpg'
install-info: warning: no info dir entry in `/usr/share/info/mime.info.gz'

when I tried to install it. If you're wondering what my control file looks like, here it is:

Source: mediawiki
Section: unknown
Priority: optional
Maintainer: Brenton Horne <brentonhorne77@gmail.com>
Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.5
Homepage: <insert the upstream URL, if relevant>
#Vcs-Git: git://anonscm.debian.org/collab-maint/mediawiki.git
#Vcs-Browser: http://anonscm.debian.org/?p=collab-maint/mediawiki.git;a=summary

Package: mediawiki
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: MediaWiki, a free wiki application.
  MediaWiki is a free and open-source wiki application written in PHP that is maintained by the Wikimedia Foundation. It depends on
  Apache, MySQL and PHP.

my rules file looks like:

#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


# main packaging script based on dh7 syntax
%:
    dh $@ 

# debmake generated override targets
# This is example for Cmake (See http://bugs.debian.org/641051 )
#override_dh_auto_configure:
#   dh_auto_configure -- \
#   -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
Josh Pinto
  • 8,089

2 Answers2

0

Packages in Debian/Ubuntu don't have to be built using make. Technically, in debian/rules, there are just certain targets that have to be met. The following is what I (and Debian's Flightgear group) use to copy files from an arch-independent tarball (no compiling involved, just copying files) into the package.

%:
    dh $@

override_dh_auto_install:
    dh_installdirs -pflightgear-data-aircrafts-ec130 usr/share/games/flightgear/Aircraft/ec130

    find -maxdepth 1 ! -name 'debian' -exec cp -r "{}" \
       debian/flightgear-data-aircrafts-ec130/usr/share/games/flightgear/Aircraft/ec130 \;

# Fix some insane permissions
    find $(CURDIR)/debian/flightgear-data-*/usr/share/games/flightgear \
        -type f -exec chmod 644 {} \;

# Drop some silly Windows PE32 executable files
    find $(CURDIR)/debian -type f -iname "*.mdl" -delete

# Drop empty directories
    find $(CURDIR)/debian -type d -empty -delete

Basically, override_dh_auto_install just copies files form the source tarball into the final package, and removes some unneeded files. Because there is no "compiling" file in the source tarball, some of the other targets do nothing.

You can follow something like this (along with using the postinst and prerm scripts) to automate the steps you've mentioned. Note that the installation of additional packages would go into debian/control, either as Depends, Recommends, or Suggests.

saiarcot895
  • 10,917
0

I'd recommend using uupdate from devscripts to get good start for your deb package.

Install required packages

$ sudo apt-get install build-essential devscripts

Download the the old package from official repository and the new tar-ball from upstream. (I'm using 14.04)

$ mkdir ~/Downloads/mediawiki
$ cd ~/Downloads/mediawiki
$ apt-get source mediawiki
$ wget http://releases.wikimedia.org/mediawiki/1.25/mediawiki-1.25.1.tar.gz

Run uupdate to create a new source folder from the upstream tar-ball and the old debian/control

$ cd mediawiki-1.19.14+dfsg   # depends on your Ubuntu version
$ uupdate ../mediawiki-1.25.1.tar.gz 1.25.1
$ cd ../mediawiki-1.25.1

Now you should check if you need to make changes to debian/control etc files. If you're done you can build the deb package and install it

$ dpkg-buildpackage -us -uc
$ cd ..
$ sudo dpkg -i *.deb
Germar
  • 6,537