Monday, February 28, 2022

How To Install Appwrite with Docker on Rocky Linux 8.5

in This Tutorial you will Learn " How to Install Appwrite with Docker on Rocky Linux 8.5"

Appwrite is a self-hosted solution that provides developers with a set of easy-to-use and integrate REST APIs to manage their core backend needs.
Docker is an open platform for developing, shipping, and running applications.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y
docker-compose --version ; docker --version
docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \
appwrite/appwrite:0.12.1
https://127.0.0.1
_________________________________________________________________________________________

Running CentOS in a Docker container

 CentOS is short for “Community Enterprise Operating System”.
Docker is a software platform that allows you to build, test, and deploy applications quickly.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y ; docker-compose --version ; docker --version
docker pull centos
docker run centos
docker container ls
docker images
docker run -i -t centos
cat /etc/redhat-release
_________________________________________________________________________________________

Deploy Run Portainer CE On Docker | Rocky Linux 8.5

 in This Tutorial you will Learn "How To Deploy Run Portainer CE On Docker | Rocky Linux 8.5"

Portainer is a popular Docker UI that helps you visualise your containers, images, volumes and networks.
Docker is a software platform that allows you to build, test, and deploy applications quickly.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y ; docker-compose --version ; docker --version
docker volume create portainer_data
docker run -d \
    -p 8000:8000 -p 9443:9443 \
    --name portainer \
    --restart=always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v portainer_data:/data \
    cr.portainer.io/portainer/portainer-ce:2.11.0

docker ps
https://localhost:9443  admin/ZSPUPvQs9c7Hs23
_________________________________________________________________________________________

Deploy Run Keycloak Server in Docker Container

 in This Tutorial you will learn " How To Deploy Run Keycloak Server in a Docker Container

Keycloak is an open source identity and access management solution.
Hoempage - https://www.keycloak.org/
Docker is a software platform that allows you to build, test, and deploy applications quickly.
_________________________________________________________________________________________
Server - Os:  Ubuntu 20.04.3 LTS 64Bit        | IP -192.168.1.80            |Hostname -  ubuntu.example.com
_________________________________________________________________________________________
lsb_release -d ; hostname -I
apt update ; apt -y install docker.io docker-compose ca-certificates curl gnupg-agent software-properties-common -y
docker --version ; docker-compose --version
docker pull mariadb
docker pull jboss/keycloak
docker network create keycloak-network
mkdir /home/ubuntu/keycloak_data

docker run -d \
--name mariadb \
--net keycloak-network \
-v /home/ubuntu/keycloak_data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=Root@1234 \
-e MYSQL_DATABASE=keycloak \
-e MYSQL_USER=keycloak \
-e MYSQL_PASSWORD=Keycloak@1234 \
mariadb

docker run -d \
--name keycloak \
--net keycloak-network \
-p 8080:8080 \
-e KEYCLOAK_USER=admin \
-e KEYCLOAK_PASSWORD=Admin@1234 \
-e DB_ADDR=mariadb \
-e DB_USER=keycloak \
-e DB_PASSWORD=Keycloak@1234 \
jboss/keycloak

docker ps
http://192.168.1.80:8080/
_________________________________________________________________________________________



Deploy run Bitwarden server On Docker Compose

 in This Tutorial you will learn " How To Run Bitwarden Password Manager in Docker Container

Docker is a software platform that allows you to build, test, and deploy applications quickly.
Bitwarden is an integrated open source password management solution for individuals, teams, and business organizations.
_________________________________________________________________________________________
Server - Os:  Ubuntu 20.04.3 LTS 64Bit        | IP -192.168.1.80            |Hostname -  ubuntu.example.com
_________________________________________________________________________________________
lsb_release -d ; hostname -I ; hostname
mkdir bitwarden && cd bitwarden
touch docker-compose.yml ; nano docker-compose.yml
# docker-compose.yml
version: '3'

services:
  bitwarden:
    image: bitwardenrs/server
    restart: always
    ports:
      - 8000:80
    volumes:
      - ./bw-data:/data
    environment:
      WEBSOCKET_ENABLED: 'true' # Required to use websockets
      SIGNUPS_ALLOWED: 'true'   # set to false to disable signups
docker-compose up -d
docker ps
http://127.0.0.1:8000/ |mail@example.com/iE7PtnczJcXKTT2
_________________________________________________________________________________________

Sunday, February 27, 2022

Deploy Run Web Apps in Node.js Docker Containers

 in This Tutorial you will learn " How To Deploy Run Web Apps in Node.js Docker Containers

Docker is a software platform that allows you to build, test, and deploy applications quickly.
Node.js is an open-source and cross-platform JavaScript runtime environment.
_________________________________________________________________________________________
Server - Os:  Ubuntu 20.04.3 LTS 64Bit        | IP -192.168.1.80            |Hostname -  ubuntu.example.com
_________________________________________________________________________________________
lsb_release -d ; hostname -I
apt update ; apt -y install docker.io docker-compose ca-certificates curl gnupg-agent software-properties-common -y
docker --version ; docker-compose --version

mkdir ~/nodejs_docker  ; cd nodejs_docker
nano myapp.js
'use strict';
const express = require('express');
// Constants
const PORT = 3000;
const HOST = '0.0.0.0';
// App
const app = express();
app.get('/', (req, res) => {
  res.send('Hello World!');
});
app.listen(PORT, HOST);
console.log(`Running at http://${HOST}:${PORT}`);

nano package.json
{
  "name": "myapp",
  "version": "1.0.0",
  "description": "Node.js on Docker",
  "author": "educationpurpose <educationpurpose@example.com>",
  "main": "myapp.js",
  "scripts": {
    "start": "node myapp.js"
  },
  "dependencies": {
    "express": "^4.16.1"
  }
}

nano Dockerfile
FROM node:13-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "node", "myapp.js" ]

docker build .
docker run \
--name nodejs-docker-app \
-p 80:3000 \
-d \
b4d550e97c57
docker logs nodejs-docker-app
curl localhost:80
_________________________________________________________________________________________




Deploy Elasticsearch On Docker Docker-Compose

 in This Tutorial you will Learn " How To Run Deploy Elasticsearch On Docker | Docker-Compose "    
 
Elasticsearch is a free, open-source search and analytics engine based on the Apache Lucene library.       
Docker is a software platform that allows you to build, test, and deploy applications quickly.
Docker Compose is a tool that was developed to help define and share multi-container applications.
________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y ; docker-compose --version ; docker --version

docker volume create elast_data
docker run -d \
     -p 9200:9200 -p 9300:9300 \
     -e "discovery.type=single-node" \
     -v elast_data:/usr/share/elasticsearch/data \
     docker.elastic.co/elasticsearch/elasticsearch:7.16.3

docker ps
docker exec -it funny_germain /bin/sh
curl -X GET "localhost:9200/"
docker stop funny_germain
docker rm funny_germain
_________________________________________________________________________________________
Docker-compose -
nano docker-compose.yaml
version: '3.3'

services:
  my-elast:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
    ports:
      - 9200:9200
      - 9300:9300
    volumes:
      - elast_data:/usr/share/elasticsearch/data
    environment:
      - "discovery.type=single-node"

volumes:
  elast_data:
docker-compose up -d
docker-compose ps
docker ps
docker exec -it root_my-elast_1 /bin/sh
curl -X GET "localhost:9200/"
_________________________________________________________________________________________

Friday, February 25, 2022

Running Joomla on Docker

 in This Tutorial you will Learn " How To install Joomla using Docker on Rocky Linux 8.5"

Docker is an open-source virtualization technology known a containerization platform for software containers.
Joomla! is an award winning open source CMS platform for building websites and applications.                      
________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; sestatus ; dnf groupinstall "Development Tools" -y
docker-compose --version ; docker --version
docker network create joomla-network
docker pull mysql:5.7
docker pull joomla
docker volume create mysql-data ; docker volume inspect mysql-data
ln -s /var/lib/docker/volumes/mysql-data/_data /mysql

