安裝和配置 ASP.NET 4(Arch Linux)

黃志斌發表於2013-04-19

我們要在 Arch Linux 64-bit 作業系統中安裝和配置 ASP.NET 4。以下是簡略步驟:

更新系統:

$ sudo pacman -Syy
$ sudo pacman -Syu

安裝 Apache、Mono、mod_mono:

$ sudo pacman -S apache
正在解決依賴關係...
正在查詢相互衝突...

軟體包 (3): apr-1.4.6-1  apr-util-1.5.2-1  apache-2.2.24-1

下載大小:    1.27 MiB
全部安裝大小: 7.18 MiB

......

apache 的可選依賴
    lynx: apachectl status

$ sudo pacman -S mono

......

$ sudo pacman -S mod_mono
正在解決依賴關係...
正在查詢相互衝突...

軟體包 (2): xsp-2.10.2-4  mod_mono-2.10-3

下載大小:    0.25 MiB
全部安裝大小: 1.62 MiB

......

-->  xsp is just the helping app for mod_mono if you like a production like
-->  server. xsp itself is for ASP testing mainly  -- read the manpage for xsp
-->  to know which options are available.
-->  Archlinux will provide xsp configured by a .webapp configuration file
-->  which rests in /etc/xsp. Just put your other webapp files there to let
-->  xsp pick them up.
-->  xsp is commandline based configuration is done in /etc/conf.d/xsp. Set all
-->  your arguments there. Don't forget that you can run xsp from the console
-->  as oridinary user, which is safer and for testing absolutely sufficient!!

-->  You can run the testpages simply by starting the server and calling 
                       http://localhost:8080
-->  from your browser's location bar


(2/2) 正在安裝 mod_mono           

安裝完成。在 Arch Linux 中,Apache2 的配置檔案是 /etc/httpd/conf/httpd.conf,在該配置檔案增加以下內容,以支援 ASP.NET 4:

Include /etc/httpd/conf/mod_mono.conf
MonoServerPath "/usr/bin/mod-mono-server4"
MonoAutoApplication enabled

配置完畢,啟動 Apache2:

$ sudo systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
$ sudo systemctl start httpd
$ systemctl status httpd
httpd.service - Apache Web Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: active (running) since 五 2013-04-19 21:22:15 CST; 19s ago
  Process: 6212 ExecStop=/usr/sbin/apachectl graceful-stop (code=exited, status=0/SUCCESS)
  Process: 6554 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 6557 (httpd)
   CGroup: name=systemd:/system/httpd.service
           ├─6557 /usr/sbin/httpd -k start
           ├─6560 /usr/sbin/httpd -k start
           ├─6562 /usr/bin/mono /usr/lib/mono/4.0/mod-mono-server4.exe --filename /tmp/mod_mono_server_global --nonstop --master
           ├─6563 /usr/sbin/httpd -k start
           ├─6564 /usr/sbin/httpd -k start
           ├─6565 /usr/sbin/httpd -k start
           ├─6566 /usr/sbin/httpd -k start
           └─6567 /usr/sbin/httpd -k start

執行效果如下:

1

2

這兩幅圖來源於我的另一篇文章:怎樣在 Markdown 中使程式程式碼帶上行號

參考資料

  1. ArchWiki: ASP.NET with Apache
  2. Mono: Mod mono
  3. The Apache HTTP Server Project

相關文章