bash on Ubuntu on windows
Windows 10 Insider Preview Build 14316がうちのPCにもいつのまにか入っていたので遊んでみることに。
ぽちぽちと使えるようにしてみましたが、apt-getでインストールできるものはたいていいけそうな感じですね。
あと、微妙にWindowsの挙動が怪しい気がしなくもない・・。
bash on Ubuntu on windosについては マイクロソフトのブログ とかその他のサイトをみてください。(丸投げ)
bash インストール
アプリの検索からbashえらぶとbashが起動します。
はじめは、"y"を入力しろと・・・。
bashってwindows storeからインストールされるんですね。
さっそく文字化けてる・・?
-- Beta feature --
This will install Ubuntu on Windows, distributed by Canonical
and licensed under its terms available here:
https://aka.ms/uowterms
Type "y" to continue: y
Downloading from the Windows Store... 100%
Extracting filesystem, this will take a few minutes...
??????????????????????????...
apt-getコマンドのHelp
root@localhost:/mnt/c/WINDOWS/system32# apt-get help
apt 1.0.1ubuntu2 for amd64 compiled on Jan 12 2016 20:13:58
Usage: apt-get [options] command
apt-get [options] install|remove pkg1 [pkg2 ...]
apt-get [options] source pkg1 [pkg2 ...]
apt-get is a simple command line interface for downloading and
installing packages. The most frequently used commands are update
and install.
Commands:
update - Retrieve new lists of packages
upgrade - Perform an upgrade
install - Install new packages (pkg is libc6 not libc6.deb)
remove - Remove packages
autoremove - Remove automatically all unused packages
purge - Remove packages and config files
source - Download source archives
build-dep - Configure build-dependencies for source packages
dist-upgrade - Distribution upgrade, see apt-get(8)
dselect-upgrade - Follow dselect selections
clean - Erase downloaded archive files
autoclean - Erase old downloaded archive files
check - Verify that there are no broken dependencies
changelog - Download and display the changelog for the given package
download - Download the binary package into the current directory
Options:
-h This help text.
-q Loggable output - no progress indicator
-qq No output except for errors
-d Download only - do NOT install or unpack archives
-s No-act. Perform ordering simulation
-y Assume Yes to all queries and do not prompt
-f Attempt to correct a system with broken dependencies in place
-m Attempt to continue if archives are unlocatable
-u Show a list of upgraded packages as well
-b Build the source package after fetching it
-V Show verbose version numbers
-c=? Read this configuration file
-o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp
See the apt-get(8), sources.list(5) and apt.conf(5) manual
pages for more information and options.
This APT has Super Cow Powers.
まったく違和感なく打てる!
ためしにgitをインストールしてみる。
root@localhost:/mnt/c/WINDOWS/system32# apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
git-man liberror-perl
Suggested packages:
git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk
gitweb git-arch git-bzr git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,306 kB of archives.
After this operation, 21.9 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main liberror-perl all 0.17-1.1 [21.1 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main git-man all 1:1.9.1-1ubuntu0.3 [699 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty-updates/main git amd64 1:1.9.1-1ubuntu0.3 [2,586 kB]
Fetched 3,306 kB in 4s (710 kB/s)
E: Can not write log (Is /dev/pts mounted?) - openpty (2: No such file or directory)
Selecting previously unselected package liberror-perl.
(Reading database ... 24997 files and directories currently installed.)
Preparing to unpack .../liberror-perl_0.17-1.1_all.deb ...
Unpacking liberror-perl (0.17-1.1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a1.9.1-1ubuntu0.3_all.deb ...
Unpacking git-man (1:1.9.1-1ubuntu0.3) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a1.9.1-1ubuntu0.3_amd64.deb ...
Unpacking git (1:1.9.1-1ubuntu0.3) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up liberror-perl (0.17-1.1) ...
Setting up git-man (1:1.9.1-1ubuntu0.3) ...
Setting up git (1:1.9.1-1ubuntu0.3) ...
root@localhost:/mnt/c/WINDOWS/system32#
なんとなくtd-agentをインストール
では td-agentのインストールしてみましょ。
ってこれなんのバージョンいれればいいのかわからないのでとりあえず、
このubuntu?のバージョンを調べてみる
root@localhost:/etc/td-agent# uname -a
Linux localhost 3.4.0+ #1 PREEMPT Thu Aug 1 17:06:05 CST 2013 x86_64 x86_64 x86_64 GNU/Linux
ん・・? PREEMPT ・・?う、うむ
3.4.0+とかだし、Trustyとかでいいのかな(適当
install の実行
root@localhost:/etc/td-agent# curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-trusty-td-agent2.sh | sh
お、なんか微妙にひっかかりがありましたがインストールできました。
(ログとっとけばよかった)
起動して・・。
root@localhost:/etc/td-agent# /etc/init.d/td-agent start
もうひとつ、bashを起動して、td-agentインストールのドキュメントにあるコマンドを打ってみる。
root@localhost:~# curl -X POST -d 'json={"json":"message"}' http://localhost:8888/debug.test
ログがでた。
root@localhost:/etc/td-agent# tail -f /var/log/td-agent/td-agent.log
port 8888
</source>
<source>
type debug_agent
bind 127.0.0.1
port 24230
</source>
</ROOT>
2016-04-11 23:17:07 +0000 [info]: listening fluent socket on 0.0.0.0:24224
2016-04-11 23:17:07 +0000 [info]: listening dRuby uri="druby://127.0.0.1:24230" object="Engine"
tail: unrecognized file system type 0x53464846 for ‘/var/log/td-agent/td-agent.log’. please report this to bug-coreutils@gnu.org. reverting to polling
2016-04-11 23:19:47 +0000 debug.test: {"json":"message"}
さいごに
快適です。
daemonはサポートしていないので、td-agentを起動できてもそんなに意味はありません(汗
bashを落とすとtd-agentも落ちます。
sshコマンドもつかえますしリモートサーバの管理も楽になりそうです。
windowsのデスクトップのリフレッシュ?が時々おきたりとかあやしい挙動してたりしますが・・・。
壊れるまではこのままいじってみようと思います。
なんかtd-agentのインストールのログには、fileが見つかりませんとか出てた気がするので、
なにかまだサポートしきれていないのがありそうですが、そのうちいろんなものが動かせるようになりそうですね。