Installing Magento 2 on Fedora 29

Last year, I moved to openSUSE, and started tinkering Magento 2. I have posted about the installation of Magento 2 on openSUSE as well. Then, recently, I missed Fedora and installed it back on my Thinkpad. Also, I am still developing Magento 2, so I got a bit struggle in setting it up with nginx in Fedora 29. But it turned out the most time-consuming part was just because of… typo.

Prerequisites

As in the official website said, Magento 2 required PHP up to version 7.1, which still preserves mcrypt extension. Since starting 7.2 it’s considered obsolete and removed due to no more maintained for long time. But, unfortunately the latest version of some Linux distros only provides PHP 7.2 in the main repository, including openSUSE and Fedora.

But no worries, thanks to community’s public repo, you are still able to install PHP 7.1 on them. In this case, I write how to set it up in Fedora 29, along with LEMP stack. So you need to install, at least nginx, mariadb, and php 7.1. As for PHP, we would need Remi’s COPR repo. He is the core contributor of both Fedora and PHP.

  1. Follow along the wizard on https://rpms.remirepo.net/wizard/ where the type of installation is multiple, since the single version is unavailable.
  2. Then, you need to install some packages: nginx mariadb-server php71-php-fpm php71-php-pdo php71-php-mysqlnd php71-php-opcache php71-php-xml php71-php-mcrypt php71-php-gd php71-php-devel php71-php-mysql php71-php-intl php71-php-mbstring php71-php-bcmath php71-php-json php71-php-iconv php71-php-soap php71-php-zip php71-php-cli.
  3. Check whether nginx is running by visiting localhost in your browser.
  4. Also, you need to make soft link of php cli executable /usr/bin/php71 to /usr/bin/php
  5. As for composer, don’t install it from Fedora repo, just download it from the official website instead https://getcomposer.org/download/

Configure nginx Virtualhost / Server Block

Magento has provide the configuration for nginx in the root directory, that is nginx.conf.sample file.

Create an nginx config file in ​/etc/nginx/sites-available/magento for example.

upstream fastcgi_backend {
server unix:/var/opt/remi/php71/run/php-fpm/www.sock;
}

server {
listen 80;
listen [::]:80;
server_name magento.test;
set $MAGE_ROOT /var/www/magento/html; # change as needed
include /var/www/html/magento/nginx.conf.sample;
}

Don’t forget to append magento.test in /etc/hosts at 127.0.0.1 and ::1 lines. Then create /etc/nginx/sites-enabled and make soft link of file above into it. Then you need to add a line in /etc/nginx/nginx.conf before server {} block.