docker run -d --name joomladb  -v mysql-data:/var/lib/mysql --network joomla-network -e "MYSQL_ROOT_PASSWORD=strogpass123" -e MYSQL_USER=joomla -e "MYSQL_PASSWORD=strogpass123" -e "MYSQL_DATABASE=joomla" mysql:5.7

docker volume create joomla-data ; docker volume inspect joomla-data
ln -s /var/lib/docker/volumes/joomla-data/_data /joomla

docker run -d --name joomla -p 80:80 -v joomla-data:/var/www/html --network joomla-network -e JOOMLA_DB_HOST=joomladb -e JOOMLA_DB_USER=joomla -e JOOMLA_DB_PASSWORD=strogpass123 joomla

http://mail.example.com    ! admin/x9rb8iiph2tw
__________________________________________________________________________________________

Set Up Remote Access To Docker Daemon | Access Docker Host Remotely

in This Tutorial you will Learn " How To Set Up Remote Access To Docker Daemon | Access Docker Host Remotely"
Docker is a software platform that allows you to build, test, and deploy applications quickly.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - mail.example.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y

systemctl status firewalld
docker-compose --version ; docker --version
systemctl status docker
nano /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H=fd:// -H=tcp://0.0.0.0:2375
systemctl daemon-reload ; systemctl restart docker  

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cat /etc/system-release ; sestatus ; hostname -I ; dnf groupinstall "Development Tools" -y
docker-compose --version ; docker --version
DOCKER_HOST=tcp://192.168.1.20:2375 docker info
docker-compose -H tcp://192.168.1.20:2375 --version
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

SonarQube on Docker |Setup SonarQube Using Docker

 in This Tutorial you will Learn " How To install SonarQube Using Docker on Rocky Linux 8.5"

Docker is a software platform that allows you to build, test, and deploy applications quickly.
SonarQube is an open source platform for continuous inspection of code quality.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y ; docker-compose --version ; docker --version
docker pull sonarqube
docker volume create sonarqube-conf ; docker volume create sonarqube-data
docker volume create sonarqube-logs ; docker volume create sonarqube-extensions
docker volume inspect sonarqube-conf ; docker volume inspect sonarqube-data
docker volume inspect sonarqube-logs ; docker volume inspect sonarqube-extensions
mkdir /sonarqube
ln -s /var/lib/docker/volumes/sonarqube-conf/_data /sonarqube/conf
ln -s /var/lib/docker/volumes/sonarqube-data/_data /sonarqube/data
ln -s /var/lib/docker/volumes/sonarqube-logs/_data /sonarqube/logs
ln -s /var/lib/docker/volumes/sonarqube-extensions/_data /sonarqube/extensions

docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 -v sonarqube-conf:/opt/sonarqube/conf -v sonarqube-data:/opt/sonarqube/data -v sonarqube-logs:/opt/sonarqube/logs -v sonarqube-extensions:/opt/sonarqube/extensions sonarqube
3024ccd7b9ca7396fdea81717c9b90e113e666ba3cc13c071e10d1c7cf27fe28

http://192.168.1.60:9000  Default Username: admin | • Default Password: admin NewPass - ndGJLhfG8ZRVA6R
__________________________________________________________________________________________

Deploying TimescaleDB with Docker

 in This Tutorial you will Learn " Deploying TimescaleDB with Docker On Rocky Linux 8.5"                       
An open-source time-series database optimized for fast ingest and complex queries.
Homepage - http://www.timescale.com/
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y
docker-compose --version ; docker --version
docker pull timescale/timescaledb:latest-pg12
docker run -d --name timescaledb-server -p 5432:5432 -e "POSTGRES_PASSWORD=Strongpassword" timescale/timescaledb:latest-pg12

Client - dnf install postgresql -y
psql -h 127.0.0.1 -U postgres

docker container stop b66151e405a56d342a5a288f47e27343ef78b80b619743c61e02ceb3fec6d138
docker container stop timescaledb-server

docker container start b66151e405a56d342a5a288f47e27343ef78b80b619743c61e02ceb3fec6d138
docker container start timescaledb-server

docker logs b66151e405a56d342a5a288f47e27343ef78b80b619743c61e02ceb3fec6d138
docker logs timescaledb-server
__________________________________________________________________________________________

Deploy Drupal with Docker

 in This Tutorial you will Learn " How To  Deploy Drupal with Docker On Rocky Linux 8.5"

Docker is an open platform for developing, shipping, and running applications.
Drupal is a powerful, popular content management system and web application framework written in PHP.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y ; docker-compose --version ; docker --version
mkdir ~/my_drupal/ ; cd ~/my_drupal/
nano docker-compose.yml
version: '3.3'

services:
  drupal:
    image: drupal:latest
    ports:
      - 80:80
    volumes:
      - drupal_modules:/var/www/html/modules
      - drupal_profiles:/var/www/html/profiles
      - drupal_themes:/var/www/html/themes
      - drupal_sites:/var/www/html/sites
    restart: always

  postgres:
    image: postgres:10
    environment:
      POSTGRES_PASSWORD: Drupalpass123
    volumes:
        - db_data:/var/lib/postgresql/data
    restart: always

volumes:
  drupal_modules:
  drupal_profiles:
  drupal_themes:
  drupal_sites:
  db_data:

docker-compose up -d
docker ps
Db name: postgres | Database username: postgres | Database password:Drupalpass123 Host : postgres
cd ~/my_drupal/ ; docker-compose stop
cd ~/my_drupal/ ; docker-compose start
cd ~/my_drupal/ ; docker-compose down
__________________________________________________________________________________________

Deploy Jenkins in Docker

 in This Tutorial you will Learn "  How To Run Deploy Jenkins in Docker On Rocky Linux"
Jenkins is an open source automation server.
Docker is a software platform that allows you to build, test, and deploy applications quickly.
__________________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
__________________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y ; docker-compose --version ; docker --version
docker pull jenkins/jenkins
docker ps
docker run -p 8080:8080 --name=jenkins-master jenkins/jenkins
netstat -tlpn
http://localhost:8080

77a10c9cd0d74c77beae88ab0bd255ec

docker stop jenkins-master
docker rm jenkins-master
__________________________________________________________________________________________________



Deploy WordPress with Docker Compose On Rocky Linux 8.5

 in This Tutorial you will Learn "  Deploy WordPress with Docker Compose On Rocky Linux 8.5"
Docker Compose is a tool that was developed to help define and share multi-container applications.
WordPress is an open-source content management system (CMS).
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
mkdir ~/my_wordpress/ ; cd ~/my_wordpress/
nano docker-compose.yml
version: '3.3'

services:
   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     volumes:
       - wordpress_files:/var/www/html
     ports:
       - "80:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: db_password

   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: db_root_password
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: db_password
volumes:
    wordpress_files:
    db_data:

docker-compose up -d
http://

cd ~/my_wordpress/ ; docker-compose stop
cd ~/my_wordpress/ ; docker-compose start
cd ~/my_wordpress/ ; docker-compose down
__________________________________________________________________________________________

Deploying Jitsi Meet with Docker On Rokcy Linux 8.5

 Jitsi is a set of Open Source projects that allows you to easily build and deploy secure videoconferencing solutions.
Docker is a software platform that allows you to build, test, and deploy applications quickly.
________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
docker-compose --version ; docker --version
git clone https://github.com/jitsi/docker-jitsi-meet && cd docker-jitsi-meet
cp env.example .env
mkdir -p ~/.jitsi-meet-cfg/{web/letsencrypt,transcripts,prosody,jicofo,jvb}
gedit .env &>/dev/null
HTTP_PORT=80
PUBLIC_URL=https://www.primaryhost.com
DOCKER_HOST_ADDRESS=192.168.1.20
docker-compose up -d
docker ps
http://192.168.1.20
_________________________________________________________________________________________


