LoginSignup
5
5

More than 5 years have passed since last update.

Vagrant上のCentOS7にSambaをインストールする方法

Last updated at Posted at 2015-05-10

Vagrantのファイル同期は便利ではあるが、ファイルの同期が遅かったり微妙な点もある。
そこで、いっそのことVagrantでもSambaでファイル共有を行った方が良いだろう…ということでCentOS7にSambaをインストールしてみた。

Vagrantfile

Vagrantfileの設定を編集

-  # config.vm.network "private_network", ip: "192.168.33.10"
+  config.vm.network "private_network", ip: "192.168.33.10"

CentOS7

1.とりあえずrootになる。

sudo su -

2.インストールする

yum install -y samba

3.ユーザの追加

pdbedit -a vagrant
  • パスワードの設定も適宜行う

4.設定

  • 念のため現状の設定ファイルのバックアップを取る
cp -p /etc/samba/smb.conf /etc/samba/smb.conf_org
  • 設定ファイルの編集を行う
vi /etc/samba/smb.conf
- workgroup = MYGROUP
+ workgroup = WORKGROUP

- ;       hosts allow = 127. 192.168.12. 192.168.13.
+         hosts allow = 127. 192.168.

+ [html]
+ comment = html
+ path = /var/www/html
+ public = yes
+ writable = yes
+ printable = no
+ write list = +vagrant

5.起動させる

systemctl start smb
systemctl start nmb

6.自動起動の設定を行う

systemctl enable smb.service
systemctl enable nmb.service

備考

ディレクトリがうまく参照できない場合は、

  • SELinux
  • firewalld

の無効化を試みること。

以上.

5
5
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
5
5