====== Part 4: Install and Configure Content Management System====== This page will show how to install the WordPress [[whatiscms|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 {{:sudo_apt_update_upgrade.png?nolink&600|}} 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. \\ {{:sudo_apt_install_apache2.png?nolink&600|}} To start and enable Apache, use command: sudo systemctl start apache2 sudo systemctl enable apache2 {{:start_enable_apache2.png?nolink&600|}} 3. Install **MySQL (MariaDB)** sudo apt install mariadb-server Press ''y'' and Enter to continue. \\ {{:mariadb_1.png?nolink&600|}} sudo mysql_secure_installation {{:mysql_secure_installation.png?nolink&600|}} {{:mysql_secure_installation2.png?nolink&600|}} 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. \\ {{:php.png?nolink&600|}} 5. Restart Apache sudo systemctl restart apache2 {{:restart_apache2.png?nolink&600|}} 6. Create a MySQL Database for WordPress. \\ Log into MySQL. sudo mysql -u root -p The password should be your root password. {{:mysql_root.png?nolink&600|}} \\ Once you are in, you will be greeted with this menu. {{:mariadb_success.png?nolink&600|}} 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; {{:database_wordpress.png?nolink&600|}} 7. Download and configure WordPress. sudo wget https://wordpress.org/latest.tar.gz {{:wordpress_install.png?nolink&600|}} Unzip using this command: sudo tar -xvzf latest.tar.gz {{:tar_unzip_wordpress.png?nolink&600|}} Now move the files to the web root directory. sudo mv wordpress /var/www/html/wordpress {{:mv_wordpress.png?nolink&600|}} Set the correct permissions sudo chown -R www-data:www-data /var/www/html/wordpress sudo chmod -R 755 /var/www/html/wordpress {{:chown_chmod.png?nolink&600|}} 8. Create a new Apache configuration file for WordPress. sudo nano /etc/apache2/sites-available/wordpress.conf {{:nano_apache2_wordpress.png?nolink&600|}} \\ Add the following configuration: DocumentRoot /var/www/html/wordpress ServerName localhost AllowOverride All ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined Press ''Ctrl + X'', ''y'', and ''Enter'' to save. {{:wordpress_conf.png?nolink&600|}} sudo a2ensite wordpress.conf sudo a2enmod rewrite {{:a2ensite_a2enmod_wordpress.png?nolink&600|}} sudo systemctl restart apache2 {{:restart_apache2.png?nolink&600|}} sudo nano /var/www/html/wordpress/wp-config.php Make sure your wp-config.php have the contents. {{:wpconfig_php.png?nolink&600|}} 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. {{:chmod_chown_wpconfig_php.png?nolink&600|}} Restart Apache2 sudo systemctl restart apache2 {{:restart_apache2.png?nolink&600|}} 9. Go to ''localhost'' on the browser and now we have the option to Install WordPress. {{:wp1.png?nolink&600|}} Fill up every information needed. \\ {{:wp2.png?nolink&600|}} {{:wp3.png?nolink&600|}} \\ And bam! We now have WordPress working. {{:wp4.png?nolink&600|}} \\ Press the __Log In__ to log in to WordPress Dashboard. Enter the username and password and press Log In. \\ {{:wp5.png?nolink&600|}} {{:wp6.png?nolink&600|}} Let's say we want to publish something. \\ Edit some texts and description. Once done, click publish. {{:wp7.png?nolink&600|}} \\ A sample of published post. \\ {{:wp8.png?nolink&600|}} \\ The post we had posted just now is now in the main WordPress home page. {{:wp9.png?nolink&600|}} ----- Congratulations! You have created your very own CMS using WordPress.