2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
First download the centos07 image. It is recommended to use the address recommended by Alibaba Cloud:
https://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/?spm=a2c6h.25603864.0.0.59b5f5ad5Nfr0X
In fact, the first pit has already appeared here.
CentOS 07 /usr/lib64/libstdc++.so only supports up to 19;
GLIBCXX will be missing all versions after 3.4.20
NET 8 will report an error when running, because it requires GLIBCXX_3.4.20 and GLIBCXX_3.4.21 (in fact, NET8 does not support CENTOS 07, we insist on supporting it)
- dotnet: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by dotnet)
- dotnet: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by dotnet)
Now that we have encountered and solved the problem, if we use a higher version of CentOS from the beginning, can we avoid these problems directly? Of course, that is a later story. The following is about how to get out of the big pit with version 07
The download and installation process is omitted; by the way, the following VM17 activation code is provided
激活码:JU090-6039P-08409-8J0QH-2YR7F
Configure the network first
In the editor, click Preferences, then select your virtual machine in the table and restore the default settings
To explain, you need to use the WGET command to download the environment package, and then the command line will prompt that the network is not allowed; finally, I searched on Baidu and found that this operation can be done.
Create a new dotnet folder in /home, then download NET 8 SDK and runtime (actually, you only need to install one of them. I saw that others installed runtime, so I chose to install SDK, which is included in NET8 SDK)
- 虚拟机拖拽命令
- systemctl enable run-vmblock\x2dfuse.mount # 开机自启
-
- systemctl start run-vmblock\x2dfuse.mount # 启动服务
-
-
- sdk 下载地址
- wget https://download.visualstudio.microsoft.com/download/pr/dd6ee0c0-6287-4fca-85d0-1023fc52444b/874148c23613c594fc8f711fc0330298/dotnet-sdk-8.0.302-linux-x64.tar.gz
-
- runtime 下载地址
- wget https://download.visualstudio.microsoft.com/download/pr/ce31d92b-b514-4f9c-843b-29c466871369/b332eba5641cbc6eed1e3a98480972d2/aspnetcore-runtime-8.0.6-linux-x64.tar.gz
- 解压路径
- mkdir dotnet
- mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-8.0.302-linux-x64.tar.gz -C $HOME/dotnet
-
- export DOTNET_ROOT=$HOME/dotnet
- export PATH=$PATH:$HOME/dotnet
-
- 保存到环境变量
- echo 'export PATH=$PATH:$HOME/dotnet' >> ~/.bashrc
- echo 'export DOTNET_ROOT=$HOME/dotnet' >> ~/.bashrc
- source ~/.bashrc
-
- dotnet --version
- dotnet --info
At this time, you should get an error when you execute dotnet --version.
That’s when I started to fall into the trap.
There are posts online saying to use yum to update libstdc.so. Is there any way to compile a new version of GCC? ??? ??? ??? ??? ??? ??? ??? ???
I followed the instructions for a long time, failed many times, doubted my life many times, and almost tried to download the centos 07+ version, or tried to downgrade NET8; I messed up the system and reinstalled it several times (luckily it was a virtual machine, so it was very fast)
Maybe the versions used by the seniors were different from mine, which led to the failure! ! ! !
- 其实就是下载一个libstdc++.so.6.0.26 放到 usr/lib64下,
-
- 然后做一个软连接所有访问libstdc++.so.6指向libstdc++.so.6.0.26
I followed the instructions for a long time, failed many times, doubted my life many times, and almost tried to download the centos 07+ version, or tried to downgrade NET8; I messed up the system and reinstalled it several times (luckily it was a virtual machine, so it was very fast)
Maybe the versions used by the seniors were different from mine, which led to the failure! ! ! !
其实就是下载一个libstdc++.so.6.0.26 放到 usr/lib64下, 然后做一个软连接所有访问libstdc++.so.6指向libstdc++.so.6.0.26
You can successfully deploy net8 on centos 07 and run a simple case of net core
I skipped the download, upload, and decompression process.
The following soft connection commands are provided
- 下载链接: libstdc.so.6.0.26 将压缩包放置/usr/lib64目录下
- cd /usr/lib64
- unzip libstdc.so_.6.0.26.zip
- rm libstdc++.so.6
- ln -s libstdc++.so.6.0.26 libstdc++.so.6
At this time, execute the dotnet command to check the environment
- dotnet --version
- dotnet --info
It should look like this
I guessed that the runtime is included in the net8 sdk (because my win10 net8 only has one sdk, but the previous net5 SDK also relied on net core 2.1 runtime)
Then just build a simple rest api and publish it and run it under windows
Copy the file to Linux, in the file path
dotnet WebApplication1.dll
At this time, we should set up the network port and virtual machine intercommunication, and then access the virtual machine on the physical machine
result,,,,
I clicked locslhost:5000 on the Linux command line (because it said it could be clicked)
It turns out that the higher version of VM already has built-in visual operation, and also has a built-in Firefox LINUX version
For Linux CentOS environment deployment of net8, Microsoft also provides simpler support, script installation
- 以下是脚本自动安装NET 8
- wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
- chmod +x ./dotnet-install.sh
- ./dotnet-install.sh --version latest
-
- 若要安装 .NET 运行时而非 SDK,请使用 --runtime 参数。
- ./dotnet-install.sh --version latest --runtime aspnetcore
It will download this thing and then install it. By default, it will install the latest version of the SDK. If you want to install other versions, or rintime can also change the command line above to achieve
This installation is relatively simple, just follow it line by line; but you will also encounter the environmental problems I mentioned (the ones that need to be solved still need to be solved)
The resources and related documents required in the article can be downloaded in the group sharing. Any technical issues can be discussed in the group. Please note: this group prohibits advertising! This group prohibits advertising! This group prohibits advertising! Important things are said three times, thank you!