Tuesday, October 27, 2015

Install Nide on CentOS

One headache i have is with the use of vi on command line of VM to edit complex script. I recently found the alternative of using Nide. Nide is a web-based editor which allows user to remotely view and edit files in a VM using a web interface. this post shows a step-by-step installation guide on how to make it run on centos or scientific linux

Install nodejs in VM

To install nodejs on centos, run the following commands:

> cd /opt
> wget http://nodejs.org/dist/v0.10.30/node-v0.10.30.tar.gz
> tar xvzf node-v0.10.30.tar.gz
> cd node-v0.10.30
> ./configure
> sudo yum install gcc gcc-c++
> make
> make-install

Now run the following command to see if it is installed:

> node --version

Install npm in VM

To install npm, run the following commands 
> curl -SL https://rpm.nodesource.com/setup | bash -

Run the following command to see if it is installed:

> npm --version

Install nide

Run the following command to install nide

> npm install -g nide

Run nide in VM

After nide is installed, before proceed to launch it, the first thing is to make sure that the port that it listen can be accessible from VM, if not run some command like the following to open the port (in this case, it is port 80):

> iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

One more thing to make sure before the launching is to make sure that the node_modules in which nide is installed have the proper permission, by running the following command:

> sudo chown -R $USER /usr/local/lib/node_modules

Now, one can launch the nide at port 80 using the following command:

> nide init -p 80

And you can go to your local machine, and enter the address "http://[VM-IP]" (where VM-IP is the ip address of the VM, since you are running nide at port 80 here, no need to add the port number). Now you are free to view and edit files in your VM.

No comments:

Post a Comment