whusnoopy
12/7/2016 - 1:56 AM

Install dev env on Ubuntu on Windows 10

Install dev env on Ubuntu on Windows 10

开启 bash 和 Ubuntu on Windows 10

  1. 设置 -> 更新和安全 -> 针对开发人员 -> 开发人员模式
  2. 设置 -> 应用和功能 -> 程序和功能(右侧相关设置下)-> 启用或关闭 Windows 功能 -> 「适用于 Linux 的 Windows 子系统」
  3. 重启。开始,输入 bash 回车,按提示安装,新建用户,正常使用 Linux

更新源

sudo vim /etc/apt/source.list
sudo apt-get update
sudo apt-get upgrade

/etc/apt/source.list 需要更新的内容

deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

# 源码
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

python

sudo apt-get install python python-pip
mkdir ~/.pip
vim ~/.pip/pip.conf
sudo pip install --upgrade pip
sudo pip install virtualenv virtualenvwrapper

~/.pip/pip.conf 的内容

[global]
trusted-host = mirrors.aliyun.com
index-url = http://mirrors.aliyun.com/pypi/simple/

node

参考 https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions ,通过 apt-get 直接获取的 node 和 npm 版本太老

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
npm config set registry https://registry.npm.taobao.org

sudo npm install grunt-cli -g

redis

sudo apt-get install redis-server
sudo service redis-server start

mongo

sudo apt-get install mongodb
sudo service mongodb start

安装 zsh 并配置 oh-my-zsh

sudo apt-get install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

让 cmder 默认启动 zsh

https://gingter.org/2016/11/16/running-windows-10-ubuntu-bash-in-cmder/

配置 tmux

vim ~/.tmux.conf
tmux source ~/.tmux.conf

~/.tmux.conf 的内容

set-option -g default-shell /usr/bin/zsh
set -g default-terminal "screen-256color"

bind-key -n F8 new-window
bind-key -n F9 command-prompt 'rename-window %%'
bind-key -n F10 detach
bind-key -n F11 previous-window
bind-key -n F12 next-window

bind-key b send-prefix

set-window-option -g window-status-current-fg brightyellow
set -g status-right "#h %Y-%m-%d %H:%M"