2018年5月7日月曜日

port forwading to ssh on Debian on VirtualBox

I have used Linux subsystem for windows 10, however the performance was not really good. especially it's Io works very slow when it write on the drive. it takes more time when downloading source or compiling codes, it is really slow. I will try to use Debian on virtualBox to compare which is the better choice for developments.
VirtualBox to open port 22 on 127.0.1.1  so let host port 3022 and forward it to 22.

name Protocol Host IP Host Port Guest IP guest Port
ssh 3022 22
$ssh -p 3022 username@127.0.0.1  
since the default ip address is 127.0.0.1 it should be changed later.

2018年4月8日日曜日

Bash on Windows subsystem with VcXcrv

Here simple what to do list for lunching xterm from bashonwindows
  1. install VcXsrv
  2. $ echo "export DISPLAY=:0.0" >> ~/.bashrc
  3. sudo sed -i 's$.*$tcp:host=localhost,port=0$' /etc/dbus-1/session.conf
  4. $ xterm &
https://sourceforge.net/p/vcxsrv/wiki/Home/
https://www.reddit.com/r/Windows10/comments/4rsmzp/bash_on_windows_getting_dbus_and_x_server_working/

2018年3月23日金曜日

Building Xorg on widows subsystem (ubuntu on Windows)

This is my note of the experimental trial of building X11 on windows subsystem. It is not yet succeeded as of today 23rd of March 2018. The reason I want to try to building x11 is that windows doesn't provide a nice console to use bush on ubuntu on windows. I want to use basic unix/linux tools like xterm,xeye ... Thereis already xming that enable us to use x wundow system on windows by the easy installer. however the version of xorg is a little bit old. so let's try to build it from source

Install required package

My reference at first is the building tutorial by the official Xorg web site.
https://www.x.org/wiki/Building_the_X_Window_System/
It seems that I have to install required package, which is necessary to build x11. Here are the all what I need
https://www.x.org/wiki/RequiredPackages/
It is ubuntu on my windows subsystem then install all by the command with apt-get.
$sudo apt-get install asciidoc autoconf automake autopoint autotools-dev  bison docbook-utils doxygen flex fop git-core  gperf intltool jadetex libdrm-dev libfontconfig1-dev libfreetype6-dev libgbm-dev libglib2.0-dev libmtdev-dev libncurses5-dev libpng12-dev libssl-dev libtool libudev-dev llvm m4  netpbm psutils python-mako systemtap-sdt-dev w3m xmlto  zlib1g-dev
now install starts and seems it takes very long, ans it took very long. once apt-get finished, get the source code using git clone and following the instruction by the official website. to tell the truce you have to install more. I am writing as it happened. please see the bellow Install-newer-LLVM

Start building Xorg

cd $HOME/src 
$git clone git://anongit.freedesktop.org/git/xorg/util/modular util/modular
$mkdir $HOME/build
$cd $HOME/src
then let's build the xorg
./util/modular/build.sh --clone $HOME/build
or use --autoresume and -n option. I operated it with sudo. because some modules need the permission to create a directory to install the lib. The -n option allows the build script to continue the build with the next module. When the script terminates, it reports which ones failed. The --autoresume option writes a list of modules and can restart where it left off after you fixed the build error. (ref)
 sudo ./util/modular/build.sh -n --autoresume resumefile  --clone /home/kanshu/XorgX11/build
please be noticed that if you cone the source code not the same place as above like $HOME/build, build.sh destination path must be a full path. It took hours until I got the bellow error... configure: error: LLVM 3.9.0 or newer is required for r600 build.sh: "./autogen.sh" failed on mesa/mesa build.sh: error processing: "mesa/mesa" since apt-get installed LLVM version 3.8 by default, I have to install newer version of LLVM.

Install newer llvm

