{"id":12254,"date":"2021-11-24T04:52:19","date_gmt":"2021-11-24T04:52:19","guid":{"rendered":"https:\/\/linuxways.net\/?p=12254"},"modified":"2021-11-24T04:52:19","modified_gmt":"2021-11-24T04:52:19","slug":"how-to-install-wordpress-on-rocky-linux-8","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/red-hat\/how-to-install-wordpress-on-rocky-linux-8\/","title":{"rendered":"How to Install WordPress on Rocky Linux 8"},"content":{"rendered":"<p>WordPress is a widely used content management system for hosting static and dynamic websites. It&#8217;s free and open-source, and it&#8217;s written in PHP with MariaDB\/MySQL as the database backend. WordPress is made for small enterprises, personal blogs, and online shopping. WordPress is becoming more popular by the day, and it&#8217;s a terrific way to get a website up and running quickly.<\/p>\n<p>In this article, we will go through the installation of WordPress using the LAMP stack on Rocky Linux 8.<\/p>\n<h2><strong>Step 1: Install LAMP Stack<\/strong><\/h2>\n<p>Before starting, the LAMP stack must be installed in your system. First, let\u2019s install Apache and MariaDB with the command:<\/p>\n<pre><strong>$ sudo dnf install httpd mariadb-server -y<\/strong><\/pre>\n<p>After that, install PHP and the required PHP extensions on your system.<\/p>\n<p>First, reset the default PHP 7.2 with the following command:<\/p>\n<pre><strong>$ sudo dnf module reset php<\/strong><\/pre>\n<p>Now, enable the PHP version you wish to install. In this guide, we will use PHP 7.4.<\/p>\n<pre><strong>$ sudo dnf module enable php:7.4<\/strong><\/pre>\n<p>Next, install PHP 7.4 with some common required extensions as follows:<\/p>\n<pre><strong>$ sudo dnf install php php-cli php-json php-gd php-mbstring php-pdo php-xml php-mysqlnd php-pecl-zip curl -y<\/strong><\/pre>\n<h2><strong>Step 2: Create a Database for WordPress<\/strong><\/h2>\n<p>WordPress needs a database to store your site\u2019s configuration settings, usernames, posts, pages, and themes among others. You need to create a database and user for WordPress:<\/p>\n<p>First, log in to the MariaDB Database as shown:<\/p>\n<pre><strong>$ sudo mysql -u root -p<\/strong><\/pre>\n<p>Next, create a database and user for WordPress as shown:<\/p>\n<pre><strong>CREATE DATABASE wordpressdb;<\/strong><\/pre>\n<pre><strong>CREATE USER `wordpressuser`@`localhost` IDENTIFIED BY 'strong@password';<\/strong><\/pre>\n<p>Next, grant all the privileges on the WordPress database to the user. Run:<\/p>\n<pre><strong>GRANT ALL ON wordpressdb.* TO `wordpressuser`@`localhost`;<\/strong><\/pre>\n<p>Then apply the changes and exit.<\/p>\n<pre><strong>FLUSH PRIVILEGES;<\/strong><\/pre>\n<pre><strong>EXIT;<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1018\" height=\"293\" class=\"wp-image-12255\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-397.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-397.png 1018w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-397-300x86.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-397-768x221.png 768w\" sizes=\"auto, (max-width: 1018px) 100vw, 1018px\" \/><\/strong><\/p>\n<h2><strong>Step 4: Download WordPress<\/strong><\/h2>\n<p>At the time of this writing, the latest version of WordPress is 5.8.1 . To download it from the WordPress official site, use the following wget command:<\/p>\n<pre><strong>$ wget https:\/\/wordpress.org\/latest.tar.gz -O wordpress.tar.gz<\/strong><\/pre>\n<p>Once downloaded, extract the contents of the archive file. Run:<\/p>\n<pre><strong>$ tar xf wordpress.tar.gz<\/strong><\/pre>\n<p>Next, copy the unzipped WordPress directory to the \/var\/www\/html folder:<\/p>\n<pre><strong>$ sudo cp -R wordpress \/var\/www\/html\/<\/strong><\/pre>\n<p>Then, change the ownership of the WordPress folder to apache user and group. Execute the command:<\/p>\n<pre><strong>$ sudo chown -R apache:apache \/var\/www\/html\/wordpress<\/strong><\/pre>\n<p>Also, set the directory permissions so as to allow global users to access WordPress content. Run:<\/p>\n<pre><strong>$ sudo chmod -R 775 \/var\/www\/html\/wordpress<\/strong><\/pre>\n<p>Thereafter, configure the SELinux context for the WordPress directory.<\/p>\n<pre><strong>$ sudo semanage fcontext -a -t httpd_sys_rw_content_t \"\/var\/www\/html\/wordpress(\/.*)?\"<\/strong><\/pre>\n<p>To apply the SELinux changes, execute the command:<\/p>\n<pre><strong>$ sudo restorecon -Rv \/var\/www\/html\/wordpress<\/strong><\/pre>\n<h2><strong>Step 5: Configure Apache to Host WordPress<\/strong><\/h2>\n<p>In this step, we will create an Apache virtual host file for WordPress. This will point Apache to the WordPress directory on your system.<\/p>\n<p>Run the following command:<\/p>\n<pre><strong>$ sudo nano \/etc\/httpd\/conf.d\/wordpress.conf<\/strong><\/pre>\n<p>Append the following lines to the file:<\/p>\n<pre><strong>&lt;VirtualHost *:80&gt;<\/strong>\r\n\r\n<strong>ServerName server-IP or FQDN<\/strong>\r\n\r\n<strong>ServerAdmin root@localhost<\/strong>\r\n\r\n<strong>DocumentRoot \/var\/www\/html\/wordpress<\/strong>\r\n\r\n<strong>&lt;Directory \"\/var\/www\/html\/wordpress\"&gt;<\/strong>\r\n\r\n<strong>Options Indexes FollowSymLinks<\/strong>\r\n\r\n<strong>AllowOverride all<\/strong>\r\n\r\n<strong>Require all granted<\/strong>\r\n\r\n<strong>&lt;\/Directory&gt;<\/strong>\r\n\r\n<strong>ErrorLog \/var\/log\/httpd\/wordpress_error.log<\/strong>\r\n\r\n<strong>CustomLog \/var\/log\/httpd\/wordpress_access.log common<\/strong>\r\n\r\n<strong>&lt;\/VirtualHost&gt;<\/strong><\/pre>\n<p>Save and exit the file. Then, restart Apache for the changes to be applied.<\/p>\n<pre><strong>$ sudo systemctl restart httpd<\/strong><\/pre>\n<h2><strong>Step 6: Access WordPress Installer<\/strong><\/h2>\n<p>Now that all the configurations are done, finalize the WordPress installation using the web wizard. Open your browser and access the WordPress installer using your server\u2019s IP.<\/p>\n<pre><strong>$ http:\/\/server-IP\/<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"972\" height=\"930\" class=\"wp-image-12256\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-398.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-398.png 972w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-398-300x287.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-398-768x735.png 768w\" sizes=\"auto, (max-width: 972px) 100vw, 972px\" \/><\/p>\n<p>Select a language then click on Continue to proceed with the installation.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"972\" height=\"823\" class=\"wp-image-12257\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-399.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-399.png 972w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-399-300x254.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-399-768x650.png 768w\" sizes=\"auto, (max-width: 972px) 100vw, 972px\" \/><\/p>\n<p>Next, provide your database details and click Submit.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"884\" class=\"wp-image-12258\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-400.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-400.png 968w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-400-300x274.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-400-768x701.png 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/p>\n<p>Once you have connected to your database successfully, you will see the following page. Click on Run installation to proceed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"608\" class=\"wp-image-12259\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-401.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-401.png 968w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-401-300x188.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-401-768x482.png 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/p>\n<p>Thereafter, create a user and set a strong password for the Admin user. Take note of your credentials since you will need them to log in to Worpress later.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"970\" height=\"929\" class=\"wp-image-12260\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-402.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-402.png 970w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-402-300x287.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-402-768x736.png 768w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/p>\n<p>Click on install WordPress. After it is done, you will see a notification confirming that the installation was successful.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"655\" class=\"wp-image-12261\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-403.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-403.png 968w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-403-300x203.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-403-768x520.png 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/p>\n<p>Now, log in to WordPress using your credentials.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"974\" height=\"740\" class=\"wp-image-12262\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-404.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-404.png 974w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-404-300x228.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-404-768x583.png 768w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/p>\n<p>This takes you to the WordPress dashboard shown below. Now you can start to explore how to fully utilize WordPress for your websites.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1251\" height=\"928\" class=\"wp-image-12263\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-405.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-405.png 1251w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-405-300x223.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-405-1024x760.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-405-768x570.png 768w\" sizes=\"auto, (max-width: 1251px) 100vw, 1251px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>You have now successfully installed WordPress on Rocky Linux 8. You are now ready to create your blog or website.<\/p>","protected":false},"excerpt":{"rendered":"<p>WordPress is a widely used content management system for hosting static and dynamic websites. It&#8217;s free and open-source, and it&#8217;s written in PHP with MariaDB\/MySQL as the database&hellip;<\/p>","protected":false},"author":1,"featured_media":12383,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[165],"tags":[436,177],"class_list":["post-12254","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-red-hat","tag-rocky-linux-8","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=12254"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12254\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/12383"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=12254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=12254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=12254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}