, , ,

How to install PHP 8 on CentOS 8 Linux

 This tutorial will explain how to install PHP 8 on CentOS 8 Linux and its dependent packages.



Step 1: Enableremi-release-8.rpm

Configure the Remi repository for installing PHP 8 on CentOS 8

# dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Step 2: Enable EPEL repository

# dnf install epel-release

Step 3: Find the current enabled version of PHP

# dnf module list php
CentOS Stream 8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
php 8.0 common [d], devel, minimal PHP scripting language

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 common [d], devel, minimal PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Step 4: Enable the module PHP8.1 from remi

From the above output, by default PHP 7.2 from the AppStream repo shall be installed and no other version is enabled. To install PHP 8.1 from the remi repo, enable it before installation.

# dnf module enable php:remi-8.1
# dnf module list php
CentOS Stream 8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
php 8.0 common [d], devel, minimal PHP scripting language

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 [e] common [d], devel, minimal PHP scripting language
Switch to the other version?

In case, if you need to install any other version, you can reset the current module enabled and set the new using the below commands:

# dnf module reset php

# dnf module enable php:remi-8.0

Step 5: Install PHP 8 on CentOS 8

# dnf install php

Last metadata expiration check: 0:13:44 ago on Wed 16 Feb 2022 11:53:53 AM IST.
Dependencies resolved.
=============================================================================================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================================================================================
Installing:
php x86_64 8.1.2-1.el8.remi remi-modular 1.7 M
Installing dependencies:
apr x86_64 1.6.3-12.el8 appstream 129 k
apr-util x86_64 1.6.1-6.el8 appstream 105 k
centos-logos-httpd noarch 85.8-2.el8 baseos 75 k
httpd x86_64 2.4.37-43.module_el8.5.0+1022+b541f3b1 appstream 1.4 M
httpd-filesystem noarch 2.4.37-43.module_el8.5.0+1022+b541f3b1 appstream 39 k
httpd-tools x86_64 2.4.37-43.module_el8.5.0+1022+b541f3b1 appstream 107 k
libsodium x86_64 1.0.18-2.el8 epel 162 k
libxslt x86_64 1.1.32-6.el8 baseos 250 k
mailcap noarch 2.1.48-3.el8 baseos 39 k
mod_http2 x86_64 1.15.7-3.module_el8.4.0+778+c970deab appstream 154 k
oniguruma5php x86_64 6.9.7.1-1.el8.remi remi-safe 210 k
php-common x86_64 8.1.2-1.el8.remi remi-modular 1.2 M
Installing weak dependencies:
apr-util-bdb x86_64 1.6.1-6.el8 appstream 25 k
apr-util-openssl x86_64 1.6.1-6.el8 appstream 27 k
nginx-filesystem noarch 1:1.14.1-9.module_el8.0.0+184+e34fea82 appstream 24 k
php-cli x86_64 8.1.2-1.el8.remi remi-modular 5.3 M
php-fpm x86_64 8.1.2-1.el8.remi remi-modular 1.8 M
php-mbstring x86_64 8.1.2-1.el8.remi remi-modular 522 k
php-opcache x86_64 8.1.2-1.el8.remi remi-modular 628 k
php-pdo x86_64 8.1.2-1.el8.remi remi-modular 160 k
php-sodium x86_64 8.1.2-1.el8.remi remi-modular 100 k
php-xml x86_64 8.1.2-1.el8.remi remi-modular 250 k
Enabling module streams:
httpd 2.4
nginx 1.14

Transaction Summary
=============================================================================================================================================================================================================================================
Install 23 Packages

Step 6: Verify the PHP installation

# php -v
PHP 8.1.2 (cli) (built: Jan 18 2022 23:52:03) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies
Enjoy and comment if any issue arrised...
Continue reading How to install PHP 8 on CentOS 8 Linux
, ,

Mikrotik time-based queue for night and day

 If you desire to know how to implement a Mikrotik time-based queue to apply different queues to clients or networks based on the time of the day, then you are reading the right post. After reading this article, you will be able to configure a Mikrotik router to assign a certain bandwidth plan to a client in the day and a different bandwidth plan at night.

The implementation of a Mikrotik time-based queue will be configured using simple queue with scripts and schedulers to automatically assign bandwidth plans to customers based on time of the day. ISPs use this method to provide extra speed to customers during off-peak periods.

Lab requirement

The implementation of Mikrotik time-based queue can be achieved on any Mikrotik router capable of simple queue. For this demonstration, the Mikrotik hAP lite series was used.

Implementation

Since Mikrotik time-based queue works with the router’s time, it is important that the time on the router remains accurate at all times. For to happen, the router must be configured as an NTP client. See commands to configure the router as an NTP client below:

/sys ntp client set primary-ntp=bd.pool.ntp.org enabled=yes

The next step is to create two simple queues; one for day (peak period) and the other for night (off-peak period). See commands below:

/queue simple add name=day target=192.168.10.2/32 max-limit=2M/2M add name=night target=192.168.10.2/32 max-limit=4M/4M

Next, we create a script that will enforce this queues. See commands below:

/system script add name=Day source=/queue simple enable day; /queue simple disable night add name=Night source=/queue simple enable night; /queue simple disable day

See below image for how to implement it on Winbox. Simply click on system>script and eneter values similar to the ones in the image below.

The final step involves the configuration system scheduler to activate any of the queues referenced in the script, depending on the system time. See commands below:

/system scheduler name=Day on-event=Day policy=read,write start-date=may/07/2023 start-time=06:00:00 interval=1d name=Night on-event=Night policy=read,write start-date=may/07/2023 start-time=18:00:00 interval=1d

The scheduler will execute, based on the router time, and cause the script to activate the desired queue while disabling the other. See the result of executing the “Day” script below.

Continue reading Mikrotik time-based queue for night and day
, , ,

Enable Root Login via SSH In Ubuntu

 By default, SSH on Ubuntu comes configured in a way that disables the root users log in. This was originally enabled as a security precaution which means that you cannot directly log in as the root user over SSH. However, you can usually get around the need for root ssh login by using the sudo command. In some cases, though it’s just more convenient to get directly logged in as root.

Enable root login over SSH

  1. Login to your server as root.
  2. As the root user, edit the sshd_config file found in /etc/ssh/sshd_config:vim /etc/ssh/sshd_config
  3. Add the following line to the file, you can add it anywhere but it’s good practice to find the block about authentication and add it there.
    PermitRootLogin yes
  4. Save and exit the file.
  5. Restart the SSH server:
    systemctl restart sshd
    or
    service sshd restart

And that’s it! With the new line added and the SSH server restarted, you can now connect via the root user.

In this instance, you are going to be able to login as the root user utilizing either the password or an ssh key.

When using SSH Keys, you can set the PermitRootLogin value to `without-password` instead of yes. To accomplish this, simply modify the following information noted in step 2 above instead:

PermitRootLogin without-password

This process should work on almost any version of Linux server that the sshd service is installed. If you are using a cPanel server though you can easily control this setting from the WHM interface. In these cases, it’s recommended to modify this setting from your control panel interface.




Continue reading Enable Root Login via SSH In Ubuntu