Tuesday, February 7, 2023

How To Install Java JDK and JRE on Oracle Linux Server 9

 Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.
OpenJDK or Oracle Java
OpenJDK is an open-source implementation of the Oracle Java SE platform edition. Oracle develops Oracle Java SE, whereas the OpenJDK is developed by Oracle Corporation, OpenJDK and Java Community, Red Hat, Azul Systems, IBM, Apple Inc, and SAP SE.
__________________________________________________________________________________________________________________________________
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

Method - 1
dnf update
sudo dnf install java-11-openjdk java-11-openjdk-devel
java -version


Method - 2
Install Java OpenJDK 16 Manually from TAR.GZ File-
wget https://download.java.net/java/GA/jdk16.0.2/d4a915d82b4c4fbb9bde534da945d746/7/GPL/openjdk-16.0.2_linux-x64_bin.tar.gz
tar -xf openjdk-16.0.2_linux-x64_bin.tar.gz
mkdir -p /usr/lib/jvm ; mv jdk-16.0.2 /usr/lib/jvm

alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-16.0.2/bin/java" 0
alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk-16.0.2/bin/javac" 0
alternatives --list
sudo alternatives --config java
sudo alternatives --config javac
java --version ; javac --version

Setup JAVA_HOME Environment Variable-
cd /etc/profile.d/ ; nano java.sh

JAVA_HOME="/usr/lib/jvm/jdk-16.0.2"
source /etc/profile.d/java.sh
echo $JAVA_HOME
__________________________________________________________________________________________________________________________________

Test Java Installation-
nano HelloWorld.java
public class helloworld {
  public static void main(String[] args) {
    System.out.println("Hello Java World from india!");
  }
}
java HelloWorld.java
__________________________________________________________________________________________________________________________________

Saturday, February 4, 2023

How To Install LEMP Stack on Oracle Linux Server 9

 LEMP is a combination of open-source software. The acronym LEMP refers to the first letters of Linux (Operating system), Nginx Server, MySQL (database software), and PHP, PERL, or Python, principal components to build a viable general-purpose web server.
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf update
dnf install nginx -y
systemctl start nginx ; systemctl enable nginx ; systemctl status nginx

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

dnf install mariadb-server mariadb -y
systemctl start mariadb ; systemctl enable mariadb ; systemctl status mariadb
mysql_secure_installation

dnf install php php-mysqlnd php-fpm php-opcache php-gd php-xml php-mbstring -y
systemctl start php-fpm ; systemctl enable php-fpm ; systemctl status php-fpm

nano /etc/php-fpm.d/www.conf
user = apache
group = apache
user = nginx
group = nginx

systemctl reload php-fpm
echo "<?php phpinfo() ?>" > /usr/share/nginx/html/info.php
systemctl restart nginx php-fpm
http:/server.testbox.com/info.php
__________________________________________________________________________________________________________________________________






































Thursday, February 2, 2023

How To Install Apache, MariaDB, PHP (LAMP) on Oracle Linux 9

 LAMP stands for Linux, Apache, MySQL, and PHP. Together, they provide a proven set of software for delivering high-performance web applications.
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y
dnf update -y
dnf install epel-release -y
dnf install php php-cli php-fpm php-gd php-mysqlnd php-json php-curl php-intl php-pdo php-mbstring php-dom php-xml unzip httpd mariadb-server httpd -y
systemctl start httpd mariadb ; systemctl enable httpd mariadb
mysql_secure_installation

chown --recursive  apache:apache /var/www/html/ ; chmod -R 777 /var/www/html/
nano /etc/httpd/conf.d/testbox.conf
<VirtualHost *:80>
    ServerName server.testbox.com
    DocumentRoot /var/www/html/
    <Directory /var/www/html/public>
        AllowOverride All
        Require all granted
    </Directory>
    RewriteEngine on
    CustomLog /var/log/httpd/testbox.access.log common
    ErrorLog  /var/log/httpd/testbox.error.log

</VirtualHost>

apachectl configtest
nano /etc/hosts
192.168.1.50    server.testbox.com
systemctl restart httpd
__________________________________________________________________________________________________________________________________






Saturday, January 14, 2023

How To Install & Configure JupyterLab Environment On Rocky Linux 9

 JupyterLab is a next-generation web-based development environment for Project Jupyter. Project Jupyter was developed with the goal to develop open-source, open standards, and services for interactive computing across multiple programming languages. JupyterLab offers a flexible interface that allows developers to work with documents and activities such as Jupyter notebooks, text editors, terminals, and custom components in a flexible, integrated, and extensible manner. JupyterLab is the next generation of Jupyter Notebook and is supposed to eventually replace it. It supports over 40 programming languages, including R, Python, Scala, and Julia.
__________________________________________________________________________________________________________________________________
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 wget curl nano unzip yum-utils -y
firewall-cmd --add-service=http --permanent ; firewall-cmd --add-service=https --permanent ; firewall-cmd --reload

nano /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

dnf install nginx -y
systemctl enable nginx --now ; systemctl status nginx

python -V
dnf install python3-pip -y
mkdir jupyterlab ; cd ~/jupyterlab
python3 -m venv --system-site-packages jupyterlab_env
source jupyterlab_env/bin/activate
pip install --upgrade pip
pip install jupyterlab

