WordPress Installation on LAMP stack

#Linux #WordPress #LAMP In this tutorial I have shown how to install WordPress on a LAMP stack in linux server. Commands used: Install Apache, PHP, and MySQL sudo apt update sudo apt install apache2 php libapache2-mod-php mariadb-server mariadb-client php-mysql Configure…

WordPress Installation on LAMP stack

Source

0
(0)

#Linux #WordPress #LAMP

In this tutorial I have shown how to install WordPress on a LAMP stack in linux server.

Commands used:

Install Apache, PHP, and MySQL
sudo apt update
sudo apt install apache2 php libapache2-mod-php mariadb-server mariadb-client php-mysql

Configure MySQL
sudo mysql_secure_installation

============================================================Create a database for WordPress
Open up MySQL with the root user:
sudo mysql

Create a new database for WordPress:
CREATE DATABASE wordpress_db;

Create a new user that WordPress can use to access the database:
CREATE USER ‘wordpress_user’@’localhost’ IDENTIFIED BY ‘my_password’;

Replace the my_password text below with a secure password (and write it down somewhere for later)

Then, give the WordPress user full permissions on the WordPress database:
GRANT ALL PRIVILEGES ON wordpress_db.* to wordpress_user@’localhost’;

Lastly, save the changes you’ve made to user permissions and exit MariaDB:
FLUSH PRIVILEGES;
exit;
============================================================

Configure Apache

Copy the default Apache configuration into a new file with the following command:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/wordpress.conf

Then, use nano or whatever text editor you prefer to open the file:
sudo nano /etc/apache2/sites-available/wordpress.conf

Change the DocumentRoot to where we plan to install WordPress:
DocumentRoot /var/www/wordpress

Create a setting for ServerName and enter your website’s domain name. If you don’t have one, leave it as localhost:
ServerName localhost

Create an alias for the www prefix as well. This isn’t necessary if you are just using localhost:
ServerAlias www.your-site.com

Save your changes and exit the file. Then, enable the site in Apache and disable the default site:
sudo a2ensite wordpress.conf
sudo a2dissite 000-default.conf

Finally, reload Apache for the new changes to take effect:
sudo systemctl reload apache2

============================================================

Download and install WordPress

First, use wget to download the latest version of WordPress:
wget -O /tmp/wordpress.tar.gz https://wordpress.org/latest.tar.gz

Extract the tar archive into your WordPress site directory:
sudo tar -xzvf /tmp/wordpress.tar.gz -C /var/www

Be sure to give the Apache user ownership of the site directory:
sudo chown -R www-data.www-data /var/www/wordpress

============================================================

Open your internet browser and navigate either to the localhost address 127.0.0.1 or your fully qualified domain name if you set one up. You should be greeted by the WordPress setup wizard. Click “Let’s go” to get started.

Follow the video for the installation.

0 / 5. 0

Leave a Reply

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