How To Dockerize Python Applications With Miniconda On Ubuntu 20.04

 in This Tutorial you will Learn " How To Dockerize Python Applications With Miniconda On Ubuntu 20.04"
                            
Python is an interpreted high-level general-purpose programming language.
Miniconda is a free minimal installer for conda.
Docker is a software platform that allows you to build, test, and deploy applications quickly.
_________________________________________________________________________________________
docker-compose --version ; docker --version
mkdir project ; cd project ; nano Dockerfile
FROM python:slim
RUN apt-get update && apt-get -y upgrade \
  && apt-get install -y --no-install-recommends \
    git \
    wget \
    g++ \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
    && mkdir /root/.conda \
    && bash Miniconda3-latest-Linux-x86_64.sh -b \
    && rm -f Miniconda3-latest-Linux-x86_64.sh \
    && echo "Running $(conda --version)" && \
    conda init bash && \
    . /root/.bashrc && \
    conda update conda && \
    conda create -n python-app && \
    conda activate python-app && \
    conda install python=3.6 pip && \
    echo 'print("Hello World!")' > python-app.py
RUN echo 'conda activate python-app \n\
alias python-app="python python-app.py"' >> /root/.bashrc
ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
CMD ["python python-app.py"]

docker build -t python-app .
docker images
docker run python-app
docker run -it python-app /bin/bash
python-app
python --version
_________________________________________________________________________________________

How To Run Joomla CMS in Podman Pod

 in This Tutorial you will Learn "How To Run Joomla CMS in Podman Pod"

Written in PHP, Joomla is a popular CMS (Content Management System) used for creating stunning websites and blogs using themes, and tons of nifty add-ons. It comes second to WordPress as the most popular and widely used Content Management System.
Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y
podman -v
podman pod create --name mypod --publish 8080:80
podman run -dit --pod mypod -e MYSQL_DATABASE=joomla -e MYSQL_USER=joomlauser -e MYSQL_PASSWORD=joomlapassword -e MYSQL_ROOT_PASSWORD=rootpw --name mariadb docker.io/library/mariadb
podman logs -f mariadb

podman run -dit --pod mypod -e JOOMLA_DB_HOST=127.0.0.1 -e JOOMLA_DB_USER=joomlauser -e JOOMLA_DB_PASSWORD=joomlapassword -e JOOMLA_DB_NAME=joomla --name joomla docker.io/library/joomla
podman logs -f joomla
http://127.0.0.1:8080   | AUrCUw4A76Aqgi9
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++








How To Set Docker Memory and CPU Usage Limit

 in This Tutorial you will Learn " How to Set Docker Memory and CPU Usage Limit On Rock Linux 8.5"

Docker is a software platform that allows you to build, test, and deploy applications quickly.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; docker-compose --version ; docker --version

docker run -it --memory="[memory_limit]" [docker_image]
Example. - docker run -it --memory="1g" ubuntu

Set Swap to Disk Memory Limit -  docker run -it --memory="[memory_limit]" --memory-swap="[memory_limit]" [docker_image]
Example - docker run -it --memory="1g" --memory-swap="2g" ubuntu

Set Soft Limit to Container Memory-
docker run -it --memory="1g" --memory-reservation="750m" ubuntu

Limit Docker Container CPU Usage- docker run -it --cpus="1.0" ubuntu
docker run -it --cpus-shares="700" ubuntu
_________________________________________________________________________________________

Run Linux Containers with LXC/LXD on Ubuntu 20.04

 in This Tutorial you will learn "How To Run Linux Containers with LXCLXD on Ubuntu 20.04
LXD is an open source container management extension for Linux Containers (LXC).
Linux Containers (LXC) is a type of virtualization setup that works with virtual containers created at the operating system level.
_________________________________________________________________________________________
Server - Os:  Ubuntu 20.04.3 LTS 64Bit      
_________________________________________________________________________________________
lsb_release -d
apt-get update ; apt-get install -y lxd
lxd init
lxc info | more
lxc launch ubuntu:20.04 test
lxc list
lxc exec test bash
ip a
lxc stop test
lxc list
lxc start test
________________________________________________________________________________________

Thursday, February 24, 2022

Running Splunk On Docker Container

                            
in This Tutorial you will Learn " How To run Splunk in Docker container On Rocky Linux 8.5"

Splunk is a software platform widely used for monitoring, searching, analyzing and visualizing the machine-generated data in real time.
Rocky Linux is an open-source enterprise operating system designed to be 100% bug-for-bug compatible with Red Hat Enterprise Linux®.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y ; docker-compose --version ; docker --version
docker pull splunk/splunk:latest
docker run -d -p 8000:8000 -e 'SPLUNK_START_ARGS=--accept-license' -e 'SPLUNK_PASSWORD=strongpass123' splunk/splunk:latest

docker ps -a -f id=05ea3e394b268371c47b5893e85a9f2bbf25505dd501df25a05acf608e394534
docker container stop 05ea3e394b268371c47b5893e85a9f2bbf25505dd501df25a05acf608e394534
docker container start 05ea3e394b268371c47b5893e85a9f2bbf25505dd501df25a05acf608e394534
http://192.168.1.60:8000
Username: admin • Password: strongpass123
__________________________________________________________________________________________

Run Pydio Cells File Sharing in Docker Container

 in This Tutorial you will Learn" How To  Run Pydio Cells File Sharing in Docker Container "

Pydio Cells is self-hosted Document Sharing & Collaboration software for organizations that need advanced sharing without security trade-offs. | Homepage - https://pydio.com/
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y ; docker-compose --version ; docker --version
mkdir ~/pydio ; cd ~/pydio ; nano docker-compose.yml
version: '3.9'
services:

  cells:
    image: pydio/cells:latest
    restart: unless-stopped
    hostname: pydio-cells
    ports: ["8080:8080"]
    environment:
      - CELLS_LOG_LEVEL=production
    volumes:
      - data:/var/cells/data
      - cellsdir:/var/cells

  mysql:
    image: mysql:latest
    restart: unless-stopped
    ports: ["3306:3306"]
    environment:
      MYSQL_ROOT_PASSWORD: StrongPassw0rd
      MYSQL_DATABASE: pydiodb
      MYSQL_USER: pydiouser
      MYSQL_PASSWORD: StrongPassw0rd
    command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci]
    volumes:
      - mysqldir:/var/lib/mysql

volumes:
    data: {}
    cellsdir: {}
    mysqldir: {}

cd ~/pydio
docker-compose up -d
docker-compose ps
netstat -tlpn
https://192.168.1.60:8080
_________________________________________________________________________________________


Deploy a LAMP server using Docker-Compose

 in This Tutorial you will Learn " How To Deploy a LAMP server using Docker-Compose On Rocky Linux"

LAMP (Linux, Apache, MySQL, PHP/Perl/Python) is an acronym denoting one of the most common software stacks for many of the web's most popular applications.
Docker Compose is a tool that was developed to help define and share multi-container applications.
Docker is a software platform that allows you to build, test, and deploy applications quickly.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y ; docker-compose --version ; docker --version
mkdir -p test/DocumentRoot  ; cd test/
nano index.php
<?php
phpinfo();
?>

nano docker-compose.yml
version: '3'
services:
    php-apache:
        image: php:7.2.1-apache
        ports:
            - 80:80
        volumes:
            - ./DocumentRoot:/var/www/html:z
        links:
            - 'mariadb'

    mariadb:
        image: mariadb:10.1
        volumes:
            - mariadb:/var/lib/mysql
        environment:
            TZ: "Asia/Kolkata"
            MYSQL_ALLOW_EMPTY_PASSWORD: "no"
            MYSQL_ROOT_PASSWORD: "rootpwd"
            MYSQL_USER: 'testuser'
            MYSQL_PASSWORD: 'testpassword'
            MYSQL_DATABASE: 'testdb'

volumes:
    mariadb:
docker-compose up -d
mv index.php DocumentRoot/

