Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy Internet of things platform IoTSharp based on .net Core on Godson 3B4000

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

How to deploy the Internet of things platform IoTSharp based on .net Core on Godson 3B4000. In view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Today, I am very happy to get the test server account of Godson. Show above.

Dual core, 8 GB of memory, 50 GB of hard disk.

Architecture mips64el

After logging in, it is displayed as uos and its URL information:

Next, without saying a word, we began to download Godson version. Net Core, Godson version. Net Core has recently been transplanted, and other domestic official accounts and open source China have reported earlier. Now, the relevant tool chain has been completed, and it is completely ready to use out of the box. Net Core 3.1.7 is the latest version. Download links are as follows:

.NET Core 3.1.7 MIPS64 Port Early Access Build 20200819

Https://github.com/gsvm/loongson-dotnet/releases

Since IoTSharp is based on asp.net core, we first download its installation package, and later, if we try to develop other content on Godson, then try sdk. Download links are as follows:

Https://github.com/gsvm/loongson-dotnet/releases/download/ea-20200819/aspnetcore-runtime-3.1.7-ea-20200819-linux-loongson3a.tar.gz

Github downloads are occasionally fast:

After the download is completed, we begin to extract it, because the assigned account does not have write access to / usr/bin, so we decompress it in the user directory.

Tar-xzvf. / aspnetcore-runtime-3.1.7-ea-20200819-linux-loongson3a.tar.gz-C / dn/

Cd dn enters the dn directory and you can see the relevant content. For convenience, we add it to the environment variable, enter vi .bashrc on the command line, and add the following at the end.

Export PATH= "$PATH://home/loongson/dn/"

Now, you can enter dotnet directly in the console for easy operation. Of course, these are all due to permission problems and the inability to modify system files. If you have root permission, you don't have to do this at all. Put it under / usr/bin.

Next, we release a version of IoTSharp with the following release configuration:

Remember, it must be portable so that. Net does not have special treatment for the platform!

Next, start installing postgresql.

At this point, I suddenly remembered su root, and then entered the password of the ordinary user given by Godson, and unexpectedly successfully switched. Well, now we are very smooth.

Start installing pgsql

Apt-get install postgresql-11

As shown in the figure:

Installation completed

According to the instructions, we entered

Pg_ctlcluster 11 main start

Start the database and enter the following command to switch the system user of the database

Su postgres

Execute psql to change the database password and enter the following script

ALTER USER postgres WITH PASSWORD 'future'

As shown in the figure

Now let's start the program, because we have root permissions! Move the. net core to / usr/bin and upload the content published by IoTSharp to / var/iotsharp

Next, let's create a system service and create a file in the current wood directory first. Use the command vi iotsharp.service to edit the content as follows:

[Unit] Description=IoTSharp running on loongson

[Service] WorkingDirectory=/var/iotsharpExecStart=/usr/bin/dotnet / var/iotsharp/IoTSharp.dll Restart=always# Restart service after 10 seconds if the IoTSharp service crashes:RestartSec=10KillSignal=SIGINTSyslogIdentifier=iotsharpUser=iotsharpEnvironment=ASPNETCORE_ENVIRONMENT=ProductionEnvironment=DOTNET_PRINT_TELEMETRY_MESSAGE=falseEnvironment=ASPNETCORE_URLS= "http://0.0.0.0:8080"[Install]WantedBy=multi-user.target

Copy service files:

Cp iotsharp.service / etc/systemd/system/iotsharp.service

Enable servic

Systemctl enable / etc/systemd/system/iotsharp.service

Create a user

Useradd iotsharp

Start the service

Systemctl start iotsharp.service

Since CapServer and ModBus services are started by default in the current version, the default port 502 of ModBus is lower than port 1024 under linux, so ordinary users have permission problems when using it, so you need to add configuration items to modify appsettings.Production.json. Add the following at the end, and the default ModBus port will be changed to 5020.

"ModBusServer": {"Port": 5020, "TimeOut": 120000}

Use the command systemctl status iotsharp.service to view the status of the IoTSharp project. The screenshot is as follows:

At this point, we have completed the construction. During this period, it is important to note that pgsql must be started. If a bit of iotsharp starts automatically, it seems impossible to restart the system through service restart or ctl+c.

This is the answer to the question on how to deploy the Internet of things platform IoTSharp developed based on .net Core on Godson 3B4000. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology