Operations 7 min read

Quickly Set Up a CentOS 8 Server for Go Development

This step‑by‑step guide shows new Linux server users how to configure remote login, switch to fast mirrors, install essential tools like lrzsz and vim, set up environment variables, install Go, and add the vim‑go plugin on a CentOS 8 system.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Quickly Set Up a CentOS 8 Server for Go Development

Remote login

Use an SSH client (e.g., Xshell or SecureCRT) to connect to the cloud server with the provided root credentials.

Replace default CentOS‑8 software mirrors

Speed up package installation by switching to a faster mirror:

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
yum makecache
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
yum -y update

Install lrzsz (rz/sz) file‑transfer tools

yum install lrzsz

Install or upgrade Vim (optional)

If the repository version is insufficient for plugins, compile the latest Vim from source:

yum install gcc ncurses-devel
wget https://github.com/vim/vim/archive/master.zip
unzip master.zip
cd vim-master/src/
./configure
make
make install

Configure Vim

Place a customized .vimrc in the home directory of the user that will run the development environment (e.g., /root/.vimrc).

Set Go‑related environment variables

Add the following lines to either /root/.bashrc or /root/.bash_profile (choose one) and then reload the file with source .bashrc:

PS1='[\t \u@\H:\w]$ '
PATH=$PATH:~/bin:~/go/bin:~/gopkg/bin
LANG=zh_CN.UTF-8
GOROOT=~/go
GOPATH=~/gopkg
GO111MODULE=on
GOPROXY=https://goproxy.cn,direct
GOCACHE=~/gocache
GOBIN=~/bin
export PATH LD_LIBRARY_PATH LANG GOROOT GOPATH GOPROXY GO111MODULE GOCACHE GOBIN

Install Go

Download the latest Go tarball from the official site (e.g., https://golang.google.cn/dl/go1.15.2.linux-amd64.tar.gz), upload it to the server (using rz), and extract it:

tar -xvf go1.15.2.linux-amd64.tar.gz -C .

Verify the installation:

go version

Install the vim-go plugin

Clone the plugin repository and enable Go binaries inside Vim:

yum install git
git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go
# Inside Vim:
:GoInstallBinaries

Result

After completing the steps above, the server provides a ready‑to‑use Go development environment with Vim configured for Go coding.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

GoLinuxVimCentOSServer SetupRemote Login
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.