AvoidErrors
  • HOME
  • WINDOWS
  • APPLE
  • MS OFFICE
  • RASPBERRY PI
  • WORDPRESS
  • TECH TIPS
  • LINUX
  • VIRTUALIZATION
  • FORUM
No Result
View All Result
AvoidErrors
No Result
View All Result

How to Install WordPress on Ubuntu Server 18.04

Abdelrahman Reda by Abdelrahman Reda
September 3, 2018 - Updated on September 5, 2018
in Linux, WordPress
0
Share on FacebookShare on Reddit
RECOMMENDED: Improve PC performance Migrate to Solid State Drive (SSD)

WordPress is an open source web development tool that powers about 30% of the internet. WordPress is the most popular and powerful content management system.

In this tutorial, we will be installing WordPress on Ubuntu Server 18.04 Before starting this step by step tutorial, ensure that you have the following requirements:

  1. Access to an Ubuntu server
  2. Install LAMP on Ubuntu. The server must have a LAMP stack installed. For WordPress to run smoothly, it requires a web server, PHP, and a database.
  3. User with sudo privileges. In this tutorial, the sudo user is ‘avoiderrors’.

Step 1:  Create a database and user for the new WordPress site

First, we are going to create a database ‘avoiderrors’ and assign it to user ‘avoiderrors’. Log in as root or sudo user for this step.

The lines of code you require are highlighted in yellow throughout the tutorial.

sudo su
mysql -u root –p

//After successfully logging in

CREATE DATABASE avoiderrors DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

GRANT ALL ON avoiderrors.* TO 'avoiderrors'@'localhost' IDENTIFIED BY 'password';

//Save changes

FLUSH PRIVILEGES;

//Exit

EXIT;

Step 2: Install essential PHP extensions.

Before installing any package on Ubuntu, always start with the command ‘sudo apt-get update’ to update the system.

In this step, we will install the necessary PHP extensions for WordPress.

The first line of code is for switching from root user to avoiderrors (sudo user). Write the following code on your terminal:

sudo apt update
sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip

Step 3: Adjust the Apache configuration.

The main reason why we need to perform these configurations is to allow .htacess rewrites and overrides. For this tutorial, my configuration file for my site is avoiderrors.tk.conf and my root directory is /var/www/avoiderrors. Make sure to substitute the above entries with your own.

The default config file is 000-default.conf and the default root directory is /var/www/html if you are only running one website on the server. Type the following code to edit your config file using nano:

sudo nano /etc/apache2/sites-available/avoiderrors.conf

Within the VirtualHost block, paste the block of code below with the correct directory:

<Directory /var/www/avoiderrors/>
  AllowOverride All
</Directory>

Save the file and exit. Write the following code to enable rewrites and restart Apache:

sudo a2enmod rewrite
sudo apache2ctl configtest
sudo systemctl restart apache2

Step 4: Downloading the latest version of WordPress

In this step, we will download WordPress latest release and extract the file on a writable directory (/tmp). We are also going to create a .htaccess file, wp-config.php file and a directory for updates. Finally, we are going to move all the content from ‘/tmp’ to our WordPress website’s root directory. Sell illustrations below:

cd /tmp

apt install curl

curl -O https://WordPress.org/latest.tar.gz

Create a .htaccess file for your WordPress

touch /tmp/WordPress/.htaccess

Copy the sample config file to the default WordPress config file

cp /tmp/WordPress/wp-config-sample.php /tmp/WordPress/wp-config.php

Create a directory for updates.

mkdir /tmp/WordPress/wp-content/upgrade

Finally, we are going to move all the content from ‘/tmp’ to our WordPress website’s root directory.

sudo cp -a /tmp/WordPress/. /var/www/avoiderrors

Step 5: Setting up the WordPress directory

Write the following code to adjust the ownership and permissions of the directory:

sudo chown -R www-data:www-data /var/www/avoiderrors

sudo find /var/www/avoiderrors/ -type d -exec chmod 750 {} \;

sudo find /var/www/avoiderrors/ -type f -exec chmod 640 {} \;

The second part of this step is the most important. This is where we configure the wp-config.php file. We need to edit the following:

Type the following command on the terminal to generate unique secret keys:

Curl –s https://api.WordPress.org/secret-key/1.1/salt/

Now type the following command to edit wp-config using nano:

Sudo nano /var/www/avoiderrors/wp-config.php

Find and change the following MySQL settings accordingly:

Add this line:

Finally, replace the dummy secret keys with the ones we generated. Dummy keys look like this:

Once replaced, they should look like these:

NOTE: Do not copy the above keys! Generate your own keys for your site’s security. If you followed all the steps in this tutorial, go to your browser and type your domain name or IP-address. The screen should look like this:

This page is proof that you have installed WordPress on Ubuntu. In case you run into any problem, ensure that you have consistently used the correct directory paths throughout. If successful, configure your preferred settings and enjoy WordPress on Ubuntu!

Previous Post

Intall Windows (Standard R2 Version) Through an External Device (USB/CD ROM) on IBM Server

Next Post

Set up Time Machine on a Mac to make Regular backups

Abdelrahman Reda

Abdelrahman Reda

Abdelrahman Reda is a Motivated Support Engineer with 6+ years of corporate and consumer support experience. His experience related to administration of Network, NOC support, computers and anti-virus server, data entry, networking sites, remote support.

Related Posts

Install ownCloud on Ubuntu 20.04 LTS DigitalOcean
Linux

Install ownCloud on Ubuntu 20.04 LTS DigitalOcean

by Miguel
June 21, 2022 - Updated on June 22, 2022
Completely Remove Windows 11 and Install Ubuntu
Linux

Completely Remove Windows 11 and Install Ubuntu

by Miguel
April 8, 2022

Subscribe to get weekly tutorials direct to your inbox!

Windows

Fix .net Framework 3.5 Missing on Windows 11

by Rhousse
August 13, 2022
Clean Install Windows 11 Without USB
Windows

How to turn off Delivery Optimization on Windows 11

by Muhammad Imran Habib
August 13, 2022
How to Enable Dark Mode on Windows 11
Windows

How to Prevent Users from Changing Proxy Settings in Windows 11

by Muhammad Imran Habib
August 13, 2022
How to Check Laptop Battery Details in Windows 10
Windows

How to Create a New Custom Power Plan in Windows 11

by Muhammad Imran Habib
August 13, 2022
  • Disclaimer & Privacy Policy
  • FAQ
© 2022 Powered by Cloudways
No Result
View All Result
  • HOME
  • WINDOWS
  • APPLE
  • MS OFFICE
  • RASPBERRY PI
  • WORDPRESS
  • TECH TIPS
  • LINUX
  • VIRTUALIZATION
  • FORUM

© 2022 AvoidErrors Powered by Cloudways | Privacy

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.