Sunday, February 21, 2016

ASP.net on Linux Ubuntu

very similar to ASP.net on Mac OS with a few new things below:

(1) Node.js binary install is zip file xz and need sudo tar -C /usr/local --strip-component 1 -xf node-v4.1-linux-x64.tar.xz 

(2) ASP.net 5/Core CLR are installed with the following command line -- differ from Mac OS where they are installed by VS Code

sudo apt-get install unzip curl

curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh

sudo apt-get install libunwind8 gettext libssl-dev libcurl4-openssl-dev zlib1g libicu-dev uuid-dev

dnvm upgrade -r coreclr

now have to install libuv:

sudo apt-get install make automake libtool curl
curl -sSL https://github.com/libuv/libuv/archive/v1.8.0.tar.gz | sudo tar zxfv - -C /usr/local/src
cd /usr/local/src/libuv-1.8.0
sudo sh autogen.sh
sudo ./configure
sudo make
sudo make install
sudo rm -rf /usr/local/src/libuv-1.8.0 && cd ~/
sudo ldconfig

(now /usr/local/lib should have all libbu files,for libux not found error do "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY")

Node.js
 Node.js is not native to Yomen scaffolding. So native Express/Node.js scaffolding may be considered:

sudo install -g express-generator
express myWeb2
cd myWeb2
npm install
npm start     will see at http://localhost:3000

code .

for full intellisense in VS code need to install typescript defintion
sudo npm install -g tsd
tsd install node
tsd install express

the following node.js server code will have full intellisense:

var http=require("http");

var server=http.createServer(function(req,res)
{
    res.write("<html><body>hello from node.js server launched from vs code</body></html>");
    res.end();
});

server.listen(3000);

No comments:

Post a Comment