CentOS

備忘録:CentOS7 最初にやること

More than 1 year has passed since last update.

概要

毎回忘れるので、備忘録として残しています。

タイムゾーン変更

今のタイムゾーンを確認

$ sudo timedatectl

      Local time: Fri 2017-09-15 09:12:41 UTC
  Universal time: Fri 2017-09-15 09:12:41 UTC
        RTC time: Fri 2017-09-15 09:12:40
       Time zone: UTC (UTC, +0000)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

タイムゾーンを日本に変更

$ sudo timedatectl set-timezone Asia/Tokyo

再度タイムゾーンを確認

$ sudo timedatectl

      Local time: Fri 2017-09-15 18:12:55 JST
  Universal time: Fri 2017-09-15 09:12:55 UTC
        RTC time: Fri 2017-09-15 09:12:54
       Time zone: Asia/Tokyo (JST, +0900)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

ロケールを変更

今のロケールを確認

$ sudo localectl

   System Locale: LANG=en_US.UTF-8
       VC Keymap: us
      X11 Layout: us

ロケールをja_JP.utf8に変更

$ sudo localectl set-locale LANG=ja_JP.utf8

再度ロケールの確認

$ sudo localectl

   System Locale: LANG=ja_JP.utf8
       VC Keymap: us
      X11 Layout: us

SELinuxを無効にする

SELinuxの確認

$ getenforce

Enforcing

viで設定ファイルを開く

$ sudo vi /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

SELINUX=disabled に変更する

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled  # ← disabled に変更
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

サーバーを再起動する

$ sudo reboot

SELinuxが無効になったことを確認

$ getenforce

Disabled

以上