WSL-Ubuntu

windows控制面板-程序中启用linux,应用商店中下载Ubuntu18.04,默认安装即可

一、启动ubuntu:

安装vim

sudo apt-get install vim

换源

1、打开源文件:vim /etc/apt/sources.list

2、清空文件内容:esc  dG

3、复制:

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
4、保存:

:wq

更新源:

sudo apt-get update

sudo apt-get upgrade

二、通过xfce4、VcXsrv实现图形化界面

unbuntu执行:

sudo apt install xubuntu-desktop

sudo apt install xfce4

export DISPLAY=`cat /etc/resolv.conf | grep nameserver | awk '{print $2}'`:0
export PULSE_SERVER=`cat /etc/resolv.conf | grep nameserver | awk '{print $2}'`

PS:出现xrdb: Connection refused报错的话,参考https://zhuanlan.zhihu.com/p/150555651

windows下载安装VcXsrv后启动XLaunch(One large window-默认-Disable access control

ubuntu修改完成后重启+startxfce4

三、创建WSL备份:

https://blog.csdn.net/mirco_mcu/article/details/103941384

下载LxRunOffline,解压后shift+右键安装包,选择在此处打开Powershell窗口,

.\LxRunOffline list 查看已安装的Linux子系统

.\LxRunOffline move -n Ubuntu-18.04 -d D:\ubuntu_wsl 开始修改WSL安装路径,途中出现黄色的warning可以忽略,启动ubuntu后执行一次update即可

.\LxRunOffline get-dir -n Ubuntu-18.04 查看当前路径

.\LxRunOffline e -n Ubuntu-18.04 -f D:\Tools\Ubuntu_WSL_Backup.tar.gz  创建备份文件

四、安装ROS

 

 

修改WSL安装路径参考:https://www.jianshu.com/p/17d3ebbc6075/

备份参考:https://p3terx.com/archives/manage-wsl-with-lxrunoffline.html

 

ubuntu换源

https://developer.aliyun.com/mirror/ubuntu

win10应用商店安装Ubuntu及图形化配置(附VcXsrv安装包)

https://blog.csdn.net/anhongning123/article/details/107979534

WIN10Linux子系统WSL2.Ubuntu18.04环境下ROS-Melodic安装与测试

https://blog.csdn.net/EternallyAccompany/article/details/117301563

win10的linux子系统下安装ros填坑笔记

https://blog.csdn.net/andyzou221312/article/details/120103823

WSL (Ubuntu 18.04 LTS) 安装ROS,可运行Rviz和Gazebo

https://www.it610.com/article/1282805517810417664.htm

 

VIM:

全选(高亮显示):按esc后,然后ggvG或者ggVG

全部复制:按esc后,然后ggyG

全部删除:按esc后,然后dG

解析:

gg:是让光标移到首行,在vim才有效,vi中无效 

v : 是进入Visual(可视)模式 

G :光标移到最后一行 

中内容以后就可以其他的操作了,比如: 
d  删除中内容 
y  复制中内容到0号寄存器 
"+y  复制中内容到+寄存器,也就是系统的剪贴板,供其他程序用

posted @ 2022-03-17 15:26  MaQaQ  阅读(339)  评论(0编辑  收藏  举报