做网站国内好的服务器,青田网页设计公司,wordpress插件整合到主题,wordpress 微信缩略图不显示部署步骤
发布安装运行环境#xff1a;dotnet-sdk#xff08;必装#xff09;、aspnetcore-runtime、dotnet-runtime安装证书设置环境变量#xff1a;临时变量、当前用户永久变量、所有用户的永久变量运行#xff1a;终端运行、后台运行 基本情况
开发系统环境 系统dotnet-sdk必装、aspnetcore-runtime、dotnet-runtime安装证书设置环境变量临时变量、当前用户永久变量、所有用户的永久变量运行终端运行、后台运行 基本情况
开发系统环境 系统Windows 10 专业版 22H2 19045.3693 开发软件IDEMicrosoft Visual Studio Community 2022 (64 位) - Current 版本 17.6.5 项目框架Blazor Server 应用 目标框架.NET 6.0 系统架构x64
发布系统环境 系统Ubuntu 20.04.6 LTS focal 架构arm64
系统信息
lsb_release -aNo LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal查看架构
sudo dpkg --print-architecturearm64二、部署
2.1 准备部署文件
2.1.1 发布 配置: Release 目标框架(F): net6.0 部署模式(M): 框架依赖 目标运行时(U): 可移植
2.1.2 打包文件 - 压缩zip
如RSS_NCD_MINI_BlazorServer.zip
2.1.3 将打包文件从Windows拷贝到Ubuntu系统
推荐将文件放在/home/用户/新建公司名/产品名/项目名目录下 如/home/signway/rsszy/webapp3/
2.1.4 释放文件 - 解压zip
打开Ubuntu终端跳转到RSS_NCD_MINI_BlazorServer.zip所在目录
cd /home/signway/rsszy/webapp3/使用unzip指令解压RSS_NCD_MINI_BlazorServer.zip文件
unzip RSS_NCD_MINI_BlazorServer.zipArchive: RSS_NCD_MINI_BlazorServer.zipinflating: Microsoft.IdentityModel.Protocols.OpenIdConnect.dll inflating: Microsoft.IdentityModel.Tokens.dll inflating: RSS_NCD(MINI)_BlazorServer.deps.json inflating: RSS_NCD(MINI)_BlazorServer.dll inflating: RSS_NCD(MINI)_BlazorServer.exe inflating: RSS_NCD(MINI)_BlazorServer.pdb inflating: RSS_NCD(MINI)_BlazorServer.runtimeconfig.json inflating: System.IdentityModel.Tokens.Jwt.dll inflating: web.config creating: wwwroot/creating: wwwroot/css/creating: wwwroot/css/bootstrap/inflating: wwwroot/css/bootstrap/bootstrap.min.css inflating: wwwroot/css/bootstrap/bootstrap.min.css.map creating: wwwroot/css/open-iconic/creating: wwwroot/css/open-iconic/font/creating: wwwroot/css/open-iconic/font/css/inflating: wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css creating: wwwroot/css/open-iconic/font/fonts/inflating: wwwroot/css/open-iconic/font/fonts/open-iconic.eot inflating: wwwroot/css/open-iconic/font/fonts/open-iconic.otf inflating: wwwroot/css/open-iconic/font/fonts/open-iconic.svg inflating: wwwroot/css/open-iconic/font/fonts/open-iconic.ttf inflating: wwwroot/css/open-iconic/font/fonts/open-iconic.woff inflating: wwwroot/css/open-iconic/FONT-LICENSE inflating: wwwroot/css/open-iconic/ICON-LICENSE inflating: wwwroot/css/open-iconic/README.md inflating: wwwroot/css/site.css inflating: wwwroot/favicon.ico inflating: wwwroot/RSS_NCD(MINI)_BlazorServer.styles.css inflating: appsettings.Development.json inflating: appsettings.json inflating: Microsoft.AspNetCore.Authentication.JwtBearer.dll inflating: Microsoft.IdentityModel.JsonWebTokens.dll inflating: Microsoft.IdentityModel.Logging.dll inflating: Microsoft.IdentityModel.Protocols.dll 2.2 安装框架
2.2.1 下载框架
.NET 6.0下载地址 dotnet-runtime-6.0.25-linux-arm64.tar.gz dotnet-sdk-6.0.417-linux-arm64.tar.gz aspnetcore-runtime-6.0.25-linux-arm64.tar.gz
注意 必须安装SDK,才能使用dotnet指令运行程序。
2.2.2 安装dotnet-sdk
将下载的文件拷贝到Ubuntu系统目录 推荐将文件放在/home/用户/功能/框架名目录下 如/home/signway/install/dotnet/打开终端跳转到文件目录
cd /home/signway/install/dotnet/安装dotnet-sdk、dotnet-runtime 、aspnetcore-runtime
mkdir -p $HOME/dotnet tar zxf dotnet-sdk-6.0.417-linux-arm64.tar.gz -C $HOME/dotnet
mkdir -p $HOME/dotnet tar zxf dotnet-runtime-6.0.25-linux-arm64.tar.gz -C $HOME/dotnet
mkdir -p $HOME/dotnet tar zxf aspnetcore-runtime-6.0.25-linux-arm64.tar.gz -C $HOME/dotnet
export DOTNET_ROOT$HOME/dotnet
export PATH$PATH:$HOME/dotnet上述指令只会在运行它的终端生效。 你可以编辑shell配置文件以永久添加命令。Linux有几个不同的shell每个shell都有不同的配置文件。例如 Bash Shell: ~/.bash_profile 或 ~/.bashrc Korn Shell: ~/.kshrc 或 .profile Z Shell: ~/.zshrc 或 .zprofile
编辑shell的相应源文件并在现有PATH语句的末尾添加$HOME/dotnet。如果没有包含PATH语句则添加一个新行export DOTNET_ROOT$HOME/dotnet。同时将export PATH$PATH:$HOME/dotnet添加到文件末尾。
# ...
export DOTNET_ROOT$HOME/dotnet
export PATH$PATH:$HOME/dotnet2.3 安装证书
2.3.1 安装证书
dotnet dev-certs https --trust
dotnet dev-certs https -tsignwayRK3588:~/rsszy/webapp2$ dotnet dev-certs https --trustTrusting the HTTPS development certificate was requested. Trusting the certificate on Linux distributions automatically is not supported. For instructions on how to manually trust the certificate on your Linux distribution, go to https://aka.ms/dev-certs-trust
A valid HTTPS certificate is already present.2.3.2 未安装会出现什么情况
The command could not be loaded, possibly because:* You intended to execute a .NET application:The application dev-certs does not exist.* You intended to execute a .NET SDK command:No .NET SDKs were found.Download a .NET SDK:
https://aka.ms/dotnet-downloadLearn about SDK resolution:
https://aka.ms/dotnet/sdk-not-foundUnable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.Unhandled exception. System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
To generate a developer certificate run dotnet dev-certs https. To trust the certificate (Windows and macOS only) run dotnet dev-certs https --trust.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid848054.at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Reload()at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Load()at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication1 application, CancellationToken cancellationToken)at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)at Microsoft.AspNetCore.Builder.WebApplication.Run(String url)at Program.Main$(String[] args) in E:\SVN\RCSoft1\RSS_NCD(MINI)\RSS_NCD(MINI)_BlazorServer\RSS_NCD(MINI)_BlazorServerAPI\Program.cs:line 85
已放弃 (核心已转储)2.4 添加环境变量
2.4.1 临时运行
每次打开终端运行以下命令来设置临时变量
export DOTNET_ROOT$HOME/dotnet
export PATH$PATH:$HOME/dotnet2.4.2 永久添加 - 当前登录用户
1. 打开 ~/.bashrc文件
vi ~/.bashrc# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples# If not running interactively, dont do anything
case $- in*i*) ;;*) return;;
esac# dont put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROLignoreboth# append to the history file, dont overwrite it
shopt -s histappend# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE1000
HISTFILESIZE2000# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize# If set, the pattern ** used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] eval $(SHELL/bin/sh lesspipe)# set variable identifying the chroot you work in (used in the prompt below)
if [ -z ${debian_chroot:-} ] [ -r /etc/debian_chroot ]; thendebian_chroot$(cat /etc/debian_chroot)
fi# set a fancy prompt (non-color, unless we know we want color)
case $TERM inxterm-color|*-256color) color_promptyes;;
esac# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_promptyesif [ -n $force_color_prompt ]; thenif [ -x /usr/bin/tput ] tput setaf 1 /dev/null; then# We have color support; assume its compliant with Ecma-48# (ISO/IEC-6429). (Lack of such support is extremely rare, and such# a case would tend to support setf rather than setaf.)color_promptyeselsecolor_promptfi
fiif [ $color_prompt yes ]; thenPS1${debian_chroot:($debian_chroot)}\[\033[01;32m\]\u\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
elsePS1${debian_chroot:($debian_chroot)}\u\h:\w\$
fi
unset color_prompt force_color_prompt# If this is an xterm set the title to userhost:dir
case $TERM in
xterm*|rxvt*)PS1\[\e]0;${debian_chroot:($debian_chroot)}\u\h: \w\a\]$PS1;;
*);;esac# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; thentest -r ~/.dircolors eval $(dircolors -b ~/.dircolors) || eval $(dircolors -b)alias lsls --colorauto#alias dirdir --colorauto#alias vdirvdir --colorautoalias grepgrep --colorautoalias fgrepfgrep --colorautoalias egrepegrep --colorauto
fi# colored GCC warnings and errors
#export GCC_COLORSerror01;31:warning01;35:note01;36:caret01;32:locus01:quote01# some more ls aliases
alias llls -alF
alias lals -A
alias lls -CF# Add an alert alias for long running commands. Use like so:
# sleep 10; alert
alias alertnotify-send --urgencylow -i $([ $? 0 ] echo terminal || echo error) $(history|tail -n1|sed -e \s/^\s*[0-9]\\s*//;s/[;|]\s*alert$//\)# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.if [ -f ~/.bash_aliases ]; then. ~/.bash_aliases
fi# enable programmable completion features (you dont need to enable
# this, if its already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; thenif [ -f /usr/share/bash-completion/bash_completion ]; then. /usr/share/bash-completion/bash_completionelif [ -f /etc/bash_completion ]; then. /etc/bash_completionfi
fiexport PATH$PATH:$HOME/dotnet
export DOTNET_ROOT$HOME/dotnet2. 设置环境变量
按I键退出命令模式进入编辑模式 ~/.bashrc文件末尾添加以下内容设置环境变量。
export PATH$PATH:$HOME/dotnet
export DOTNET_ROOT$HOME/dotnet3. 保存退出
按Esc键退出编辑模式进入命令模式输入以下指令保存。
:wq!2.4.3 永久添加 - 所有用户
1. 打开 /etc/profile文件
sudo vim /etc/profile# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).if [ ${PS1-} ]; thenif [ ${BASH-} ] [ $BASH ! /bin/sh ]; then# The file bash.bashrc already sets the default PS1.# PS1\h:\w\$ if [ -f /etc/bash.bashrc ]; then. /etc/bash.bashrcfielseif [ id -u -eq 0 ]; thenPS1# elsePS1$ fifi
fiif [ -d /etc/profile.d ]; thenfor i in /etc/profile.d/*.sh; doif [ -r $i ]; then. $ifidoneunset i
fi
2. 设置环境变量
按I键退出命令模式进入编辑模式 ~/.bashrc文件末尾添加以下内容设置环境变量。
export PATH$PATH:$HOME/dotnet
export DOTNET_ROOT$HOME/dotnet3. 保存退出
按Esc键退出编辑模式进入命令模式输入以下指令保存。
:wq!4. 重新加载
执行以下指令生效
source /etc/profile2.4.4 查看设置的环境变量
1 只看PATH变量
echo $PATH/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin:/home/signway/dotnet2 查看所有环境变量
envSHELL/bin/bash
SESSION_MANAGERlocal/RK3588:/tmp/.ICE-unix/20779,unix/RK3588:/tmp/.ICE-unix/20779
QT_ACCESSIBILITY1
COLORTERMtruecolor
XDG_MENU_PREFIXgnome-
GNOME_DESKTOP_SESSION_IDthis-is-deprecated
GNOME_KEYRING_CONTROL/home/signway/.cache/keyring-ZRVEE2
DOTNET_ROOT/home/signway/dotnet
SSH_AUTH_SOCK/home/signway/.cache/keyring-ZRVEE2/ssh
XMODIFIERSimibus
SSH_AGENT_PID20915
GTK_MODULESgail:atk-bridge
PWD/home/signway
LOGNAMEsignway
XDG_SESSION_TYPEx11
GPG_AGENT_INFO/run/user/1000/gnupg/S.gpg-agent:0:1
PULSE_SCRIPT/etc/xrdp/pulse/default.pa
HOME/home/signway
LANGzh_CN.UTF-8
LS_COLORSrs0:di01;34:ln01;36:mh00:pi40;33:so01;35:do01;35:bd40;33;01:cd40;33;01:or40;31;01:mi00:su37;41:sg30;43:ca30;41:tw30;42:ow34;42:st37;44:ex01;32:*.tar01;31:*.tgz01;31:*.arc01;31:*.arj01;31:*.taz01;31:*.lha01;31:*.lz401;31:*.lzh01;31:*.lzma01;31:*.tlz01;31:*.txz01;31:*.tzo01;31:*.t7z01;31:*.zip01;31:*.z01;31:*.dz01;31:*.gz01;31:*.lrz01;31:*.lz01;31:*.lzo01;31:*.xz01;31:*.zst01;31:*.tzst01;31:*.bz201;31:*.bz01;31:*.tbz01;31:*.tbz201;31:*.tz01;31:*.deb01;31:*.rpm01;31:*.jar01;31:*.war01;31:*.ear01;31:*.sar01;31:*.rar01;31:*.alz01;31:*.ace01;31:*.zoo01;31:*.cpio01;31:*.7z01;31:*.rz01;31:*.cab01;31:*.wim01;31:*.swm01;31:*.dwm01;31:*.esd01;31:*.jpg01;35:*.jpeg01;35:*.mjpg01;35:*.mjpeg01;35:*.gif01;35:*.bmp01;35:*.pbm01;35:*.pgm01;35:*.ppm01;35:*.tga01;35:*.xbm01;35:*.xpm01;35:*.tif01;35:*.tiff01;35:*.png01;35:*.svg01;35:*.svgz01;35:*.mng01;35:*.pcx01;35:*.mov01;35:*.mpg01;35:*.mpeg01;35:*.m2v01;35:*.mkv01;35:*.webm01;35:*.ogm01;35:*.mp401;35:*.m4v01;35:*.mp4v01;35:*.vob01;35:*.qt01;35:*.nuv01;35:*.wmv01;35:*.asf01;35:*.rm01;35:*.rmvb01;35:*.flc01;35:*.avi01;35:*.fli01;35:*.flv01;35:*.gl01;35:*.dl01;35:*.xcf01;35:*.xwd01;35:*.yuv01;35:*.cgm01;35:*.emf01;35:*.ogv01;35:*.ogx01;35:*.aac00;36:*.au00;36:*.flac00;36:*.m4a00;36:*.mid00;36:*.midi00;36:*.mka00;36:*.mp300;36:*.mpc00;36:*.ogg00;36:*.ra00;36:*.wav00;36:*.oga00;36:*.opus00;36:*.spx00;36:*.xspf00;36:
XDG_CURRENT_DESKTOPGNOME
VTE_VERSION6003
XRDP_SOCKET_PATH/run/xrdp/sockdir
XRDP_PULSE_SOURCE_SOCKETxrdp_chansrv_audio_in_socket_10
GNOME_TERMINAL_SCREEN/org/gnome/Terminal/screen/af8cf72d_9406_4502_87df_7737e813f8a2
LESSCLOSE/bin/lesspipe %s %s
XDG_SESSION_CLASSuser
TERMxterm-256color
LESSOPEN| /bin/lesspipe %s
USERsignway
GNOME_TERMINAL_SERVICE:1.393
XRDP_SESSION1
DISPLAY:10.0
XRDP_PULSE_SINK_SOCKETxrdp_chansrv_audio_out_socket_10
SHLVL1
QT_IM_MODULEibus
XDG_DATA_DIRS/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop
PATH/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin:/home/signway/dotnet
DBUS_SESSION_BUS_ADDRESSunix:abstract/tmp/dbus-LY2CUzKESO,guid88d0510cbc94cdf2015ed92765542918
UID1000
_/bin/env 2.5 运行
**注意一定要到根目录下运行不要使用全路径不然一些资源加载不了导致页面显示不正常**
2.5.1 临时变量运行程序
export DOTNET_ROOT$HOME/dotnet
export PATH$PATH:$HOME/dotnet
cd /home/signway/rsszy/webapp2/
dotnet RSS_NCD(MINI)_BlazorServer.dll2.5.2 永久变量运行程序
cd /home/signway/rsszy/webapp2/
dotnet RSS_NCD(MINI)_BlazorServer.dllsignwayRK3588:~$ cd /home/signway/rsszy/webapp2/
signwayRK3588:~/rsszy/webapp2$
signwayRK3588:~/rsszy/webapp2$ dotnet RSS_NCD(MINI)_BlazorServer.dll
info: Microsoft.Hosting.Lifetime[14]Now listening on: http://[::]:9002
info: Microsoft.Hosting.Lifetime[14]Now listening on: https://[::]:9003
info: Microsoft.Hosting.Lifetime[0]Application started. Press CtrlC to shut down.
info: Microsoft.Hosting.Lifetime[0]Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]Content root path: /home/signway/rsszy/webapp2/2.5.3 永久变量静默运行后台运行
cd /home/signway/rsszy/webapp2/
nohup dotnet RSS_NCD(MINI)_BlazorServer.dll /dev/null 21 signwayRK3588:~/rsszy/webapp2$ cd /home/signway/rsszy/webapp2/
signwayRK3588:~/rsszy/webapp2$
signwayRK3588:~/rsszy/webapp2$ nohup dotnet RSS_NCD(MINI)_BlazorServer.dll /dev/null 21
[1] 70286
signwayRK3588:~/rsszy/webapp2$ 2.5.4 查看后台运行
ps aux | grep 运行程序名称
ps aux | grep BlazorServersignwayRK3588:~/rsszy/webapp2$ ps aux | grep BlazorServer
signway 70286 0.6 2.2 24527624 90396 pts/2 Sl 17:59 0:01 dotnet RSS_NCD(MINI)_BlazorServer.dll
signway 70327 0.0 0.0 11664 664 pts/2 S 18:03 0:00 grep --colorauto BlazorServer2.5.5 终止运行程序
kill PID
kill 70286signwayRK3588:~/rsszy/webapp2$ kill 70286
signwayRK3588:~/rsszy/webapp2$ 2.5.6 强制终止运行程序
kill -9 PID
kill -9 70286signwayRK3588:~/rsszy/webapp2$ kill -9 70336
signwayRK3588:~/rsszy/webapp2$