InspirationAndInnovation / co-learning-and-sharing

3 stars 0 forks source link

【Tmux】windows系统从0安装Tmux的记录 #20

Open noobakong opened 1 year ago

noobakong commented 1 year ago

tmux在windows上运行需要依赖Linux环境 
借助windows的wsl子系统可以实现

WSL安装前置配置

在【设置】中打开【开发人员模式】

tpc2

【控制面板】  -> 【程序和功能】 -> 左侧【启用或关闭windows功能】
 

安装ubuntu

安装方法1 - 商店直接安装

安装方法2 - 手动安装

#创建和指定安装位置可自定义,例如
C:\wsl\ubuntu2110
#导入并安装镜像包
wsl --import <名称> <解压位置> <镜像位置>
#例如在我的电脑是这样的
wsl --import Ubuntu-2110 C:\wsl\ubuntu2110 C:\wsl\ubuntu-21.10-server-cloudimg-amd64-wsl.rootfs.tar.gz
#安装完成后没有启动图标,我们需要手动启动
wsl -d <子系统名称>
#这里的子系统名称就是我们上面安装时指定的名称例如
Ubuntu-2110

其他参考资料

启动 ubuntu

_config.yml

安装Tmux

在打开的 ubuntu 终端内 

sudo apt update
sudo apt upgrade -y

# 执行完毕上述命令应该 tmux默认已经安装成功 如果没有 执行下列命令
sudo apt install tmux

在执行 `sudo apt update` 时 如果遇到类似下列的错误

可能的原因是impish资源有问题

执行下列命令fix资源路径重试即可

sudo sed -i -r 's/([a-z]{2}.)?archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
sudo sed -i -r 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

详见 https://serverfault.com/questions/1106694/unable-to-run-apt-update-on-ubuntu-21-10

启动Tmux

终端内输入 tmux 即可 🎉🎉🎉🎉

noobakong commented 1 year ago

参考资料

dora-ljh commented 1 year ago

我想知道这个linux子系统运行起来的话,是linux环境还是window环境,比如我想打包electron,或者操作window的一些命令如Get-WmiObject等,是否可以使用呢

noobakong commented 1 year ago

我想知道这个linux子系统运行起来的话,是linux环境还是window环境,比如我想打包electron,或者操作window的一些命令如Get-WmiObject等,是否可以使用呢

powershell可以用

tmux不可以

dora-ljh commented 1 year ago

那看起来如果只是简单的一些操作文件的命令用这个子系统是完全可以的,但是涉及到window自带的一些命令的话,还是得用powershell了。那安装的node环境等是否通用呢,还是说我在子系统中需要重新安装一遍呢。