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 20.04
- Ubuntu 22.04 LTS
- Ubuntu 18.04
- Debian 10
- AlmaLinux 8
- Deprecated guides:
- 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.
WordPress is an open-source content management system (CMS), one of the most popular around. You can frequently find WordPress powering blogs and other websites where effective content management is central. WordPress also comes with access to a wide array of themes, plug-ins, and widgets to meet your website’s needs and make it your own.
In this guide, learn how to install WordPress on your Ubuntu 20.04 server.
Before You Begin
If you have not already done so, create a Linode account and Compute Instance. See our Getting Started with Linode and Creating a Compute Instance guides.
Follow our Setting Up and Securing a Compute Instance guide to update your system. You may also wish to set the timezone, configure your hostname, create a limited user account, and harden SSH access.
Replace all instances of
example.com
in this guide with your domain name.
sudo
. If you’re not familiar with the sudo
command, see the
Linux Users and Groups
guide.Set Up the Prerequisites
WordPress runs on PHP and uses MySQL/MariaDB for storing data. You also need a webserver to serve the content from WordPress.
To satisfy these requirements, you can set up a LAMP (Linux, Apache, MySQL, and PHP) or a LEMP (Linux, NGINX, MySQL, and PHP) stack. Then, you need to create a database that WordPress can use.
Install a LAMP or LEMP Stack
Install and configure a LAMP or LEMP stack. For either stack, make sure that you are installing at least PHP version 7.4. This is the default on Ubuntu 20.04. Additionally, make sure to replace all version numbers in the below guides with the number of the version you are installing.
To create a LAMP stack, follow the How to Install a LAMP Stack on Ubuntu 20.04 guide.
To create a LEMP stack, follow the How to Install the LEMP Stack on Ubuntu 18.04 guide.
If you are using a LAMP stack, make sure the
rewrite
module is enabled.See what modules are enabled using the below command:
sudo a2enmod status
Enable the
rewrite
module if it is not already enabled, then restart Apache:sudo a2enmod rewrite sudo systemctl restart apache2
If you are using a LEMP stack use the below steps:
Add
index.php
to thelocation /
block of your site’s configuration file.- File: /etc/nginx/sites-available/example.com
1 2 3 4 5
location / { index index.php index.html index.htm; try_files $uri $uri/ =404; }
Unlink the default configuration file.
sudo unlink /etc/nginx/sites-enabled/default
Use the following command to reload NGINX’s configuration.
sudo systemctl restart nginx
Create a WordPress Database
Log into MySQL as the root user.
sudo mysql -u root
Create a MySQL database for WordPress using the following command:
1
CREATE DATABASE wordpress;
While still logged into MySQL, create a MySQL user for WordPress, and give that user privileges for the WordPress database. In the commands below, replace
wpuser
andpassword
with the username and password, respectively, that you want for your WordPress MySQL user.1 2 3
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost'; FLUSH PRIVILEGES;
You can then use the
quit;
command to exit MySQL.
Install WordPress
Create a
src
directory in your website’s directory, then change into that new directory. Here and following, the website directory created in the LAMP and LEMP guides linked above is used, which is/var/www/example.com
.sudo mkdir -p /var/www/html/example.com/src cd /var/www/html/example.com/src
Download and extract the latest version of the WordPress package.
sudo wget http://wordpress.org/latest.tar.gz sudo tar -xvf latest.tar.gz
Rename the
tar.gz
package in a way that makes it easy to distinguish, such as including the date in the filename. Here is an example:sudo mv latest.tar.gz wordpress-`date "+%Y-%m-%d"`.tar.gz
Doing this, while not required, can be helpful. If, for instance, you later install a newer version but subsequently need to roll it back, you have a past version stored, and labeled here.
Move the contents of the
src/wordpress
directory into the root directory defined in your website’s configuration file. For the guides linked above, this is thepublic_html
directory.sudo mv wordpress/* ../public_html/
Give the webserver user (
www-data
) and its associated user group ownership of the website directory.sudo chown -R www-data:www-data /var/www/html/example.com
Configure WordPress
In a web browser, visit the domain name for your website —
example.com
above. Follow the prompts to enter information related to your WordPress website. When prompted, enter the database credentials you created when setting up the MySQL database in the steps above. Choose to Run the installation.Enter information for your WordPress administrator user, then click Install WordPress. After the installation has finished, log in using the credentials you entered for the administrator user.
By default, WordPress attempts to use FTP credentials to install themes and plug-ins. Bypass this by adding the following lines to the
public/wp-config.php
file.- File: /var/www/html/example.com/public_html/wp-config.php
1 2 3
/** Bypass FTP */ define('FS_METHOD', 'direct');
Conclusion
Congratulations! Your WordPress site is up and running. You can reach the site’s dashboard, where you can manage its settings, by appending /wp-admin
to the domain name. For instance, using the example.com
domain name above—example.com/wp-admin
.
To start learning more about getting the most out of your WordPress site, check out WordPress’s First Steps with WordPress . It helps you figure out how to start using and making your WordPress site your own.
To go beyond the basic configuration on your WordPress site, take a look at our Configuring WordPress guide. It walks you through more advanced configuration options that open up new features for your WordPress installation.
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