sestatus ; hostname -f
http://192.168.1.60
_________________________________________________________________________________________

Rename MySQL Root User

 in This Tutorial you will Learn " How To Rename MySQL Root User "
MySQL is a relational database management system based on SQL.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release
mysql -u root -p
select user,host from mysql.user;
rename user 'root'@'localhost' to 'newadmin'@'localhost';
select user,host from mysql.user;
FLUSH PRIVILEGES;
EXIT;
mysql -u newadmin -p
_________________________________________________________________________________________


Steps To Configure Chrony as NTP Server & Client On Rocky Linux 8.5

 in This Tutorial you will Learn " Steps To Configure Chrony as NTP Server & Client On Rocky Linux 8.5 | chrony is an implementation of the Network Time Protocol (NTP). You can use chrony |
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y

timedatectl set-timezone Asia/Kolkata
dnf install chrony -y
systemctl start chronyd ; systemctl enable --now chronyd ; systemctl status chronyd
nano /etc/chrony.conf
timedatectl set-ntp true
systemctl restart chronyd
chronyc sources
firewall-cmd --permanent --add-service=ntp --permanent ; firewall-cmd --reload
chronyc clients
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Configure Chrony Client -
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y

timedatectl set-timezone Asia/Kolkata
dnf install chrony -y
nano /etc/chrony.conf
server chrony-server-ip         [ server 192.168.1.20 ]
timedatectl set-ntp true
systemctl stop chronyd  ;systemctl start chronyd ; systemctl enable --now chronyd
firewall-cmd --permanent --add-service=ntp --permanent ; firewall-cmd --reload
chronyc sources
_________________________________________________________________________________________

How To Setup NFS Server & Client On Rocky Linux 8.5

 in This Tutorial you will Learn " Configure NFS Server To share Directories on Your Network "    

NFS stands for Network File Share.
+----------------------+                                  +----------------------+
| [    NFS Server    ] |192.168.1.20 | 192.168.1.80| [    NFS Client    ]
|   www.primaryhost.com     +----------+----------+   www.tertiary.com   |
|                             |                                |
+----------------------+                                     +----------------------+
_________________________________________________________________________________________
Testing Environment - Os:  Rocky Linux 8.5  64Bit | IP -192.168.1.20 | Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf -y install nfs-utils  
nano /etc/exports
# create new
# for example, set [/home/nfsshare] as NFS share
/home/nfsshare  192.168.1.80(rw,no_root_squash)
cat /etc/exports ; exportfs -v
mkdir /home/nfsshare
systemctl enable --now rpcbind nfs-server ; systemctl restart nfs-server
firewall-cmd --add-service={nfs,nfs3,rpc-bind,mountd} --permanent ; firewall-cmd --reload
systemctl daemon-reload  ; systemctl restart nfs-server
_________________________________________________________________________________________
Configure NFS Client -
cat /etc/system-release ; sestatus ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf -y install nfs-utils
mount -t nfs 192.168.1.20:/home/nfsshare /mnt
mount -t nfs -o vers=3 192.168.1.20:/home/nfsshare /mnt
df -hT /mnt
showmount -e 192.168.1.20
_________________________________________________________________________________________












Change MySQL Mariadb Default Port and Listening Address

 in This Tutorial you will Learn " Change MySQL Default Port and Listening Address"

By default, MySQL and MariaDB listen on port 3306 on the loopback address. It is a good idea to change the MySQL default port for security purposes.
_________________________________________________________________________________________
lsb_release -d ; hostname -I ; mysql -V

MySQL - nano /etc/mysql/mysql.conf.d/mysqld.cnf
netstat -tln
bind-address = 127.0.0.1
Port = 9090
systemctl restart mysql

MariaDB - nano /etc/mysql/mariadb.conf.d/50-server.cnf
netstat -tln
bind-address = 127.0.0.1
Port = 9090
systemctl restart mariadb
_________________________________________________________________________________________

How To install SSH Server On Rocky Linux 8.5 | Enable OpenSSH

 in This Tutorial you will Learn "How To install SSH Server On Rocky Linux 8.5 | Enable OpenSSH"

SSH is a client-server service providing secure encrypted connections over the network connection.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
nano /etc/ssh/sshd_config
PermitRootLogin no
systemctl restart sshd ; systemctl status sshd
firewall-cmd --add-service=ssh ; firewall-cmd --runtime-to-permanent
getent passwd  
hostname -i ; hostname          | username - debs             hostname or IP address - 192.168.1.20
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SSH Client : Rocky Linux
cat /etc/system-release ; sestatus ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf -y install openssh-clients

ssh [username@(hostname or IP address)]
ssh debs@192.168.1.20
_________________________________________________________________________________________

How To Setup an SFTP server on Rocky Linux 8.5

 in This Tutorial you will Learn " How To setup an SFTP server on Rocky Linux 8.5
"SFTP (SSH File Transfer Protocol) is a secure file transfer protocol. It runs over the SSH protocol.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y

cat /etc/passwd
groupadd  sftp_users ; usermod -G sftp_users -s /sbin/nologin debs
gedit /etc/ssh/sshd_config &>/dev/null
Subsystem sftp internal-sftp

# add Below lines at the end of file
Match Group sftp_users
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory %h
ForceCommand internal-sftp

systemctl restart sshd ; systemctl status sshd
chmod 755 /home/debs ; chown root /home/debs ; chgrp -R sftp_users /home/debs
mkdir -p /home/debs/upload ; chown debs. /home/debs/upload/
firewall-cmd --add-service=ssh ; firewall-cmd --runtime-to-permanent
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Client : Rocky Linux
cat /etc/system-release ; sestatus ; hostname ; hostname -I
dnf -y install openssh-clients
sftp [username@(hostname or IP address)]  
sftp debs@192.168.1.20
_________________________________________________________________________________________


How To Install Samba Server on Rocky Linux 8.5

 in This Tutorial you will Learn "  How to install Samba and configure it as a standalone sharing server on Rocky Linux 8.5"

Samba is a free and open-source software that can be used to share files, folders, and printers between Linux and Windows systems. It is also used for Authentication and Authorization, Name resolution and Service announcement. It can be run on different operating systems including, Linux, Unix, OpenVMS and many more.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y

dnf install samba samba-common samba-client -y
systemctl start smb ; systemctl enable smb ; systemctl status smb
 
mkdir -p /samba/share/public ; touch /samba/share/public/file.txt ; touch /samba/share/public/filetwo.txt
chmod -R 0755 /samba/share/ ; chmod -R 0755 /samba/share/public ; chown -R nobody:nobody /samba/share
chown -R nobody:nobody /samba/share/public
mv /etc/samba/smb.conf /etc/samba/smb.bak

nano /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = samba-server
security = user
map to guest = bad user
dns proxy = no

[Public]
path = /samba/share/public
browsable =yes
writable = yes
guest ok = yes
read only = no

systemctl restart smb
testparm
firewall-cmd --add-service=samba --zone=public --permanent ;  firewall-cmd --reload

_________________________________________________________________________________________

Windows Machine- \\192.168.1.20
Linux - smb://192.168.1.20
Command-line - smbclient -L //192.168.1.20
_________________________________________________________________________________________


How To Setup Samba Server on Rocky Linux 8.5 | Create a Private Share Directory"

 in This Tutorial you will Learn " How To Setup Samba Server on Rocky Linux 8.5 | Create a Private Share Directory"

Samba is a free and open-source software that can be used to share files, folders, and printers between Linux and Windows systems. It is also used for Authentication and Authorization, Name resolution and Service announcement. It can be run on different operating systems including, Linux, Unix, OpenVMS and many more.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y

dnf install samba samba-common samba-client -y
systemctl start smb ; systemctl enable smb ; systemctl status smb
 
mkdir -p /samba/share/public ; touch /samba/share/public/file.txt ; touch /samba/share/public/filetwo.txt
chmod -R 0755 /samba/share/ ; chmod -R 0755 /samba/share/public ; chown -R nobody:nobody /samba/share
chown -R nobody:nobody /samba/share/public

