Thursday, August 21, 2025

How To Enable Remote Desktop Protocol Using xrdp on On Ubuntu 24.04 LTS

XRDP is a tool used for connecting to an Ubuntu or other Linux system via Remote Desktop Protocol (RDP). It provides remote access to your Linux desktop environment from a Windows machine or any other RDP-compatible client. Additionally, it also offers a graphical user interface for managing the system remotely. 
__________________________________________________________________________________________________________________
Testing Environment: Ubuntu 24.04.1 LTS                   Hostname -                       ip Address - 
__________________________________________________________________________________________________________________
apt update ; apt install build-essential net-tools curl git software-properties-common 
sudo apt install xrdp -y
sudo adduser xrdp ssl-cert
sudo systemctl restart xrdp ; sudo systemctl status xrdp 
sudo ufw allow 3389
sudo ufw allow from [IP_Address] to any port 3389
__________________________________________________________________________________________________________________

Saturday, August 2, 2025

How to Run a Python Script on Ubuntu 24.04.2 LTS

Running a Python script on Ubuntu is a fundamental skill for developers, system administrators, and data scientists. Whether you’re automating tasks, running a web server, or training a machine learning model, understanding the proper execution methods is essential. This article provides a comprehensive overview of how to run Python scripts on Ubuntu, covering everything from basic commands to professional best practices.

Python is a programming language that is interpreted, object-oriented, and considered to be high-level.|
__________________________________________________________________________________________________________________
Testing Environment: Ubuntu 24.04.2 LTS                   Hostname -                       ip Address - 
__________________________________________________________________________________________________________________
lsb_release -a
apt update ; apt install build-essential net-tools curl git software-properties-common 
python3 --version
sudo apt install python3 python3-venv python3-pip
cd ~/path-to-your-script-directory

nano demo_ai.py
from sklearn.tree import DecisionTreeClassifier
import numpy as np
import random

# Generate sample data
x = np.array([[i] for i in range(1, 21)])  # Numbers 1 to 20
y = np.array([i % 2 for i in range(1, 21)])  # 0 for even, 1 for odd

# Create and train the model
model = DecisionTreeClassifier()
model.fit(x, y)

# Function to predict if a number is odd or even
def predict_odd_even(number):
    prediction = model.predict([[number]])
    return "Odd" if prediction[0] == 1 else "Even"

if __name__ == "__main__":
    num = random.randint(0, 20)
    result = predict_odd_even(num)
    print(f"The number {num} is an {result} number.")

python3 -m venv python-env
source python-env/bin/activate
pip install scikit-learn numpy

Run Python Script -   python3 demo_ai.py

Script Executable [OPTIONAL] - 
nano demo_ai.py
#!/usr/bin/env python3
chmod +x demo_ai.py
./demo_ai.py
___________________________________________________________________________________________________________________

Saturday, July 26, 2025

How to Install n8n on Ubuntu 24.04 LTS

 n8n is a versatile workflow automation tool that enables you to automate tasks across different services.
__________________________________________________________________________________________________________________
Testing Environment: Ubuntu 24.04.1 LTS                   Hostname -                       ip Address - 
__________________________________________________________________________________________________________________
apt update ; apt install build-essential net-tools curl git software-properties-common 
adduser master
usermod -aG sudo master
su - master
curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt update ; sudo apt install nodejs -y
node -v; npm -v
sudo npm install -g n8n
sudo n8n
___________________________________________________________________________________________________________________

Friday, July 11, 2025

How To Install Fast API with MongoDB on Ubuntu 24.04 LTS

 In this tutorial, you'll learn how to install FastAPI with MongoDB on Ubuntu 24.04 LTS . 
FastAPI is a web framework based on Python for creating API services. It's a modern, fast, high-performance framework supporting asynchronous operations.
__________________________________________________________________________________________________________________
Testing Environment: Ubuntu 24.04.1 LTS                   Hostname -                       ip Address - 
__________________________________________________________________________________________________________________
apt update ; apt install build-essential net-tools curl git software-properties-common gnupg python3 python3-pip python3-venv -y

curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
--dearmor

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list

sudo apt update && sudo apt install mongodb-org -y

sudo systemctl enable --now mongod ; sudo systemctl status mongod
mongosh


