Introduction
WordPress is a free and open-source content management system (CMS) with a plugin architecture and customizable themes. The PHP-based platform is usually paired with a MySQL or MariaDB database and was originally designed for publishing blogs. It is available for free and considered easy to install, configure, and uses.
This article explains how to install WordPress on OpenSUSE.
Prerequisites
- A root or non-root user with
sudo
privileges. - A LAMP stack includes the Linux operating system, the Apache web server, MySQL, and the PHP programming language.
If the LAMP stack is not installed, then just Follow the below steps to install LAMP on OpenSUSE.
Installing Apache HTTP Server
- Run the below command on the terminal to install Apache.
$ sudo zypper install apache2
- Start the service apache service using the following commands.
$ sudo systemctl start apache2
$ sudo systemctl enable apache2
$ sudo systemctl status apache2
Install MySQL
- To install MariaDB on openSUSE, run the following command.
sudo zypper install mariadb mariadb-client
- Start MySQL server.
$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb
$ sudo systemctl status mariadb
Installing PHP and PHP Modules
- To install PHP along with the needed modules run the following command.
sudo zypper install php php-mysql php-gd php-mbstring apache2-mod_php7
- Next, enable the PHP module and restart the Apache webserver to affect the latest changes as shown.
$ sudo a2enmod php7
$ sudo systemctl restart apache2
Install WordPress
After configuring the LAMP, install and configure WordPress. Follow the instructions below to download and install WordPress.
- Run the below command on the terminal to download WordPress packages.
wget http://wordpress.org/latest.tar.gz
- Run the following command to Uncompress the tarball which will generate a folder called
wordpress
.tar -xvf latest.tar.gz
- This extracts the compressed file to a folder called
wordpress
. Move this folder to the Document root directory.mv wordpress/ /srv/www/htdocs/
- Next, create a
wp-config.php
file by copying thewp-config-sample.php
file.sudo cp /srv/www/htdocs/wordpress/wp-config-sample.php /srv/www/htdocs/wordpress/wp-config.php
- Run commands to change file permissions of the
wordpress
folder.$ chown -R wwwrun:www /srv/www/htdocs/
$ chmod 775 -R /srv/www/htdocs/ -
Create WordPress Database.
WordPress uses MySQL to manage and store site and user information so need to create a database and user for WordPress.
-
Login into MySQL shell using the below command
mysql -u root -p
-
Create a database for a WordPress installation.
CREATE DATABASE wordpress;
-
Create a new database user and assign it a password.
CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
-
Now, grant the user full rights to the new WordPress database.
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password'
-
Flush the privileges.
FLUSH PRIVILEGES:
-
Exit from MySQL.
exit
-
-
Next, access the
wp-config
. file and update the DB_NAME, DB_USER, DB_PASSWORD fields as show in below image.vim /srv/www/htdocs/wordpress/wp-config.php
- Restart Apache server
sudo systemctl restart apache2
- Open your browser and go to the server’s URL and replace "server-ip" with your system IP in the below URL.
https://server-ip/wp-admin
- Follow the on-screen instructions to create a WordPress user.
- Once the WordPress installation is complete, click on login to access your site’s administrative login page.
- Authenticate with the user credentials and start accessing WordPress.