mv /etc/samba/smb.conf /etc/samba/smb.bak ; nano /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = samba-server
security = user
map to guest = bad user
dns proxy = no

[Public]
path = /samba/share/public
browsable =yes
writable = yes
guest ok = yes
read only = no

[Private]
path = /samba/share/private
valid users = @private     
guest ok = no
writable = yes
browsable = yes

systemctl restart smb
testparm
groupadd private ; useradd -g private privateuser ; smbpasswd -a privateuser
mkdir -p /samba/share/private
touch /samba/share/private/private1.txt ; touch /samba/share/private/private2.txt
chmod -R 0770 /samba/share/private ; chown -R root:private /samba/share/private
firewall-cmd --add-service=samba --zone=public --permanent ;  firewall-cmd --reload

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sestatus ; hostname ; hostname -I
Windows Machine- \\192.168.1.20  | Linux - smb://192.168.1.20 | Command-line - smbclient -L //192.168.1.20
_________________________________________________________________________________________

Wednesday, February 23, 2022

How To Configure iSCSI Target And Initiator On Rocky Linux 8.5

 in This Tutorial you will Learn " How To Configure iSCSI Target & Initiator On Rocky Linux 8.5"

iSCSI stands for Internet Small Computer Systems Interface, IP-based storage, works on top of internet protocol by carrying SCSI commands over IP network. iSCSI transports block-level data between an iSCSI initiator on a client machine and an iSCSI target on a storage device (server).

