Friday, February 24, 2023

How To Install Squid Proxy Server with Squid Basic Authentication On Rocky Linux 8.5

in This Tutorial you will Learn " How To Install Squid Proxy Server with Squid Basic Authentication On Rocky Linux 8.5"

Squid is a web proxy application with a variety of configurations and uses. Squid has a large number of access controls and supports different protocols, such as HTTP, HTTPS, FTP, and SSL.

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 ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf -y install squid httpd-tools
gedit  /etc/squid/squid.conf &>/dev/null
acl my_localnet src 192.168.1.20/24                                                                         -29
http_access deny to_localhost                                                                                - 46
#http_access allow localnet                                                                                      -55
http_access allow my_localnet   # line 57 : add                                                       -57

request_header_access Referer deny all
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all
forwarded_for off

auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.htpasswd
auth_param basic children 5
auth_param basic realm Squid Basic Authentication
auth_param basic credentialsttl 5 hours
acl password proxy_auth REQUIRED
http_access allow password

systemctl enable --now squid ; systemctl start squid
firewall-cmd --add-service=squid ; firewall-cmd --runtime-to-permanent

htpasswd -c /etc/squid/.htpasswd rocky
systemctl daemon-reload ; systemctl restart squid.service
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Proxy Client -
cat /etc/system-release ; hostname -I ; dnf groupinstall "Development Tools" -y
192.168.1.20 3128  

curl -x http://192.168.1.20:3128 -I http://google.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Monday, February 13, 2023

How To Install Node.js npm ( Creating Sample app ) on Oracle Linux 9

 Node.js is a JavaScript runtime for server-side programming. It allows developers to create scalable backend functionality using JavaScript, a language many are already familiar with from browser-based web development.
NPM is an acronym for Node Package Manager, which is the default package manager for Node.JS and the richest repository for Node.JS packages.
__________________________________________________________________________________________________________________________________
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
curl -sL https://rpm.nodesource.com/setup_16.x | bash -
dnf install nodejs -y
node --version ; npm --version

Creating Sample app on Node.js
nano myapp.js
const http = require('http');

const hostname = '0.0.0.0';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World, running on NodeJS 1x');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

node myapp.js
http://127.0.0.1:3000
_________________________________________________________________________________________________________________________________


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
__________________________________________________________________________________________________________________________________

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
__________________________________________________________________________________________________________________________________