1、linux安裝.net core運行環境,筆者是在虛擬機安裝的CenOS 7 。linux
1、首先須要註冊該機器的祕鑰,每太機器只須要註冊一次既可。 sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
注意:1,筆者是虛擬機部署安裝的CentOs 7 網絡默認沒有打開,因此須要配置網絡nginx
2、sudo yum install dotnet-sdk-2.2 這個格局項目需求,筆者此處安裝的是 core 2.2的sdk
以上第二步可能會消耗一段時間,不妨喝杯茶改改BUG。。。。。。。。安裝完畢git
3、查看是否安裝成功 dotnet --version
如今開始運行項目
此時已經能夠預覽了:
1) 解決繪圖問題。
在.net時期繪圖使用GDI,System.Drawing。可是在.net core上此時就失效了。
直到.net core 2.2 開始又再一次支持System.Drawing可是此時再也不是System.Drawing而是System.DrawingCore
NUGet引入:
此時就能夠開始繪圖了。
---------------------------------------------------------------------------------------------------------------------------------------
**github
**
linux上面繪圖必須安裝!!!web
你在windows上使用圖像組件沒有任務問題,但部署到linux以後,將注意如下幾點: 安裝gdiplus插件,這個須要根據linux類型不一樣,有不一樣的方法
快捷方法:
yum whatprovides libgdiplus && yum install -y epel-release && yum install -y libgdiplus-2.10-9.el7.x86_64 && yum install -y libgdiplus-develwindows
官方的方法:centos
yum install autoconf automake libtool yum install freetype-devel fontconfig libXft-devel yum install libjpeg-turbo-devel libpng-devel giflib-devel libtiff-devel libexif-devel yum install glib2-devel cairo-devel yum install git git clone https://github.com/mono/libgdiplus cd libgdiplus yum -y install ftp ./autogen.sh yum -y install gcc automake autoconf libtool make yum -y install gcc gcc-c++ make make install cd /usr/lib64/ ln -s /usr/local/lib/libgdiplus.so gdiplus.dll
安裝起來比較慢,你能夠直接下載:https://github.com/mono/libgdiplus ,本身安裝在linux。瀏覽器
最後要執行下:yum install libgnomeui-devel (很重要的一行代碼)服務器
此時部署的項目只能是http://localhost:5000訪問,你須要配置一下nginx作一個代理。
過程以下:
*
*
*
*
*
*
*
*markdown
--創建nginx的yum倉庫 [root@localhost ~]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm --下載並安裝nginx [root@localhost ~]# yum install nginx --啓動nginx服務 [root@localhost ~]# systemctl start nginx 或者[root@localhost ~]# service nginx start命令也能夠 --設置nginx的開機啓動(linux宕機、重啓會自動運行nginx不須要連上去輸入命令) [root@localhost ~]# systemctl enable nginx 或者[root@localhost ~]# chkconfig nginx on
配置nginx:
--配置nginx 默認路徑以下所示 若是是多站點 須要在/etc/nginx/conf.d/目錄下 建多個.conf文件 [root@localhost webapph]# vi /etc/nginx/conf.d/default.conf --文件內容以下 server { listen 80; server_name 192.168.88.106; location / { proxy_pass http://localhost:5000; } } --從新加載Nginx配製文件 --nginx -t 測試配製文件是否正確 [root@localhost ~]# nginx -t --命令:nginx -s reload 從新加載nginx配製文件,不用重啓nginx [root@localhost ~]# nginx -s reload
檢測nginx配置是否有問題(nginx可正常運行時,請忽略)
--配置好上面的nginx.conf/default.conf後,檢查一下是否正確。 [root@localhost /]# whereis nginx nginx: /usr/sbin/nginx /etc/nginx /usr/share/nginx /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx.8.gz --檢測配置是否有問題 [root@localhost /]# /usr/sbin/nginx -t nginx: [emerg] invalid URL prefix in /etc/nginx/nginx.conf:49 nginx: configuration file /etc/nginx/nginx.conf test failed [root@localhost /]# /usr/sbin/nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful --重啓nginx服務, [root@localhost /]# sudo service nginx restart Redirecting to /bin/systemctl restart nginx.service [root@localhost /]# #或者使用reload [root@localhost /]# /usr/sbin/nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [root@localhost /]# sudo nginx -s reload [root@localhost /]#
配置防火牆:
--開放80端口 [root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent --重啓防火牆以使配置即時生效 [root@localhost ~]# systemctl restart firewalld
在瀏覽器輸入服務器地址192.168.88.106(這是個人地址)