WordPress is the world’s most popular Content Management System (CMS), powering over 40% of all websites. With WordPress, you can easily build blogs, business websites, or even online stores in just a few steps.
However, installing WordPress alone is not enough. To run a professional and reliable website, you also need to secure it with SSL. In this article, I will guide you through installing WordPress on Ubuntu/Debian and configuring a free SSL certificate from Let’s Encrypt, so your website runs smoothly and safely.
Prerequisites
Before getting started, make sure you have:
- A domain name, purchased from any provider.
- A server (VPS, Cloud Server, or a self-hosted machine).
- Ubuntu or Debian operating system installed.
- A LAMP stack (Linux, Apache, MySQL/MariaDB, PHP).
Read more: How to Install LAMP (Linux – Apache – MySQL/MariaDB – PHP ) on Ubuntu
How to Install LAMP stack ( Linux – Apache – MySQL/MariaDB – PHP ) on Debian
Make sure your domain points to your server:
- Create an A record for
@
andwww
pointing to your server’s IP address. - If you’re using VPS/Cloud, point directly to the server IP.
- If you’re hosting at home, point the domain to your public IP (router/firewall), then configure NAT (Port Forwarding) to forward ports 80 (HTTP) and 443 (HTTPS) to your web server.

Install PHP Extensions for WordPress
WordPress requires several PHP extensions to function properly. After installing PHP, add these extensions:
sudo apt install php-mysql php-xml php-curl php-gd php-mbstring php-zip unzip -y
Restart Apache to apply changes:
sudo systemctl restart apache2
Create a Database for WordPress
Now let’s create a dedicated database for WordPress. Log in to MySQL or MariaDB as root:
sudo mysql -u root -p
Then run the following commands:
CREATE DATABASE wp_db;
CREATE USER wp_db_user@localhost IDENTIFIED BY 'wp_db_PWD';
GRANT ALL PRIVILEGES ON wp_db.* TO wp_db_user@localhost;
FLUSH PRIVILEGES;
EXIT;
Replace wp_db
, wp_db_user
, and wp_db
_PWD with your own values.

Download and Install WordPress
Navigate to the web server root directory, usually /var/www/html/
:
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvzf latest.tar.gz
The extracted folder will be named wordpress
. You can rename it to something relevant to your website, for example:
sudo mv wordpress mywebsite
Set the correct ownership and permissions for Apache:
sudo chown -R www-data:www-data /var/www/html/mywebsite
sudo chmod -R 755 /var/www/html/mywebsite

Configure Apache Virtual Host
Create a configuration file for your website:
sudo nano /etc/apache2/sites-available/mywebsite.conf
Add the following content:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html/mywebsite
<Directory /var/www/html/mywebsite>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/mywebsite_error.log
CustomLog ${APACHE_LOG_DIR}/mywebsite_access.log combined
</VirtualHost>
Enable the site and required modules:
sudo a2ensite mywebsite.conf
sudo a2enmod rewrite
sudo a2dissite 000-default.conf
sudo systemctl restart apache2
Install WordPress via Web Browser
Open your browser and go to your domain. The WordPress installation screen will appear.
- Select your preferred Language.

- Enter the database information created earlier (database name, user, password). Then, click Submit.

- Then click Run the installation.

Next, fill in your website details:
- Site Title
- Admin Username & Password
- Admin Email
Click Install WordPress to complete the setup.

You will then see a success message. Log in using the admin account to access the WordPress Dashboard.

Configure Free SSL with Let’s Encrypt
To make your website secure, we’ll use Certbot to request and manage a free SSL certificate from Let’s Encrypt.
Install Certbot:
sudo apt install certbot python3-certbot-apache -y
Request an SSL certificate for your domain:
sudo certbot --apache -d example.com -d www.example.com
If successful, Certbot will automatically configure Apache for HTTPS. Restart Apache to apply changes:
sudo systemctl restart apache2
Now open https://example.com
in your browser. If you see a padlock icon, SSL has been successfully installed and is working.

Conclusion
You’ve now completed the process of installing WordPress on Ubuntu/Debian and securing it with a free SSL certificate from Let’s Encrypt.
Your website is fully functional and protected. From here, you can install themes, add plugins, and start building content confidently. WordPress offers powerful flexibility, allowing you to expand and customize your site as your project grows.