• Home
  • Akiko Yokoyama
  • Contact
  • Feed
ja | en |

WSL / Windows Subsystem for Linux + Ubuntuのセットアップ方法

Windows Subsystem for Linux + Ubuntu セットアップまで

参考サイト

  • Windows で WSL + Hyper + fish shell 環境を再構築する - Qiita
  • WSL (Windows Subsystem for Linux) の導入と設定 | ラボラジアン
  • WSL を使って Windows10 上で Linux を動かす – グローディア株式会社

PowerShellから管理者権限で実行

powershell.exe

1
> Start-Process powershell.exe -Verb runas

管理者権限で実行

1
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

再起動を求められる、再起動

WindowsアプリストアからLinuxと検索、特集ページからUbuntuをインストール

Ubuntuを起動

Username, Passwordを変更する

そのままアップデートする

1
2
$ sudo apt-get update
$ sudo apt-get upgrade

ライブラリインストール

1
$ sudo apt-get install curl jq git openssl 

agコマンドのインストール

1
$ apt-get install silversearcher-ag

コマンド使用できる

1
$ ag -a テスト ~/Documents/

ショートカットの設定

デスクトップやドキュメントへのシンボリックリンクを貼る

  • 参考:Windows 10のWindows Subsystem for Linux(WSL)を日常的に活用する - ククログ(2017-11-08)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    $ ln -s /mnt/c/Users/akiko.yokoyama/Documents ~/Documents
    $ ln -s /mnt/c/Users/akiko.yokoyama/Desktop ~/Desktop
    $ ls -la ~/Desktop
    lrwxrwxrwx 1 yokoyama yokoyama 35 Mar  4 10:20 /home/yokoyama/Desktop -> /mnt/c/Users/akiko.yokoyama/Desktop
    $ ls -la ~/Desktop
    lrwxrwxrwx 1 yokoyama yokoyama 35 Mar  4 10:20 /home/yokoyama/Desktop -> /mnt/c/Users/akiko.yokoyama/Desktop
    $ ls -la ~/Desktop/
    Atom.lnk                                          Postman.lnk
    Everythingで検索.lnk                              Slack.lnk
    Fork.lnk                                          desktop.ini
    GitHub Desktop.lnk
    

ターミナルのカラースキームを変更する

windows公式で公開されており、めちゃ簡単だった

https://github.com/Microsoft/console/releases

参考:コンソールにカラーテーマを!WSLも見やすくなる! - lisz-works https://www.lisz-works.com/entry/ms-color-tool#入手方法

Pyenvのインストール

1
2
3
4
5
6
7
   47  git clone https://github.com/pyenv/pyenv.git ~/.pyenv
   48  ls -la
   49  echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
   50  ls -la
   51  echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
   52  echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
   53  source ~/.bash_profile

Redisのインストール

インストール

1
$ sudo apt-get install redis

起動テスト

1
2
$ redis-server
<起動>

set / getサンプル

1
2
3
4
5
$ redis-cli
127.0.0.1:6379> set hoge fuga
OK
127.0.0.1:6379> get hoge
"fuga"

MySQLのインストール

1
$ sudo apt-get install mysql-server

なんかだだハマった。MySQL途中で止めてしまったから。

これのおかげでなんとかなりそう https://askubuntu.com/a/1091405

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Ok I will answer to my question, thanks for the help, so what I have done after many try/error:
First, ensure you can run these commands without any error: (don't hesitate to reboot to avoid locks in apt)
sudo apt-get remove --purge mysql*
sudo apt update
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
sudo apt-get autoclean
sudo dpkg --configure -a
Delete: (do backup before if you want but do no leave the files in these directories, even with .bak or .old extensions)
    - /etc/mysql
    - /var/lib/mysql
If you have an error mentioning alternatives, run: (replace my.cnf) by the file indicated in the error message)
sudo update-alternatives --remove my.cnf
Then reinstall:
sudo apt install mysql-server
Check now, if at least the mysql service is running:
sudo service mysql status
If still not OK, try to force reinstall:
sudo apt install mysql-server --reinstall
And reconfigure:
sudo dpkg-reconfigure mysql-server

Hyper設定

1
2
3
4
5
6
Puluginsに以下を追加
'hyper-material-theme',
'hyperlinks ',
'hypercwd',
'hyper-search',
'hyper-statusline',

イケてるプラグインをリストアップしてくれている

Awesome Hyper

  • Hyperの設定ファイルパス
  • vim /mnt/c/Users/yokoyama/.hyper.js
user-image
Akiko yokoyama in Coding
5 minute read

Similar Posts

3年前にブログの多言語化対応を実はしていた話

Leica Q2 を購入して1年経ちました &レビュー

ブログの再構築を Jekyll + Netlify + Github で行った話

Excel Tips vol.1

チャットボット hubot adapterを利用した Slack と Chatwork連携コードサンプル

user-image

Published Jan 15, 2019

Akiko yokoyama in Coding

Also found in

  • Coding

Share this article

3年前にブログの多言語化対応を実はしていた話

Leica Q2 を購入して1年経ちました &レビュー

ブログの再構築を Jekyll + Netlify + Github で行った話

Excel Tips vol.1

チャットボット hubot adapterを利用した Slack と Chatwork連携コードサンプル

チャットボットライブラリhubotをインストールとセットアップまで

  • Home
  • Akiko Yokoyama
  • Contact
  • Feed