Install WordPress with LAMP on Ubuntu 18

Updated 9 January 2020

Introduction

 

Here, in this blog, we will discuss about installing WordPress with LAMP on Ubuntu 18.04

LAMP is an open source Web development platform that uses Linux as the operating system, Apache as the Web server, MySQL as the relational database management system and PHP as the object-oriented scripting language.

WordPress is a content management system based on PHP and MySQL usually used with the MySQL or MariaDB database servers but can also use the SQLite database engine.

 

Setup LAMP Server:

 

The following configurations is used to setup LAMP server on ubuntu for installing wordpress:

 

  • OS: Ubuntu 18.04
  • Web Server: Apache2
  • Database: MySQL 5.6
  • PHP: php7.3
  • WordPress 5.2.4

 

Step 1: Installing Apache 

 

Install Apache using Ubuntu’s package manager, apt:

 


 

Visit your system’s IP address in your web browser

 


 

Step 2: Installing MySQL

 


 

This will ask if you want to configure the validate password plugin. Answer Y for yes, or anything else to continue without enabling. If you answer “yes”, you’ll be asked to select a level of password validation. Select level 1 for the mediun level. You’ll be shown the password strength for the root password you just entered and your server will ask if you want to change that password. If you don’t want to change your current password then enter N for ‘no’ at the prompt.

 

 i) Login to mysql and follow the below steps

 


 

Step 3: Installing PHP

 

i) Install PHP

 

PHP is the component of your setup that will process code to display dynamic content. It can run scripts, connect to your MySQL databases to get information, and hand the processed content over to your web server to display.

 


 

 ii) Create a PHP script

 

In order to test that your system has correct php version and is configured properly for PHP, create a very basic PHP script called phpversion.php. In order for Apache to find this file and serve it correctly, it must be saved to your apache document root directory.

 



 

save and close the file.

 

iii) Navigate to your system ip on web browser

 

Now you can test whether your web server is able to correctly display content generated by this PHP script. To try this out, visit the page in your web browser.

 


 

Step 4: Adjusting Apache’s Configuration

 

i) Environment Variables

 

The Apache2 environment variables are set in the /etc/apache2/envvars file. The /etc/apache2/envvars file holds variable definitions such as Apache_Log_Dir (the location of Apache log files), Apache_Pid_File (the Apache process ID), Apache_Run_Users (the user that run Apache, by default www-data), etc.

 

ii) Currently, the use of .htaccess files is disabled. WordPress and many WordPress plugins use these files extensively for in-directory tweaks to the web server’s behavior.

Open the Apache configuration file for your website:

 


 

iii) Allowoverride ALL in  apache’s configuration file

To allow .htaccess files, we need to set the Allowoverride directive within a Directory block pointing to our document root. Add the following block of text inside the VirtualHost block in your configuration file, being sure to use the correct web root directory:

 


 

save and close the file.

 

Steps 5: Downloading WordPress and adjusting the ownership

 


 

One of the most important things we need to accomplish is setting up reasonable file permissions and ownership.

We’ll start by giving ownership of all the files to the www-data user and group. This is the user that the Apache webserver runs as, and Apache will need to be able to read and write WordPress files in order to serve the website and perform automatic updates.

 


 

Step 6: Setting up the wordpress configuration file

 

Now, we need to make some changes to the main WordPress configuration file. We need to modify some of the database connection settings at the beginning of the file. Therefore, you need to adjust the database name, the database user, and the associated password that we configured within MySQL.

 


 

Step 7: Completing the Installation Through the Web Interface

 

In your web browser, navigate to your system domain name or IP address:

 


 

i) Select the language you would like to use:

 


 

 ii) Next, you will come to the main setup page

 

Select a name for your WordPress site and choose a username. Either generate a strong password and save or select an alternative strong password. Enter your email address and select whether you want to discourage search engines from indexing your site:

 

 

iii) When you click on Install WordPress, it will open the page that prompts you to log in:

 

 

 

iv) When you click on log in, it will open the WordPress administration dashboard:

 

 

 

 

In case of any help or query, please contact us or raise a ticket.

 

Category(s) AWS cloud ecommerce linux php
author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project




    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home