Open main menu

Wiki-Orange Pi β

Changes

Orange Pi Zero 3

917 bytes added, 10:08, 11 July 2023
The method of setting the Linux system to automatically connect to the network for the first time
=== The method of setting the Linux system to automatically connect to the network for the first time ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The development board has an Ethernet port. If you want to remotely log in to the Linux system of the development board through the Ethernet port, you only need to plug in a network cable that can access the Internet normally to the Ethernet port. Assign an IP address, and then we can obtain the IP address of the Ethernet port through the HDMI screen, serial port or view the background of the router, and then we can log in to the Linux system remotely.'''
'''The development board also has wireless WIFI. If you want to remotely log in to the Linux system of the development board through WIFI, you need to remotely log in to the Linux system through the IP address of the Ethernet port ssh and then connect to WIFI through commands, or through commands on the HDMI screen or serial port. Connect to WIFI.'''
'''But if there is no HDMI screen and serial port module, although there is a network cable, the IP address of the development board cannot be checked through the background of the router. Or there is no HDMI screen, serial port module and network cable, and only WIFI can be connected, then you can use the method introduced in this section to automatically connect to WIFI and also set the static IP address of WIFI or automatically set the static IP address of the Ethernet port.'''</big>|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''To use the method in this section, you first need to prepare a Linux system machine. For example, a computer or a virtual machine with Ubuntu system installed.'''
'''Why do you need a Linux system machine, because the root file system of the development board Linux system burned in the TF card is in ext4 format, and the Linux system machine can mount it normally, and then modify the configuration files in it.'''</big>|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''If you want to modify it in the Windows system, you can use the software Paragon ExtFS for Windows. Since this software needs to be paid, and there is no similar free software that is easy to use, I will not demonstrate it here.'''
'''In addition, if you have any problems with Paragon ExtFS for Windows software, please solve it yourself, we will not answer questions.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First burn the Linux image of the development board you want to use into the TF card, and then use a card reader to insert the TF card that has burned the Linux image of the development board into a machine with a Linux system (such as a machine with an Ubuntu system installed) computer, the following uses Ubuntu computer as an example to demonstrate)</p></li>
<li><p>When the TF card is inserted into the Ubuntu computer, the Ubuntu computer will generally automatically mount the partition of the Linux root file system in the TF card. You can know from the following command that '''/media/test/opi_root''' is the Linux root file in the TF card The path where the system is mounted</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''df -h | grep &quot;media&quot;'''</p>
<p>/dev/sdd1 &nbsp;&nbsp; 1.4G &nbsp;&nbsp; 1.2G &nbsp;&nbsp; 167M &nbsp;&nbsp; 88% '''<span style="color:#FF0000">/media/test/opi_root</span>'''</p>
<p>test@test:~$ '''ls /media/test/opi_root'''</p>
<p>bin &nbsp;&nbsp; boot &nbsp;&nbsp; dev &nbsp;&nbsp; etc &nbsp;&nbsp; home &nbsp;&nbsp; lib &nbsp;&nbsp; lost+found &nbsp;&nbsp; media &nbsp;&nbsp; mnt &nbsp;&nbsp; opt &nbsp;&nbsp; proc &nbsp;&nbsp; root &nbsp;&nbsp; run <br> sbin &nbsp;&nbsp; selinux &nbsp;&nbsp; srv &nbsp;&nbsp; sys &nbsp;&nbsp; tmp &nbsp;&nbsp; usr &nbsp;&nbsp; var</p>|}</li>
<li><p>Then enter the '''/boot''' directory of the Linux system burned in the TF card</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''cd /media/test/opi_root/boot/'''</p>|}</li>
<li><p>Then copy the '''orangepi_first_run.txt.template''' to '''orangepi_first_run.txt'''. Through the orangepi_first_run.txt configuration file, you can set the Linux system on the development board to automatically connect to a WIFI hotspot when it starts for the first time, and you can also set the WIFI or Ethernet port. static IP address</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:/media/test/opi_root/boot$ '''sudo cp orangepi_first_run.txt.template orangepi_first_run.txt'''</p>|}</li>
<li><p>You can open the orangepi_first_run.txt file with the following command, and then you can view and modify the contents</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:/media/test/opi_root/boot$ '''sudo vim orangepi_first_run.txt'''</p>|}</li>
<li><p>Instructions for using variables in the orangepi_first_run.txt file</p>
<ol style="list-style-type: lower-alpha;">
<ol style="list-style-type: lower-alpha;">
<li><p>For example, if you want the Linux system of the development &gt; board to automatically connect to the WIFI hotspot after the &gt; first startup, you can set it like this:</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) Set '''FR_net_change_defaults''' to '''1'''</p></li><li><p>b) Set '''FR_net_wifi_enabled''' to '''1'''</p></li><li><p>c) Set '''FR_net_wifi_ssid''' to the name of the WIFI hotspot you &gt; want to connect to</p></li><li><p>d) Set '''FR_net_wifi_key''' to the password of the WIFI hotspot &gt; you want to connect to</p></li></ol>
</li>
<li><p>For example, if you want the Linux system of the development &gt; board to automatically connect to the WIFI hotspot after the &gt; first startup, and set the IP address of the WIFI to a &gt; specific static IP address (so that when the Linux system is &gt; started, you can directly use the set static IP address to ssh &gt; remotely Log in to the development board without checking the &gt; IP address of the development board through the background of &gt; the router), you can set it like this:</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) Set '''FR_net_change_defaults''' to '''1'''</p></li><li><p>b) Set '''FR_net_wifi_enabled''' to '''1'''</p></li><li><p>c) Set '''FR_net_wifi_ssid''' to the name of the WIFI hotspot you &gt; want to connect to</p></li><li><p>d) Set '''FR_net_wifi_key''' to the password of the WIFI hotspot &gt; you want to connect to</p></li><li><p>e) Set '''FR_net_use_static''' to '''1'''</p></li><li><p>f) Set '''FR_net_static_ip''' to the desired IP address</p></li><li><p>g) Set '''FR_net_static_gateway''' to the corresponding gateway &gt; address</p></li></ol>
</li>
<li><p>For example, if you want to automatically set the IP address of &gt; the Ethernet port to the desired static IP address after the &gt; Linux system of the development board starts for the first &gt; time, you can set it like this:</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) Set '''FR_net_change_defaults''' to '''1'''</p></li><li><p>b) Set '''FR_net_ethernet_enabled''' to '''1'''</p></li><li><p>c) Set '''FR_net_use_static''' to '''1'''</p></li><li><p>d) Set '''FR_net_static_ip''' to the desired IP address</p></li><li><p>e) Set '''FR_net_static_gateway''' to the corresponding gateway &gt; address</p></li></ol>
</li></ol>
</li>
<li><p>After modifying the orangepi_first_run.txt file, you can exit the /boot directory of the development board Linux system in the TF card, uninstall the TF card, and then insert the TF card into the development board to start</p></li>
<li><p>If you have not set a static IP address, you still need to check the IP address through the background of the router. If you have set a static IP address, you can ping the set static IP address on the computer. If you can ping, it means that the system has started normally, and The network has also been set correctly, and then you can use the set IP address ssh to remotely log in to the Linux system of the development board</p></li></ol>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''After the Linux system of the development board is started for the first time, orangepi_first_run.txt will be deleted or renamed to orangepi_first_run.txt.old. At this time, the orangepi_first_run.txt configuration file will be reset, and then the Linux system of the development board will be restarted, orangepi_first_run. The configuration in txt will not take effect again, because this configuration will only be effective when the Linux system is started for the first time after burning, please pay special attention to this point.'''</big>|}</li></ol><span id="ssh-remote-login-development-board"></span>
<span id="ssh-remote-login-development-board"></span>
== SSH remote login development board ==