yum install yum-utils rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" yum-config-manager --add-repo http://download.mono-project.com/repo/centos7/
yum install mono-devel
等待漫長的安裝過程...html
安裝成功:linux
1.新建一個文件名爲hello.cs,內容以下:nginx
using System; public class HelloWorld { static public void Main () { Console.WriteLine ("Hello Mono World"); } }
2.執行命令編譯web
mcs hello.cs
編譯成功會出現 hello.exeubuntu
3.執行命令運行hello.exevim
1.執行下面的命令安裝jexuscentos
cd /tmp wget linuxdot.net/down/jexus-5.8.2.tar.gz tar -zxvf jexus-5.8.2.tar.gz cd jexus-5.8.2
安裝成功會有以下提示!服務器
啓動 /usr/jexus/jws startapp
中止 /usr/jexus/jws stop框架
mkdir /wwwroot/test cd /wwwroot/test
cd /usr/jexus/siteconf vim defalut
修改配置以下圖:
/usr/jexus/jws restart
而後輸入ip便可正常訪問,這裏我傳的是一個簡單的html網頁
1.新建 jexus.service
cd /lib/systemd/system vim jexus.service
向文件 jexus.service 粘貼下面的內容並保存:
[Unit] Description=jexus After=network.target [Service] Type=forking ExecStart=/usr/jexus/jws start ExecReload=/usr/jexus/jws restart ExecStop=/usr/jexus/jws stop PrivateTmp=true [Install] WantedBy=multi-user.target
執行命令,加入服務:
systemctl enable jexus.service
啓動服務:
systemctl start jexus.service
查看服務狀態:
systemctl status jexus.service
重啓測試:
reboot
等待重啓完成,執行命令查看服務狀態,若啓動則爲設置成功!
sudo yum install libunwind libicu curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?linkid=848821 sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet sudo ln -s /opt/dotnet/dotnet /usr/local/bin
(2)建立一個hello word程序來驗證
dotnet new console -o hwapp cd hwapp dotnet restore dotnet run
dotnet publish
cd /usr/jexus/siteconf vim default
AppHost的配置格式是:
AppHost={CmdLine=應用程序命令行; AppRoot=應用程序工做目錄; Port=應用程序HTTP偵聽端口},其中:
「CmdLine」表示啓動應用程序的命令行,如:dotnet /var/www/site1/app.dll;
「AppRoot」表示應用程序工做目錄,如:/var/www/site1;
「Port」表示這個HTTP應用程序所使用的偵聽端口,如:5000(Asp.Core默認端口是5000)。
systemctl start jexus.service
這裏演示使用的是ABP框架的asp.net zero項目
寫完了~最後感謝jexus的做者 宇內流雲 寫出這麼好用的服務器。