vagrant にcentOS7をを入れてみたので変更点の変更をまとめておく。
vagrantというか、centos7のことになってしまった。。
環境
mac 10.10
virtualBox : 4.3.18
vagrant : 1.6.5
まずはosのアップデート
$ sudo yum update
iptablesを無効にしようと思ったら以下のようなエラー…..
$ sudo chkconfig iptables off
サービス iptables に関する情報の読み込み中にエラーが発生しました: そのようなファイルやディレクトリはありません
そういえば、iptablesはcentos7からの変更箇所だった。ってかchkconfig自体過去のものになってたんだ。
systemctl コマンドを使うのが推奨されている。
ちなみに、chkconfigコマンドを使うとこんな感じで表示されます。
$ sudo chkconfig –list
注記: この出力は SysV サービスのみであり、ネイティブな systemd のサービスは含まれていません。
systemd services. SysV 設定のデータはネイティブな systemd の設定によって上書きされます。
systemd サービスを一覧表示するには ‘systemctl list-unit-files’ を使用してください。
特定のターゲットにおいて有効化されているサービスを確認するには、
‘systemctl list-dependencies [target]’ 。
iprdump 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iprinit 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iprupdate 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
vboxadd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
vboxadd-service 0:off 1:off 2:on 3:on 4:on 5:on 6:off
vboxadd-x11 0:off 1:off 2:off 3:on 4:off 5:on 6:off
改めて、systemctlコマンドを実行する
$ systemctl list-unit-files | grep firewall
firewalld.service enabled
firewallを無効に設定する
$ sudo systemctl disable firewalld.service
rm ‘/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service’
rm ‘/etc/systemd/system/basic.target.wants/firewalld.service’
無効になったのを確認
$ systemctl list-unit-files | grep firewall
firewalld.service disabled
ついでにSELinuxもデフォルトで有効になっているのでOFFにしておく
変更前 : SELINUX=enforcing
変更後 : SELINUX=disabled
設定を反映させる
$ reboot
つづいて、Apacheをインストールしながらデーモンの制御をしてみる。
Apacheをインストールする
$ yum -y install httpd
httpdの起動
centOS6系
$ sudo service httpd start
centOS7
$ sudo systemctl start httpd.service
httpdが起動しているか確認
centOS6系
$ sudo service httpd status
httpd (pid 10102) を実行中…
centOS7
$ systemctl list-units | grep httpd
httpd.service loaded active running The Apache HTTP Server
デーモンの登録状態の確認
centOS 6系
$ sudo chkconfig –list httpd
centOS7
$ sudo systemctl list-unit-files | grep httpd
httpd.service disabled
デーモンがOS起動時に自動起動するように設定
centOS6系
$ sudo chkconfig httpd on
centOS7
$ sudo systemctl enable httpd.service
ln -s ‘/usr/lib/systemd/system/httpd.service’ ‘/etc/systemd/system/multi-user.target.wants/httpd.service’
デーモンの登録状態の確認
$ sudo systemctl list-unit-files | grep httpd
httpd.service enabled