目的:由于服务器装了ubuntu14,以前海思在上面开发。现在鸿蒙系统要求ubuntu16以上,为了兼容以前的环境,在docker跑ubuntu16.04,然后再在16.04上搭建鸿蒙开发环境。

安装docker

apt-get intall docker.io

创建ubuntu16容器

docker run -i -t ubuntu:16.04 /bin/bash

配置容器ubuntu16基本环境

root@26fef51f6477:# apt-get update
root@26fef51f6477:# apt-get install wget
root@26fef51f6477:# apt-get install bzip2
root@26fef51f6477:# apt-get install vim

保存镜像

root@26fef51f6477:/# exit
root@ubuntu:~# docker commit -m="harmony v0" -a="wei" 26fef51f6477 ubuntu-harmony:v0
root@ubuntu:~# docker run -i -t 26fef51f6477

删除镜像

root@ubuntu:docker images
root@ubuntu:~# docker rmi 26fef51f6477

运行容器

端口映射12222为docker的22,用于ssh

docker run -i -t -d -p 12222:22 26fef51f6477
docker ps
CONTAINER ID        IMAGE                 COMMAND             CREATED             STATUS              PORTS                   NAMES
4ea85f674c75 26fef51f6477:latest   "/bin/bash"         About an hour ago   Up About an hour    0.0.0.0:12222->22/tcp   stupefied_pare 

进入容器

docker exec -i -t 4ea85f674c75 /bin/bash

配置ssh服务

root@4ea85f674c75:~# apt-get install net-tools
root@4ea85f674c75:~# apt-get install openssh-server
root@4ea85f674c75:~# vi /etc/ssh/sshd_config # change ===> PermitRootLogin yes
root@4ea85f674c75:~# /etc/init.d/ssh restart
root@4ea85f674c75:~# passwd root

#windows xshell, ip为docker所在ubuntu14的ip
ssh root@192.168.1.xxx:1222

搭建HarmonyOS环境

官方教程 https://openharmony.gitee.com/openharmony/docs/blob/master/quick-start/%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83-0.md

#dpkg-reconfigure dash
select no

#install python3.8.5
wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz
apt-get install gcc && apt-get install g++ && apt-get install make && apt-get install zlib* && apt-get install libffi-dev
apt-get install openssl-dev
tar -xvzf Python-3.8.5.tgz && cd Python-3.8.5 && ./configure && make -j8 && make install
cd /usr/bin && rm python && ln -s /usr/local/bin/python3.8 python && python --version && cd -
apt-get install python3-setuptools python3-pip -y
pip3 install --upgrade pip
pip3 install setuptools
pip3 install kconfiglib

#install package tool
apt-get install dosfstools
apt-get install mtools

#install gn
wget https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar
tar -xvf gn.1523.tar -C ~/
vi ~/.bashrc # append ==> export PATH=~/gn:$PATH
source ~/.bashrc

#install ninja
wget https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar
tar -xvf ninja.1.9.0.tar -C ~/
vi ~/.bashrc # append ==> export PATH=~/ninja:$PATH
source ~/.bashrc

#install LLVM compile tool-chain
wget https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar
tar -xvf llvm-linux-9.0.0-34042.tar -C ~/
vi ~/.bashrc # append ==> export PATH=~/llvm/bin:$PATH
source ~/.bashrc

#install hc-gen
wget https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar
tar -xvf hc-gen-0.65-linux.tar -C ~/
vim ~/.bashrc # append ==> export PATH=~/hc-gen:$PATH
source ~/.bashrc

#doload code1.0 on web https://device.harmonyos.com/cn/docs/start/get-code/oem_sourcecode_guide-0000001050769927
wget https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz
mkdir code-1.0
tar -xvf code-1.0.tar.gz -C code-1.0

#compile code for Hi3516DV300
cd code-1.0
python build.py ipcamera_hi3516dv300 -b debug

在这里插入图片描述在这里插入图片描述

目前没有开发板,先搭起来了过过手瘾。

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