Thursday, 15 April 2021

LAMP installation in CentOS Stream, RedHat 8





Greeting Everyone,

Installation of LAMP Stack in RedHat 8, CentOS Stream and Oracle Linux 8

First of all, during apache server installation its completely up to you and can begin with whatever you like either apache or mariadb or php. I will start in LAMP format which is Linux first and it obviously already installed then apache, mariadb then finally, php


Update your system
# dnf update -y

Install Apache (httpd)
# dnf install httpd httpd-tools

Start and Enable Apache (httpd)
# systemctl start httpd
# systemctl enable httpd
# netstat -tnlp

Give permission to Apache and check website
# chown apache:apache -R /var/www/html
# echo “welcome to the site” >> /var/www/html

 Install MariaDB

# dnf install mariadb-server mariadb

Enable MariaDB
# systemctl start mysqld
# systemctl enable mysqld

Mysql installation to create user and pass
# mysql_secure_installation

 

create a root password and selected Y to all

# mysql -u root -p
MariaDB> exit;

Install php
# dnf install php php-fpm php-xml php-mysqlnd php-gd php-mbstring

Enable php-fpm
# systemctl start php-fpm
# systemctl enable php-fpm

Enable SELINUX to allow apache to execute PHP-FPM
# setsebool -P httpd_execmem 1
Enable firewall for port 80, 443 and 3306
# systemctl status firewalld
# systemctl start firewalld
# firewall-cmd --permanent --zone=public --add-port=80/tcp
# firewall-cmd --permanent --zone=public --add-port=443/tcp 
# firewall-cmd --permanent --zone=public --add-port=3306/tcp 
# firewall-cmd --reload
# firewall --list-all

Test php
# echo “<?php phpinfo() ?)” >> /var/www/html/info.php
# links http://localhost/info.php

Wednesday, 14 June 2017

Working with ClamaAV on Fedora 25, Redhat 7 and CentOS 7


Greetings,


I'll show you how to install and scan your system using ClamAV.


ClamAV installation is pretty simple.


In Fedora 25, Redhat 7, CentOS 7


# dnf install clamav clamav-update
Before we proceed any furture we would need to check or edit freshclam (to update virus definition)
# vim /etc/freshclam.conf
Please comment "Example" (You will see it at the start)

Then uncomment following lines
DNSDatabaseInfo current.cvd.clamav.net
DatabaseMirror db.XY.clamav.net (change XY to your country for example: gb, us, de, in, ch etc)
DatabaseMirror database.clamav.net
Once that’s done, we will update virus definition
# freshclam
Now, time to scan the system
# clamscan [option] [file/directory]


# clamscan -r /home (r = recursive)


# clamscan -ivr /home (i = infected, v = verbose)


# clamscan --bell –ivr /home (--bell = It will sound bell if it discovers virus)


# clamscan --remove=yes –ivr /home (remove=yes = it means it will remove virus upon detection)


# clamscan -ivr --phishing-sigs=yes --heuristic-scan-precedence=yes /home (it can perform phishing and heuristic scan)
 If you think that’s complicated then install GUI version called ClamTK
 # dnf install clamtk
Please read more about clamscan
# man clamscan
# clamscan --help

Thursday, 8 June 2017

Howto M/Monit in Ubuntu



Monit is a free open source utility for managing and monitoring, processes, programs, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.

So basically, it is a Network Monitoring System (NMS) which monitors, logs servers and its process. Lets roll with the installation and configuration but remember we need to have Apache server already installed.

# apt-get install monit
It will install in a flash, no sweat.

The main config file of monit is located in "/etc/monit" called monitrc.
Here, we need to fix few things and monit is up and running, its way faster than compared to Nagios (whose installation is most tedious)

# vim /etc/monit/monitrc
Just uncomment those lines seen in the image below



set httpd port 2812use address localhostallow localhostallow admin:monitallow @monitallow @users readonly

Let's start monit

# /etc/init.d/monit start

then open up your browser and login using username and password admin and monit respectively.

This is how it looks at the start, we have installed monit successfully and its working perfectly.

Now, lets try and monitor Apache and SSH server.

# vim /etc/monit/monitrc

Append following lines



Now, restart the monit

# /etc/init.d/monit restart
Lets check the browser we should get following results

Hopefully, we can do more and you can test it by disabling Apache or SSH Server

Cheers