| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

「CentOS7」の版間の差分

提供: MyMemoWiki
ナビゲーションに移動 検索に移動
 
1行目: 1行目:
==CentOS7==
+
==[[CentOS7]]==
 
[[CentOS]] |  
 
[[CentOS]] |  
  
===CentOS 初期設定===
+
===[[CentOS 初期設定]]===
*CentOS 初期設定
+
*[[CentOS 初期設定]]
==Tips==
+
==[[Tips]]==
==Service==
+
==Ser[[vi]]ce==
 
===systemctl===
 
===systemctl===
 
====稼働中のサービス====
 
====稼働中のサービス====
  systemctl list-units --type=service
+
  systemctl list-units --type=ser[[vi]]ce
 
====定義されているサービス====
 
====定義されているサービス====
  systemctl list-unit-files --type=service
+
  systemctl list-unit-files --type=ser[[vi]]ce
 
====サービス状態====
 
====サービス状態====
 
  systemctl status [サービス]
 
  systemctl status [サービス]
60行目: 60行目:
 
  export LANG
 
  export LANG
  
====ユーザーディレクトリを英語に変更====
+
====ユーザーディレクトリを[[英語]]に変更====
  
 
  $ LANG=C xdg-user-dirs-gtk-update
 
  $ LANG=C xdg-user-dirs-gtk-update
73行目: 73行目:
 
====確認====
 
====確認====
 
  # ip address
 
  # ip address
  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
+
  1: lo: <LOOPBACK,UP,LOWE[[R]]_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
 
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
 
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
 
     inet 127.0.0.1/8 scope host lo
 
     inet 127.0.0.1/8 scope host lo
79行目: 79行目:
 
     inet6 ::1/128 scope host
 
     inet6 ::1/128 scope host
 
         valid_lft forever preferred_lft forever
 
         valid_lft forever preferred_lft forever
  2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
+
  2: enp0s3: <B[[R]]OADCAST,MULTICAST,UP,LOWE[[R]]_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
 
     link/ether 08:00:27:f5:18:8e brd ff:ff:ff:ff:ff:ff
 
     link/ether 08:00:27:f5:18:8e brd ff:ff:ff:ff:ff:ff
 
     inet 192.168.0.35/24 brd 192.168.0.255 scope global dynamic enp0s3
 
     inet 192.168.0.35/24 brd 192.168.0.255 scope global dynamic enp0s3
96行目: 96行目:
  
 
====ファイアーウォールの設定====
 
====ファイアーウォールの設定====
  # firewall-cmd --permanent --zone=public --add-service=http
+
  # firewall-cmd --permanent --zone=public --add-ser[[vi]]ce=http
 
  success
 
  success
  # firewall-cmd --permanent --zone=public --add-service=https
+
  # firewall-cmd --permanent --zone=public --add-ser[[vi]]ce=https
 
  success
 
  success
 
  # firewall-cmd --reload
 
  # firewall-cmd --reload
118行目: 118行目:
 
  # firewall-cmd --reload
 
  # firewall-cmd --reload
 
  success
 
  success
====HTTPを許可====
+
====[[HTTP]]を許可====
  # firewall-cmd --add-service=http --zone=public --permanent
+
  # firewall-cmd --add-ser[[vi]]ce=http --zone=public --permanent
 
  # firewall-cmd --reload
 
  # firewall-cmd --reload
===SELinux===
+
===SE[[Linux]]===
 
====無効化====
 
====無効化====
 
*/etc/selinux/config
 
*/etc/selinux/config
151行目: 151行目:
 
  +-----------------+
 
  +-----------------+
  
===PHPのインストール===
+
===[[PHP]]のインストール===
*PHP
+
*[[PHP]]

2020年2月16日 (日) 04:23時点における最新版

CentOS7

CentOS |

CentOS 初期設定

Tips

Service

systemctl

稼働中のサービス

systemctl list-units --type=service

定義されているサービス

systemctl list-unit-files --type=service

サービス状態

systemctl status [サービス]
systemctl is-enabled [サービス]
option 意味
is-active Check whether units are active
is-enabled Check whether unit files are enabled
is-failed Check whether units are failed

run level の変更

run level 説明 コマンド
1 シングルユーザモード systemctl set-default rescue.target
3 CLI マルチユーザモード systemctl set-default multi-user.target
5 GUI マルチユーザモード systemctl set-default graphical.target


GUI

シェルを実行するとエディタが開いてしまう。

  • ファイルを選択、メニュー - ファイル - 設定 - 動作 から 実行可能ファイルは実行するにチェック

0312 centos7 shell run gui.jpg

日本語表示

~/.bash_profile の末尾に以下を記述

LANG=ja_JP.UTF-8
export LANG

ユーザーディレクトリを英語に変更

$ LANG=C xdg-user-dirs-gtk-update

ネットワーク

設定系コマンド

  • nmcli
  • nmtui
  • rfkill

メールサーバー構築

IPアドレス

確認

# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:f5:18:8e brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.35/24 brd 192.168.0.255 scope global dynamic enp0s3
       valid_lft 85143sec preferred_lft 85143sec
    inet6 2402:6b00:3498:1a00:a00:27ff:fef5:188e/64 scope global noprefixroute dynamic
       valid_lft 260sec preferred_lft 260sec
    inet6 fe80::a00:27ff:fef5:188e/64 scope link
       valid_lft forever preferred_lft forever

設定変更

# nmtui

Httpdのインストール

インストール

# yum install httpd
# systemctl start httpd
# systemctl enable httpd

ファイアーウォールの設定

# firewall-cmd --permanent --zone=public --add-service=http
success
# firewall-cmd --permanent --zone=public --add-service=https
success
# firewall-cmd --reload
success

https

Host名の変更

# hostnamectl set-hostnamee [hostname]

ランレベルの切り替え

ランレベル3
# systemctl set-default multi-user.target
ランレベル5
# systemctl set-default graphical.target

Firewall

ポート開放

# firewall-cmd --permanent --zone=public --add-port=3306/tcp
success
# firewall-cmd --reload
success

HTTPを許可

# firewall-cmd --add-service=http --zone=public --permanent
# firewall-cmd --reload

SELinux

無効化

  • /etc/selinux/config
#SELINUX=enforcing
SELINUX=disabled

SSH認証用KEY作成

[piroto@ganzin ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/piroto/.ssh/id_rsa):
Created directory '/home/piroto/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/piroto/.ssh/id_rsa.
Your public key has been saved in /home/piroto/.ssh/id_rsa.pub.
The key fingerprint is:
c7:75:49:7e:b7:db:6c:09:aa:1d:3f:90:75:34:75:fe piroto@ganzin
The key's randomart image is:
+--[ RSA 2048]----+
|              . +|
|             o =.|
|            . = =|
|         . . o o+|
|        S o o...E|
|         . o. ..+|
|           o.  o+|
|          o o. . |
|         . . ..  |
+-----------------+

PHPのインストール