0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS7での初期環境設定

Posted at

CentOS7での初期環境設定

前提

初期設定は、すべてrootユーザを使用して実行する。

ホスト名の変更

ホスト名変更は、今まで/etc/sysconfig/network等に定義していたが、hostnamectlへ移行した。

# hostanmectl set-hostname ${hostname}
example.command
# hostnamectl set-hostname new_host

タイムゾーンの変更

タイムゾーンは、/usr/share/zoneinfo配下にある、各々のゾーンファイルを/etc/localtimeへ置き換える形で変更していたが、timedatectlへ移行した。

# timedatectl list-timezones # タイムゾーンの一覧表示
# timedatectl set-timezones ${timezone}
example.command
# timedatectl set-timezones Asia/Tokyo

localeの変更

localeは、/etc/sysconfig/i18nや/etc/sysconfig/keyboardへ定義していたが、localectlへ移行した。

# localectl list-locales # localeの一覧表示
# localectl set-locale LANG=${locale}
example.command
# localectl set-locale LANG=ja_JP.utf8

iptablesの設定変更

iptablesは、/etc/iptablesなどに直接定義を記述する、または、iptablesコマンドを使用していたが、firewall-cmdへ移行した。

# firewall-cmd --state # 起動確認
# firewall-cmd --reload # 定義反映
# firewall-cmd --add-port=${port_num}/${protocol} # 対象ポートの許可

httpプロトコルの許可を代表として記載

exmaple.command
# firewall-cmd --add-service=http --permanent # httpプロトコル(デフォルト)の解放
# firewall-cmd --add-port=3000/tcp --permanent # port=3000の解放

※ firewall-cmdは、機能が多彩なため、別途書籍等で学習するのが良い。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?