文档
目录
- 虚拟机和镜像
- Ubuntu环境搭建
- 使用mo'baxterm
- 问题和解决方法
一.虚拟机和镜像
使用vmware16.2.5
Ubuntu使用20.04.6
二.Ubuntu环境搭建
1.代码更新源替换
sudo su //进入root,需要输入密码。
cd /etc/apt/ //进入API软件包配置目录
nano sources.list sources.list_bak vim sources.list
//nano 是一个文本编辑器
//sources.list 是API使用的源列表文件,包含系统从哪里获取软件包信息
//vim sources.list 打开sources.list文件进行编辑
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
//API中的软件源配置文件,包含:主要软件包源,安全性更新源,常规更新源,预发布和后背软件包源放入nano中保存即可
apt-get update //更新本地软件包列表
apt-get upgrade //安装可用的软件包更新
2.Root权限安装的工具包
https://gitee.com/houzhongbo1985/document/blob/master/basic_skills/env/ubuntu_env_config.md
//查看所有的直接安装的程序和依赖包且必须一个一个安装
下载repo脚本
mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
添加执行权限
chmod +x ~/bin/repo
设置环境变量,添加到PATH环境变量中
echo 'export PATH=~/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
检查是否安装成功
repo --version
如果遇到的问题:
File "/home/zhou/bin/repo", line 51 def print(self, *args, **kwargs):
解决办法:
打开repo脚本并在第一行添加#!/usr/bin/env python3
如下图:
三.使用Mobaxterm
在Ubuntu中查看自己的IP
在终端输入:ifconfig,ens33中inet的为网络接口名称
在Windows中打开mobaxterm程序,点击Session,选择SSH,在Remote host中输入自己的IP,点击OK即可
输入Ubuntu中的账户名和密码即可
四.问题和解决方法
拉取代码
repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony-3.2-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
repo start OpenHarmony-3.2-Release --all
出现了错误:
下载repo源代码时遇到了问题,可能原因包括连接被拒绝,网络问题或者服务被拒绝
解决方法:
尝试更换了其他镜像源和使用HTTPS替换Git协议,均不行
使用git clone + git网址 暂时提取到了文件
这样子提取到的只是git中的东西,并不是真正需要的代码,在公司没有限制你的网络权限时,按照上述repo操作可以拿到代码。