Skip to content

DevOps

How to remove unnecessary Package in Oracle Linux Server

List Installed Packages

Before uninstalling, check which packages are installed:

dnf list installed
or for older versions:

rpm -qa

Identify Unnecessary Applications

  • Use dnf list installed to find applications you don’t need

  • Check running services:

    systemctl list-units --type=service --state=running
    

  • Use ps aux or top to find unnecessary processes.

Remove Applications Using dnf

For newer Oracle Linux versions (8+), use:

sudo dnf remove package_name -y

For example:

sudo dnf remove httpd -y  # Removes Apache HTTP Server
sudo dnf remove libreoffice* -y  # Removes LibreOffice and related packages

To remove multiple packages at once:

sudo dnf remove package1 package2 package3 -y

Remove Applications Using rpm (If dnf Is Not Available)

sudo rpm -e package_name
If dependencies prevent removal, force it with:

sudo rpm -e --nodeps package_name

Remove Unused Dependencies

After uninstalling, clean up unused packages:

sudo dnf autoremove -y

Disable and Remove Unnecessary Services

  • Disable a service before removing it
sudo systemctl disable service_name --now
  • Check if the service is disabled:
systemctl status service_name
  • Remove the service package:

sudo dnf remove package_name -y
For example, to remove firewalld:

sudo systemctl disable firewalld --now
sudo dnf remove firewalld -y

Clear Cache and Free Up Space

After removing applications, clean up system cache:

sudo dnf clean all
sudo rm -rf /var/cache/dnf/*

Check disk usage:

df -h

How to tune Oracle Linux Server Performance

Update System Packages

Keep your system and kernel updated

sudo dnf update -y

Optimize Kernel Parameters

Modify sysctl.conf for better memory and network performance

sudo vi /etc/sysctl.conf
Add or modify these lines:
vm.swappiness=10
vm.dirty_ratio=20
vm.dirty_background_ratio=10
net.core.somaxconn=1024
net.ipv4.tcp_max_syn_backlog=2048

Apply changes without rebooting:

sudo sysctl -p

Enable Performance Profiles

Use tuned to apply performance optimizations

sudo dnf install tuned -y
sudo systemctl enable --now tuned
sudo tuned-adm profile throughput-performance

Optimize Disk I/O

Set the correct I/O scheduler for SSD:

echo "none" | sudo tee /sys/block/sd*/queue/scheduler

Use iotop to monitor disk usage:

sudo dnf install iotop -y
sudo iotop

Optimize Memory Usage

Increase file descriptors limit:

sudo vi /etc/security/limits.conf
Add:

* soft nofile 65535
* hard nofile 65535

Reduce swapping:

sudo sysctl -w vm.swappiness=10

Optimize Network Performance

Enable TCP Fast Open:

sudo sysctl -w net.ipv4.tcp_fastopen=3
Increase connection tracking limit:

sudo sysctl -w net.netfilter.nf_conntrack_max=100000

Use Oracle Linux UEK (Unbreakable Enterprise Kernel)

Check if you're using UEK:

uname -r
If not, install and enable it:

sudo dnf install kernel-uek -y
sudo grubby --set-default /boot/vmlinuz-$(ls /boot | grep uek | tail -1)
sudo reboot

Disable Unnecessary Services

List enabled services:

sudo systemctl list-unit-files --type=service | grep enabled
Disable unused services:

sudo systemctl disable servicename --now

Use Oracle Linux Ksplice (Live Kernel Patching)

Enables zero-downtime kernel patching:

sudo dnf install ksplice-uptrack -y
sudo systemctl enable --now uptrack

Monitor Performance

Use built-in tools:

top      # Process monitoring
htop     # Enhanced top (install with `sudo dnf install htop -y`)
iostat   # Disk I/O (install with `sudo dnf install sysstat -y`)
vmstat   # Memory and CPU stats

How to install icedtea-web with OpenJDK-8?

Java

sudo dnf update -y
sudo dnf install java-1.8.0-openjdk-devel -y
java -version

Find the Java Installation Path

sudo alternatives --config java

Set JAVA_HOME Environment Variable

/usr/lib/jvm/java-11-openjdk-11.0.16.1.1-1.el8_6.x86_64

