Install the GO Runtime environment and its development tools on CentOS Liteide

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

As early as five years ago, I thought that if Microsoft had a simple C-based web framework that was easy to develop, that would be much better than ASP. Later know that there is a good PHP performance, but also because of hate in the HTML page to write the background code pain, so once very despised PHP. With the recent popularity of cloud computing, the go language is also sought after, and I'll try to install the Go runtime and development tools on the CentOS system.

First, install GO operating environment

1. To install the Go operating environment, you must ensure that the GCC compiler is installed on the machine. Want to know whether there is a simple installation of GCC on the machine, just enter "gcc--version" to view, if prompted with the relevant version of GCC information on the machine has been installed, otherwise you will be prompted that the command cannot be found. If you do not have GCC installed, the installation is super simple, just like this:

sudo  Yum install gcc

2, download go run environment package (need FQ), download address: https://golang.org/dl/. Installation instructions The document address is: Http://golang.org/doc/install. If you are installing from the source, the document address is: Http://golang.org/doc/install/source. Let me tell you about my installation steps:

First, extract the downloaded "go1.4.2.linux-amd64.tar.gz" package to the/tmp directory, and then copy the extracted "Go" folder to "/usr/local".

2, then start the installation, enter the "/USR/LOCAL/GO/SRC" directory, with root permissions to execute:

./all.bash

The "All TESTS PASSED" prompt appears when the installation is complete. The prompt below also prompts us to add the "/usr/local/go/bin" path to the "path" environment variable. So, we open the "~/.BASHRC" file to add the GO environment variable to path.

Then we enter ". ~/.BASHRC "To reload the configuration file just set. Then enter "Go" in the shell and if a description of the Go command appears, the installation is successful.

Second, install GO Integrated development tool Liteide

1, download Liteide source package: Https://github.com/visualfc/liteide.

2. Extract the downloaded package "Liteide-master.zip" to the "/tmp" directory, then move the extracted folder to the "/usr/local" directory and rename it.

LITEIDE-MASTER.ZIP-D/tmp
   
    
/tmp/liteide-master/usr/local/liteide

3, install the necessary QT package

The official document says QT packages need to compile Liteide source code, so we have to first download the latest version of the QT development package: Https://qt-project.org/downloads. In my case, I downloaded 500 MB of offline install package "Qt-opensource-linux-x64-5.4.1.run". You can install it by simply double-clicking it into the "/tmp" folder.

Then is set QT environment variable "Qtdir", I still put it in "~/.BASHRC" file, on my machine "qtdir= $HOME/qt5.4.1/5.4/gcc_64".

After setting the environment variables for QT, we will formally execute the installation command:

(1) First enter the following directory:

Cd/usr/local/liteide/build

(2) Then execute the instructions for the update package (Note: please FQ before executing):

./update_pkg.sh

(3) Compiling Linux version of Liteide:

./build_linux.sh

Execution to half of the time error, prompt as follows (if your machine does not have an error, skip to step (4)):

From the wrong point of view is said to find "LGL" this thing, this is a god horse thing ah? I found on the Internet after finally know what this error means, the original similar to "/usr/bin/ld:cannot find-lxxx" such as errors are because of the lack of library files, the missing library name format is "libxxx.so", so I should be missing on the machine " libgl.so "file. So I tried to install it online:

sudo  Yum install LIBGL

The result is that I have this package installed:

And I want to know where this is:

-QL mesa-libgl-9.2.5-6.20131218.el7_0.x86_64

The result is found in the following places:

/usr/lib64/libgl.so.1
/usr/lib64/libgl.so.1.2.0
/usr/share/doc/mesa-libgl-9.2.5
/usr/share/doc/mesa-libgl-9.2.5/copying

After you find this ya, you can link this to the "/usr/lib" directory:

CD /usr/lib
LN /usr/lib64/libgl.so.1.2.0/usr/lib/libgl.so

Of course, you can also link this to the "/usr/lib" directory by adding a "-S" parameter after the "ln" command.

Then retry step (3) to pass the installation.

(4) Liteide add Desktop shortcut:

-s/usr/local/liteide/build/liteide/bin/liteide $HOME/desktop/liteide

Finally, run the shortcut on the desktop to see the Liteide interface.

Third, configure and run Liteide

1. First, we need to add a "gopath" environment variable to liteide, which is a bit like the project folder "E:\VS2012\Projects" that we set up in Visual Studio.

Locate the menu bar, click View-"Manage Gopath" to open the Management window, and then add the "gopath" environment variable in the Administration window:

2. Create a new HelloWorld project:

3, write the test code:

Iv. using the VIM editor

If you use Vim to write, it is also quite good to say. The main thing is to install the "Gocode" smart cue plugin.

(1) first determine the "$GOBIN" environment variable has been configured, that is, "Export gobin= $GOROOT/bin" from the normal user switch to the root user (be sure to switch to the root user), and then execute the following command:

Go get-u Github.com/nsf/gocode

(2) Configure "Gocode"

$GOPATH/src/github.com/nsf/gocode/vim
   
    
./update.sh
Set Propose-builtins True
"$GOROOT/pkg/linux_amd64"

(3) Download the "Vim-go" plugin, the address is: Https://github.com/fatih/vim-go, then unzip the downloaded compressed package, and then copy all the files to the "~/.vim" directory. Other available go plugins can be downloaded from this location: Https://code.google.com/p/go-wiki/wiki/IDEsAndTextEditorPlugins.

Then use VIM to open the go file I wrote above


Reference documents
    • Http://golang.org/doc/install
    • Http://golang.org/doc/install/source
    • Https://github.com/visualfc/liteide/blob/master/liteidex/deploy/welcome/en/install.md
    • Http://blog.sina.com.cn/s/blog_4156950c0100sfzz.html
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.