Install WordPress with Apache on OpenSUSE

This article will take you through how to install WordPress with Apache on OpenSUSE. WordPress (WP, WordPress.org) is a PHP-based content management system (CMS) that works with either a MySQL or MariaDB database. Plugin architecture and a template system referred to as Themes in WordPress, are among the features that make it easier to create and maintain websites/blogs.

How to Install WordPress with Apache on OpenSUSE

You have to have LAMP stack already installed before proceeding to WordPress installation. Check out our article on how to install the LAMP stack on OpenSUSE.

Install WordPress on OpenSUSE

  • Start by creating a WordPress database. Login into MariaDB by running the command below.
mysql -u root -p
  • Create your preferred database.
CREATE DATABASE wpdemo;
  • Next, create a username and password.
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'Pass@123';
  • Then grant permission to the user created.
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
  • Flush all privileges.
FLUSH PRIVILEGES;

Sample output

Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.6.7-MariaDB MariaDB package

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database wordpress character set utf8mb4;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> create user demouser@localhost identified by 'Pass@123'; 
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> grant all on wordpress.* to demouser@localhost;
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit
Bye
  • Download WordPress using the command below.
wget http://wordpress.org/latest.tar.gz
  • After downloading, extract it using the following command.
tar -zxvf latest.tar.gz
  • Next, move the extracted directory to /srv/www/htdocs directory.
sudo mv wordpress/ /srv/www/htdocs/
  • Then rename the sample config file.
sudo cp /srv/www/htdocs/wordpress/wp-config-sample.php /srv/www/htdocs/wordpress/wp-config.php
  • Enter your database details into the configuration file. Open the config file with your preferred text editor.
sudo nano /srv/www/htdocs/wordpress/wp-config.php

Sample database info.

// ** Database settings - You can get this info from your web host ** >
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** Database username */
define( 'DB_USER', 'demouser' );

/** Database password */
define( 'DB_PASSWORD', 'Pass@123' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8mb4' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication unique keys and salts.
 *
  • Change ownership.
sudo chown -R wwwrun:www /srv/www/htdocs/
  • Give permissions.
sudo chmod 775 -R /srv/www/htdocs/
  • Configure virtual host.
sudo nano /etc/apache2/conf.d/wordpress.conf

File config

<virtualhost *:80>
servername www.yourexampledomain.com
documentroot "/srv/www/htdocs/wordpress/"
<directory "/srv/www/htdocs/">
AllowOverride All
Require all granted
</directory>
</virtualhost>
  • Restart Apache service using the following command.
sudo systemctl restart apache2
  • Access WordPress on your browser by entering your domain or server IP and then select your language.
  • Next, enter your website details.
  • Log in using your username/email and password created above.
  • After successful login, you will be redirected to WordPress Dashboard.
  • That marks the end of our article. We have gone through how to install WordPress with Apache on OpenSUSE. Cheers!

Read more on WordPress Documentation

Other Tutorials

Install WordPress with LAMP Stack on Ubuntu 22.04

Install LAMP Stack on Debian 11

Install phpMyAdmin with Apache on Debian 11

System administrator | Software Developer | DevOps

Leave a Comment