{"id":3407,"date":"2019-06-24T18:21:27","date_gmt":"2019-06-24T15:21:27","guid":{"rendered":"https:\/\/kifarunix.com\/?p=3407"},"modified":"2024-03-11T23:05:24","modified_gmt":"2024-03-11T20:05:24","slug":"install-lemp-stack-with-mysql-8-on-fedora-30-fedora-29","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-lemp-stack-with-mysql-8-on-fedora-30-fedora-29\/","title":{"rendered":"Install LEMP Stack with MySQL 8 on Fedora 30\/Fedora 29"},"content":{"rendered":"\n<p>Learn how to Install LEMP Stack with MySQL 8 on Fedora 30\/Fedora 29 by following through this guide.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing LEMP Stack with MySQL 8 on Fedora<\/h2>\n\n\n\n<p>Run system update;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf update\ndnf upgrade<\/code><\/pre>\n\n\n\n<p>Next, install LEMP stack. Installation of different components of LEMP stack (Nginx, MySQL and PHP) have been covered on different guides. See the links below;<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/install-nginx-web-server-on-fedora-30\/\" target=\"_blank\">Install Nginx Web Server on Fedora 30\/Fedora 29<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/install-mysql-8-on-fedora-30-fedora-29\/\" target=\"_blank\">Install MySQL 8 on Fedora 30\/Fedora 29<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/install-php-7-3-4-on-fedora-30\/\" target=\"_blank\">Install PHP 7.3.4 on Fedora 30\/Fedora 29<\/a><\/p>\n\n\n\n<p>Assuming the above components have been installed, proceed to do the configuration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Configure PHP<\/h3>\n\n\n\n<p>This is a number of PHP extensions that are required for the functionality of Nginx. In our basic setup, this guide installs PHP MySQL native driver and FastCGI Process Manager (<strong>php-mysqlnd<\/strong> and <strong>php-fpm<\/strong>) extensions.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php-mysqlnd php-fpm<\/code><\/pre>\n\n\n\n<p>If your application requires other PHP extensions, you can always install them on Fedora 30\/29 by running the command below<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php-[extension]<\/code><\/pre>\n\n\n\n<p>Next, you need to set the Unix user\/group of PHP processes to <strong>nginx<\/strong>. This can be done by editing the file, and replacing <strong>apache<\/strong> user\/group with <strong>nginx.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/php-fpm.d\/www.conf<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n...\n; Unix user\/group of processes\n; Note: The user is mandatory. If the group is not set, the default user's group\n;       will be used.\n; RPM: apache user chosen to provide access to the same directories as httpd\nuser = nginx\n; RPM: Keep a group allowed to write in log dir.\ngroup = nginx\n...\n<\/code><\/pre>\n\n\n\n<p>Next, set ownership permissions for unix socket to <strong>nginx<\/strong> user\/group defined above.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nlisten.owner = nginx\nlisten.group = nginx\n...<\/code><\/pre>\n\n\n\n<p>Save the configuration file and restart and enable <strong>PHP-FPM<\/strong> to run on system boot.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart php-fpm\nsystemctl enable php-fpm<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configuring Nginx<\/h3>\n\n\n\n<p>Now that Nginx has been installed, create your site configuration file with the following <strong>basic<\/strong> settings.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/nginx\/conf.d\/kifarunix-demo.conf<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nserver {\n    listen 80;\n    server_name kifarunix-demo.com;\n\n    root \/usr\/share\/nginx\/html\/kifarunix-demo.com;\n    index index.php;\n\n    access_log \/var\/log\/nginx\/kifarunix-demo.com.access.log;\n    error_log \/var\/log\/nginx\/kifarunix-demo.com.error.log;\n\n    location \/ {\n        try_files $uri $uri\/ \/index.php?$args;\n    }\n\n    location ~ \\.php$ {\n        try_files $uri =404;\n        fastcgi_pass unix:\/run\/php-fpm\/www.sock;\n        fastcgi_index   index.php;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        include fastcgi_params;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Set the <a href=\"http:\/\/nginx.org\/en\/docs\/http\/ngx_http_core_module.html#types_hash_bucket_size\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"bucket size for the types hash tables (opens in a new tab)\">bucket size for the types hash tables<\/a> to <strong>4096<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sed -i 's\/types_hash_max_size 2048;\/types_hash_max_size 4096;\/' \/etc\/nginx\/nginx.conf<\/code><\/pre>\n\n\n\n<p>Create the web root directory defined above.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mkdir \/usr\/share\/nginx\/html\/kifarunix-demo.com<\/code><\/pre>\n\n\n\n<p>Save the configuration file and run the command below to verify Nginx syntax.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx -t\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/code><\/pre>\n\n\n\n<p>Restart Nginx if there is no syntactical error.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart nginx<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Test Nginx PHP Processing<\/h3>\n\n\n\n<p>To confirm that Nginx PHP-FPM is working, create a PHP test page as shown below and test it by accessing it from the browser.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"&lt;?php phpinfo(); ?&gt;\" &gt; \/usr\/share\/nginx\/html\/kifarunix-demo.com\/php-test.php<\/code><\/pre>\n\n\n\n<p>Now, access the URL <strong>http:\/\/kifarunix-demo.com\/php-test.php<\/strong>. Replace your site domain accordingly.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/06\/php-test-page.png\"><img loading=\"lazy\" decoding=\"async\" width=\"935\" height=\"688\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/06\/php-test-page.png\" alt=\"Install LEMP Stack with MySQL 8 on Fedora\" class=\"wp-image-3408\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/06\/php-test-page.png 935w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/06\/php-test-page-768x565.png 768w\" sizes=\"(max-width: 935px) 100vw, 935px\" \/><\/a><\/figure>\n\n\n\n<p>Well, seems everything is fine. You can now remove the PHP test page.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>rm -rf \/usr\/share\/nginx\/html\/kifarunix-demo.com\/php-test.php<\/code><\/pre>\n\n\n\n<p>That is all on our demo on how to install LEMP Stack with MySQL 8 on Fedora.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Other related tutorials;<\/h3>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-lamp-stack-on-fedora-30\/\" target=\"_blank\">Install LAMP Stack on Fedora 30<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-lamp-stack-on-debian-9\/\" target=\"_blank\">Install LAMP Stack on Debian 9<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/how-to-install-lamp-linux-apache-mysql-php-stack-on-fedora-28-29\/\" target=\"_blank\">How To Install LAMP (Linux, Apache, MySQL, PHP) Stack on Fedora 28\/29<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/how-to-install-lamp-stack-apachemariadb-php-7-2-on-ubuntu-18-04-lts\/\" target=\"_blank\">How to Install LAMP Stack (Apache,MariaDB, PHP 7.2) on Ubuntu 18.04 LTS<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-phpmyadmin-with-apache-on-fedora-30\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install phpMyAdmin with Apache on Fedora 30<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to Install LEMP Stack with MySQL 8 on Fedora 30\/Fedora 29 by following through this guide. Installing LEMP Stack with MySQL 8 on<\/p>\n","protected":false},"author":2,"featured_media":12497,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,235],"tags":[289,924,5002,1011,1010,5003,229],"class_list":["post-3407","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-lemp-stack","tag-fedora-29","tag-fedora-30","tag-install-lemp-stack-fedora","tag-lemp","tag-lemp-stack","tag-mysql-8-fedora","tag-nginx","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3407"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=3407"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3407\/revisions"}],"predecessor-version":[{"id":21159,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3407\/revisions\/21159"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/12497"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=3407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=3407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=3407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}