How to set a static IP address in RHEL8

How to set a static IP address in RHEL8
# get the current connection name
[root@localhost ~]# nmcli con show
NAME UUID TYPE DEVICE
ens160 6b0e7866-7d4f-4668-afbf-a485f9a1e6db ethernet ens160

# Note the NAME of the connection
# To see what IP, gateway and DNS you are currently using do
[root@localhost ~]# nmcli con show ens160 | grep ipv4
ipv4.method: auto
ipv4.dns: 8.8.4.4
ipv4.addresses: 192.168.0.33/32
ipv4.gateway: 192.168.0.1

# If that doesn’t show the information you need, try this command instead:
[root@localhost ~]# nmcli con show ens160 | grep IP4
IP4.ADDRESS[1]:
IP4.GATEWAY[1]:
IP4.DNS[1]:
IP4.DNS[2]:
# set a static IP of 192.168.0.33
[root@localhost ~]# nmcli con mod ens160 ipv4.address 192.168.0.33 ipv4.gateway 192.168.0.1 ipv4.dns 8.8.4.4 ipv4.method manual
# apply new settings to device
[root@localhost ~]# nmcli dev reapply ens160
NOTE : Your connection name, IP address, gateway and DNS information will probably be different to the above, so change it where necessary.

Installing Visual Studio Code on RHEL

RHEL, Fedora, and CentOS based distributions
We currently ship the stable 64-bit VS Code in a yum repository, the following script will install the key and repository:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'

Then update the package cache and install the package using dnf (Fedora 22 and above):
sudo dnf check-update
sudo dnf install code


Or on older versions using yum:
yum check-update
sudo yum install code


Due to the manual signing process and the system we use to publish, the yum repo may lag behind and not get the latest version of VS Code immediately

RHEL Subscriptions


To be able to use YUM on an RHEL server you need to register it with the RedHat servers.
NB: You can do this with a Developer account, which is free!
First register the system
# subscription-manager register --auto-attach
that enter your username and password.
or add --username=<username> --password=<password> onto the end of the above command
 
Next attach a subscription
# subscription-manager list --available | awk '/Pool/ { system ("subscription-manager attach --pool="$3) }'
or
# subscription-manager attach --auto
Once you are done, you can remove the subscription and server from their systems.
To remove a system from a RHEL subscription you first have to run,
# subscription-manager list --consumed
to get the serial number. Then pass that serial number to the remove command
# subscription-manager remove --serial=XXXXXXX
OR
you can run this command, which does both
# subscription-manager list --consumed | awk '/Serial:/ { system ("subscription-manager remove --serial="$2) }'