スポンサーサイト

2023.04.20 Thursday
0

    一定期間更新がないため広告を表示しています

    category:- | by:スポンサードリンク | - | - | -

    centOSで使用する容量チェックコマンド df -hl

    2015.07.19 Sunday 04:40
    0
      dfオプション 容量確認にいいね
      centOSで使用する容量チェックコマンド df -hl

      [xxxxx@xxxxx ~]$ df -hlP
      Filesystem Size Used Avail Use% Mounted on
      /dev/hda2 18G 12G 5.2G 69% /
      /dev/hda1 99M 17M 77M 18% /boot
      tmpfs 1014M 0 1014M 0% /dev/shm

      オプション説明
      "-h, --human-readable"
      それぞれのサイズに、 例えばメガバイトなら M のようなサイズ文字を付加する。 10 の累乗ではなく 2 の累乗を用いるので、 M は 1,048,576 バイトを表す。

      -l, --local
      ローカルファイルシステムのみをリスト表示する。

      "-P, --portability"
      POSIX 出力形式を用いる。 これはデフォルトの表示形式に似ているが、 以下の a), b), c) の点が異なる。 a) ファイルシステムについての情報が常に 1 行で表示される。 このオプションを付けると マウントデバイス名だけが単独で 1 行に表示されることはない。 すなわちマウントデバイス名が 20 文字以上の場合 (例えばネットワークマウントなど) コラムの整列が崩れることになる。 b) 丸めが繰上げになる。 c) コラムのヘッダが POSIX に準拠している。
      category:サーバー | by:ittoocomments(0)trackbacks(0) | -

      CentOS7になって、systemctl、firewalldコマンドにいろいろ変更になったのでめも

      2015.07.19 Sunday 03:31
      0
        ・CentOS6.xと7の主な変更点
        「service」コマンドと「chkconfig」コマンドが、「systemctl」コマンドに統合
        「iptables」が「firewalld」に変更
        「ntpd」が「chronyd」に変更
        「ifconfig」が「ip」コマンドに変更



        Apachのインストール

        「service」コマンドは「systemctl」コマンドに変わったので、以下になります。
        # yum –y install httpd //インストール
        # systemctl start httpd //Apache起動
        # systemctl enable httpd //Apacheの自動起動設定
        # systemctl list-unit-files | grep httpd //自動起動設定を確認
        # systemctl restart httpd //再起動
        # systemctl status httpd //ステータス確認



        chkconfig -listの代わりに
        以下のコマンドで、自動起動設定を一覧で確認出来ます。
        # systemctl list-unit-files -t service //自動起動の一覧表示する



        firewall(iptables)の設定
        iptablesもfirewallに変わったので、設定の方法が異なります。
        # systemctl status firewalld //firewallの稼働状況確認
        # firewall-cmd --zone=public --add-port=80/tcp --permanent //80番ポート確認
        # firewall-cmd --add-service=http --zone=public --permanent //httpを許可
        # firewall-cmd --add-service=https --zone=public --permanent //httpsを許可
        # firewall-cmd --reload //リロード
        # firewall-cmd --list-services --zone=public //設定を確認
        dhcpv6-client http https ssh //こう表示されればOK


        Fedora15 から一部のサービス、CentOS7 より systemd services で管理される様になりました。 この事により今まで久し馴染んできたコマンド(service xxx start や chkconfig xxx on)では実行や停止、自動起動の設定などができないサービスがあります。(例えば dhcpd サービスなど)
        これらのスクリプトは /lib/systemd/system 配下に存在し、systemd services のコマンド systemctl で制御する様になっています。


        service, chkconfigコマンドはsystemctlコマンドへ
        service, chkconfigコマンドは推奨されずsystemctlコマンドへ切り替わった。

        試しにchkconfigコマンドを利用すると…
        # chkconfig --list

        # systemctl list-unit-files
        例)systemctl list-unit-files | grep http

        また、サービスの起動・停止・状態確認などは
        # service
         ↓
        # systemctl

        そして、サービスの起動オプションの設定は
        # chkconfig

        # systemctl
        例)# systemctl enable httpd とかね


        本記事ではRHEL6からRHEL7で変更された主要コマンドがまとめられております。
        RHEL6→RHEL7で変更された主要コマンドをまとめてみました。

        サービス系コマンド

        RHEL 7では、サービス起動デーモンとして、SysVinit/Upstartに代わり、systemdが導入されました。これにより、サービス系コマンドが大幅に変更されています。

        サービス系コマンドの一覧は下記のとおりです。

        ■サービス逐次起動系

        処理内容 RHEL 6 RHEL 7
        状態の表示(サービス単位) /sbin/service
        [1]service_name status
        /usr/bin/systemctl status unit_name
        状態の表示(全サービス) /sbin/service --status-all /usr/bin/systemctl list-units
        [2]--type service
        起動 /sbin/service service_name start /usr/bin/systemctl start unit_name
        終了 /sbin/service service_name stop /usr/bin/systemctl stop unit_name
        強制終了 kill -9 PID /usr/bin/systemctl kill -s 9 unit_name
        再起動 /sbin/service service_name restart /usr/bin/systemctl restart unit_name
        設定反映 /sbin/service service_name reload /usr/bin/systemctl reload unit_name
        [1]/etc/init.d/service_nameでも同様

        [2]list-unitsは省略可

        ■サービス自動起動系

        処理内容 RHEL 6 RHEL 7
        (全サービス)定義の表示 ls /etc/init.d/ /usr/bin/systemctl list-unit-files --type service
        (サービス単位の)定義の登録 /sbin/chkconfig --add service_name /usr/bin/systemctl daemon-reload
        [3]
        自動起動の確認 /sbin/chkconfig --list service_name /usr/bin/systemctl is-enabled unit_name
        自動起動の有効化 /sbin/chkconfig service_name on /usr/bin/systemctl enable unit_name
        自動起動の無効化 /sbin/chkconfig service_name off /usr/bin/systemctl disable unit_name

        category:サーバー | by:ittoocomments(0)trackbacks(0) | -

        ad
        Calender
           1234
        567891011
        12131415161718
        19202122232425
        262728293031 
        << July 2015 >>
        Selected entry
        PR
        Category
        Archives
        Recommend
        Link
        Profile
        Search
        Others
        Mobile
        qrcode
        Powered
        無料ブログ作成サービス JUGEM