vi ~/.bashrc
vi ~/.bash_profile
vi /etc/profile

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.16.1.1-1.el8_6.x86_64
export PATH=$JAVA_HOME/bin:$PATH
Verify the Setup

echo $JAVA_HOME
java -version

IcedTea-Web

sudo dnf install epel-release -y
sudo dnf install icedtea-web -y
javaws -viewer
javaws /path/to/application.jnlp
javaws URL 

JVM Settiing

javaws -viewer

How to setup Java Environment Variables

Windows

Download and Install Java

  • Download latest version or your required version Java (Java Oracle , OpenJDK)
  • Install on your system

Set JAVA_HOME and PATH

  • Right-click on This PC (or My Computer) and select Properties.
  • Click on Advanced system settings.
  • In the System Properties window, click Environment Variables.

Add JAVA_HOME:

  • Under System variables, click New.
  • Set Variable name as JAVA_HOME.
  • Set Variable value as the path where Java is installed. For example: C:\Program Files\Java\jdk-XX(replace XX with the version number).

Update PATH:

  • Under System variables, find the Path variable, select it, and click Edit.
  • Click New and add %JAVA_HOME%\bin

Verify Setup:

  • Open a new command prompt and type

java -version
javac -version
echo %JAVA_HOME%
- You should see the Java version and the JAVA_HOME path.

Windows

  • Right click on the 'My Computer' icon on your desktop and select 'Properties'.
  • Click the 'Advanced' tab.
  • Click the 'Environment Variables' button.
  • Click 'New'.
  • In the 'Variable name' field, enter 'JAVA_HOME'.
  • In the 'Variable value' field, enter the directory (including its full path) where you installed the JDK.
  • Restart the computer.

Linux

For your current user:

  • Open up a shell / terminal window
  • vi ~/.profile (replace vi with your favorite text editor)
  • Add export JAVA_HOME=/path/to/java/home/dir on its own line at the end of the file
  • Add export PATH=$JAVA_HOME/bin:$PATH on its own line immediately after
  • Save, and restart your shell
  • Running java -version should give you the desired results

For all users in the system:*

  • Open up a shell / terminal window
  • vi /etc/profile (replace vi with your favorite text editor)
  • Add export JAVA_HOME=/path/to/java/home/dir on its own line at the end of the file
  • Add export PATH=$JAVA_HOME/bin:$PATH on its own line immediately after
  • Save, and restart your shell
  • Running java -version should give you the desired results
  • If you are using a GUI, you may not need to open up the shell. Instead, you might be able to open the file directly in a graphical text editor.

Linux (Ubuntu or other distros):

Install Java

  • Install Java using the package manager for your Linux distribution:

    sudo apt update
    sudo apt install default-jdk
    

  • For specific versions (like OpenJDK 11), use:

sudo apt install openjdk-11-jdk

FAQ Setting JAVA_HOME

Rocky Linux yum update failed

 Curl error (28): Timeout was reached for https://mirrors.rockylinux.org/
[root@rocky ~]# yum update
Rocky Linux 9 - BaseOS                                                                                                                               0.0  B/s |   0  B     03:02
Errors during downloading metadata for repository 'baseos':
  - Curl error (28): Timeout was reached for https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=BaseOS-9 [Failed to connect to mirrors.rockylinux.org port 443: Connection timed out]
Error: Failed to download metadata for repo 'baseos': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=BaseOS-9 [Failed to connect to mirrors.rockylinux.org port 443: Connection timed out]

Solution

  1. Stop the system firewall
`systemctl status firwalld

java vs javaw vs javaws

java: Java application executor which is associated with a console to display output/errors

javaw: (Java windowed) application executor not associated with console. So no display of output/errors. It can be used to silently push the output/errors to text files. It is mostly used to launch GUI-based applications.

javaws: (Java web start) to download and run the distributed web applications. Again, no console is associated.

All are part of JRE and use the same JVM.

Difference between java, javaw, javaws and javac

https://javapapers.com/core-java/java-vs-javaw-vs-javaws/

What is the difference between 'java', 'javaw', and 'javaws'?

JDK VS JRE VS JVM

JDK is the development platform, while JRE is for execution. JVM is the foundation, or the heart of the Java programming language, and ensures the program's Java source code will be platform-agnostic. JVM is included in both JDK and JRE—Java programs won't run without it.