Discover DevOps roles and learn Linux from basics to advanced at DevOpsRoles.com. Detailed guides and in-depth articles to master Linux for DevOps careers.
In this tutorial, How to Install JDK on CentOS step by step. How to switch between JDK 7 and JDK 8?
Precondition
Open the terminal and log in as root or you use sudo before each command with another user.
Working on a Linux system operating: Centos/REHL
Search for JDK on CentOS
You use the command below to search the packages
$ yum search openjdk
The output terminal console as below
Install JDK 1.8
$ sudo yum install java-1.8.0-openjdk
Confirmation is complete when the installed Java version is displayed.
$ java --version
# Output
# openjdk version "1.8.0_212"
# OpenJDK Runtime Environment (build 1.8.0_212-b04)
# OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
How to switch JDK 7 to JDK 8
Use the command “sudo alternatives –config java” to switch to JDK.
How to switch JDK 8 to JDK 7
Conclusion
Through the article, How to Install JDK on CentOS step by step. How to switch between JDK 7 and JDK 8? as above. I hope will this your helpful. Thank you for reading the DevopsRoles page!
In this tutorial, How to install on Linux. is part of the bind-utils package. The package bind-utils is not yet installed on Linux, then you type command not found on Linux.
To install nslookup on Linux, you need to install the dnsutils package, which contains the nslookup utility. The process for installing the package can vary depending on the Linux distribution you are using. Here are the commands for some popular distributions:
Once the installation is complete, you can use nslookup from the command line.
[vagrant@DevopsRoles ~]$ nslookup x.x.x.x
Conclusion
In this guide, we have covered how to install and use the nslookup command on Linux, specifically for CentOS and Ubuntu. Whether you’re troubleshooting DNS issues or simply querying domain name records, nslookup is a powerful and essential tool for network administrators and IT professionals.
By following the simple installation steps, you can quickly enable nslookup on your system and start resolving domain names with ease. If you encounter any issues, ensure that your system’s package manager is up to date and that you have the necessary permissions to install packages.
We hope this guide has been helpful! If you have any questions or need further assistance, feel free to leave a comment or check out our other Linux tutorials. Thank you for reading the DevopsRoles page!
In this tutorial, How to install Prometheus on RHEL / CentOS 7. Prometheus is an open-source applications and microservices. Prometheus releases Github
cd /tmp
export RELEASE=2.8.1
wget https://github.com/prometheus/prometheus/releases/download/v${RELEASE}/prometheus-${RELEASE}.linux-amd64.tar.gz
tar xvf prometheus-${RELEASE}.linux-amd64.tar.gz
cd prometheus-${RELEASE}.linux-amd64/
Copy Prometheus binary, consoles and console_libraries
# Global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
scrape_timeout: 15s # scrape_timeout is set to the global default (10s).
# A scrape configuration containing exactly one endpoint to scrape:# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
In this tutorial, How to install InfluxDB on RHEL / Centos 7. InfluxDB is an open-source time-series database. It is High availability storage and optimized for fast and metrics analysis.
To install InfluxDB on RHEL/CentOS 7, you can follow the steps below:
Install InfluxDB on RHEL / Centos 7
First, You add InfluxDB repository to your system using the command below
[vagrant@DevopsRoles ~]$ sudo vi /etc/yum.repos.d/influxdb.repo
[vagrant@DevopsRoles ~]$ curl -XPOST "http://localhost:8086/query" --data-urlencode "q=CREATE USER \
username WITH PASSWORD 'password' WITH ALL PRIVILEGES"
You need to run any Influxdb commands on the terminal with a specific username and password.
In this tutorial, I will quickly guide create user and group in Linux. How to add a user to a group in Linux. How to create users has permission or user no has permission.
Using command to create the and command to create the in Linux system.
How to create user and group in Linux
create group new in Linux
use groupadd command as below
$ sudo groupadd -g 2000 common # group common no has sudo permission
$ sudo groupadd -g 2001 dev # group dev has sudo permission
$ sudo groupadd -g 1100 IT
Create user new in Linux
For example, user user01 no has permission and user has permission
In this tutorial, I will change timezone in Linux by command line. How to change the to your current time zone.
The location of the local time file in Linux is /etc/localtime.
Timezone files are located in /usr/share/zoninfo/
To change the timezone in the Linux command line, you can use the methods below, which are available on most modern Linux distributions. Here’s how you can do it:
How to Change Timezone in Linux with Two Methods.
Method 1: I will copy from /usr/share/zoneinfo/Asia/Ho_Chi_Minh to /etc/localtime
In this tutorial, How to configure a static IP address on Linux. Step by step to make a static IP address on Linux.
Note: To change the network setting a good idea to make a copy of any configured file before your changes.
Configure a static IP address on Linux
For RHEL 8
How to configure a static IP address on an RHEL system. using command shown list network connections and devices on the system.
$ nmcli dev status
Now, To change the network interface from dynamic to static, you need to edit the file in folder “/etc//network-scripts”. In this example, I will create new file -Comtrend7FB9
Configuring a static IP address as below
HWADDR=7C:67:2A:CC:DF:8F
ESSID=Comtrend7FB9
MODE=Managed
KEY_MGMT=WPA-PSK
SECURITYMODE=open
MAC_ADDRESS_RANDOMIZATION=default
TYPE=Wireless
IPADDR=192.168.3.4 # Ip address static for Linux server
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=Comtrend7FB9
UUID=3f5a6317-27c7-249f-bfaa-1d2fa5283482
ONBOOT=yes
Restarting NetworkManager.
$ sudo systemctl restart NetworkManager
For Ubuntu 18.10
Using (network manager command-line interface) command to list the network interface on Ubuntu server.
$ nmcli d
For example, configure a static IP address on the Ubuntu system.
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp0s25
iface enp0s25 inet static
address 192.168.3.4
netmask 255.255.255.0
network 192.168.3.1
broadcast 192.168.3.255
Restart the networking service.
$ sudo systemctl restart NetworkManager.service
Configure Static IP On CentOS 6
You can update/edit as follow static IP configure. For example, I will update for eth0 interface network.
HWADDR=00:08:A2:0B:BA:B7
TYPE=Ethernet
BOOTPROTO=none
# IP static for Server #
IPADDR=192.168.3.4
# Subnet #
PREFIX=24
# Set default gateway IP for server #
GATEWAY=192.168.3.1
# Set dns servers #
DNS1=192.168.3.1
DNS2=8.8.8.8
DNS3=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
# Disable ipv6 #
IPV6INIT=no
NAME=eth0
# This is system specific and can be created using 'uuidgen eth0' command #
UUID=31171a6f-bcg1-44de-8h6e-cf8e782f8bd6
DEVICE=eth0
ONBOOT=yes
Save and close the file. you need to restart the service network to apply the configure for the eth0 interface network.
$ sudo systemctl restart network
Conclusion
You have configure a static IP address on Linux. I hope will this your helpful. Thank you for reading the DevopsRoles page!