Go to the official web site to see the details. http://apt.llvm.org/ Here is what I did. edit souce.list file, which is found in /etc/apt/
$sudo vi /etc/apt/source.list
since my ubuntu version is xenial, add bellow lines into the source.list
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
# 5.0
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main
# 6.0
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main
if you want to know the Linux version, check cat /etc/lsb-release . do apt-get update to reflect the change on apt get.
sudo apt-get update
To retrieve the archive signature:
$wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
# Fingerprint: 6084 F3CF 814B 57C1 CF12 EFD5 15CF 4D18 AF4F 7421 
$apt-get install llvm 
$apt autoremove
then, newer LLVM was installed. do building Xorg again...
Package libtizcore was not found in the pkg-config search path.
Perhaps you should add the directory containing `libtizcore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libtizcore' found
checking for RADEON... yes
checking for RADEON... yes
configure: error: r600 requires libelf when using llvm
another error ... it is still stuck on libtizcore but i think it skipped.

Install libelf

https://packages.ubuntu.com/xenial/libelf-dev It seems like I have to install libelf-dev by using apt-get.
$ sudo apt-get install libelf-dev
let's continue building Xorg again ... there is still error...
./util/modular/build.sh: 691: ./util/modular/build.sh: meson: not found
build.sh: "meson" failed on app/rendercheck
build.sh: error processing:  "app/rendercheck"

Install meson

http://mesonbuild.com/Getting-meson.html I need to install pip3 at first
$sudo apt-get -y install python3-pip
$pip3 install --upgrade pip
then install meson by using pip3.
$pip3 install meson
let's continue building Xorg again ...
Configuring rendercheck.1 using configuration
Build targets in project: 1

ERROR: Could not detect Ninja v1.5 or newer

A full log can be found at /home/XorgX11/src/app/rendercheck/builddir/meson-logs/meson-log.txt
build.sh: "meson" failed on app/rendercheck
build.sh: error processing:  "app/rendercheck"

Install ninja

https://ninja-build.org/
$apt-get install ninja-build 
sill getting an error...
======================================================================
==  Processing:  "app/rendercheck"
==        configuration options:
./util/modular/build.sh: 731: [: missing ]
ninja: Entering directory `builddir'
ninja: error: loading 'build.ninja': No such file or directory
build.sh: "ninja -C builddir" failed on app/rendercheck
build.sh: error processing:  "app/rendercheck"
Probably there were old files in the directly app/rendercheck. It would be solved by erasing everything in the directory. My guess was correct and I got another error ....
make[2]: Entering directory '/home/kanshu/XorgX11/src/app/xdm'
make[2]: Nothing to be done for 'install-exec-am'.
 /bin/mkdir -p '/lib/systemd/system'
 /usr/bin/install -c -m 644 xdm.service '/lib/systemd/system'
/usr/bin/install: cannot create regular file '/lib/systemd/system/xdm.service': Permission denied
Makefile:538: recipe for target 'install-systemdsystemunitDATA' failed
make[2]: *** [install-systemdsystemunitDATA] Error 1
make[2]: Leaving directory '/home/kanshu/XorgX11/src/app/xdm'
Makefile:869: recipe for target 'install-am' failed
make[1]: *** [install-am] Error 2
make[1]: Leaving directory '/home/kanshu/XorgX11/src/app/xdm'
Makefile:566: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1
build.sh: " env LD_LIBRARY_PATH=/home/kanshu/XorgX11/build/lib make  install" failed on app/xdm
build.sh: error processing:  "app/xdm"
I forgot to install with root permission... doing with 'sudo' option.
checking for GLAMOR... no
configure: error: Package requirements (epoxy) were not met:

No package 'epoxy' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GLAMOR_CFLAGS
and GLAMOR_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
build.sh: "./autogen.sh" failed on xserver
build.sh: error processing:  "xserver"

libepoxy

what is 'epoxy' ? Epoxy is a library for handling OpenGL function pointer management for you. It hides the complexity of dlopen(), dlsym(), glXGetProcAddress(), eglGetProcAddress(), etc. from the app developer, with very little knowledge needed on their part. They get to read GL specs and write code using undecorated function names like glCompileShader(). from git repository of libepoxy it sounds interesting. let's install it as well.
$ sudo apt-get install libepoxy-dev
that works good. next error is
==  Processing:  "libinput"
==        configuration options:
./util/modular/build.sh: 691: ./util/modular/build.sh: meson: not found
build.sh: "meson" failed on libinput
build.sh: error processing:  "libinput"
I think it is because meson was installed in my "$HOME/.local/bin/meson". since I call the build.sh usin sudo, the path to meson was not found. I have to install meson as root user. I still got error
meson.build:59:1: ERROR: Native dependency 'libwacom' not found

A full log can be found at /home/kanshu/XorgX11/src/libinput/builddir/meson-logs/meson-log.txt
build.sh: "meson" failed on libinput
build.sh: error processing:  "libinput"
there are also error on processing: "driver/xf86-video-v4l" and other drivers.
v4l.c: In function ‘V4LInit’:
v4l.c:1206:25: error: ‘VIDEO_INVERT_CLIPLIST’ undeclared (first use in this function)
         VAR[i]->flags = VIDEO_INVERT_CLIPLIST;
                         ^
Makefile:474: recipe for target 'v4l.lo' failed
make[2]: *** [v4l.lo] Error 1
make[2]: Leaving directory '/home/kanshu/XorgX11/src/driver/xf86-video-v4l/src'
Makefile:439: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/kanshu/XorgX11/src/driver/xf86-video-v4l'
Makefile:371: recipe for target 'all' failed
make: *** [all] Error 2
build.sh: "make " failed on driver/xf86-video-v4l
build.sh: error processing:  "driver/xf86-video-v4l"
I gave up at here. I also realized that i had great misunderstanding. I need to build Xorg on visual studio to use it with windows 10 and the Ubuntu subsystem. so let's try common solution to use VcXsrv or Xming.

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.