su - username
mkdir -p ~/app; cd ~/app
python3 -m venv .venv
source .venv/bin/activate
deactivate
pip3 install fastapi uvicorn
mkdir -p server/{models,routes}
touch main.py server/{app.py,database.py} server/models/itemModels.py server/routes/item.py

nano app.py  | nano server/app.py
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
async def root():
 return {"message": "Hello FastAPI!"}

nano main.py
import uvicorn

if __name__ == "__main__":
 uvicorn.run("server.app:app", host="0.0.0.0", port=8080, reload=True)

python3 main.py
__________________________________________________________________________________________________________________

Thursday, July 10, 2025

How To Install latest OpenSSL version from Source On Oracle Linux Server 9.1

 OpenSSL is a widely used crypto library that implements SSL and TLS protocols for secure communication over computer networks. Many programs like Apache Web server, PHP, Postfix, and many others use OpenSSL. OpenSSL provides support for various cryptographic algorithms such as ciphers (AES, Blowfish, DES, IDEA etc.), cryptographic hash functions (MD5, MD4, SHA-1, SHA-2, etc.), and public key cryptography (RSA, DSA, Diffie-Hellman key exchange).
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9.1   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
yum install perl-core zlib-devel -y

openssl version -a
Openssl Latest - https://www.openssl.org/source/-
cd /usr/local/src/ ; wget https://www.openssl.org/source/openssl-3.0.7.tar.gz
tar -xf openssl-3.0.7.tar.gz ; cd openssl-3.0.7

cd /usr/local/src/openssl-3.0.7
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
make ; make test ; make install
cd /etc/ld.so.conf.d/ ; nano openssl-3.0.7.conf
/usr/local/ssl/lib64

sudo ldconfig -v
mv /bin/openssl /bin/openssl.bak

nano  /etc/profile.d/openssl.sh
#Set OPENSSL_PATH
OPENSSL_PATH="/usr/local/ssl/bin"
export OPENSSL_PATH
PATH=$PATH:$OPENSSL_PATH
export PATH

chmod +x /etc/profile.d/openssl.sh ; source /etc/profile.d/openssl.sh
echo $PATH ; which openssl ; openssl version -a

______________________________________________________________________________________

How To Install GoAccess Web Log Analyzer on Oracle Linux Server 9

 GoAccess is a free, open-source, lightweight log analyzer written in C language. It can read and analyze log files of Apache, Nginx, CloudFront, Caddy, and more. It uses the ncurses library for its CLI interface. It is an interactive and real-time web server log analyzer that helps you to analyze and view web server logs quickly.
Homepage - https://goaccess.io/
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; dnf groupinstall "Development Tools" -y
dnf update -y
dnf install httpd ncurses-devel openssl-devel -y
systemctl start httpd ; systemctl enable httpd

wget https://tar.goaccess.io/goaccess-1.5.4.tar.gz
tar -xvzf goaccess-1.5.4.tar.gz
cd goaccess-1.5.4
autoreconf -fi
./configure --enable-utf8 --with-openssl
make ; make install
goaccess --version

nano /usr/local/etc/goaccess/goaccess.conf
time-format %H:%M:%S
date-format %d/%b/%Y
#ignore-panel REFERRERS
log-format COMBINED

goaccess /var/log/httpd/access_log
goaccess /var/log/httpd/access_log -o /var/www/html/stats.html
http://192.168.1.50/stats.html
__________________________________________________________________________________________________________________________________

How To Install Suricata IDS on Oracle Linux Server 9

 Suricata is an open-source detection engine that can act as an intrusion detection system (IDS) and an intrusion prevention system (IPS).
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; dnf groupinstall "Development Tools" -y
dnf install epel-release -y
dnf info suricata
dnf install suricata -y
ip --brief add

nano /etc/suricata/suricata.yaml
HOME_NET: "[192.168.1.50]"
EXTERNAL_NET: "!$HOME_NET"


af-packet:
  - interface: ens33

default-rule-path: /var/lib/suricata/rules
rule-files:
  - suricata.rules

ethtool -K ens33 gro off lro off

nano /etc/sysconfig/suricata
OPTIONS="-i ens33 --user suricata "

systemctl enable --now suricata
systemctl status suricata
tail /var/log/suricata/suricata.log
__________________________________________________________________________________________________________________________________