User Tools

Site Tools


cms

Part 4: Install and Configure Content Management System

This page will show how to install the WordPress Content Management System.

Note: This is a guide on how to install and configure CMS on localhost.


To install WordPress on Debian, we would need to set up a LAMP stack (Linux, Apache, MySQL, PHP).

Below is a step-by-step guide on how to install WordPress through the command line.

1. Before starting, ensure your Debian system is up to date.

sudo apt update
sudo apt upgrade

2. WordPress requires a web server (Apache), a database (MySql/MariaDB), and PHP.
Let's install Apache first.

sudo apt install apache2


Press y and Enter to continue.

To start and enable Apache, use command:

sudo systemctl start apache2
sudo systemctl enable apache2

3. Install MySQL (MariaDB)

sudo apt install mariadb-server

Press y and Enter to continue.

sudo mysql_secure_installation

4. Install PHP

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

Press y and Enter to continue.

5. Restart Apache

sudo systemctl restart apache2

6. Create a MySQL Database for WordPress.
Log into MySQL.

sudo mysql -u root -p

The password should be your root password.
Once you are in, you will be greeted with this menu.

Now, create a database and user for WordPress.

CREATE DATABASE wordpress;
CREATE USER 'eusoff'@'localhost' IDENTIFIED BY 'eusoff*A';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'eusoff'@'localhost';
FLUSH PRIVILEGES;
EXIT;

7. Download and configure WordPress.

sudo wget https://wordpress.org/latest.tar.gz 

Unzip using this command:

sudo tar -xvzf latest.tar.gz

Now move the files to the web root directory.

sudo mv wordpress /var/www/html/wordpress

Set the correct permissions

sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress

8. Create a new Apache configuration file for WordPress.

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


Add the following configuration:

<VirtualHost *:80>
  DocumentRoot /var/www/html/wordpress
  ServerName localhost
  
  <Directory /var/www/html/wordpress>
      AllowOverride All
  </Directory>
  
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Press Ctrl + X, y, and Enter to save.

sudo a2ensite wordpress.conf
sudo a2enmod rewrite

sudo systemctl restart apache2

sudo nano /var/www/html/wordpress/wp-config.php

Make sure your wp-config.php have the contents.

sudo chmod 644 /var/www/html/wordpress/wp-config.php
sudo chown www-data:www-data /var/www/html/wordpress/wp-config.php

Make sure the permission is accessible.

Restart Apache2

sudo systemctl restart apache2

9. Go to localhost on the browser and now we have the option to Install WordPress.

Fill up every information needed.

And bam! We now have WordPress working.
Press the Log In to log in to WordPress Dashboard.

Enter the username and password and press Log In.

Let's say we want to publish something.
Edit some texts and description. Once done, click publish.
A sample of published post.

The post we had posted just now is now in the main WordPress home page.


Congratulations! You have created your very own CMS using WordPress.

cms.txt · Last modified: 2025/01/18 08:46 by 1211112299

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki