在Windows下面快速构建各种Linux应用

Win10 支持将Ubuntu Linux承载在Windows系统中,将Ubuntu Linux作为Win10的子系统运行。
通过Ubuntu人性化的apt-get命令,只需几行代码就可以在Windows下面快速构建各种Linux应用。

1.开始

命令安装: lxrun /install /y
手动安装:windows bash

2. 构建应用

目前Windows Bash基于Ubuntu 16.04 LTS。
Ubuntu官方软件源速度不佳,首先将软件源更改为清华大学Ubuntu软件源

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

Mysql
由于Windows Bash跟实际的Linux系统还是有所区别,下面展示一下安装Mysql的正确姿势。
参考了: BashOnWindows

#更新
sudo apt-get update
#跳过所有的提示,创建一个用户名为root,密码为空的用户
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server
#启动mysql服务
sudo service mysql start
#登录
mysql -u root

Redis

#安装
sudo apt-get install redis-server
#启动
redis-server --daemonize yes

rabbitmq

#安装
sudo apt-get install rabbitmq-server
#启动
service rabbitmq-server start

3.已知问题

不以守护线程运行的话关闭Windows Bash命名窗口,Mysql、Redis等服务也会随之关闭。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值