How to Install and Configure WordPress

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Deprecated

This guide has been deprecated and is no longer being maintained. Please refer to the updated version of this guide.

WordPress is a popular, dynamic, blog-focused content management system. The software is built upon a LAMP or LEMP stack and features an extensive plugin framework and theme system, which allows site owners and developers to deploy easy-to-use and powerful publishing tools.

If you’re using Ubuntu 16.04, please use our guide on how to Install WordPress on Ubuntu 16.04.

Note
This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, you can check our Users and Groups guide.

Before You Begin

  • Ensure that you have followed the Getting Started and Securing Your Server guides, and that the Linode’s hostname is set.

    To check your hostname run:

     hostname
     hostname -f
    

    The first command will output your short hostname; the second, your fully-qualified domain name (FQDN).

  • You have a configured web stack set up. This can be a LAMP or LEMP stack.

  • MySQL has a database set up for WordPress. If you do not have a database, create it:

    1. Enter the MySQL command line:

      mysql -u root -p
      
    2. Create a WordPress database:

      create database wordpress;
      
    3. Create and grant a user privileges for the newly-created wordpress database, replacing user and password with the username and password you wish to use:

      grant all on wordpress.* to 'user' identified by 'password';
      
    4. Exit MySQL:

      quit
      

Install WordPress

  1. Create an src directory under your website’s directory to store pristine copies of WordPress’s source files. In this guide, the home directory /var/www/example.com/ is used as an example. Navigate to that new directory:

    sudo mkdir /var/www/html/example.com/src/
    cd /var/www/html/example.com/src/
    
  2. Set the owner of the new directory to be your web server’s user. In this instance, our web server is Apache:

    sudo chown -R www-data:www-data /var/www/
    
  3. Install the latest version of WordPress and expand it:

    sudo wget http://wordpress.org/latest.tar.gz
    sudo tar -xvf latest.tar.gz
    
  4. Move latest.tar.gz, so it is renamed as wordpress, followed by the date to store a pristine backup of the source files:

    sudo mv latest.tar.gz wordpress-`date "+%Y-%m-%d"`.tar.gz
    
  5. Move the WordPress files to your public_html folder:

    sudo mv wordpress/* ../public_html/
    

Configure WordPress

  1. 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:

  2. 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.php file by adding the following line:

    File: /var/www/html/example.com/public_html/wp-config.php
    1
    2
    
    /** Bypass FTP */
    define('FS_METHOD', 'direct');

    Next, give WordPress permission to add and edit files in the public_html folder:

    sudo chown -R www-data:www-data /var/www/html/example.com/public_html
    
  3. If using Apache, issue the following commands to ensure that mod_rewrite is enabled:

    sudo a2enmod rewrite
    

    Restart Apache.

    Note

    If using permalinks to set your posts’ URLs, Apache will need to be updated to allow individual sites to update the .htaccess file. To permit this, add the following to you WordPress website’s VirtualHosts code block:

    1
    2
    3
    4
    5
    
    <Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    You will now be able to login 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.

More Information

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 page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.
The Disqus commenting system for Linode Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.