Manage Web Content with WordPress
Updated by Elle Krout
WordPress is popular dynamic blog-focused content management system. The software is built upon the LAMP stack and features an extensible plugin framework and extensive theme system, which allows site owners and developers to deploy easy-to-use and powerful publishing tools.
This guide assumes you have a complete and up-to-date Debian system, and that you have completed the Getting Started guide. If you are new to Linux system administration, you may want to review our Administration Basics guide or the Introduction to Linux Concepts guide.
The steps required in this guide require root privileges. Be sure to run the steps below as
rootor with the sudo prefix. For more information on privileges see our Users and Groups guide.
Before installing WordPress, you must ensure that your system has a fully functioning LAMP stack. Alternatively, you may choose to deploy WordPress on top of a LEMP stack; however, this may affect some aspects of configuration.
Additionally, this guide assumes that you are deploying WordPress on the domain
example.com, where the directory
/var/www/example.com/public_html/ is the document root where all web accessible files are stored. Replace all instances of
example.com in the code below with your own domain information.
The WordPress installer assumes you’ve already created a MySQL database and user that it can use. If you haven’t yet, use the following steps to create one.
Enter the MySQL command line:
mysql -u root -p
Create a database for WordPress. In this example the database name reflects the domain that will serve the WordPress site, but you can choose your own naming convention:
create database example_com;
Create a user with privileges for the new database. Replace
wordpresswith your desired user name, and
5t1ckwith a strong password:
grant all on example_com.* to 'wordpress' identified by '5t1ck';
As of this writing, the latest version of WordPress is 4.1. The latest version of WordPress is always available from the URL
http://wordpress.org/latest.tar.gz. Issue the following sequence of commands to download and install the required files:
1 2 3 4 5 6 7 8
mkdir /var/www/example.com/src/ cd /var/www/example.com/src/ chown -R www-data:www-data /var/www/ wget http://wordpress.org/latest.tar.gz sudo -u www-data tar -xvf latest.tar.gz mv latest.tar.gz wordpress-`date "+%Y-%m-%d"`.tar.gz cp -R wordpress/* ../public_html/ rm -rf wordpress/
These commands create a
src/ folder within the
/var/www/example.com/ directory to store and manage pristine copies of the source files that you use to deploy your WordPress site. New versions of WordPress and plug-ins can be downloaded from within the WordPress administration interface, once installed.
Visit your domain in your web browser, and follow the steps outlined by the configuration process. Begin by reviewing the informational page and clicking the “Let’s go!” button. Supply WordPress with the database credentials established when you installed the database server. Finally, select “Run the install” and supply the required values as prompted:
As it stands, should you try to update WordPress or install new themes or plugins, you will be asked to input your FTP information. To bypass this you must alter your
wp-config.phpfile by adding the following line:
Next, give WordPress permission to add and edit files in the
chown -R www-data:www-data /var/www/example.com/public_html/wp-content
Unless you’ve decided to use a web server other than Apache, issue the following commands to ensure that
a2enmod rewrite service apache2 restart
You will now be able to log in to your new WordPress-powered website. You can continue the configuration of your WordPress site from the web-based interface.
Congratulations! You have now successfully installed WordPress!
Monitor for Software Updates and Security Notices
When running software compiled or installed directly from sources provided by upstream developers, you are responsible for monitoring updates, bug fixes, and security issues. After becoming aware of releases and potential issues, update your software to resolve flaws and prevent possible system compromise. Monitoring releases and maintaining up-to-date versions of all software is crucial for the security and integrity of a system.
WordPress comes with update alerts, accessible within the “Updates” page of your web-based administration interface. From here you can also reinstall WordPress, and update both your WordPress version and any plug-ins you have installed, as needed.
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This guide is published under a CC BY-ND 3.0 license.