2018年2月24日土曜日

ruby on rails with windows 10.

next step of setting up Ruby on Rails, let's install postgresSQL
mv to /mnt/c/Users/yourname/Documents it is not easy to access the file of linux subsystem however the windows files can be found in under /mnt . I will create a new working folder here in windows Documents.
$rails new myNewSite
$cd myNewSite
$rails server
It works from windows file system but work on Linux. Now I can edit source code, css and more with a GUI editor like visual studio code. Set up postgressql
$su apt-get install postgresql postgresql-contrib

2018年2月13日火曜日

Windows subsystem for Linux と Ruby on Railsメモ

Windows subsystem for Linux WSL により windows上でLinuxバイナリが動作できるようになりました
マイクロソフトはストアで Ubuntu, open SUSE leap42, and SUSE Linux Enterprise server を提供していて、インストールと利用が簡単になっています。
 web開発には非常に便利な機能になる可能性があります。それはRuby on Railsなどは Linux/Unix 環境では便利でほぼそれを必要としています. 

以下railsのインストール時のメモ

$sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev


Install rbenv
https://github.com/rbenv/rbenv
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ cd ~/.rbenv && src/configure && make -C src

add ~/.rbenv/bin  to bash Path

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

Run init

$~/.rbenv/bin/rbenv init

rbenvを最新にしたい場合

$ cd ~/.rbenv
$ git pull


Install ruby-build
https://github.com/rbenv/ruby-build
$git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc



$rbenv install 2.5.0
$rbenv global
2.5.0



ruby -v.でインストールを確認する
install bundler

 $gem install bundler

install node.js
https://github.com/nodesource/distributions

$curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$sudo apt-get install -y nodejs


install rails

$gem install rails
$rails -v




Windows Subsystem for Linux and Ruby on Rails set up

Windows subsystem for Linux WSL enable us to run Linux binaries on Windows 10.
Microsoft provide Ubuntu, open SUSE leap42, and SUSE Linux Enterprise server on windows store.
The installation is very easy now.
The Linux subsystem would be really great new feature on Windows, since the web development requires many open source web app frame works, for example Ruby on Rails, django, play framework and more new web technology tend to be based on Linux/Unix environment. that is one of the reason that many professional developers use Mac for their work machine.

The below is my set up on Ruby on Rails with Windows subsystem Ubuntu.
Assume ubuntu is already ready and running.
You need to install git, python, libssl .....
install necessary using apt-get like

$sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev


Install rbenv
https://github.com/rbenv/rbenv
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ cd ~/.rbenv && src/configure && make -C src

add ~/.rbenv/bin  to bash Path

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

Run init

$~/.rbenv/bin/rbenv init

to update rbenv

$ cd ~/.rbenv
$ git pull


Install ruby-build
https://github.com/rbenv/ruby-build
$git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc


$rbenv install 2.5.0
$rbenv global
2.5.0




after checking if ruby has been installed successfully by ruby -v.
install bundler


 $gem install bundler

install node.js
https://github.com/nodesource/distributions

$curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$sudo apt-get install -y nodejs


install rails

$gem install rails
$rails -v

Let's create myWebService 


$ rails new myWebService

it takes a little bit of minutes...
after everything was done, type below to start the service.


$ rails server

when it says


=> Booting Puma
=> Rails 5.1.5 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.11.2 (ruby 2.5.0-p0), codename: Love Song
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000

go to the  http://localhost:3000.  ' You are on Rails' will be shown in the page and Rails works perfect. 

2018年2月12日月曜日

The new start of my blog from today.

The new start of my blog from today.
I have not written anything on this blog since 2012. it has been very long time and I didn't know the time passed so quick.
This blog was my secret keeping memo blog about Ubuntu/Linux. however I will write anything about current technology, especially on web/ mobile development.