iSCSI Target   ] |192.168.1.20 | 192.168.1.80| [ iSCSI Initiator  
|www.primaryhost.com    +----------+----------+    www.tertiary.com
_________________________________________________________________________________________
iSCSI Target  -  ip - 192.168.1.20  - Hostname - www.primaryhost.com   Os:  Rocky Linux 8.5

cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf makecache ; 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.2021-07.primaryhost.com:www.target01
cd iqn.2021-07.primaryhost.com:www.target01//tpg1/luns
create /backstores/fileio/disk01
cd ../acls

create iqn.2021-07.primaryhost.com:node01.initiator01
cd iqn.2021-07.primaryhost.com:node01.initiator01
set auth userid=username
set auth password=password
exit
ss -napt | grep 3260
systemctl enable target ; systemctl status target
firewall-cmd --add-service=iscsi-target ; firewall-cmd --runtime-to-permanent

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
iSCSI Initiator -   ip - 192.168.1.80  - Hostname - www.tertiary.com   Os:  Rocky Linux 8.5

cat /etc/system-release ; sestatus ; hostname ; hostname -I  
dnf groupinstall "Development Tools" -y
dnf -y install iscsi-initiator-utils
nano  /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2021-07.primaryhost.com: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.20
iscsiadm -m node -o show
iscsiadm -m node --login
iscsiadm -m session -o show
cat /proc/partitions

parted --script /dev/sdb "mklabel gpt"
parted --script /dev/sdb1 "mkpart primary 0% 100%"
mkfs.xfs -i size=1024 -s size=4096 /dev/sdb1
mount /dev/sdb1 /mnt
_________________________________________________________________________________________


How To Enable Binary Log in MariaDB 10

 in This Tutorial you will Learn " How To Enable Binary Log in MariaDB 10"
                           
MariaDB Server is one of the most popular open source relational databases.
The binary log contains a record of all changes to the databases, both data and structure.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; mysql -V
Verify Binary Log - show variables like '%bin%';
show binary logs;
Enable Binary Log  -  Mariadb - nano /etc/my.cnf.d/server.cnf

log-bin=bin.log
log-bin-index=bin-log.index
max_binlog_size=100M
binlog_format=row
socket=mysql.sock
systemctl daemon-reload ; systemctl restart mariadb
_________________________________________________________________________________________
Mysql  Ver 8.0.26 -
mysql -V

Verify Binary Log - show variables like '%bin%';
show binary logs;
Enable Binary Log  - nano /etc/my.cnf.d/mysql-server.cnf
log-bin=bin.log
log-bin-index=bin-log.index
max_binlog_size=100M
binlog_format=row
socket=mysql.sock
systemctl daemon-reload ; systemctl restart mysqld
mysql -u root -p
_________________________________________________________________________________________

Monday, February 21, 2022

Deploy Varnish 7 for Nginx on Rocky Linux 8

 In this tutorial, I will show you " How to install Varnish 7 in front of Nginx on Rocky Linux 8.5

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy.
NGINX is a web server that also acts as an email proxy, reverse proxy, and load balancer.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y

dnf module disable varnish
dnf install epel-release -y
curl -s https://packagecloud.io/install/repositories/varnishcache/varnish70/script.rpm.sh | bash
dnf install varnish -y
systemctl start varnish ; systemctl enable varnish ; systemctl status varnish

nano /usr/lib/systemd/system/varnish.service
ExecStart=/usr/sbin/varnishd -a :80 -a localhost:8443,PROXY -p feature=+http2 -f /etc/varnish/default.vcl -s malloc,2g

systemctl daemon-reload ; systemctl restart varnish
dnf install nginx -y

nano /etc/nginx/nginx.conf
        listen       8080 default_server;
        listen       [::]:8080 default_server;

nginx -t
systemctl restart nginx ; systemctl status nginx
curl -I http://192.168.1.20
_________________________________________________________________________________________

Deploy Varnish Cache with Apache On Rocky Linux 8.5

 in This Tutorial you will Learn " How To Install Varnish Cache with Apache on Rocky Linux 8.5"

Varnish is a proxy server focused on HTTP caching. It's designed as an HTTP accelerator and can act as reverse proxy for your web server Apache or Nginx. Varnish has been used for high-profile and high-traffic websites, including Wikipedia, The Guardian, and the New York Times.

Apache is the most widely used web server software.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf install httpd -y
nano  /etc/httpd/conf/httpd.conf
Listen 8080
apachectl configtest
systemctl start httpd ; systemctl enable httpd
firewall-cmd --zone=public --add-service=http --permanent ; firewall-cmd --reload

touch /var/www/html/test.html
curl -I http://localhost:8080/test.html

dnf module disable varnish -y ; dnf install epel-release -y
curl -s https://packagecloud.io/install/repositories/varnishcache/varnish70/script.rpm.sh | bash
dnf install varnish -y
systemctl start varnish ; systemctl enable varnish ; systemctl status varnish
varnishd -V
nano /usr/lib/systemd/system/varnish.service

systemctl daemon-reload ; systemctl restart varnish ; systemctl status varnish
curl -I http://localhost/test.html
ss -lnpt | grep 80
_________________________________________________________________________________________


Friday, February 18, 2022

How To Setup Redis Replication ( General Primary-Replica settings )

 in This Tutorial you will Learn "How To Setup Redis Replication ( General Primary-Replica settings )"

Redis (Remote Directory Server) is a popular in-memory data structure store used as a database, cache and message broker.
what is redis replication -
Redis replication is a very simple to use and configure master-slave replication that allows slave Redis servers to be exact copies of master servers.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; dnf groupinstall "Development Tools" -y
dnf module -y install redis:6
gedit  /etc/redis.conf   &>/dev/null  ||  nano /etc/redis.conf
bind 0.0.0.0 | daemonize yes |
min-replicas-to-write 1
min-replicas-max-lag 10
# requirepass password
systemctl enable --now redis ; systemctl restart redis ; systemctl status redis
firewall-cmd --add-service=redis --permanent ; firewall-cmd --reload
_________________________________________________________________________________________
Replica Host-
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf module -y install redis:6

gedit  /etc/redis.conf &>/dev/null   Or nano /etc/redis.conf
bind 0.0.0.0  | daemonize yes  || replicaof 192.168.1.60 6379 || masterauth password || replica-read-only yes
# requirepass password

firewall-cmd --add-service=redis --permanent ; firewall-cmd --reload
systemctl restart redis
redis-cli
auth password
info Replication
_________________________________________________________________________________________


Setup Self Signed SSL/TLS on MySQL 8 | Secure MySQL 8

 in This Tutorial you will Learn " How To Setup / Secure Self Signed Certificate SSL/TLS on MySQL 8 On Rocky Linux 8
MySQL is an open-source relational database management system.    
Homepage - https://dev.mysql.com/                     
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf module -y install mysql:8.0
systemctl start mysqld ; systemctl enable --now mysqld ; mysql_secure_installation

mkdir /etc/mysql ; cd /etc/mysql ; openssl genrsa 2048 > ca-key.pem
openssl req -sha1 -new -x509 -nodes -days 3650 -key ca-key.pem > ca-cert.pem
openssl req -sha1 -newkey rsa:2048 -days 3650 -nodes -keyout server-key.pem > server-req.pem
openssl x509 -sha1 -req -in server-req.pem -days 3650 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > server-cert.pem
openssl rsa -in server-key.pem -out server-key.pem
chown -R mysql:mysql /etc/mysql

gedit /etc/my.cnf.d/mysql-server.cnf &>/dev/null
ssl-ca = /etc/mysql/ca-cert.pem
ssl-cert = /etc/mysql/server-cert.pem
ssl-key = /etc/mysql/server-key.pem
systemctl restart mysqld ; systemctl status mysqld

Verify SSL/TLS Status:-
mysql -u root -p --ssl-mode=required --protocol=tcp
show status like 'ssl_cipher';
show variables like '%ssl%';
status
_________________________________________________________________________________________

Thursday, February 17, 2022

How To Enable SSL On CouchDB ( HTTPS (SSL/TLS) Options )

 in This Tutorial you will Learn " How To Enable SSL On Apache CouchDB"

CouchDB is an open-source, document-oriented NoSQL database.
SSL, or Secure Sockets Layer, is an encryption-based Internet security protocol.
Homepage - https://couchdb.apache.org/

Doc - https://docs.couchdb.org/en/3.2.0/config/http.html
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; dnf groupinstall "Development Tools" -y ; yum install -y yum-utils
yum-config-manager --add-repo https://couchdb.apache.org/repo/couchdb.repo
dnf makecache ; dnf -y install couchdb
systemctl start couchdb ; systemctl enable couchdb ; systemctl status couchdb

mkdir -p  /etc/couchdb/cert ; cd /etc/couchdb/cert
openssl genrsa > privkey.pem
openssl req -new -x509 -key privkey.pem -out couchdb.pem -days 1095
chmod 600 privkey.pem couchdb.pem
chown couchdb privkey.pem couchdb.pem

nano  /opt/couchdb/etc/local.ini
[chttpd]
port = 5984
bind_address = 0.0.0.0

[ssl]
enable = true
cert_file = /etc/couchdb/cert/couchdb.pem
key_file = /etc/couchdb/cert/privkey.pem

[admins]
admin = StrongPassword
systemctl restart couchdb
firewall-cmd --zone=public --permanent --add-port=5984/tcp ; firewall-cmd --reload
firewall-cmd --zone=public --permanent --add-port=6984/tcp ; firewall-cmd --reload

http://127.0.0.1:5984/_utils/
https://127.0.0.1:6984/_utils/
User/Pass -  admin/StrongPassword
__________________________________________________________________________________________

Setup MariaDB Self Signed SSL/TLS | Secure Mariadb 10

 in This Tutorial you will Learn "  How To Configure / Setup MariaDB Self Signed SSL/TLS on Rocky Linux 8"
MariaDB Server is one of the most popular open source relational databases.
Homepage - https://mariadb.com/
MariaDB Server Documentation - https://mariadb.com/kb/en/securing-connections-for-client-and-server/
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; dnf groupinstall "Development Tools" -y
dnf module -y install mariadb:10.3
systemctl enable --now mariadb ; systemctl start mariadb ; mysql_secure_installation
gedit /etc/my.cnf.d/charaset.cnf &>/dev/null
[mysqld]
character-set-server = utf8mb4
[client]
default-character-set = utf8mb4

mkdir /etc/mysql ; cd /etc/mysql ; openssl genrsa 2048 > ca-key.pem
openssl req -sha1 -new -x509 -nodes -days 3650 -key ca-key.pem > ca-cert.pem
openssl req -sha1 -newkey rsa:2048 -days 3650 -nodes -keyout server-key.pem > server-req.pem
openssl x509 -sha1 -req -in server-req.pem -days 3650 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > server-cert.pem
openssl rsa -in server-key.pem -out server-key.pem ; chown -R mysql:mysql /etc/mysql

gedit /etc/my.cnf.d/mariadb-server.cnf &>/dev/null
ssl-ca = /etc/mysql/ca-cert.pem
ssl-cert = /etc/mysql/server-cert.pem
ssl-key = /etc/mysql/server-key.pem
systemctl restart mariadb ; systemctl status mariadb
firewall-cmd --add-service=mysql --permanent ; firewall-cmd --reload
mysql -u root -p
show variables like '%ssl%';
mysql -u root -p --ssl
show status like 'ssl_cipher';
exit
status

_________________________________________________________________________________________





Setup Redis Server with SSL/TLS | Enable SSL for Redis

 in This Tutorial you will Learn " How To Setup Redis Server with SSL/TLS On Rocky Linux 8"
Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker.
SSL, or Secure Sockets Layer, is an encryption-based Internet security protocol.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf module -y install redis:6
cd /etc/pki/tls/certs ; openssl req -x509 -nodes -newkey rsa:2048 -keyout redis.pem -out redis.pem -days 3650
chmod 600 redis.pem ; chown redis. redis.pem
gedit /etc/redis.conf &>/dev/null
# requirepass Strongpassword
port 0
tls-port 6379
tls-ca-cert-dir /etc/pki/tls/certs
tls-auth-clients no
tls-cert-file /etc/pki/tls/certs/redis.pem
tls-key-file /etc/pki/tls/certs/redis.pem
systemctl enable --now redis ; systemctl restart redis ; systemctl status redis
firewall-cmd --add-service=redis --permanent ; firewall-cmd --reload

redis-cli -h 127.0.0.1 --tls \
--cert /etc/pki/tls/certs/redis.pem \
--key /etc/pki/tls/certs/redis.pem \
--cacert /etc/pki/tls/certs/redis.pem
________________________________________________________________________________________




Setup Redis Sentinel

 in This Tutorial you will Learn " How To Setup Redis Sentinel On Rocky Linux 8.5
Redis sentinel is the high availability solution offered by Redis.
Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker.

If Primary Node would be down, Master role will failover to other Replica Node.
  [ Redis Sentinel ]                               [ Redis Primary ]  
    192.168.1.20     +----------+----------+     192.168.1.80  
                              [ Redis Replica ]  
                                  192.168.1.40
_________________________________________________________________________________________
[ Redis Sentinel ] - 192.168.1.20
cat /etc/system-release ; sestatus ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf module -y install redis:6
gedit  /etc/redis-sentinel.conf &>/dev/null
daemonize yes
sentinel monitor mymaster 192.168.1.80 6379 1                                                                                            
sentinel auth-pass mymaster password     
                                                                                                                                                                         
systemctl enable --now redis-sentinel ; systemctl restart redis-sentinel
firewall-cmd --zone=public --permanent --add-port=26379/tcp ; firewall-cmd --reload
redis-cli -p 26379
sentinel get-master-addr-by-name mymaster
sentinel master mymaster
sentinel slaves mymaster

redis-cli -p 26379 sentinel get-master-addr-by-name mymaster
redis-cli -p 26379 info sentinel
_________________________________________________________________________________________
[ Redis Primary ] 192.168.1.80
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y
dnf module -y install redis:6
gedit  /etc/redis.conf &>/dev/null
bind 0.0.0.0  || daemonize yes | requirepass password
min-replicas-to-write 1
min-replicas-max-lag 10
firewall-cmd --add-service=redis --permanent ; firewall-cmd --reload ; systemctl restart redis
hostname -I
systemctl restart redis
_________________________________________________________________________________________
Redis Replica# 192.168.1.40
_________________________________________________________________________________________
hostname -I ; cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y
dnf module -y install redis:6
gedit  /etc/redis.conf &>/dev/null
bind 0.0.0.0  | daemonize yes |replicaof 192.168.1.80 6379 |masterauth password |# requirepass password
firewall-cmd --add-service=redis --permanent ; firewall-cmd --reload ; systemctl restart redis
_________________________________________________________________________________________

Setting up a Remote MySQL 8 Database Connection

 in This Tutorial you will Learn " How To Allow Remote Connection to MySQL 8 Database Server On Rocky Linux 8"
By default, MySQL is configured to allow connections only from the localhost. You will need to allow remote access to the MySQL database server if your application and database are hosted on different servers.

MySQL is an open source SQL database management system developed by Oracle Corporation.
________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
dnf groupinstall "Development Tools" -y ; dnf module -y install mysql:8.0
nano /etc/my.cnf.d/mysql-server.cnf
character-set-server=utf8mb4
firewall-cmd --add-service=mysql --permanent ; firewall-cmd --reload
systemctl enable --now mysqld ; systemctl start mysqld ; mysql_secure_installation

[ remote-server-ip- 192.168.1.80 ]
mysql -u root -p
CREATE DATABASE testdb;
CREATE USER 'testuser'@'192.168.1.80' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON testdb.* TO 'testuser'@'192.168.1.80';         
FLUSH PRIVILEGES ;
SHOW GRANTS FOR 'testuser'@'192.168.1.80';
EXIT;
_________________________________________________________________________________________
sestatus ; hostname -I
Verify Database Connection -  mysql -u testuser -h 192.168.1.60 -p
show databases;
status;
show processlist;
_________________________________________________________________________________________



Set up Cassandra for Remote Access

 in This Tutorial you Will Learn " How To Configure /set up Apache Cassandra for Remote Connection On Rocky Linux"
Apache Cassandra is a free and open-source distributed NoSQL database management system.
Homepage - https://cassandra.apache.org/_/index.html
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; dnf groupinstall "Development Tools" -y
dnf install epel-release java-1.8.0-openjdk java-1.8.0-openjdk-devel -y
dnf install python38 -y
update-alternatives --config python
pip3 install --user cqlsh

nano /etc/yum.repos.d/cassandra.repo
[cassandra]
name=Apache Cassandra
baseurl=https://www.apache.org/dist/cassandra/redhat/40x/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.apache.org/dist/cassandra/KEYS

dnf install cassandra -y

nano /etc/systemd/system/cassandra.service
[Unit]
Description=Apache Cassandra
After=network.target

[Service]
PIDFile=/var/run/cassandra/cassandra.pid
User=cassandra
Group=cassandra
ExecStart=/usr/sbin/cassandra -f -p /var/run/cassandra/cassandra.pid
Restart=always

[Install]
WantedBy=multi-user.target

systemctl daemon-reload ; systemctl start cassandra ; systemctl enable cassandra
systemctl stop firewalld.service

nano /etc/cassandra/conf/cassandra.yaml
rpc_address:
firewall-cmd --zone=public --add-port=9042/tcp --permanent ; firewall-cmd --reload
systemctl restart cassandra ; systemctl status cassandra
cqlsh 192.168.1.60 9042
_________________________________________________________________________________________
sestatus ; cat /etc/system-release
cqlsh
cqlsh -u cassandra 192.168.1.60 9042
cqlsh 192.168.1.60 9042 -u cassandra -p cassandra
_________________________________________________________________________________________

MySQL 8 Master-Slave Replication - Step by Step

 in This Tutorial you will Learn " How To Configure MySQL 8 Master-Slave Replication ( General Master-Slave settings ) on Rocky Linux 8"

MySQL replication is a process that allows you to automatically copy data from one database server to one or more servers.
Homepage - https://dev.mysql.com/
________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf module -y install mysql:8.0
systemctl start mysqld ; systemctl enable --now mysqld
mysql_secure_installation

gedit /etc/my.cnf.d/mysql-server.cnf &>/dev/null
log-bin=mysql-bin
server-id=101
plugin-load=mysql_clone.so
character-set-server=utf8mb4

mysql -u root -p
create user 'repl_user'@'%' identified by 'password';
grant replication slave on *.* to repl_user@'%';
create user 'clone_user'@'%' identified by 'password';
grant backup_admin on *.* to 'clone_user'@'%';
flush privileges;
exit

firewall-cmd --add-service=mysql --permanent ; firewall-cmd --reload
systemctl restart mysqld ; systemctl status mysqld
*************************************************************************************************************************************
Slave Host - IP 192.168.1.80/www.example.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf module -y install mysql:8.0
systemctl start mysqld ; systemctl enable --now mysqld
mysql_secure_installation

gedit /etc/my.cnf.d/mysql-server.cnf &>/dev/null
log-bin=mysql-bin
server-id=102
read_only=1
plugin-load=mysql_clone.so
character-set-server=utf8mb4
report-host=www.example.com

mysql -u root -p
create user 'clone_user'@'%' identified by 'password';
grant clone_admin on *.* to 'clone_user'@'%';
flush privileges;
exit
firewall-cmd --add-service=mysql --permanent ; firewall-cmd --reload
systemctl restart mysqld ; systemctl status mysqld

mysql -u root -p
set global clone_valid_donor_list = '192.168.1.60:3306';
clone instance from clone_user@192.168.1.60:3306 identified by 'password';
select ID,STATE,SOURCE,DESTINATION,BINLOG_FILE,BINLOG_POSITION from performance_schema.clone_status;

change master to
master_host='192.168.1.60',
master_ssl=1,
master_log_file='mysql-bin.000001',
master_log_pos=1345;
start slave user='repl_user' password='password';
show slave status\G
_________________________________________________________________________________________

MongoDB – Allow Remote Access On Rocky Linux 8

 in This Tutorial you will Learn " How To MongoDB – Allow remote Access On Rocky Linux 8"

MongoDB is an open-source NoSQL Database solution also available in a paid edition for enterprises.
Homepage - https://www.mongodb.com/
Rocky Linux is an open-source enterprise operating system designed to be 100% bug-for-bug compatible with Red Hat Enterprise Linux®.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname -I ; sestatus ; dnf groupinstall "Development Tools" -y
cat > /etc/yum.repos.d/mongodb.repo << 'EOL'
[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
EOL

dnf update ; dnf install mongodb-org -y
mongod --version
systemctl start mongod ; systemctl enable mongod
tail /var/log/mongodb/mongod.log
mongo
use admin
db.createUser(
      {
      user: "mongod_admin",
      pwd: "YOUR-PASSWORD",
      roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
      }
    )

Db Details -
User - mongod_admin                || Pass - YOUR-PASSWORD || Db - admin

mongo -u mongod_admin -p YOUR-PASSWORD --authenticationDatabase admin
mongo -u mongod_admin -p YOUR-PASSWORD 127.0.0.1/admin

nano /etc/mongod.conf
#security
security:
  authorization: "enabled"
systemctl restart mongod ; systemctl status mongod
firewall-cmd --permanent --add-port=27017/tcp ; firewall-cmd --reload
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cat /etc/system-release ; hostname -I ; sestatus ; dnf groupinstall "Development Tools" -y
cat > /etc/yum.repos.d/mongodb.repo << 'EOL'
[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
EOL

dnf update ; dnf install mongodb-org -y
systemctl start mongod ; systemctl enable mongod
firewall-cmd --permanent --add-port=27017/tcp ; firewall-cmd --reload


mongo -u mongod_admin -p YOUR-PASSWORD 192.168.1.60/admin
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

MariaDB 10 Replication on Rocky Linux 8.5

 in This Tutorial you wil Learn " How To Configure MariaDB Replication (General Primary-Replica settings. ) on Rocky Linux 8.5"
MariaDB is a fork of the MySQL database management system. Offcial site - https://mariadb.org/
_________________________________________________________________________________________
Master node (Rocky Linux 8.5 64 bit) : IP 192.168.1.60
Replica Hosts ( Slave node) - (Rocky Linux 8.5 bit) : IP 192.168.1.80
_________________________________________________________________________________________
cat /etc/system-release
dnf groupinstall "Development Tools" -y ; dnf module -y install mariadb:10.3
nano /etc/my.cnf.d/charset.cnf
[mysqld]
character-set-server = utf8mb4
[client]
default-character-set = utf8mb4
systemctl start mariadb ; systemctl enable --now mariadb ; mysql_secure_installation

nano /etc/my.cnf.d/mariadb-server.cnf
log-bin=mysql-bin
server-id=101
systemctl restart mariadb ; systemctl status mariadb
mysql -u root -p
grant replication slave on *.* to repl_user@'%' identified by 'password';
flush privileges;
exit

mkdir /home/mariadb_backup
mariabackup --backup --target-dir /home/mariadb_backup -u root -p password
firewall-cmd --add-service=mysql ; firewall-cmd --runtime-to-permanent
systemctl restart mariadb    
Transfer Dump-Data - Replica Hosts ( Slave node:)                      

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Configure Replica Hosts ( Slave node:)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cat /etc/system-release
dnf groupinstall "Development Tools" -y ; dnf module -y install mariadb:10.3
nano /etc/my.cnf.d/charset.cnf
[mysqld]
character-set-server = utf8mb4
[client]
default-character-set = utf8mb4
systemctl start mariadb ; systemctl enable --now mariadb ; mysql_secure_installation
firewall-cmd --add-service=mysql ; firewall-cmd --runtime-to-permanent

nano /etc/my.cnf.d/mariadb-server.cnf
log-bin=mysql-bin
server-id=102
read_only=1
report-host=www.example.com
systemctl stop mariadb ; rm -rf /var/lib/mysql/*

mariabackup --prepare --target-dir /root/mariadb_backup
mariabackup --copy-back --target-dir /root/mariadb_backup
chown -R mysql. /var/lib/mysql
systemctl restart mariadb

cat /root/mariadb_backup/xtrabackup_binlog_info
mysql -u root -p
change master to
master_host='192.168.1.60',
master_user='repl_user',
master_password='password',
master_log_file='mysql-bin.000001',
master_log_pos=642;
start slave;
show slave status\G

stop slave;
start slave;
reset slave;
show slave status\G
_________________________________________________________________________________________

How To Use Redis With Python | Example To use Redis on Python 3

 in This Tutorial you will Learn " How To Use Redis With Python | Example To use Redis on Python 3"

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker.
Python is a popular programming language.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf install epel-release -y
dnf makecache ; dnf install redis python3-redis -y
systemctl start redis ; systemctl enable redis

gedit  /etc/redis.conf &>/dev/null
# requirepass password

firewall-cmd --add-service=redis --permanent ; firewall-cmd --reload
dnf install python3 -y
alternatives --set python /usr/bin/python3
pip3 install redis
________________________________________________________________________________________
Example -1

nano use_redis.py
# Sample Python program that uses Redis-py to connect to a Redis Server
import redis

# Create a redis client
redisClient = redis.StrictRedis(host='127.0.0.1',
                                port=6379,
                                db=0)
# Set a string value for the key named 'Language'
redisClient.set('Language', 'Python 2.x')
 
# Get the value for the key and print it
print(redisClient.get('Language'))

# Change the value of they key
redisClient.set('Language', 'Python 3.x')

# Get the new value of the key and print it
print(redisClient.get('Language'))

python3 use_redis.py
________________________________________________________________________________________
Example -2

nano use_redistwo.py
import redis

redis = redis.Redis(
     host= '127.0.0.1',
     port= '6379')

redis.set('mykey', 'Hello from Python!')
value = redis.get('mykey')
print(value)

redis.zadd('vehicles', {'car' : 0})
redis.zadd('vehicles', {'bike' : 0})
vehicles = redis.zrange('vehicles', 0, -1)
print(vehicles)

python3 use_redistwo.py
________________________________________________________________________________________








How To Use Redis in PHP | Example To Use Redis on PHP

 in This Tutorial you will Learn "  How To Use Redis in PHP| Example To Use Redis on PHP "
Redis is an open source key-value store that functions as a data structure server.
PHP is a server side scripting language.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf makecache ; dnf install redis -y
systemctl start redis ; systemctl enable redis
gedit  /etc/redis.conf &>/dev/null
# requirepass password
systemctl restart redis ; systemctl status redis
redis-cli

dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
dnf module list php
dnf module reset php -y
dnf module enable php:remi-7.4 -y
dnf install php -y
dnf install -y php-pecl-redis5
php -m | grep redis
_________________________________________________________________________________________
Example 1 -
_________________________________________________________________________________________
nano use_redis.php
<?php
 
$redis = new Redis();
//Connecting to Redis
$redis->connect('127.0.0.1', 6379);
$redis->auth('password');
 
if ($redis->ping()) {
 echo "PONG";
}
 
?>
php use_redis.php
_________________________________________________________________________________________
Example 2 -
_________________________________________________________________________________________
nano connect.php
<?php
// connecting to Redis server on localhost
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
echo "Connection successful";
php connect.php
________________________________________________________________________________________


How To Set Up Streaming Replication in PostgreSQL

 in This Tutorial you Will Learn " How To Set Up Streaming Replication in PostgreSQL"

PostgreSQL is an extremely robust open-source database used by noted players like Skype, Reddit, Instagram, and OpenStreetMap. PostgreSQL allows replication to nodes that can run read-only queries.
Homepage - https://www.postgresql.org/
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
                                 Replica Host IP - 192.168.1.80 | Os:  Rocky Linux 8.5
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y
dnf module -y install postgresql:10
postgresql-setup --initdb
systemctl enable --now postgresql
gedit /var/lib/pgsql/data/postgresql.conf &>/dev/null
listen_addresses = '*'
wal_level = replica
synchronous_commit = on
max_wal_senders = 10
wal_keep_segments = 10
synchronous_standby_names = '*'

gedit /var/lib/pgsql/data/pg_hba.conf  &>/dev/null
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host    replication     all             127.0.0.1/32            ident
#host    replication     all             ::1/128                 ident
host    replication     rep_user        192.168.1.60/32            md5
host    replication     rep_user        192.168.1.80/32            md5

su - postgres
createuser --replication -P rep_user   [ Password -toor ]
exit
systemctl restart postgresql ; systemctl status postgresql
firewall-cmd --add-service=postgresql ; firewall-cmd --runtime-to-permanent

su - postgres
psql -c "select usename, application_name, client_addr, state, sync_priority, sync_state from pg_stat_replication;"



+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Postgresql install and Configure Replica Host -
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y
dnf module -y install postgresql:10
postgresql-setup --initdb ; systemctl enable --now postgresql
systemctl stop postgresql
rm -rf /var/lib/pgsql/data/*
pg_basebackup -R -h 192.168.1.60 -U rep_user -D /var/lib/pgsql/data -P

cd /var/lib/pgsql/ ; chmod 700 data/ ; chown -R postgres:postgres data/
gedit /var/lib/pgsql/data/postgresql.conf &>/dev/null
listen_addresses = '*'
hot_standby = on
gedit /var/lib/pgsql/data/pg_hba.conf &>/dev/null
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host    replication     all             127.0.0.1/32            ident
#host    replication     all             ::1/128                 ident
host    replication     rep_user        192.168.1.60/32            md5
host    replication     rep_user        192.168.1.80/32            md5
systemctl restart postgresql ; systemctl status postgresql
_________________________________________________________________________________________