This is an old revision of the document!
Part 4: Install and Configure Content Management System
The content management system we have chosen is WordPress.
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.
