安装CentOS7
在VirtualBox中最小化安装CentOS(略)
配置网络
1 2 3 4 5 6 7 8 9
| ip addr vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 systemctl restart network ip addr ping www.baidu.com #设置dhcp动态分配网络 yum install net-tools yum install wget #安装常用软件
|
安装专用编译器
1 2 3 4 5 6 7
| tar -zxvf gcc_riscv32-linux-7.3.0.tar.gz -C /usr/local/ #解压到/usr/local vi /etc/profile source /etc/profile #添加bin目录到环境变量中 riscv32-unknown-elf-gcc --version #查看结果
|
安装Python3.7+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz ls tar -zxvf Python-3.9.0.tgz -C /usr/local/ #解压安装包
#安装之前下载以下需要的依赖软件 yum groupinstall -y "Development tools" yum install -y "Development tools" yum install -y openssl-devel yum install -y libffi libffi-devel yum install -y bzip2-devel yum install -y sqlite-devel yum install -y readline-devel yum install -y libuuid-devel yum install -y uuid-devel yum install -y xz-devel yum install -y gdbm-devel yum install -y tk-devel
#安装Python cd /usr/local/Python-3.9.0/ ls ./configure --prefix=/usr/local/python3 make && make install
#建立软链接,不影响系统自带的python ln -s /usr/local/python3/bin/python3 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3 pip3 --version python3 --version
#安装python包 pip3 installsetuptools pip3 install setuptools pip3 install kconfiglib pip3 install pycryptodome pip3 install six --upgrade --ignore-installed six pip3 install ecdsa
|
安装SCONS
1 2 3 4
| tar -zxvf scons-4.0.1.tar.gz cd SCons-4.0.1/ python3 setup.py install ln -s /usr/local/python3/bin/scons /usr/bin/scons
|
安装gn
1 2 3
| tar -xvf gn-linux-x86-1717.tar.gz -C /usr/local/ ln -s /usr/local/gn /usr/bin/gn gn --version
|
安装ninja
1 2 3
| tar -xvf ninja.1.9.0.tar -C /usr/local/ ln -s /usr/local/ninja/ninja /usr/bin/ninja ninja --version
|
安装llvm
1 2 3
| tar -xvf llvm-linux-9.0.0-36191.tar -C /usr/local/ vi /etc/profile source /etc/profile
|
安装hb
1 2 3
| python3 -m pip install --user ohos-build vi ~/.bashrc source ./.bashrc
|
解压源码并编译
1 2 3 4 5 6
| mkdir code-1.0 tar -zxvf code-1.0.tar.gz -C ./code-1.0 cd code-1.0 #使用python3编译源码 python3 build.py wifiiot #编译成功
|
安装Samba服务
1 2 3 4 5 6 7 8 9 10 11
| yum install samba systemctl enable smb #编辑配置文件 vi /etc/samba/smb.conf #创建用户 smbpasswd -a root systemctl start smb netstat -antp #配置selinux及防火墙 sestatus -b |grep samba setsebool -P samba_export_all_rw 1
|
参考文献
[1]Centos下安装鸿蒙LiteOS编译环境
https://www.sohu.com/a/425806016_463994
[2]华为设备开发快速入门官方文档
https://device.harmonyos.com/cn/docs/start/introduce/quickstart-lite-env-setup-lin-0000001105407498