What is Wordpress?
WordPress is an open-source content management system, or CMS for short, that allows you to create website content and manage it simply and efficiently. Being open-source, anyone can view and modify the Wordpress source code for free. With Wordpress, you can have a place on the web to share poetry, short stories, novels, academic writings, paintings, or tutorials on whatever topic interests you. You can build a blog that inspires the world. And If you have an established business, you can use Wordpress to manage a blog-based content marketing strategy to generate more sales. Wordpress also allows you to create eCommerce stores, portfolios, forums, social networks, and much more. In fact, Wordpress powers 43% of all the websites on the Internet, making it the world’s most popular content management system.What is LEMP Stack?
In order to set up Wordpress on your web server, you'll need a few software components, referred to as LEMP, which stands for "Linux, Nginx (pronounced as engine-x, hence the E in the acronym), MySQL, and PHP."Linux
Linux is the most popular, secure and open source operating system used in web servers. It is the foundation for the rest of the stack.Nginx
Nginx is an open-source web server that delivers web content through the internet, as well as reverse proxying, caching, load balancing, media streaming, and more. We will use Nginx to serve our Wordpress website.MySQL/MariaDB
MySQL is a relational database engine that allows you to store data and manage it. In this tutorial, we’ll be using MariaDB— a backward compatible, drop-in replacement of MySQL, which includes all major open source storage engines. MariaDB will be used by Wordpress to store and organize your website's data.PHP
PHP is a widely used open source and general purpose server-side scripting language used mainly in web development to create dynamic websites and applications. PHP is the dynamic programming language Wordpress was written in.Prerequisites
To install Wordpress you need the following:- An Ubuntu 22.04 server.
- Root access to your server or a
sudo
user. Check out our How to access your server using SSH guide to learn how to access your server and create asudo
user. - The LEMP stack installed on your server. Use our Installing LEMP on Ubuntu 22.04 LTS guide to set it up.
Step 1 - Updating the Package Cache
Start by updating the packages in the package manager cache to the latest available versions using the following command:sudo apt update
Step 2 - Creating a MariaDB Database and a User for WordPress
Wordpress needs a MySQL database to store your site's data, such as user information, posts, pages, etc. In this tutorial we'll use MariaDB, which is a compatible drop-in replacement for MySQL but with more features. To create a MySQL/MariaDB database, use themysql
client to connect to MariaDB and access its command line interface with the following command:
sudo mysql
If you get an error that contains Access denied for user 'root'
, this means that the default authentication method has changed, and connecting to MariaDB requires a password for the root account. To solve this issue, use the following command to connect to MariaDB using the root user and a password:
mysql -u root -p
You'll be asked for your MySQL root password, enter it and then press Enter.
Note: If you've installed the LEMP stack using our 1-Click App, you'll find your MySQL root password in the App Details widget on your SSDNodes Dashboard. As demonstrated in the following image:
You should get a prompt similar to the following:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 51
Server version: 10.6.7-MariaDB-2ubuntu1.1 Ubuntu 22.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Now you can create a database for Wordpress. We'll name the database wordpress
, but feel free to use your site's name, or any other name you would like, just make sure to remember it. Use the following MySQL statement to create a database named wordpress
:
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
This creates a database called wordpress
with UTF-8 as a character set, which supports all alphabets and languages.
If you receive an error upon entering the preceding command, make sure you've typed it in correctly, and that you end it with a semicolon (;
).
Next, you'll need to create a MariaDB user account that will manage this wordpress
database. Only this one account can interact with the site's database, which is a good security best practice. For this new user, we'll use the name wp_user
, but again, feel free to use another name of your choice.
To create a new MariaDB user account, use the following statement in the MariaDB command line interface. Remember to replace password
with a strong password for your user account, or you might wake up some day to the news of your Wordpress website transforming into an abnormal nightmare:
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'password';
Now, you'll need to give all access permissions to the user account that will manage your wordpress
database:
GRANT ALL ON wordpress.* TO 'wp_user'@'localhost';
Here, you use the GRANT ALL
statement to grant all privileges on the wordpress
database to your wp_user
user.
Refresh the privileges for the preceding command to take effect and apply the permission changes to the database server:
FLUSH PRIVILEGES;
Exit out of the MariaDB command line interface and return to the regular Linux shell with the following command:
EXIT;
With this, you have a MariaDB database and a MariaDB user account that can be used by your Wordpress website to store data. Next, you'll install some important PHP packages that Wordpress needs to function properly.
Step 3 — Installing Required PHP Extensions for Wordpress
Wordpress requires a few additional PHP packages to be installed, in addition to the PHP packages that were installed with the LEMP stack. In this step, you'll use theapt
command to install the most important PHP extensions that Wordpress uses.
Note: The PHP packages we'll install are required for basic Wordpress usage, but many Wordpress plugins that extend the basic functionalities of Wordpress come with their own requirements, and may require additional PHP extension packages to be installed. Refer to the documentation of the specific plugin you want to install to find out its required packages and install them with apt
using the method we'll demonstrate in this step.
To install the most important PHP extensions for WordPress, run the following command:
sudo apt install php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip php-imagick
Here, you install the following packages:
php-curl
: Provides a CURL module for PHP. CURL is used in command lines and scripts to transfer data through URLs.php-gd
: Provides a GD module for PHP. The GD library is a library that offers graphics drawing tools to manage image data.php-intl
: Provides an Internationalisation module for PHP.php-mbstring
: A package that provides the MBSTRING module for PHP, which is used to manage non-ASCII strings.php-soap
: Provides the SOAP module for PHP. SOAP is an API architecture that uses the XML language to transfer data between software. Although it has been replaced by the more flexible REST architecture in most web services, SOAP is still used by some companies.php-xml
: A package that provides a DOM, SimpleXML, WDDX, XML, and XSL module for PHP.php-xmlrpc
: Provides a XMLRPC-EPI module for PHP. XML-RPC is a feature of WordPress that enables data to be transmitted via HTTP using XML for encoding.php-zip
: Provides a Zip module for PHP. Zip is a tool that is used to archive and compress files.
Continue reading this article
by subscribing to our newsletter.
Subscribe nowby subscribing to our newsletter.
A note about tutorials: We encourage our users to try out tutorials, but they aren't fully supported by our team—we can't always provide support when things go wrong. Be sure to check which OS and version it was tested with before you proceed.
If you want a fully managed experience, with dedicated support for any application you might want to run, contact us for more information.