include /etc/nginx/sites-enabled/*;

Test the configuration with sudo nginx -t whether it’s OK or failed. If OK, restart it with systemctl restart nginx.

File and Folder Permissions (and SELinux)

Make user www-data as the runner of nginx and php-fpm. Then add your Fedora user to its group, and edit conf files to adjust the user.

In /etc/opt/remi/php71/php-fpm.d/www.conf edit user, group, listen-user and listen-group to www-data. Also in /etc/nginx/nginx.conf change user to www-data. Restart nginx and php71-php-fpm systemd process. useradd -Mr www-data && usermod -aG <user> www-data then chmod -R :www-data * from Magento root.

Then you need to take into account the SELinux in Fedora, as well as firewall.

semanage permissive -a httpd_t
chcon -R -t httpd_sys_content_t /var/www/html/magento
chcon -R -t httpd_sys_rw_content_t /var/www/html/magento

Bonus: Alternative of Local Sendmail

Download Mailhog from https://github.com/mailhog/MailHog/releases then run it. Then you just need to edit a line in /etc/opt/remi/php71/php-fpm.d/www.conf earlier.

php_admin_value[sendmail_path] = "~/MailHog_linux_amd64 sendmail test@example.org"

Adjust the mailhog path to your own. Restart php-fpm systemd. Or you may need to restart Fedora.

Advertisements

Setting up Magento Local Development in openSUSE

Screenshot_20180301_103321

Finally, I managed to install Magento in my local environment of openSUSE. It’s quite tricky to get it up and running. It’s mainly due to filesystem permissions issue, as well as Apache virtual host configuration. I don’t have many experience with Apache, so it took more time to configure the virtual host. Because I prefer LEMP stack, and since a couple of months ago, I use Docker for local development environment instead.

Actually, I have successfully installed it in Fedora as well. But, I delete the installation due to the low disk capacity. The overall steps I did to eventually get Magento served in my localhost are:

  1. Downloading Magento from its official website, and I had to log in first, I downloaded the latest version (2.3)
  2. Installing the prerequisites as described in Magento dev docs, I got a little trouble to fulfill the minimum requirements, i.e. PHP version and extensions. openSUSE Tumbleweed has PHP v 7.2 in the main repo, but Magento didn’t support this version, so I used other repo to install v 7.1. But the issue hasn’t stopped, as that repo didn’t have php-mcrypt package. So I had to download the RPM from somewhere (likely rpmfind.net) which had the nearly compatible version.
  3. Configuring Apache in localhost, where I struggled to get the right configuration
  4. Extracting the Magento tarball and setting filesystem permissions. Actually this step was the hardest phase, although I had followed the instruction from official Magento website.
  5. Running the installation step. Since I didn’t get the right configuration of filesystem permissions, so that the front end installer didn’t show up, I used the Magento command line installer module instead. It’s quite tricky as well, actually. But it worked.
  6. Setting up PHP session directory permission manually. As I put the Magento source files in my home partition, and Apache run as wwwrun user, it cannot access the PHP session directory to write a new session. Actually Magento can make use of other session handler system like memcached and redis, but I didn’t find the corresponding packages in the custom zypper repo I mentioned before.

This is the final result of the installation of Magento in my openSUSE.

Magento dashboard

Screenshot_20180301_223633

my command line history

Farewell OpenShift 2

It’s 3 days after the End of Life of OpenShift 2. As I posted earlier about the notice, I had migrated my little app to its next generation: OpenShift Online 3. My app is the basis of my personal website and the backend of my Android app. So it’s kind of a must for me to migrate it as soon as possible. And actually I did it successfully last week.

As I deploy it by Git, I still have the source repository. So, I don’t care of the deployed one on the OpenShift. But, once I received an email from OpenShift about the “one time exception” to allow me to backup the data even after its end of life, I think it’s worth trying. 😀

Screenshot_20171004-072146

So, I just followed the guide from attached link. Then a few moments after I typed rhc snapshot save php, I got my deployed source of the app, including error logs of Nginx and PHP.

Screenshot_20171004_073342

And now I feel so relieve of the data –if it will be deleted forever. Farewell, my –prior– app.

PopojiCMS, Pengelola Laman Web yang Fleksibel

Sudah banyak sekali pilihan CMS untuk website, sekarang ini. Salah satunya adalah PopojiCMS, buatan developer Indonesia. Menurut pengembangnya, Popoji berarti “kantong”, yang merupakan bahasa Manado. Karena memang pengembangnya berasal dari Manado. CMS ini belum begitu kompleks, maksudnya tidak seperti WordPress yang punya banyak API. Ya ini karena memang PopojiCMS ditujukan untuk developer pemula sampai master. Oleh karena itu, kita bisa membuat hasil akhir website yang sangat customizable dan fleksibel sesuai dengan yang kita inginkan.

Lihat laman web PopojiCMS.org

Kebetulan sudah lama saya ingin mengisi hosting dengan tulisan-tulisan. Masalah utama adalah kuota penyimpanan file hanya 40 MB. 😀 Kalau diinstal WordPress, sangat tidak mungkin. Mau membuat sendiri, waduh, belum sempat dan mungkin akan lama. Nah, sepertinya PopojiCMS cocok dengan kebutuhan saya ini. Tinggal utak-atik tema dan lainnya sesuai kebutuhan. Kalau mau lebih simple lagi, pengembang menyediakan paket yang lebih komplit hanya dengan donasi Rp. 50.000,00.

Lihat laman demonya

Sementara saya masih menguji coba di localhost dulu.

Popoji CMS made in Indonesia

Laman admin Popoji CMS. (lihat ukuran asli)

Edit: (21.12.14)

Hasil instal di hostingan dan oprekan awal:

PopojiCMS diinstall di hostingan

PopojiCMS diinstall di hostingan (lihat ukuran asli)

Kalender Hijriyah dan jadwal waktu sholat sehari

Tulisan ini dipindahkan dari tulisan di blog saya yang lain.

Your Portfolio Archive currently has no entries. You can start creating them on your dashboard.

Sudah banyak widget-widget kalender hijriyah dan jadwal waktu sholat untuk situs web yang dibagikan oleh orang lain di internet. Namun kali ini saya memilih untuk membuatnya sendiri. Bukan karena tidak menghargai mereka yang sudah mendahului, tetapi karena saya ingin sekalian belajar dan mengembangkan kemampuan PHP dan juga menambah keanekaragaman karya semacam ini. Maksud saya adalah karya yang berhubungan dengan Islam. Semoga bisa menjadi salah satu syi’ar Islam.

Continue reading “Kalender Hijriyah dan jadwal waktu sholat sehari”