Differences between revisions 1 and 9 (spanning 8 versions)
Revision 1 as of 2013-11-26 10:11:15
Size: 2976
Comment: Created page
Revision 9 as of 2014-01-30 03:28:17
Size: 9068
Editor: gi1242
Comment: Make wp-content alias first (suppresses Apache warning.)
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= WordPress =

[[http://wordpress.org/|Home Page]]

WordPress is a free and open source (GNU GPLv2 or later) blogging tool and a content management system (CMS) based on PHP and MySQL.Features include a plug-in architecture and a template system.
#language en
~-
[[DebianWiki/EditorGuide#translation|Translation(s)]]: none-~
----

WordPress is a free and open source (GNU GPLv2 or later) blogging tool and a content management system (CMS) based on PHP and MySQL. Features include a plug-in architecture and a template system.

<<TableOfContents(3)>>
Line 9: Line 10:
{{{# apt-get install wordpress curl apache2 mysql-server}}} {{{
# apt-get install wordpress curl apache2 mysql-server}}}
Line 15: Line 17:
{{{# nano /etc/apache2/sites-available/wp}}} {{{
# nano /etc/apache2/sites-available/wp}}}
Line 19: Line 22:
        Alias /wp/wp-content /var/lib/wordpress/wp-content
Line 20: Line 24:
        Alias /wp/wp-content /var/lib/wordpress/wp-content
Line 37: Line 40:
{{{# a2ensite wp}}} {{{
# a2ensite wp}}}
Line 41: Line 45:
{{{# service apache2 reload}}} {{{
# service apache2 reload}}}
Line 45: Line 50:
{{{# nano /etc/wordpress/config-dev.php}}} {{{
# nano /etc/wordpress/config-dev.php}}}
Line 58: Line 64:
<!> replace `password` with a suitably secure password
Line 60: Line 68:
{{{# nano ~/wp.sql}}} {{{
# nano ~/wp.sql}}}
Line 72: Line 81:
'''NOTE:''' replace `password` with a suitably secure password <!> replace `password` with your "suitably secure password"
Line 76: Line 85:
{{{# cat ~/wp.sql | mysql --defaults-extra-file=/etc/mysql/debian.cnf}}} {{{
# cat ~/wp.sql | mysql --defaults-extra-file=/etc/mysql/debian.cnf}}}
Line 79: Line 89:
`http://debianwordpress.dev/wp` which redirects to `http://debianwordpress.dev/wp/wp-admin/install.php` where you'll see the "classic" wordpress 5 minute install page (actually a 5 second install thanks to the Debian packagers [[http://packages.qa.debian.org/w/wordpress.html|Giuseppe Iuculano and Raphaël Hertzog]])

At time of writing this provides WordPress v3.6.1
Upgrading WordPress, plugins and themes, as well as installing them is the same process with the Debian package as with the upstream installer.

 ----

See also:-
 * [[LaMp]]

 ----

Additional references:-
 * [[http://codex.wordpress.org/Main_Page|WordPress Online Documentation]]
`http://debianwordpress.dev/wp` which redirects to `http://debianwordpress.dev/wp/wp-admin/install.php` where you'll see the "classic" wordpress 5 minute install page (actually a 5 second install thanks to the Debian packaging)

<!> replace `debianwordpress.dev` with your domain name (or `localhost` if running on the same box as your browser).

At time of writing this provides WordPress v3.6.1. WordPress v3.7.1 is available in Testing and Unstable. I haven't tested it but it should install fine on Wheezy.

== Upgrading the installed WordPress version ==


=== Automated FTP upgrade ===

<!> Untested.

 * Login to WordPress Admin
 * Go to the Updates section
 * Click on the '''Re-install Now''' button
 * Fill in the required fields and click on the '''Proceed button'''
{{http://s25.postimg.org/knlbtblhn/install_01.jpg|Update page}} {{http://s25.postimg.org/5qcusb897/install_02.jpg|FTP details}}

=== Manual upgrade ===

 * Login to WordPress admin
 * Go to the Plugins page
 * Select all your plugins
 * Deactivate them all
 * Download the latest version of WordPress
   . {{{
# cd ~
# wget http://wordpress.org/latest.tar.gz
      }}}
 * Back-up your current `wp-includes` directory
   . {{{
# mv /usr/share/wordpress/wp-includes{,-3.6.1}
      }}}
 * Back-up your current `wp-admin` directory
   . {{{
# mv /usr/share/wordpress/wp-admin{,-3.6.1}
     }}}
 * Extract the upgraded `wp-admin` directory (replaces existing)
   . {{{
# tar -zxvf latest.tar.gz -C /usr/share wordpress/wp-admin
     }}}
 * Extract the upgraded `wp-includes` directory (replaces existing)
   . {{{
# tar -zxvf latest.tar.gz -C /usr/share wordpress/wp-includes
     }}}
 * Extract the upgrade `wp-content` directory (overwrites existing)
   . {{{
# tar -zxvf latest.tar.gz -C /usr/share wordpress/wp-content
     }}}
 * Extract the upgraded WordPress root files (overwrites existing)
   . {{{
# tar --wildcards -zxvf latest.tar.gz -C /usr/share/ 'wordpress/*.php'
     }}}
 * Back in WordPress agree to reload/upgrade the database then reactivate plugins

{{http://s25.postimg.org/t8enkhvnv/install_04.jpg|Completed manual upgrade}}

== An alternate installation method ==

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, 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.

The key useful script here is `/usr/share/doc/wordpress/examples/setup-mysql`. This gem does a few things:

 * Creates a WordPress config file under `/etc/wordpress`
 * Creates the WordPress database and user
 * Sets up a `wp-content` structure under `/srv/www/wp-content/DOMAIN` (this is key for a non-WordPress multisite install, which is covered more below)


=== Install required packages ===

{{{
# apt-get install wordpress apache2 mysql-server
}}}

=== Run the helper script ===

Now run `/usr/share/doc/wordpress/examples/setup-mysql`, passing an argument of your site name; eg. `myblog.com`. 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-myblog.com.php` config file. Peruse that and sanity check it.

=== Create the Apache site ===

Quoting `/usr/share/doc/wordpress/examples/apache.conf`:

There are several ways to setup Wordpress & Apache in Debian. However the maintainer's recommended way with the helper script `setup-mysql` uses:

{{{
## Virtual host VirtualDocumentRoot

        NameVirtualHost *:80

        <VirtualHost *:80>
        UseCanonicalName Off
        VirtualDocumentRoot /usr/share/wordpress
        Options All

        # wp-content in /srv/www/wp-content/$0
        RewriteEngine On
        RewriteRule ^/wp-content/(.*)$ /srv/www/wp-content/%{HTTP_HOST}/$1
        </VirtualHost>
}}}

For this configuration to work you'll also need to have `mod_rewrite` and `mod_vhost_alias` loaded and working in Apache. To enable these modules run

{{{
# a2enmod rewrite && a2enmod vhost_alias && /etc/init.d/apache2 restart
}}}

Place this config into something like `/etc/apache2/sites-available/myblog.com` and modify according to your needs (IP-based virtual host, name-based, logging, etc.)

=== Final reading before actual configuration ===

Now would be a great time to read `/usr/share/doc/wordpress/README.Debian` if you haven't already. All the rest of the pieces should fall into place once you do.

Amongst other things, it explains the great way that the Debian WordPress package utilises the WordPress `wp-config.php` framework, and more importantly, how to handle the infamous "themes" and "plugins" directories in a WordPress install. The key point is that by symlinking under `/var/lib/wordpress`, users better abide by the [[FilesystemHierarchyStandard]], and can use the in-app upgrade mechanisms of WordPress to upgrade plugins and themes, without clobbering the package, and risking server security.

It also discusses the two choices regarding multisite installs, of which this here describes the non-WordPress version.

=== Enable the Apache site ===

Now we enable the Apache site config made earlier using `a2ensite`, which basically just creates a symlink in `/etc/apache2/sites-enabled` from `sites-available`, then reload Apache:

{{{
# a2ensite myblog.com
# service apache2 reload
}}}

=== Configure WordPress ===

Now, browse to your new domain, and follow the normal WP configuration process, and you should be done.

=== Issues ===

Sadly at this point, there are some issues with symlinking, and messing around generally with `WP_CONTENT_DIR`.

The main bug is being tracked at http://core.trac.wordpress.org/ticket/16953. At this point, basically a fair few things break, especially if plugin or theme authors don't do things right when determining correct filesystem and URI paths to use. There seems no easy fix right now, other than not using symlinks or non-standard (but configurable!) paths.

== See also ==
Line 95: Line 230:
 * [[LaMp|LAMP]]

== External links ==
 * [[http://wordpress.org/|Home Page]]
 * [[http://codex.wordpress.org/|WordPress Online Documentation]]
 * [[http://codex.wordpress.org/Updating_WordPress#Manual_Update|WordPress Manual Update Guide]]

Translation(s): none


WordPress is a free and open source (GNU GPLv2 or later) blogging tool and a content management system (CMS) based on PHP and MySQL. Features include a plug-in architecture and a template system.

Basic Installation guide for Wheezy

# apt-get install wordpress curl apache2 mysql-server

Set the mysql admin root user password when prompted

Create a site

# nano /etc/apache2/sites-available/wp

Add this content:-

        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
            Order allow,deny
            Allow from all
        </Directory>
        <Directory /var/lib/wordpress/wp-content>
            Options FollowSymLinks
            Order allow,deny
            Allow from all
        </Directory>

Enable the site

# a2ensite wp

Restart the webserver

# service apache2 reload

Create /etc/wordpress/config-$DM.php (where $DM is the domain name e.g. if the fully qualified domain name is debianwordpress.dev create /etc/wordpress/config-dev.php)

# nano /etc/wordpress/config-dev.php

Add this content:-

   1 <?php
   2 define('DB_NAME', 'wordpress');
   3 define('DB_USER', 'wordpress');
   4 define('DB_PASSWORD', 'password');
   5 define('DB_HOST', 'localhost');
   6 define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');
   7 ?>

<!> replace password with a suitably secure password

Create a file to hold the database creation instructions

# nano ~/wp.sql

Add this content:-

   1 CREATE DATABASE wordpress;
   2 GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
   3 ON wordpress.*
   4 TO wordpress@localhost
   5 IDENTIFIED BY 'password';
   6 FLUSH PRIVILEGES;

<!> replace password with your "suitably secure password"

Create the database:-

# cat ~/wp.sql | mysql --defaults-extra-file=/etc/mysql/debian.cnf

Navigate to the wordpress directory in browser e.g.:- http://debianwordpress.dev/wp which redirects to http://debianwordpress.dev/wp/wp-admin/install.php where you'll see the "classic" wordpress 5 minute install page (actually a 5 second install thanks to the Debian packaging)

<!> replace debianwordpress.dev with your domain name (or localhost if running on the same box as your browser).

At time of writing this provides WordPress v3.6.1. WordPress v3.7.1 is available in Testing and Unstable. I haven't tested it but it should install fine on Wheezy.

Upgrading the installed WordPress version

Automated FTP upgrade

<!> Untested.

  • Login to WordPress Admin

  • Go to the Updates section
  • Click on the Re-install Now button

  • Fill in the required fields and click on the Proceed button

Update page FTP details

Manual upgrade

  • Login to WordPress admin

  • Go to the Plugins page
  • Select all your plugins
  • Deactivate them all
  • Download the latest version of WordPress

    • # cd ~
      # wget http://wordpress.org/latest.tar.gz
  • Back-up your current wp-includes directory

    • # mv /usr/share/wordpress/wp-includes{,-3.6.1}
  • Back-up your current wp-admin directory

    • # mv /usr/share/wordpress/wp-admin{,-3.6.1}
  • Extract the upgraded wp-admin directory (replaces existing)

    • # tar -zxvf latest.tar.gz -C /usr/share wordpress/wp-admin
  • Extract the upgraded wp-includes directory (replaces existing)

    • # tar -zxvf latest.tar.gz -C /usr/share wordpress/wp-includes
  • Extract the upgrade wp-content directory (overwrites existing)

    • # tar -zxvf latest.tar.gz -C /usr/share wordpress/wp-content
  • Extract the upgraded WordPress root files (overwrites existing)

    • # tar --wildcards -zxvf latest.tar.gz -C /usr/share/ 'wordpress/*.php'
  • Back in WordPress agree to reload/upgrade the database then reactivate plugins

Completed manual upgrade

An alternate installation method

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, 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.

The key useful script here is /usr/share/doc/wordpress/examples/setup-mysql. This gem does a few things:

  • Creates a WordPress config file under /etc/wordpress

  • Creates the WordPress database and user

  • Sets up a wp-content structure under /srv/www/wp-content/DOMAIN (this is key for a non-WordPress multisite install, which is covered more below)

Install required packages

# apt-get install wordpress apache2 mysql-server

Run the helper script

Now run /usr/share/doc/wordpress/examples/setup-mysql, passing an argument of your site name; eg. myblog.com. 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-myblog.com.php config file. Peruse that and sanity check it.

Create the Apache site

Quoting /usr/share/doc/wordpress/examples/apache.conf:

There are several ways to setup Wordpress & Apache in Debian. However the maintainer's recommended way with the helper script setup-mysql uses:

## Virtual host VirtualDocumentRoot

        NameVirtualHost *:80

        <VirtualHost *:80>
        UseCanonicalName Off
        VirtualDocumentRoot /usr/share/wordpress
        Options All

        # wp-content in /srv/www/wp-content/$0
        RewriteEngine On
        RewriteRule ^/wp-content/(.*)$ /srv/www/wp-content/%{HTTP_HOST}/$1
        </VirtualHost>

For this configuration to work you'll also need to have mod_rewrite and mod_vhost_alias loaded and working in Apache. To enable these modules run

# a2enmod rewrite && a2enmod vhost_alias && /etc/init.d/apache2 restart

Place this config into something like /etc/apache2/sites-available/myblog.com and modify according to your needs (IP-based virtual host, name-based, logging, etc.)

Final reading before actual configuration

Now would be a great time to read /usr/share/doc/wordpress/README.Debian if you haven't already. All the rest of the pieces should fall into place once you do.

Amongst other things, it explains the great way that the Debian WordPress package utilises the WordPress wp-config.php framework, and more importantly, how to handle the infamous "themes" and "plugins" directories in a WordPress install. The key point is that by symlinking under /var/lib/wordpress, users better abide by the FilesystemHierarchyStandard, and can use the in-app upgrade mechanisms of WordPress to upgrade plugins and themes, without clobbering the package, and risking server security.

It also discusses the two choices regarding multisite installs, of which this here describes the non-WordPress version.

Enable the Apache site

Now we enable the Apache site config made earlier using a2ensite, which basically just creates a symlink in /etc/apache2/sites-enabled from sites-available, then reload Apache:

# a2ensite myblog.com
# service apache2 reload

Configure WordPress

Now, browse to your new domain, and follow the normal WP configuration process, and you should be done.

Issues

Sadly at this point, there are some issues with symlinking, and messing around generally with WP_CONTENT_DIR.

The main bug is being tracked at http://core.trac.wordpress.org/ticket/16953. At this point, basically a fair few things break, especially if plugin or theme authors don't do things right when determining correct filesystem and URI paths to use. There seems no easy fix right now, other than not using symlinks or non-standard (but configurable!) paths.

See also

  • Sample configurations can be found in /usr/share/doc/wordpress/examples/

  • Debian specific instructions are /usr/share/doc/wordpress/README.Debian

  • LAMP