Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

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

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
kedaha
Posts: 3521
Joined: 2008-05-24 12:26
Has thanked: 33 times
Been thanked: 77 times

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

#1 Post by kedaha »

PART ONE
Image
INTRODUCTION
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 domain.com rather than in a subdirectory. eg., at domain.com/wp/ 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.
Image
PROCEDURE
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. 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.
Commentary:
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).

Options:
    -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 http://blog.example.com
         for user 'wordpress'.

Then run:
sudo bash setup-mysql -n wordpress blog.example.com

BUGS: See ../TODO.Debian
If your domain were example.com, assuming you want your blog to be served from http://blog.example.com for user 'wordpress'. then you would now run:

Code: Select all

# bash /usr/share/doc/wordpress/examples/setup-mysql -n wordpress blog.example.com
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/config-blog.example.com.php written
Trying to create wp-content directory: /srv/www/wp-content/blog.example.com
Setting up permissions
Goto http://blog.example.com to setup Wordpress
Now if you went to example.com/wp/ you would get this:
Neither /etc/wordpress/config-example.com.php 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/blog.example.com.conf
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 blog.example.com
ERROR: Site blog.example.com 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>
        <Directory /var/lib/wordpress/wp-content>
            Options FollowSymLinks
            Require all granted
        </Directory>
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 blog.example.com.conf which must be enabled thus:

Code: Select all

# a2ensite blog.example.com.conf
# service apache2 reload
After this it was a little tricky:
Changing directory to /etc/wordpress/ the ls command showed:

Code: Select all

config-blog.example.com.php   htaccess
But I because I again got this in the browser:
Neither /etc/wordpress/config-example.com.php 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 config-blog.example.com.php to config-example.com.php
After this I was able to do the browser Wordpress install by going to: http://blog.example.com/wp/, which redirected to http://blog.example.com/wp/wp-admin/install.php
Image
PART 3
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.
listen=NO
#
# 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.
listen_ipv6=YES
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# 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)
local_umask=022
#
# 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.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# 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.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# 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!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# 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.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# 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.
#nopriv_user=ftpsecure
#
# 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.
#async_abor_enable=YES
#
# 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.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# 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.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# 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.
#chroot_local_user=YES
#
# 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)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# 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.
#ls_recurse_enable=YES
#
# 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.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=YES
ssl_sslv3=YES
Last edited by kedaha on 2020-09-21 12:36, edited 3 times in total.
DebianStable

Code: Select all

$ vrms

No non-free or contrib packages installed on debian!  rms would be proud.

kedaha
Posts: 3521
Joined: 2008-05-24 12:26
Has thanked: 33 times
Been thanked: 77 times

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

#2 Post by kedaha »

[Space reserved for Howto to be continued]
DebianStable

Code: Select all

$ vrms

No non-free or contrib packages installed on debian!  rms would be proud.

Post Reply