Showing posts with label Oracle Linux. Show all posts
Showing posts with label Oracle Linux. Show all posts

Thursday, 15 April 2021

Install Apache Tomcat9 in CentOS Stream, Oracle Linux 8

 


Create tomcat user and group

We need to add user dedicated to running tomcat service.

# groupadd --system tomcat

# useradd -d /usr/share/tomcat -r -s /bin/false -g tomcat tomcat

Install Tomcat 9 on Linux RHEL / CentOS 8

Check the latest release version of Tomcat 9. Save the version number to VER variable and proceed to download.

# dnf -y install wget

# export VER="9.0.XX"

# wget https://archive.apache.org/dist/tomcat/tomcat-9/v${VER}/bin/apache-tomcat-${VER}.tar.gz

Extract downloaded file with tar.

# tar xvf apache-tomcat-${VER}.tar.gz -C /usr/share/

# ln -s /usr/share/apache-tomcat-$VER/ /usr/share/tomcat

If you download a newer version of Tomcat, just update the symbolic link to the new version folder.

Set proper directory permissions.

# chown -R tomcat:tomcat /usr/share/tomcat

# chown -R tomcat:tomcat /usr/share/apache-tomcat-$VER/

Configure Tomcat 9 Systemd service

Create a new systemd service to Tomcat.

# vim /etc/systemd/system/tomcat.service

With below configuration:

[Unit]

Description=Tomcat Server

After=syslog.target network.target

[Service]

Type=forking

User=tomcat

Group=tomcat

Environment=JAVA_HOME=/usr/lib/jvm/jre

Environment='JAVA_OPTS=-Djava.awt.headless=true'

Environment=CATALINA_HOME=/usr/share/tomcat

Environment=CATALINA_BASE=/usr/share/tomcat

Environment=CATALINA_PID=/usr/share/tomcat/temp/tomcat.pid

Environment='CATALINA_OPTS=-Xms512M -Xmx1024M'

ExecStart=/usr/share/tomcat/bin/catalina.sh start

ExecStop=/usr/share/tomcat/bin/catalina.sh stop

[Install]

WantedBy=multi-user.target


Start and enable service.

# sudo systemctl daemon-reload

# sudo systemctl enable tomcat

# sudo systemctl start tomcat


Check service status with the following command:

# systemctl status tomcat


Configure Firewall

# sudo firewall-cmd --permanent --add-port=8080/tcp

# sudo firewall-cmd --reload

Access Tomcat Web interface

Open browser and type http://ip-or-hostname:8080


freeRadius Installation in Oracle Linux 8, RedHat 8 and CentOS Stream



 Installation of freeRadius in Oracle Linux 8

# dnf -y update

# dnf search freeradius

# dnf -y install freeradius


Config File location: 

/etc/raddb

Two most important files within /etc/raddb are: -

/etc/raddb/clients.conf

It is where details of client router, switch, pc etc will be here

Basic conf would be like this, make sure you take a backup

#  vim /etc/raddb/clients.conf

clients testpc {

    ipaddr = 192.168.1.1

    shortname = Windows10-PC

    secret   = blabla+123

}

clients router {

ipaddr = 10.10.1.1

shortname = CiscoRouter

secret   = Hmm+098

}

Make sure there is no space

/etc/raddb/users

It is where user info will be located, username pass etc

Basic conf would be like this, make sure you take a backup

○ # vim /etc/raddb/users

bob   Cleartext-Password := "hello"

Enable firewall for port 1812 and 1813
# systemctl status firewalld
# systemctl start firewalld
# firewall-cmd --permanent --zone=public --add-port=1812/udp
# firewall-cmd --permanent --zone=public --add-port=1813/udp
# firewall-cmd --reload
# firewall --list-all

Check if ports are up and running

# netstat -unlp 

To check logs

# vim /etc/raddb/radius.conf


To do a testing you can download a tool called ntradping or you can use radtest command. 

I won't go through how to use ntradping but I will walk you through radtest command

Make sure you open 2 SSH session with on freeradius server

Stop the freeradius service

# systemctl stop radiusd

Go to debugging mode

# radiusd -X


Now, on another SSH session start your radtest
# radtest bob hello localhost 0 testing123

 


 If you go back to your other SSH session which is in debuggig mode you should see a something like this



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