Сменить hostname oracle linux

Learn How to Localize Your Installation on Oracle Linux

Many Oracle Linux systems are installed without a desktop environment. However, multiple ways of using the command line are available to configure base system settings, such as the system hostname.

This tutorial describes how to configure the system hostname, locale, language, and date and time from the command line. This tutorial is targeted at users of Oracle Linux 8 or later.

Objectives

Upon completion of this Lab you will be able to:

  • Set the system host name
  • Set the system locale and system language
  • Set the system date, time and time zone

Prerequisites

Update the System Hostname

Note: When using the free lab environment, see Oracle Linux Lab Basics for connection and other usage instructions.

In other distributions, configuring the system hostname typically involves editing system files, such as /etc/hostname and /etc/hosts , running the hostname command to set the hostname, and rebooting the system. With Oracle Linux, the process is simplified through the hostnamectl command.

    Review the static and transient hostnames for your Oracle Linux 8 system:

Note: The static hostname is the default host name for the system and is configured in the /etc/hostname file. The transient hostname represents the name that is set for the system by services such as DHCP or mDNS after a system boot. If the transient hostname is not set, the system uses the static hostname.

sudo hostnamectl set-hostname myoracle.oraclehost 
sudo hostnamectl set-hostname --pretty "My Oracle Linux 8 Server" 

Note: A pretty hostname is a friendly free-form system name that is displayed in user interface environments. Normally, the transient hostname and the pretty hostname are identical. However, with the hostnamectl command, you can set different values for each.

Update the System Locale and Language

Use the localectl command to set the default system locale and language settings. The command handles the generation of locale information and sets the default values for users when they log into the system, either throught the command line or on a desktop environment. The command can also be used to set default keyboard mappings for both the command line and the desktop environment.

Читайте также:  Мой ip linux terminal

    Review the current system locale:

sudo localectl list-locales 
sudo localectl set-locale en_GB.utf8 

Note: The system locale defines the language and character set encoding used for presentation of information on a terminal and on many GUI applications as well. Locale options are usually listed in the following format LANGUAGE_COUNTRY.CODESET[@MODIFIERS] . The LANGUAGE is an ISO 639 language code, for example en for English; COUNTRY is an ISO 3166 country code, for example GB for Great Britain and the United Kingdom; CODESET is the character set or encoding, for example utf-8 . Thus, in this example, the locale is en_GB.utf8 .

sudo localectl list-keymaps 
sudo localectl set-keymap gb 

Note: A locale can also be configured for a specific sessions or user. For session-based configurations, set the LANG environment variable. For user-based configurations, set the LANG variable on the user’s profile or shell configuration. Thus, the environment variable is set each time a user logs into the system.

Update the System Date and Time

Use the timedatectl command to set the system date and time. The command updates the real time clock (RTC), also known as the hardware clock, as well as the system clock that is maintained by the system kernel.

    Review the current system date and time configuration:

sudo timedatectl list-timezones 
sudo timedatectl list-timezones | grep 'Los_Angeles' 
sudo timedatectl set-timezone America/Los_Angeles 
sudo timedatectl set-time '2100-01-01 00:00:00' 

Note: If the NTP service is set to active, your system’s date and time are automatically synchronized with the configured NTP server. In that scenario, you cannot directly modify the date or time on your system.

For More Information

Learn how to use chrony to synchronize the system date and time over the network: https://docs.oracle.com/en/learn/config_chrony_linux_8/

The video demonstration and tutorial provided at https://www.youtube.com/watch?v=q8VlYiF5sx8 is also useful if you need more information on configuring the date and time from the command line interface.

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.

Learn How to Localize Your Installation on Oracle Linux

Copyright © 2021, Oracle and/or its affiliates.

Источник

Learn How to Localize Your Installation on Oracle Linux

Many Oracle Linux systems are installed without a desktop environment. However, multiple ways of using the command line are available to configure base system settings, such as the system hostname.

This tutorial describes how to configure the system hostname, locale, language, and date and time from the command line. This tutorial is targeted at users of Oracle Linux 8 or later.

Читайте также:  Linux серийный номер памяти

Objectives

Upon completion of this Lab you will be able to:

  • Set the system host name
  • Set the system locale and system language
  • Set the system date, time and time zone

Prerequisites

Update the System Hostname

Note: When using the free lab environment, see Oracle Linux Lab Basics for connection and other usage instructions.