python3 -c "from jupyter_server.auth import passwd; print(passwd('YOUR_PASSWORD'))"
jupyter lab --generate-config
nano ~/.jupyter/jupyter_lab_config.py
c.ServerApp.allow_remote_access = True
c.ServerApp.password = 'YOUR_PASSWORD'
=8$jAJtckno+4fUhJ7nXWbR+w$kaMe/LaitfDs7vRKLEVRrb08WNiMZEAhXHGjfIbgtkU

firewall-cmd --add-port=8888/tcp --permanent ; firewall-cmd --reload
jupyter lab --ip 0.0.0.0 --allow-root
http://127.0.0.1:8888/
deactivate
__________________________________________________________________________________________________________________________________

Sunday, January 8, 2023

How To Install and Secure MongoDB on Oracle Linux Server 9

 MongoDB is an object-oriented, schema-less, NoSQL database server used in developing modern dynamic apps.
__________________________________________________________________________________________________________________________________
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

nano /etc/yum.repos.d/mongodb-org-4.4.repo     [ Latest Repo - https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-red-hat/ ]
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc

dnf install mongodb-org -y
systemctl start mongod ; systemctl enable mongod ; mongod --version

Configure MongoDB -
nano /etc/mongod.conf
security:
 authorization: enabled
systemctl restart mongod

Create an Admin User for MongoDB -
mongosh    Or mongosh "mongodb://localhost:27017"
use admin

db.createUser(
{
user: "mongoadmin",
pwd: passwordPrompt(),
roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
}
)

exit
systemctl restart mongod
mongosh --port 27017 --authenticationDatabase "admin" -u "mongoadmin" -p



Create a Database in MongoDB- --
use wpdb
db.person.insertOne(
  { "Anant" : "31",
   "Test" : "8",
   "Test Two" : "18"
  }
)
db
show collections
db.person.find()
use admin
db.getUsers()
__________________________________________________________________________________________________________________________________

rm -rf mongod.lock rm -rf /tmp/mongodb-27017.sock

Sunday, December 11, 2022

How To Install InfluxDB and Telegraf on Oracle Linux Server 9

 InfluxDB is an open-source time series database (TSDB) developed by the company InfluxData.
Telegraf is a server-based agent for collecting and sending all metrics and events from databases, systems, and IoT sensors.
__________________________________________________________________________________________________________________________________
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

cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = influxdb Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF

sudo dnf install influxdb2
sudo systemctl start influxdb ; sudo systemctl enable influxdb ; sudo systemctl status influxdb
sudo firewall-cmd --add-port=8086/tcp --permanent ; sudo firewall-cmd --reload ; sudo firewall-cmd --list-ports
sudo dnf install influxdb2-cli -y
which influx ; influx version

sudo influx completion bash > /etc/bash_completion.d/influx.sh
sudo chmod +x /etc/bash_completion.d/influx.sh
sudo influx TAB
sudo influx setup
sudo influx user list
sudo influx auth list

export INFLUX_TOKEN=OK15O5laLtEr88RFtLE9xtVAN7cNCieQFT_YJ2FYEC5T-fYcZkGyp1A7e_vjhIXUKZDBktaPdH0GUmlVQDzsDQ==
sudo influx v1 shell $INFLUX_TOKEN
show DATABASES
http://192.168.5.100:8086)
alice
__________________________________________________________________________________________________________________________________

Sunday, October 9, 2022

HAProxy: Configure HTTP Load Balancing Server in Rocky Linux 8.5

 in This Tutorial you will Learn " HAProxy: Configure HTTP Load Balancing Server in Rocky Linux 8.5"

HAProxy is a free and open source software that provides a high availability load balancer and proxy server for TCP and HTTP-based applications that spreads requests across multiple servers. It is written in C and has a reputation for being fast and efficient.
-----------+---------------------------+--------------------------+-------------
           |                           |                          |
           |192.168.1.20                    |192.168.1.80                 |192.168.1.70
+----------+-----------+   +-----------+----------+   +-----------+----------+
|   [ www.primaryhost.com ]  |     | [ www.tertiary.com ] |   | [ www.example.com ] |
|        HAProxy       |                           Web Server#1    |         Web Server#2    |
_________________________________________________________________________________________
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 -y install haproxy
gedit /etc/haproxy/haproxy.cfg &>/dev/null
frontend http-in
    # listen 80 port
    bind *:80
    # set default backend
    default_backend    backend_servers
    # send X-Forwarded-For header
    option             forwardfor

backend backend_servers
    # balance with roundrobin
    balance            roundrobin
    # define backend servers
    server             node01 192.168.1.80:80 check
    server             node02 192.168.1.70:80 check
systemctl enable --now haproxy ; systemctl daemon-reload ; systemctl restart haproxy
systemctl status firewalld
________________________________________________________________________________________
Backends Web server 1-
cat /etc/system-release ; sestatus ; hostname ; hostname -I
dnf install httpd -y
gedit /etc/httpd/conf/httpd.conf &>/dev/null
LogFormat "\"%{X-Forwarded-For}i\" %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
systemctl restart httpd
echo "<h1>This is a Test Page www.tertiary.com</h1>" > /var/www/html/index.html
_________________________________________________________________________________________
Backends Web server 2-
cat /etc/system-release ; sestatus ; hostname ; hostname -I
yum install httpd -y
gedit /etc/httpd/conf/httpd.conf &>/dev/null
LogFormat "\"%{X-Forwarded-For}i\" %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
systemctl restart httpd
echo "<h1>This is a Test Page www.example.com</h1>" > /var/www/html/index.html
_________________________________________________________________________________________