Product docs and API reference are now on Akamai TechDocs.
Search product docs.
Search for “” in product docs.
Search API reference.
Search for “” in API reference.
Search Results
 results matching 
 results
No Results
Filters
Install WordPress on Ubuntu 16.04
Traducciones al EspañolEstamos 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.
DeprecatedThis guide has been deprecated and is no longer being maintained.
In this guide, you’ll learn to how to install WordPress on a Linode running Ubuntu 16.04. WordPress is a popular dynamic content management system focused on blogs. WordPress can be deployed on a LAMP or LEMP stack, and features an extensive plugin framework and theme system that allows site owners and developers to use its simple, yet powerful publishing tools.
![](/docs/images/pix.gif)
![Install WordPress on Ubuntu 16.04 Install WordPress on Ubuntu 16.04](/docs/guides/install-wordpress-on-ubuntu-16-04/wordpress-ubuntu-16-04-title_hu9becff639cc669eaa4666951027414ef_1236164_694x0_resize_q71_bgfafafc_catmullrom_3.jpg)
![Install WordPress on Ubuntu 16.04 Install WordPress on Ubuntu 16.04](/docs/guides/install-wordpress-on-ubuntu-16-04/wordpress-ubuntu-16-04-title_hu9becff639cc669eaa4666951027414ef_1236164_1388x0_resize_q71_bgfafafc_catmullrom_3.jpg)
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.
All configuration files should be edited with elevated privileges. Remember to include sudo
before running your text editor.
Replace each instance of example.com
in this guide with your site’s domain name.
Before You Begin
This guide assumes you have followed the Creating a Compute Instance and Setting Up and Securing a Compute Instance guide, and that your 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).
Make sure MySQL has a database set up for WordPress. If you do not have a WordPress database, create one:
Log in to the MySQL command line as the root user:
mysql -u root -p
Create the WordPress database:
CREATE DATABASE wordpress;
Create a user and grant them privileges for the newly created
wordpress
database, replacingwpuser
andpassword
with the username and password you wish to use:CREATE USER 'wpuser' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser';
Exit MySQL:
quit
Install WordPress
Create a directory called
src
under your website’s directory to store fresh copies of WordPress’s source files. In this guide, the home directory/var/www/html/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/
Set your web server’s user,
www-data
, as the owner of your site’s home directory:sudo chown -R www-data:www-data /var/www/html/example.com/
Install the latest version of WordPress and extract it:
sudo wget http://wordpress.org/latest.tar.gz sudo -u www-data tar -xvf latest.tar.gz
Rename
latest.tar.gz
aswordpress
followed by the date to store a backup of the original source files. This will be useful if you install new versions in the future and need to revert back to a previous release:sudo mv latest.tar.gz wordpress-`date "+%Y-%m-%d"`.tar.gz
Create a
public_html
directory to be the root directory for WordPress. Move the WordPress files to yourpublic_html
folder:sudo mkdir /var/www/html/example.com/public_html/ sudo mv wordpress/* ../public_html/
Give your web server ownership of the
public_html
folder:sudo chown -R www-data:www-data /var/www/html/example.com/public_html
Configure WordPress
Visit your domain in a web browser and follow the steps shown onscreen. Select your preferred language, review the information page and click the Let’s go! button. Enter the database credentials that were set when you installed MySQL:
WordPress will test the credentials and if authentication is successful, prompt you to Run the install.
Note If WordPress doesn’t display when you visit your domain, try adding/wp-admin
to the end of the URL. This sometimes happens if you previously created an index file in your site’s home directory.Fill out the administration information and click Install WordPress.
Click Log In, enter your credentials and proceed to the WordPress Dashboard.
By default, WordPress will prompt you for FTP credentials when you install new themes or plugins. To bypass this, modify your
wp-config.php
file by adding the following lines:- File: /var/www/html/example.com/public_html/wp-config.php
1 2
/** Bypass FTP */ define('FS_METHOD', 'direct');
If you’re using Apache, run the following commands to ensure that
mod_rewrite
is enabled and then restart Apache to apply the changes:sudo a2enmod rewrite sudo systemctl restart apache2
To make changes to your site in the future, you can access the Dashboard of your WordPress site from the web interface by adding
/wp-admin
to your site’s URL:example.com/wp-admin
.
Congratulations! You have now successfully installed WordPress.
Create WordPress Permalinks (Optional)
Permalink is a portmanteau of the words permanent and link. Permalinks are URLs that are automatically created for specific posts or pages in WordPress so that you or others can link to them. WordPress’s default settings assign post numbers as permalinks, meaning a link to a specific post would look like example.com/?p=42
. To enforce a “prettier” permalink format, you’ll need to make a few adjustments to Apache or nginx.
For more information on permalinks, visit the WordPress guide on permalinks.
To configure permalink settings:
Log in to the WordPress admin panel through your site’s
/wp-admin
URL.Mouseover Settings in the menu on the left of your screen, then click Permalinks:
Select your preferred permalink style or create your own Custom Structure and click Save Changes
Configure your web server to allow WordPress to create the customized URLs using the appropriate section below.
Configure WordPress to Allow Permalinks on Apache
Instruct Apache to allow individual sites to update the .htaccess
file, by adding the following options to the Directory section in your virtual host configuration:
- File: /etc/apache2/sites-available/example.com.conf
1 2 3 4 5
<Directory /var/www/html/example.com/public_html> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
Restart Apache to enable the changes:
sudo systemctl restart apache2
Configure WordPress to Allow Permalinks on nginx
Direct nginx to check whether each permalink refers to an existing page. By default, nginx assumes that it doesn’t, and returns a server-side 404. Update the following lines in the location / {
block in your virtual host configuration:
- File: /etc/nginx/sites-available/example.com
1 2 3
location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$args;
Configure Maximum File Size Upload Setting to Allow Larger Files
By default, PHP restricts web uploads to under two megabytes. To allow larger file uploads through the web interface, configure the upload_max_filesize
setting in php.ini
:
Apache: /etc/php/7.0/apache2/php.ini
nginx: /etc/php/7.0/fpm/php.ini
1 2 3
; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 2M
Install Optional PHP Extensions
WordPress, and many of its plugins, use PHP extensions that you’ll need to install manually. This section is optional, but it will allow you to access some WordPress features you may not have with a basic PHP installation.
In order to modify photos or images in Wordpress, you’ll need the PHP-GD extension. For example, when you upload an image to use as a header, you may need to crop the image to make it fit your page.
To install the GD extension:
sudo apt install php7.0-gd
For full non-English language support and to fix certain character encoding-related bugs, you’ll need the multibyte string (MBSTRING) extension.
To install MBSTRING:
sudo apt install php7.0-mbstring
To use XML-RPC to access WordPress via the mobile app, or to use Jetpack, you’ll need
php-xmlrpc
. For more information on XML-RPC, visit the WordPress guide on XML-RPC. For more information on Jetpack, visit Jetpack for Wordpress.To install the XML-RPC extension:
sudo apt install php7.0-xmlrpc
These are only a few of the extensions you may find useful. Plenty of other PHP extensions exist and are required for certain plugin features, such as php7.0-curl
, php7.0-xml
, and php7.0-mcrypt
. If you’re having issues with a plugin or widget, check its documentation to see if a PHP extension is required.
php
prefix rather than php7.0
. For example, instead of installing php7.0-gd
, use php-gd
.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