Sabtu, 06 Juli 2013

Sharing gems (or any files really) from lubuntu to windows

Continuing from my previous post about developing rails using lubuntu vm as rails server, I need to have access to gem files inside lubuntu from windows for viewing its sources..

At first I tried to use virtual box shared folders to store rbenv/gems files but it cause many problems in ruby or at the very least it result in a very slow performance (especially when gems are loading)

After many many sleepless nights (dramatization) I finally succeed by using samba and sharing the gems via (virtual) network with the following steps..

Sharing folder in lubuntu

Add symbolic link from gems folder (this is optional but recommended if you have multiple ruby installed) assuming you're using ruby 1.9.3-p448 under rbenv in default path:
mkdir $HOME/gems-link
ln -s $HOME/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems $HOME/gems-link/1.9.3-p448
repeat for each installed ruby

Install samba:
sudo apt-get install samba
Edit samba configuration file:
sudo nano /etc/samba/smb.conf
and add the following (you don't need "follow symlinks" and "wide links" line and need to change the path if you didn't use symbolic link earlier)
        path = /home/[your username]/gems-link
;       writeable = no
;       browseable = yes
        guest ok = yes
        follow symlinks = yes
        wide links = yes
you can set writeable to yes if you want to modify gems file in windows (unlikely..) and also add the following to global configuration if you use symbolic link:
unix extensions = no
reboot lubuntu

Access shared folder in windows

If you already added lubuntu ip to windows hosts file from previous post then you can access shared folders in lubuntu in
that's it :)

Tidak ada komentar:

Posting Komentar