Ubuntu, MAC under the WEB development environment Build: node. js, Golang and Revel configuration installation

Source: Internet
Author: User
Tags install node gocode
This is a creation in Article, where the information may have evolved or changed.

This article introduces the setting up of node. js, Golang and other environments under Ubuntu, and the difference between MAC installation is only two points:

    1. When installing Golang dependent libraries, use brew install xxx instead sudo apt-get xxx ;
    2. When installing Golang, do not need to download the source code compilation and set PATH, only need to download go pkg file on Golang official website, double-click the boot installation. (But the gopath still needs to be configured)

Official homepage

The safest and newest way to install it is to find installation tutorial on the official website (or GitHub homepage). First, give me the official homepage I'm referring to during the installation process:

    • NVM, NODE.JS:HTTPS://GITHUB.COM/CREATIONIX/NVM
    • Golang:https://golang.org/doc/install
    • Revel:https://github.com/revel/revel

installation process

  1. NVM (Node version manager) installation script:

     curl-o-https://raw.githubusercontent  /creationix/nvm/v0.31  .0 /install< Span class= "hljs-preprocessor" >.sh  | Bash  

    Copy and paste into terminal, enter to begin installing NVM.

  2. Install node. js
    Enter the following command into terminal to view the latest version of node. JS:

    ls-remote

    Then select a version to install:

    install v5.11.0

    Where v5.11.0 is the node. JS version number and can be modified to another version. You can install node. js by entering the above into terminal carriage return. After the installation is complete, you can:

    ls

    View the version of node. js that you have installed.

  3. Installation of Glup.js, Webpack, Bower, Vue.js

    npm install -g gulp@latest webpack bower vue-cli

    Note that NPM is not a nvm.

  4. Installing Golang

    Golang is the Go language development environment. The installation is divided into three steps: (1) Installing the Dependent Library, (2) installing Golang; (3) Configuring environment variables.

    (1) Install dependent libraries
    Copy the following code into terminal, enter:

    sudo apt-get install bison ed gawk gcc libc6-dev make git mercurial

    (2) Installation Golang
    The simplest installation method is to enter the following script directly into the terminal carriage return:

    sudo apt-get install golang

    However, this installs the old version of Go. In order to install the new version, you can refer to the Golang official website installation instructions. The process is as follows:

    (1) Download the latest Go Compress package from official website https://golang.org/dl/, download to local;
    (2) Extract the compressed package to/usr/local/:

    -C /usr/local-xzf go1.6.2.linux-amd64.tar.gz

    (3) Add/usr/local/go/bin to the environment path. Opens the/etc/profile file,

    sudo vim /etc/profile

    and add the following code to the end of the profile file:

    PATH=$PATH:/usr/local/go/bin

    (4) Set the $GOPATH. The go language needs to set the default workspace, which is the GOPATH environment variable. Suppose the working directory is ~/gocode:

    mkdir ~/gocode

    Will:

    export GOPATH=/home/USER/gocodeexport PATH=$PATH:$GOPATH/bin

    Written into the end of the/etc/profile.

  5. Installing Revel
    Enter the installation code from the Revel GitHub home page to Terminal:

    get -u github.com/revel/cmd/revel

    Takes a long time. Because the network is not connected, this script will be executed at the end of the feedback two errors (Note: Although the error, but the above code will be executed, because the other code will be downloaded full):

    packageimport"golang.org/x/net/websocket" (https fetch: Get https://golang.org/x/net/websocket?go-get=1: dial tcp [2404:6800:4005:803::2011]:443: getsockopt: host is down)packageimport"golang.org/x/sys/unix" (https fetch: Get https://golang.org/x/sys/unix?go-get=1: dial tcp [2404:6800:4005:803::2011]:443: getsockopt: host is down)

    It's okay to find the net and SYS code from GitHub, clone to Local. After entering the gocode/src/directory, execute the following code:

    mkdir golang.orgcd golang.orgxxgit clone https://github.com/golang/net.gitgit clone https://github.com/golang/sys.git

    After the download is complete, enter:

    install github.com/revel/cmd/revel

    will give back soon. It's done. When you enter revel in terminal, the usage information appears, which means the installation is complete.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.