sequence
There are two main things about the Hongmu development environment: 1. You need a Linux environment to pull code, commit changes, and compile and build. 2. To run The DevCo IDE, which is used to edit code, write and debug, so I suggest a virtual Linux on Windows. This article will introduce how to based on Windows10 host, through VirtualBox virtual Linux system (Ubuntu) : ~Win10 run IDE, virtual machine run Ubuntu, Win10 through SSH connection virtual machine to get shell port; At the same time, Win10 can access the virtual machine file directory through Samba, so that IDE can open the code in the virtual machine, so that IDE and shell can operate the same set of code together.
VirtualBox installation
Download and install:www.virtualbox.org/wiki/Downlo…This is relatively simple, no longer repeated, the author installed this version is: 6.1.14R140239 (Qt5.6.2) PS: the official website is slow, if in a hurry, you can also install 360 software butler
Create an Ubuntu VM
1. Open VirtuaBox and click Create. 2. Specify the parameters as shown in the figure.The memory configuration page is displayed. You are advised to set the memory size to 1/4 to 1/2 of the actual host memory size. In this example, set the memory size to 2 GB (the host has 8 GB memory size).4. Select Create a new virtual hard drive and click next.Next is the continuous virtual disk parameter Settings, page omitted ~~
5. Select the VDI type and go to the next step
6. Set the file allocation type to Dynamic Allocation and go to the next step
7. Specify the storage location of the virtual disk files. At the same time, set the size of the virtual hard disk, 128GB is recommended, and then click “Create”.
8. After the VM is created, create the VM icon, choose Settings > System, and set the number of CPU cores based on the actual situation
Installing Ubuntu
1, Ubuntu installation image download [ubuntu.com/download/al… select 18.04 and 20.04 can PS: Server version small, no UI, if you like fancy Desktop, you can also choose the Desktop version
2, set the boot media Right-click the virtual machine icon and select “Settings”, then choose system, hard disk is set in the startup sequence list to the front drive, the abolition of all other options, then click “OK” PS: for the first time, so no hard disk system, cannot be started, and will continue to select cd-rom start, for installation. Start again, the hard disk system has been installed, will preferentially hard disk boot, enter the systemRight-click the vm icon, choose Settings, select Storage, and select the virtual CD-ROM as the newly downloaded ISO image4, start the virtual machine click “start”, start the virtual machine, the first time to run, thoughtful VirtualBox will prompt us to specify a virtual CD file, the default is the ISO image we just set, directly click “start”5. Start the VM. After the VM is started, it will brush the log for about 2 minutes, and then enter the installation options interface.6. Set the user name and password7, installation process, brush log PS: because the installation process needs to download software, so the installation speed will be affected by the network situation, if really slow, go to see a movie…
Ubuntu Environment Configuration
1. Configure the VM network
There are two vm network modes: network address translation (NAT) In this mode, a VM can use the host network to access the Internet, for example, ping through Baidu.com. However, the outside world cannot access the VIRTUAL machine through the network, and the virtual IP address cannot be recognized by the outside world. 2) Bridge network adapter this way, the author thinks is the most happy, virtual machine is equivalent to the host network adapter capability, virtual network adapter virtual machine and host has the same network segment IP address, just like an independent machine, You are advised to select the second method. The two methods have different configurations when the host needs to access vm hard disk files, as described in the following section
2. Set SSH login
SSH Login Settings It is difficult to operate the VIRTUAL machine directly in the VritualBox window. Of course, we want to access the LInux server through Xshell/Putty, which requires the SSH service
Install ssh-server: sudo apt-get install openssh-server Start SSH service: sudo service SSH start
1. Run the ifconfig command to query the IPV4 address and log in to the VM using Putty or Xshell2. Network Address translation In this mode, the SSH tool on the host cannot directly connect to the VM IP address. Therefore, you need to configure port forwardingThen, the SSH tool directly connects to the local host address, and the port is specified as the port configured in port forwarding. In this example, the port is 2222
3. Samba configuration
If you are using an IDE, how does the IDE open code on the Linux server? Samba allows Windows to access folders on other Linux servers as if they were local disks. (1) Install Samba first: sudo apg-get install Samba (2) Vim /etc/samba/smb.conf Add the following information at the end:[yang] browseable = yes writable = yes available = yes path = /home/yang valid users = yang public = yes
Sudo smbpasswd -a Yang (4) Sudo smbpasswd -a Yang (4) sudo smbpasswd -a Yang (4) (5) Restart Samba: sudo service SMBD restart Enter the VM IP address in Windows Explorer, and you can access itRemaining issues: This mode is valid only for bridge nics. The NETWORK address translation (NAT) mode needs to be further resolved
4. Obtain the source code configuration
This direct reference to the official document: gitee.com/openharmony…
1) curl gitee.com/oschina/rep… > /usr/local/bin/repo: /usr/local/bin/repo: /usr/local/bin/repo: /usr/local/bin/repo: /usr/local/bin/repo sudo mv repo-py3 /usr/local/bin/repo
2) You also need to install Python3. The official document requires PYTHon3.7 +, but the ubuntu 3.6.9 that I installed also works. Sudo apt-get install python3- PIP install python3- PIP install python3.7+ /usr/bin/python
3) PIP install – ihttps://pypi.tuna.tsinghua.edu.cn/simple requests please use pip3 in this step, if other slowly, can be directly try pip3 install requests
5. Compile environment configuration
The Hi3861/Hi3516/Hi3518 environment configuration and compilation commands are different. For details, see the official Quick Start: gitee.com/openharmony… Here do necessary supplement: 1) Hi3861 the first example in detail introduced the IDE tool VsCode and the use of DevEco plug-in, Hi3516 and Hi3518 in the introduction of the water down, so directly look at the back of the example do not understand the IDE usage, first go to see a Hi3861 introduction
Sudo apt-get install zip sudo apt-get install zip sudo apt-get install zip sudo apt-get install zip sudo apt-get install zip
Sudo apt-get install mtools sudo apt-get install mtools
Windos Environmental configuration
For the configuration of the IDE environment on Windows, please refer to the official guidance document:Device.harmonyos.com/cn/docs/ide…For more information on IDE use, refer to the Quick Start article:Gitee.com/openharmony…IDE’s main functions are: code editing: auto-completion through plug-ins, error prompts, etc. Burning image: burning the compiled image to the development board, and online debugging terminal tools: You can link Linux server through Terminal, get shell port, so IDE and shell port in one page, very convenient!
conclusion
The whole environment construction process, is in accordance with the “source code configuration -” compilation environment configuration – “IDE environment configuration” order of the actually the official README and development guidance have more detailed elaboration, but because of the software involved, configuration more, and not centralized, Therefore, it is easy to let the children’s shoes feel configuration is more troublesome. This post is to follow this idea, from scratch, step by step to build the environment, record the pit process, and share with you, hongmeng come on!
The original link: developer.huawei.com/consumer/cn… Author: NickYang