Tuesday, April 11, 2023

Ruby Hello World Example- How To Write and Execute Ruby Program on Ubuntu 20.04

 Ruby is an interpreted, high-level, general-purpose programming language which supports multiple programming paradigms.

apt update ; apt-get install ruby -y
whereis ruby
which ruby

nano helloworld.rb
#!/usr/bin/ruby

# Hello world ruby program

puts "Hello World!";

ruby helloworld.rb
( or )
chmod u+x helloworld.rb
./helloworld.rb

Executing Ruby one liner - ruby -e 'puts "Hello World!\n"'

_____________________________________________________________________________________

Wednesday, April 5, 2023

How To Install Uninstall or Remove Anydesk on Oracle Linux 9

in This Tutorial you will Learn " How To Install Uninstall or Remove Anydesk on Oracle Linux 9  "
Anydesk is a Lightweight, secure, and fast remote desktop application distributed by Anydesk Software GmbH. Anydesk allows the System admins to access remote devices anywhere and at any time.
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9.0   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y

sudo tee /etc/yum.repos.d/anydesk.repo<<EOF
[anydesk]
name=AnyDesk CentOS - stable
baseurl=http://rpm.anydesk.com/centos/8/x86_64/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://keys.anydesk.com/repos/RPM-GPG-KEY
EOF
sudo dnf update -y ; sudo dnf install anydesk -y


#2nd method using Binary
cd Downloads
ls
sudo dnf install ./anydesk-*.el8.x86_64.rpm


Uninstall or Remove AnyDesk – Oracle Linux
sudo dnf remove anydesk -y
sudo rm -r /etc/yum.repos.d/anydesk.repo
__________________________________________________________________________________________________________________________________

Tuesday, April 4, 2023

How To Install Flask with Gunicorn and Nginx on Oracle Linux 9

 in This Tutorial you will Learn " How To Install Flask with Gunicorn and Nginx on Oracle Linux 9"
Flask is a web application framework written in Python.
Gunicorn is a WSGI server.
NGINX is open source software for web serving, reverse proxying, caching, load balancing, media streaming, and more.
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9.0   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
sudo dnf update ;  sudo dnf install epel-release -y
sudo dnf install python3-pip python3-devel gcc -y
dnf install nginx -y
nginx -version


dnf install --assumeyes python3-pip
pip3 install virtualenv
sudo update-crypto-policies --set LEGACY
sudo reboot
sudo mkdir /sample_project && cd /sample_project
sudo chmod 777 /sample_project
virtualenv projectenv
source projectenv/bin/activate

pip3 install gunicorn flask
pip install --upgrade pip
nano  /sample_project/helloworld.py
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return "<h1 style='color:red'>Hello, World!</h1>"

if __name__ == '__main__':
    app.run(host='0.0.0.0')


sudo firewall-cmd --add-port=5000/tcp --permanent ; sudo firewall-cmd --reload

python helloworld.py
http://127.0.0.1:5000


nano /sample_project/wsgi.py
from helloworld import app

if __name__ == "__main__":
    app.run()

firewall-cmd --add-port=8000/tcp --permanent ; firewall-cmd --reload
python helloworld.py
http://0.0.0.0:8000
deactivate
gunicorn --bind 0.0.0.0:8000 wsgi:app
_________________________________________________________________________________________________________________________________

Tuesday, March 28, 2023

How to install KVM on Oracle Linux 9

 in This Tutorial you will Learn " How to install KVM on Oracle Linux 9 "
Kernel-based Virtual Machine (KVM) is an open source virtualization technology built into Linux®. Specifically, KVM lets you turn Linux into a hypervisor that allows a host machine to run multiple, isolated virtual environments called guests or virtual machines (VMs).
__________________________________________________________________________________________________________________________________
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

lscpu | grep Virtualization
sudo dnf update ; sudo dnf install qemu-kvm qemu-img libvirt virt-manager virt-install virt-viewer libvirt-client
sudo systemctl start libvirtd ; sudo systemctl enable libvirtd ; sudo systemctl status libvirtd
sudo virt-manager
__________________________________________________________________________________________________________________________________

Thursday, March 23, 2023

How To Install Docker on Oracle Linux Server 9

 
Docker is a container engine that uses the Linux Kernel to create the containers on top of an operating system. Which is used to create, deploy and run the applications.
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9.0   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf update
sudo dnf install -y docker-ce docker-ce-cli containerd.io
docker --version
sudo systemctl enable docker ; sudo systemctl start docker ; sudo systemctl status docker
sudo usermod -aG docker yourname
id testbox
docker run hello-world
docker pull ubuntu
docker images
docker run -it ubuntu
__________________________________________________________________________________________________________________________________

Tuesday, March 21, 2023

Configure Storage Server with iSCSI.

 in This Tutorial you will Learn " How To Configure Storage Server with iSCSI On Oracle Linux 9
Configure Storage Server with iSCSI.
Storage server with iSCSI on network is called iSCSI Target, Client Host that connects to iSCSI Target is called iSCSI Initiator.
+----------------------+          |          +----------------------+
| [   iSCSI Target   ] |192.168.1.50 | 192.168.1.40| [ iSCSI Initiator  ] |
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9.0   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
Configure iSCSI Target (Targetcli) -  

cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf -y install targetcli
mkdir /var/lib/iscsi_disks
targetcli
cd backstores/fileio
create disk01 /var/lib/iscsi_disks/disk01.img 10G
cd /iscsi
create iqn.2023-03.server.testbox:dlp.target01
cd iqn.2023-03.server.testbox:dlp.target01/tpg1/luns
create /backstores/fileio/disk01
cd ../acls
create iqn.2023-03.server.testbox:node01.initiator01
cd iqn.2023-03.server.testbox:node01.initiator01
set auth userid=username
set auth password=password
exit
ss -napt | grep 3260
systemctl enable target
firewall-cmd --add-service=iscsi-target ; firewall-cmd --runtime-to-permanent
__________________________________________________________________________________________________________________________________
Configure iSCSI Initiator  -
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf -y install iscsi-initiator-utils
nano /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2023-03.server.testbox:node01.initiator01

nano /etc/iscsi/iscsid.conf
node.session.auth.authmethod = CHAP
node.session.auth.username = username
node.session.auth.password = password

iscsiadm -m discovery -t sendtargets -p 192.168.1.50                   
iscsiadm -m node -o show
systemctl restart iscsid
iscsiadm -m node --login
iscsiadm -m session -o show
cat /proc/partitions

parted --script /dev/sdc "mklabel gpt"
parted --script /dev/sdc "mkpart primary 0% 100%"
mkfs.xfs -i size=1024 -s size=4096 /dev/sdc1
mount /dev/sdc1 /mnt
df -hT
__________________________________________________________________________________________________________________________________

Sunday, March 19, 2023

Create SSL Certificate (Self Signed)

 in This Tutorial you will Learn" How To Create SSL Certificate (Self Signed) On Oracle Linux 9"

SSL stands for Secure Sockets Layer, a global standard security technology that enables encrypted communication between a web browser and a web server.
__________________________________________________________________________________________________________________________________
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
cd /etc/pki/tls/certs
openssl genrsa -aes128 2048 > server.key
openssl rsa -in server.key -out server.key
openssl req -utf8 -new -key server.key -out server.csr
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650
chmod 600 server.key
ll server.*
__________________________________________________________________________________________________________________________________