HOWTO apt-get install wordpress in jessie the Debian way.

Share your own howto's etc. Not for support questions!

HOWTO apt-get install wordpress in jessie the Debian way.

Postby kedaha » 2016-03-17 18:29

This assumes a LAMP server has already been set up with apache2 and the mysql-server. It is "work in progress" and if anyone wishes to try it, I'd suggest using a server used for trial purposes before using it for production. The objective is just to make An_alternate_installation_method a little clearer for installing WordPress but it should be read in conjunction with the wiki for further details. To quote the author of the wiki page:
I believe this method conforms more with how the maintainer recommends it should be done. Various sources are drawn upon using this method, and it is also affected by a few bugs as at this writing. It is basically centric around a "kind of" multisite install, but I recommend this method even for a single blog [my italics], otherwise when you decide down the track to have more than one and share the packages' codebase, you'll have a fair bit of work on your hands.

On the other hand, these notes aim to encourage the installation of the official Debian stable wordpress packages instead of the popular method of downloading "the latest tarball" and installing "the latest Wordpress." But there are several hurdles to be jumped like actually getting the installation to run from a browser, which is dealt with in PART ONE; and, as the author of the wiki puts it, how to handle the infamous "themes" and "plugins" directories in a WordPress install, dealt with in PART 2 and one or two other issues like configuring vsftpd and getting the blog to open at say rather than in a subdirectory. eg., at which I'll mention later.
Finally, I'd really welcome your views, comments & suggestions from anyone who's interested in giving "the alternate method" detailed on the Debian Wiki and here a whirl.
Following the wiki:
Install required packages
Code: Select all
# apt-get update && apt-get install wordpress

Run the helper script (Before doing so, please see the comments below):
Now run /usr/share/doc/wordpress/examples/setup-mysql, passing an argument of your site name; eg. You will most probably need other arguments too -- just try an initial -h to get help.
At this point, as per above, you should have a database created for you, and the /etc/wordpress/ config file. Peruse that and sanity check it.

Before any script can be run it is necessary expand the setup-mysql.gz file:
Code: Select all
# gzip -d /usr/share/doc/wordpress/examples/setup-mysql.gz

For anyone interested:
Code: Select all
# bash /usr/share/doc/wordpress/examples/setup-mysql -h

shows text:
Code: Select all
/usr/share/doc/wordpress/examples/setup-mysql [-h | -d | -b] [-n NAME | -e DB Name] [-u MySQL user] [-t MySQL host] FQDN

Creates by default a Wordpress mysql configuration depending on required fully
qualified domain name(FQDN).

    -n name for the wordpress site; see also -e below
    -h help
    -d destroy and purge
    -b backup
    -u mysql username, will require password
    -t mysql server hostname, if unset localhost will be used
    -e existing empty mysql database name; will replace -n

Example: You want your blog to be served from
         for user 'wordpress'.

Then run:
sudo bash setup-mysql -n wordpress

BUGS: See ../TODO.Debian

If your domain were, assuming you want your blog to be served from for user 'wordpress'. then you would now run:
Code: Select all
# bash /usr/share/doc/wordpress/examples/setup-mysql -n wordpress

This will result in a user named "wordpress" and a database called "wordpress" as can be seen, for instance, in the phpmyadmin tool, if you have installed it. The last command will output something similar to:
Code: Select all
/etc/wordpress/ written
Trying to create wp-content directory: /srv/www/wp-content/
Setting up permissions
Goto to setup Wordpress

Now if you went to you would get this:
Neither /etc/wordpress/ nor /etc/wordpress/config-es.php could be found.
Ensure one of them exists, is readable by the webserver and contains the right password/username.

The following is taken from the wiki page, which I refer the interested reader to for explanations, and inserted here so as not have to go back and forth:
Code: Select all
nano /etc/apache2/sites-available/

The temination .conf is necessary for jessie otherwise running a2ensite will result in the error that the site does not exist. For instance:
Code: Select all
# a2ensite
ERROR: Site does not exist!

Enter this content and save:
Code: Select all
        Alias /wp/wp-content /var/lib/wordpress/wp-content
        Alias /wp /usr/share/wordpress
        <Directory /usr/share/wordpress>
            Options FollowSymLinks
            AllowOverride Limit Options FileInfo
            DirectoryIndex index.php
            Require all granted
        <Directory /var/lib/wordpress/wp-content>
            Options FollowSymLinks
            Require all granted

Continue with:
Code: Select all
# a2enmod rewrite && a2enmod vhost_alias && service apache2 restart

Now if we change directory thus:
Code: Select all
# cd /etc/apache2/sites-available

Now /etc/apache2/sites-available will include which must be enabled thus:
Code: Select all
# a2ensite
# service apache2 reload

After this it was a little tricky:
Changing directory to /etc/wordpress/ the ls command showed:
Code: Select all   htaccess

But I because I again got this in the browser:
Neither /etc/wordpress/ nor /etc/wordpress/config-com.php could be found.
Ensure one of them exists, is readable by the webserver and contains the right password/username.

I then renamed to
After this I was able to do the browser Wordpress install by going to:, which redirected to
I set up vsftpd according to setting-up-ftps-using-vsftpd-for-wordpress-plugins-auto-upgrade/. The configuration file was edited to look like this:
Code: Select all
# apt-get install vsftpd

And edit the configuration file like this:
Code: Select all
# cat vsftpd.conf
# Example config file /etc/vsftpd.conf
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# Allow anonymous FTP? (Disabled by default).
# Uncomment this to allow local users to log in.
# Uncomment this to enable any form of FTP write command.
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
# If enabled, vsftpd will display directory listings with the time
# in  your  local  time  zone.  The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
# Activate logging of uploads/downloads.
# Make sure PORT transfer connections originate from port 20 (ftp-data).
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
# You may override where the log file goes if you like. The default is shown
# below.
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
# You may change the default value for timing out an idle session.
# You may change the default value for timing out a data connection.
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
# (default follows)
# You may restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
# (default follows)
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
# Customization
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
# This option should be the name of a directory which is empty.  Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
# This string is the name of the PAM service vsftpd will use.
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
Last edited by kedaha on 2020-09-21 12:36, edited 3 times in total.
User avatar
Posts: 3183
Joined: 2008-05-24 12:26

Re: HOWTO apt-get install wordpress in jessie the Debian way

Postby kedaha » 2016-03-17 18:30

[Space reserved for Howto to be continued]
User avatar
Posts: 3183
Joined: 2008-05-24 12:26

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 5 guests