Centos修改时间为24小时制
终端输入命令:tzselect 根据提示选择: 5 --> 9-->1-->1-->ok rm /etc/localtime ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime [root@node01 ]#date from:https://www.cnblogs.com/dbslinux/p/10742115.html
View DetailsCentOS7 Core离线安装net core
1、从微软下载net core https://download.visualstudio.microsoft.com/download/pr/dd164132-d4c4-4c1a-8233-a4fc7e157935/bffa5312d613cab1a14f0858f947a6fc/dotnet-runtime-2.1.11-linux-x64.tar.gz 2、将安装包上传至linux中 3、解压 tar -vxf dotnet-runtime-2.1.11-linux-x64.tar.gz 4、创建链接,使所有目录下都可以访问到dotnet命令(这里是解压后放在/home/dotnetcore目录下) ln -s /home/dotnetcore/dotnet /usr/local/bin 5、测试验证是否成功 任意目录下:dotnet --info 最后,使用dotnet+dll名称,测试软件是否可以运行,如果无法运行,则安装相应的软件包即可 参考: 1、.NET Core 指南:https://docs.microsoft.com/zh-cn/dotnet/core/ 2、net core下载中心:https://dotnet.microsoft.com/download/dotnet-core from:https://blog.csdn.net/dqcoffee/article/details/91353543
View Details在Linux安装ASP.Net Core的运行时(Runtime)
在部署的时候,如果您不想在您的Linux服务器上安装.Net Core SDK,您可以只安装Runtime,接下来我们看看该如何安装运行时Runtime。 下载运行时文件 下载页面:https://www.microsoft.com/net/download/linux 先获取一下对应的下载链接,可以使用浏览器点击链接来获取具体文件的下载链接 获取完链接以后,就可以使用命令下获取和安装了 以Centos 7,Ubuntu 16.04为例安装ASP.Net Core 2.0.5的运行时:
1 2 3 4 5 |
wget -O dotnet-runtime.tar.gz https://download.microsoft.com/download/1/1/0/11046135-4207-40D3-A795-13ECEA741B32/dotnet-runtime-2.0.5-linux-x64.tar.gz wget -O aspnetcore-store.tar.gz https://download.microsoft.com/download/1/1/0/11046135-4207-40D3-A795-13ECEA741B32/aspnetcore-store-2.0.5-linux-x64.tar.gz mkdir dotnet tar zxf dotnet-runtime.tar.gz -C dotnet tar zxf aspnetcore-store.tar.gz -C dotnet |
还需要安装 libunwind Centos 7
1 |
yum update -y && yum install libunwind libicu -y |
Ubuntu 16.04
1 |
apt-get update -y && apt-get install libunwind-dev -y |
原文地址:https://www.zkea.net/codesnippet/detail/post-85 from:https://www.cnblogs.com/seriawei/p/8438126.html
View DetailsLinux下卸载删除.Net Core
最近在技术博客和技术交流群遇到很多小伙伴们在Linux下更新或者安装.Net Core SDK后dotnet命令无法识别等问题,现如下解决: 卸载SDK命令
1 |
sudo yum remove dotnet-sdk-* |
1 |
sudo yum remove libunwind libicu |
1 |
sudo yum remove /etc/yum.repos.d/dotnetdev.repo |
从新安装即可 from:https://www.cnblogs.com/yangzhili/p/9217083.html
View DetailsCentOS 设置网络(修改IP&修改网关&修改DNS)
CentOS修改IP地址 # ifconfig eth0 192.168.1.80 这样就把IP地址修改为192.168.1.80(如果发现上不了网了,那么你可能需要把网关和DNS也改一下,后面会提到),但是当你重新启动系统或网卡之后,还是会变回原来的地址,这种修改方式只适用于需要临时做IP修改。要想永久性修改,就要修改/etc/sysconfig/network-scripts/ifcfg-eth0这个文件,这个文件的主要内容如下(你的文件中没有的项,你可以手动添加): # vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 #描述网卡对应的设备别名 BOOTPROTO=static #设置网卡获得ip地址的方式,选项可以为为static,dhcp或bootp BROADCAST=192.168.44.255 #对应的子网广播地址 HWADDR="00:0C:29:6B:2E:7B"#对应的网卡物理地址 IPADDR=192.168.44.137 #只有网卡设置成static时,才需要此字段 NETMASK=255.255.255.0 #网卡对应的网络掩码 NETWORK=192.168.44.0 #网卡对应的网络地址,也就是所属的网段 ONBOOT=yes #系统启动时是否设置此网络接口,设置为yes时,系统启动时激活此设备 CentOS修改网关 # route add default gw 192.168.1.1 dev eth0 这样就把网关修改为192.168.1.1了,这种修改只是临时的,当你重新启动系统或网卡之后,还是会变回原来的网关。要想永久性修改,就要修改/etc/sysconfig/network 这个文件,这个文件的主要内容如下(你的文件中没有的项,你可以手动添加): # vi /etc/sysconfig/network NETWORKING=yes #表示系统是否使用网络,一般设置为yes。如果设为no,则不能使用网络。 HOSTNAME=centos #设置本机的主机名,这里设置的主机名要和/etc/hosts中设置的主机名对应 GATEWAY=192.168.1.1 #设置本机连接的网关的IP地址。 **********上面的文件修改完要重新启动一下网卡才会生效:# service network restart ******** CentOS修改DNS 上面的都修改完之后,当你ping一个域名是肯能不通,但ping对应的IP地址是同的,这时我们需要修改一下DNS。修改DNS要通过修改/etc/resolv.conf这个文件: # vi /etc/resolv.conf nameserver 8.8.8.8 #google域名服务器 nameserver 8.8.4.4 #google域名服务器 通过上面的所有设置,系统应该可以上网了。 如果centos系统建立在虚拟机之上,那么在设置虚拟机的网络时请选择‘网桥适配器’连接。 from:https://www.cnblogs.com/liuys635/p/11335594.html
View Details查看CentOS版本方法
有以下命令可以查看: rpm -q centos-release # lsb_release -a LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: CentOS Description: CentOS release 5.4 (Final) Release: 5.4 Codename: Final 这个命令适用于所有的linux,包括Redhat、SuSE、Debian、Centos等发行版。 root@MyMail ~ # uname Linux root@MyMail ~ # uname -r 2.6.18-164.el5 [root@localhost ~]# uname -a Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686 i686 i386 GNU/Linux 以下二种方法适用于RedHat,CentOS root@MyMail ~ # cat /etc/redhat-release CentOS release 5.4 (Final) 登录到linux执行rpm -q redhat-release #rpm -q redhat-release 或CentOS root@MyMail ~ # rpm -q centos-release centos-release-5-4.el5.centos.1 当前centos 版本与redhat对应的版本的命令 # cat /proc/version Linux version 2.6.9-78.ELsmp (mockbuild@builder16.centos.org) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)) #1 SMP Fri […]
View Details.NET Core2.1项目在Linux上使用验证码报Unable to load shared library 'gdiplus' or one of its dependencies
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
2019-05-09 10:27:01,330 线程ID:[80] 日志级别:ERROR 出错类:WebApp.HttpGlobalExceptionFilter property:[(null)] - 错误描述:System.TypeInitializationException: The type initializer for 'System.DrawingCore.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'gdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgdiplus: cannot open shared object file: No such file or directory at System.DrawingCore.GDIPlus.GdiplusStartup(UInt64& token, GdiplusStartupInput& input, GdiplusStartupOutput& output) at System.DrawingCore.GDIPlus..cctor() --- End of inner exception stack trace --- at System.DrawingCore.GDIPlus.GdipGetGenericFontFamilySansSerif(IntPtr& fontFamily) at System.DrawingCore.FontFamily..ctor(GenericFontFamilies genericFamily) at System.DrawingCore.FontFamily.get_GenericSansSerif() at System.DrawingCore.Font.CreateFont(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical) at Common.VerifyCodeHelper.CreateByteByImgVerifyCode(String verifyCode, Int32 width, Int32 height) in F:\src\WebApp\Common\VerifyCodeHelper.cs:line 206 at WebApp.Controllers.VerifyCodeController.NumberVerifyCode() in F:\src\WebApp\Controllers\VerifyCodeController.cs:line 27 at lambda_method(Closure , Object , Object[] ) at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters) at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync() |
解决方法 Centos 7 yum install libgdiplus-devel from:https://www.cnblogs.com/asd14828/p/10837140.html?utm_source=tuicool
View DetailsCentOS7/8-重建官方yum源
1 2 3 4 |
cd /etc/yum.repos.d/ #删除所有 rpm -Uvh --force https://vault.centos.org/7.7.1908/os/x86_64/Packages/centos-release-7-7.1908.0.el7.centos.x86_64.rpm yum clean all yum makecache |
from:https://www.jianshu.com/p/cd1dfca70e85 CentOS8 http://mirror.centos.org/centos-8/8.5.2111/extras/x86_64/os/Packages/centos-release-stream-8.1-1.1911.0.7.el8.x86_64.rpm
View Details如何让 ASP.NET Core Web API 在 500 错误时返回具体的异常信息
通过 Opw.HttpExceptions.AspNetCore 搞定了。 1)安装 nuget 包 Opw.HttpExceptions.AspNetCore
1 |
<PackageReference Include="Opw.HttpExceptions.AspNetCore" Version="2.3.0" /> |
2)Startup.ConfigureServices 中添加 AddHttpExceptions
1 |
services.AddControllers().AddHttpExceptions(); |
3)Startup.Configure 中添加 UseHttpExceptions
1 |
app.UseHttpExceptions(); |
示例响应输出
1 |
{"type":"error:invalid-cast","title":"InvalidCast","status":500,"detail":"Invalid cast from \u0027System.Int32\u0027 to \u0027Cnblogs.Infrastructure.Primitives.PostConfig\u0027.","instance":"/zzkdocuments"} |
from:https://q.cnblogs.com/q/121590/
View DetailsGradle 换阿里仓库
改单个项目 在项目的build.gradle文件中,修改repositories配置,将mavenCentral()改为 maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}, 如:
1 2 3 |
repositories { maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } } |
更改所有项目 如果想一次更改所有的仓库地址,可以在 USER_HOME/.gradle/文件夹下添加 init.gradle 文件来配置,如:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
allprojects{ repositories { def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/' all { ArtifactRepository repo -> if(repo instanceof MavenArtifactRepository){ def url = repo.url.toString() if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')) { remove repo } } } maven { url REPOSITORY_URL } } } |
作者:xiaolyuh 链接:https://www.jianshu.com/p/471227b2b7e8 来源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
View Details