In other distributions, configuring the system hostname typically involves editing system files, such as /etc/hostname and /etc/hosts , running the hostname command to set the hostname, and rebooting the system. With Oracle Linux, the process is simplified through the hostnamectl command.

    Review the static and transient hostnames for your Oracle Linux 8 system:

Note: The static hostname is the default host name for the system and is configured in the /etc/hostname file. The transient hostname represents the name that is set for the system by services such as DHCP or mDNS after a system boot. If the transient hostname is not set, the system uses the static hostname.

sudo hostnamectl set-hostname myoracle.oraclehost 
sudo hostnamectl set-hostname --pretty "My Oracle Linux 8 Server" 

Note: A pretty hostname is a friendly free-form system name that is displayed in user interface environments. Normally, the transient hostname and the pretty hostname are identical. However, with the hostnamectl command, you can set different values for each.

Update the System Locale and Language

Use the localectl command to set the default system locale and language settings. The command handles the generation of locale information and sets the default values for users when they log into the system, either throught the command line or on a desktop environment. The command can also be used to set default keyboard mappings for both the command line and the desktop environment.

    Review the current system locale:

sudo localectl list-locales 
sudo localectl set-locale en_GB.utf8 

Note: The system locale defines the language and character set encoding used for presentation of information on a terminal and on many GUI applications as well. Locale options are usually listed in the following format LANGUAGE_COUNTRY.CODESET[@MODIFIERS] . The LANGUAGE is an ISO 639 language code, for example en for English; COUNTRY is an ISO 3166 country code, for example GB for Great Britain and the United Kingdom; CODESET is the character set or encoding, for example utf-8 . Thus, in this example, the locale is en_GB.utf8 .

sudo localectl list-keymaps 
sudo localectl set-keymap gb 

Note: A locale can also be configured for a specific sessions or user. For session-based configurations, set the LANG environment variable. For user-based configurations, set the LANG variable on the user’s profile or shell configuration. Thus, the environment variable is set each time a user logs into the system.

Update the System Date and Time

Use the timedatectl command to set the system date and time. The command updates the real time clock (RTC), also known as the hardware clock, as well as the system clock that is maintained by the system kernel.

Читайте также:  Объединение содержимого файлов linux

    Review the current system date and time configuration:

sudo timedatectl list-timezones 
sudo timedatectl list-timezones | grep 'Los_Angeles' 
sudo timedatectl set-timezone America/Los_Angeles 
sudo timedatectl set-time '2100-01-01 00:00:00' 

Note: If the NTP service is set to active, your system’s date and time are automatically synchronized with the configured NTP server. In that scenario, you cannot directly modify the date or time on your system.

For More Information

Learn how to use chrony to synchronize the system date and time over the network: https://docs.oracle.com/en/learn/config_chrony_linux_8/

The video demonstration and tutorial provided at https://www.youtube.com/watch?v=q8VlYiF5sx8 is also useful if you need more information on configuring the date and time from the command line interface.

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.

Learn How to Localize Your Installation on Oracle Linux

Copyright © 2021, Oracle and/or its affiliates.

Источник

Changing the HOSTNAME on Oracle Enterprise Linux

Either due to cloning or corporate naming standards, you may find the need to change the hostname of an Oracle Enterprise Linux System.

The current hostname for this machine is odlinux.oracledistilled.com and it will be changed to secondary.oracledistilled.com. The hostname can be changed by editing /etc/sysconfig/network as the root user.

[root@odlinux ~]# hostname Odlinux.oracledistilled.com [root@odlinux ~]# cat /etc/sysconfig/network NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=odlinux.oracledistilled.com [root@odlinux ~]# [root@odlinux ~]# cat /etc/sysconfig/network NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=secondary.oracledistilled.com [root@odlinux ~]#

After changing the hostname in you should also change the hostname in /etc/hosts .

[root@secondary ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 192.168.4.111 wrath.oracledistlled.com wrath 192.168.4.115 secondary.oracledistilled.com secondary ::1 localhost6.localdomain6 localhost6 [root@secondary ~]#

While changing the host name is fairly easy care should be taken with applications that might already be installed on the system. Many applications will store the hostname of the system in configuration and start up files at the time of installation. You should check your applications and update their configurations with the new hostname.

Источник

Оцените статью
Adblock
detector