Red Hat Enterprise Linux 5、6、7、および 8 で一般的な管理コマンド
更新 -
システムに関する基本的なコマンド
| タスク | RHEL5 | RHEL6 | RHEL7 | RHEL8 |
|---|---|---|---|---|
| サブスクリプション情報の表示 | /etc/sysconfig/rhn/systemid | /etc/sysconfig/rhn/systemid subscription-manager identity |
subscription-manager identity | |
| サブスクリプションの設定 | rhn_register1 | rhn_register rhnreg_ks subscription-manager |
subscription-manager2 rhn_register 3 |
|
| RHEL バージョン情報の表示 | /etc/redhat-release | |||
| システムプロファイルの表示 | sosreport dmidecode hwbrowser |
sosreport dmidecode lstopo lscpu |
sosreport dmidecode lstopo lscpu cat /proc/cpuinfo lshw |
|
基本設定
| タスク | RHEL5 | RHEL6 | RHEL7 | RHEL8 |
|---|---|---|---|---|
| グラフィカルな設定ツール | system-config-* | gnome-control-center | ||
| テキストベースの設定ツール | system-config-*-tui | |||
| プリンターの設定 | system-config-printer | gnome-control-center | ||
| ネットワークの設定 | system-config-network | nmcli nmtui nm-connection-editor |
nmcli nmtui nm-connection-editor gnome-control-center |
|
| システム言語の設定 | system-config-language | localectl | localectl gnome-control-center |
|
| 日時の設定 | system-config-date date |
timedatectl date |
timedatectl date gnome-control-center |
|
| 日時の同期 | ntpdate /etc/ntp.conf |
timedatectl /etc/chrony.conf ntpdate |
timedatectl date /etc/chrony.conf chronyc |
|
| キーボードの設定 | system-config-keyboard | localectl | localectl gnome-control-center |
|
| SSH の設定 | /etc/ssh/ssh_config /etc/ssh/sshd_config ~/.ssh/config ssh-keygen |
|||
ジョブおよびサービス
| タスク | RHEL5 | RHEL6 | RHEL7 | RHEL8 |
|---|---|---|---|---|
| サービス一覧の表示 | chkconfig --list ls /etc/init.d/ |
systemctl -at service ls /etc/systemd/system/*.service ls /usr/lib/systemd/system/*.service |
systemctl list-units -at service find /etc/systemd/ /usr/lib/systemd/ /run/systemd/ -name *.service" |
|
| 実行中のサービス一覧の表示 | service --status-all | systemctl -t service --state=active | ||
| サービスの開始または停止 | service name start service name stop |
systemctl start name.service systemctl stop name.service |
||
| サービスの有効化または無効化 | chkconfig name on chkconfig name off |
systemctl enable name.service systemctl disable name.service |
||
| サービス状態の表示 | service name status | systemctl status name.service | ||
| サービスが有効になっているかどうかを確認 | chkconfig name --list | systemctl is-enabled name | ||
| サービスファイルの新規作成または設定変更 | chkconfig --add | systemctl daemon-reload /etc/systemd/system/*.service |
||
| ランレベルまたはターゲットの表示 | runlevel who -r |
systemctl get-default who -r |
||
| ランレベルまたはターゲットの変更 | /etc/inittab init run_level |
systemctl isolate name.target systemctl set-default |
||
| ロギングの設定 | /etc/syslog.conf | /etc/rsyslog.conf | /etc/rsyslog.conf /etc/rsyslog.d/*.conf /var/log/journal systemd-journald.service |
|
| ログの表示 | /var/log | /var/log journalctl |
||
| システム監査の設定 | カーネルのコマンドラインに audit=1 を追加 auditctl /etc/audit/auditd.conf /etc/audit/audit.rules authconfig /etc/pam.d/system-auth pam_tty_audit kernel module |
カーネルのコマンドラインに audit=1 を追加 auditctl /etc/audit/auditd.conf /etc/audit/audit.rules authconfig /etc/pam.d/system-auth tlog |
||
| 監査結果の表示 | aureport /var/log/faillog |
|||
| タスクのスケジュールまたはバッチ処理 | cron at batch |
cron at batch systemd-run --on-calendar |
||
| ファイルを名前で検索 | locate | |||
| ファイルを特性で検索 | find | |||
| アーカイブの作成 | tar cpio zip xz |
|||
カーネル、ブート、およびハードウェア
| タスク | RHEL5 | RHEL6 | RHEL7 | RHEL8 |
|---|---|---|---|---|
| シングルユーザーまたはレスキューモード | カーネルのコマンドラインに 1、s、または init=/bin/bash を追加 | カーネルのコマンドラインに 1、s、rd.break、または init=/bin/bash を追加 | ||
| システムのシャットダウン | shutdown | |||
| システムの電源オフ | poweroff | poweroff systemctl poweroff |
||
| システムの停止 | halt | halt systemctl halt |
||
| システムの再起動 | reboot | reboot systemctl reboot |
||
| ランレベルまたはターゲットのデフォルト設定 | /etc/inittab | systemctl set-default | ||
| GRUB ブートローダの設定 | /boot/grub/grub.conf | /etc/default/grub grub2-mkconfig grub-set-default |
||
| カーネルモジュールの設定 | modprobe | |||
| 設定したハードウェアの表示 | hwbrowser | (EPEL の場合) lshw | lshw | |
| ハードウェアデバイスの設定 | udev | |||
| カーネルパラメーターの表示 | sysctl -a cat /proc/cmdline |
|||
| カーネルモジュールの読み込み | modprobe | |||
| カーネルモジュールの削除 | modprobe -r | |||
| カーネルバージョンの表示 | rpm -q kernel uname -r |
|||
ソフトウェア管理
| タスク | RHEL5 | RHEL6 | RHEL7 | RHEL8 |
|---|---|---|---|---|
| ソフトウェアのインストール | yum install yum groupinstall |
yum install yum group install |
||
| ソフトウェア情報の表示 | yum info yum groupinfo |
yum info yum group info |
||
| ソフトウェアの更新 | yum update | |||
| ソフトウェアのアップグレード | yum upgrade | |||
| ソフトウェアリポジトリーの設定 | subscription-manager repos /etc/yum.repos.d/*.repo |
|||
| パッケージが所有するファイルの表示 | rpm -qf filename yum provides filename-glob |
|||
| ソフトウェアバージョンの表示 | rpm -q packagename | yum list installed packagename rpm -q packagename |
||
| インストールしたソフトウェアの表示 | rpm -qa yum list installed |
|||
| モジュールのインストール | yum module install module_name | |||
| モジュール情報の表示 | yum module info module_name | |||
| モジュールストリームの表示 | yum module info module_name | |||
| モジュールストリームの変更 | yum module remove module_name:stream yum module reset module:stream yum module install module:new_stream |
|||
| 利用可能なモジュール一覧の表示 | yum module list | |||
ユーザー管理
| タスク | RHEL5 | RHEL6 | RHEL7 | RHEL7 | |
|---|---|---|---|---|---|
| グラフィカルなユーザー管理 | system-config-users | gnome-control-center | |||
| ユーザーアカウントの作成 | useradd | ||||
| ユーザーアカウントの削除 | userdel | ||||
| ユーザーアカウントの詳細の表示または変更 | usermod /etc/passwd vipw id |
||||
| ユーザーグループの作成 | groupadd | ||||
| ユーザーグループの削除 | groupdel | ||||
| グループの詳細の変更 | groupmod /etc/group |
||||
| ユーザーパスワードの変更 | passwd | ||||
| ユーザーのアクセス権の変更 | usermod visudo |
||||
| グループのアクセス権の変更 | groupmod visudo |
||||
| パスワードポリシーの変更 | chage | ||||
| ユーザーセッションの表示 | w | ||||
ファイルシステム、ボリューム、およびディスク
| タスク | RHEL5 | RHEL6 | RHEL7 | RHEL8 |
|---|---|---|---|---|
| デフォルトのファイルシステム | ext3 | ext4 | xfs | |
| ディスクパーティションの作成または変更 | fdisk parted |
fdisk gdisk parted ssm create |
parted fdisk gdisk ssm_create |
|
| ディスクパーティションのフォーマット | mkfs.filesystem_type (ext4, xfs) mkswap |
mkfs.filesystem_type (ext4, xfs) mkswap ssm create |
||
| ディスク領域のデフラグ | データを新しいファイルシステムにコピー fsck (隣接しない inodes を検索) |
データを新しいファイルシステムにコピー fsck (隣接しない inodes を検索) xfs_fsr |
||
| ストレージのマウント | mount /etc/fstab |
mount /etc/fstab ssm mount |
||
| スワップをマウントおよびアクティベート | /etc/fstab swapon -a |
|||
| 静的マウントの設定 | /etc/fstab | |||
| ディスクの空き容量の表示 | df | |||
| 論理ボリューム情報の表示 | lvdisplay lvs vgdisplay vgs pvdisplay pvs |
|||
| 物理ボリュームの作成 | pvcreate | pvcreate ssm create (バックエンドが lvm の場合) |
||
| ボリュームグループの作成 | vgcreate | vgcreate ssm create (バックエンドが lvm の場合) |
||
| 論理ボリュームの作成 | lvcreate | lvcreate ssm create (バックエンドが lvm の場合) |
||
| デフォルトのファイルシステムでフォーマットしたボリュームの拡大 | vgextend lvextend resize2fs |
vgextend lvextend xfs_growfs ssm resize |
||
| デフォルトのファイルシステムでフォーマットしたボリュームの縮小 | resize2fs lvreduce vgreduce |
現在 XFS は縮小できないため、より小さいファイルシステムに必要なデータをコピーしてください。 | ||
| ファイルシステムの確認/修復 | fsck | fsck ssm check |
||
| NFS 共有の表示 | showmount -e mount |
|||
| NFS 共有の設定 | /etc/exports service nfs reload |
/etc/exports systemctl reload nfs.service |
||
| オンデマンドな自動マウントの設定 | /etc/auto.master.d/*.autofs /etc/auto.* |
|||
| ファイルのアクセス権の変更 | chmod chown chgrp umask (将来のファイル作成) |
|||
| ファイル属性の変更 | chattr | |||
| アクセス制御リストの変更 | setfacl | |||
ネットワーク
| タスク | RHEL5 | RHEL6 | RHEL7 | RHEL8 |
|---|---|---|---|---|
| 名前解決の設定 | /etc/hosts /etc/resolv.conf |
/etc/hosts /etc/resolv.conf nmcli con mod |
||
| ホスト名の設定 | /etc/sysconfig/network | hostnamectl /etc/hostname nmtui |
||
| ネットワークインターフェース情報の表示 | ip addr ifconfig brctl |
ip addr nmcli dev show teamdctl brctl bridge |
||
| ネットワークインターフェースの設定 | /etc/sysconfig/network-scripts/ifcfg-* | /etc/sysconfig/network-scripts/ifcfg-* nmcli con [add|mod|edit] nmtui nm-connection-editor |
||
| ルートの表示 | ip route | |||
| ルートの設定 | ip route add system-config-network /etc/sysconfig/route-iface |
ip route add nmcli nmtui nm-connection-editor /etc/sysconfig/route-iface |
||
| ファイアウォールの設定 | iptables and ip6tables /etc/sysconfig/ip*tables |
iptables and ip6tables /etc/sysconfig/ip*tables system-config-firewall |
firewall-cmd firewall-config |
firewall-cmd firewall-config nftables |
| ポートまたはソケットの表示 | ss lsof netstat |
ss lsof netstat |
ss lsof netstat pcp-dstat --socket |
|
セキュリティーおよび ID
| タスク | RHEL5 | RHEL6 | RHEL7 | RHEL8 |
|---|---|---|---|---|
| システムセキュリティーの設定 | /etc/selinux/config chcon restorecon semanage setsebool system-config-selinux |
|||
| システムセキュリティーの報告 | sealert | |||
| LDAP、SSSD、Kerberos | authconfig authconfig-tui authconfig-gtk |
authselect | ||
| ネットワークユーザー | getent | |||
リソース管理
| タスク | RHEL5 | RHEL6 | RHEL7 | RHEL8 |
|---|---|---|---|---|
| システムコールの追跡 | strace | |||
| ライブラリーコールの追跡 | ltrace | |||
| プロセスの優先度の変更 | nice renice |
|||
| プロセスの実行場所の変更 | taskset | |||
| プロセスの強制終了 | kill pkill killall |
|||
| システムの利用状況の表示 | top ps sar iostat netstat vmstat mpstat numastat |
top ps sar iostat netstat ss vmstat mpstat numastat tuna |
top ps sar iostat ss vmstat mpstat numastat tuna |
pcp atop top ps sar iostat ss vmstat mpstat numastat tuna |
| ディスクの利用状況の表示 | df | df iostat |
pcp-dstat pmiostat df iostat |
|
-
Red Hat Enterprise Linux 5 で subscription-manager を使用する場合は、潜在的な問題に注意してください (「subscription-manager で一部のコンテンツ (FasTrack など) がダウンロードできないか、too many content sets for certificate エラーが発生する」を参照)。↩
-
subscription-manager は、Satellite 6、Satellite 5.6 with SAM 以降、および Red Hat の CDNで使用されています。
↩ -
RHN ツールは、Red Hat Enterprise Linux 7 では廃止になりました。rhn_register は Satellite サーバー 5.6 以降でのみ使用してください。詳細は、「RHSM で提供されるサブスクリプション管理サービス」、「Red Hat Subscription Management」、および「Satellite 5.6: unable to register RHEL 7 client system due to rhn-setup package not included in Minimal installation」を参照してください。↩
Comments