Tag: wordpress

Install WordPress Locally on Linux (Step-by-Step Guide)

HOST NAME

sudo nano /etc/hostname
sudo nano /etc/hosts
ping / nslookup
sudo systemctl restart systemd-logind.service
source /etc/hostname
hostnamectl

UPDATE THE SYSTEM

sudo apt update
sudo apt full-upgrade 
sudo reboot

INSTALL APACHE

sudo apt install apache2
systemctl status apache2
sudo lsof -i :80
check in broweser


#INSTALL MariaDB

sudo apt install mariadb-server

# Secure MariaDB (optional but recommended)
sudo mysql_secure_installation


# Access MariaDB shell
sudo mariadb

#Then, inside the MariaDB prompt:

CREATE DATABASE cp_breeze_wordpress_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'cp_breeze_wordpress_user'@'localhost' IDENTIFIED BY 'cp-breeze-pw';
GRANT ALL ON cp_breeze_wordpress_db.* TO 'cp_breeze_wordpress_user'@'localhost';
FLUSH PRIVILEGES;
QUIT;


DOWNLOAD WORDPRESS:

sudo apt install unzip wget
sudo wget https://wordpress.org/latest.zip
sudo unzip latest.zip
sudo chown -R www-data:www-data wordpress/
sudo mv wordpress /var/www


CONFIGURE APACHE:

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

<VirtualHost *:80>
    DocumentRoot /var/www/wordpress
    <Directory /var/www/wordpress>
        Options FollowSymLinks
        AllowOverride All
        DirectoryIndex index.php
        Require all granted
    </Directory>
    <Directory /var/www/wordpress/wp-content>
        Options FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>


#Enable and reload Apache:

sudo a2dissite 000-default.conf
sudo a2ensite wordpress.conf

#install these packaged:

sudo apt install \
    php-mysql php-xml php-curl php-zip \
    php-mbstring php-soap php-intl \
    php-xmlrpc php-gd libapache2-mod-php
 

#to make sure it reload all the new changes

sudo a2ensite wordpress.conf
sudo systemctl restart apache2 

sudo systemctl status apache2