antecedents

In the previous article “OPERATING System 1 — vmware VIRTUAL Machine +centos environment construction”, I did not solve the problem of virtual machine experience is not smooth, this time, I investigated some cloud servers, hoping to once and for all.

Cloud Server Purchase

I saw a discount on the homepage of Tencent Cloud. Although the server configuration is a little low, it has high cost performance, so I couldn’t wait to buy a cloud server to experience it quickly. As I have some experience in using cloud services, I am very quick to get started. The following are some key points I have summarized.

Early experience

Server Login

After the purchase is successful, you will receive an in-site letter which will tell you the initial password of the server for direct login.

Enter the console and you can find the cloud server you just purchased.

I couldn’t wait to try the login, directly enter the user name and password.

After the successful login, the web version of the terminal will appear, with several commands to experience, very smooth.

Other features

In addition to login, cloud server also provides a lot of functions, including password change, system reinstallation, instance configuration adjustment, security group adjustment and so on, which I have not tried.

Next, I will try something on this console in my own way.

Adding a Common User

In general, root is rarely used in enterprise environments, so I created a regular user, Monki.

Add the sudoers

Common users also use some of Root’s privileges, but the password of Root is usually maintained and periodically changed by the system administrator, and it is troublesome to ask the administrator for the password each time. Therefore, ordinary users are added to sudoers so that ordinary users can temporarily obtain Root privileges through sudo commands.

sed -i '/^root.*ALL=(ALL).*ALL/a\monki\tALL=(ALL) \tALL' /etc/sudoers
Copy the code

You can either type the command above, or modify the /etc/sudoers file to add this line

Next, we re-log in to the server using Monki and find that the login was successful.

Install git

$ cd /tmp
$Wget HTTP: / / https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.30.2.tar.gz
$The tar - XVZF git - 2.30.2. Tar. Gz
$ cdGit - 2.30.2 /
$ ./configure
$ make
$ sudo make install
$ git --version          Git installation is successfulThe git version 2.30.2Copy the code

After following the steps above, you need to add Git’s binary directory to the PATH PATH, or Git may fail to find some commands.


tee -a $HOME/.bashrc <<'EOF'
# Configure for git
export PATH=/usr/local/libexec/git-core:$PATH
EOF
Copy the code

Finally, configure Git

$ git config --global user.name "xxx"    Change your username to your own
$ git config --global user.email "[email protected]"    # Change your email address to your own
$ git config --global credential.helper store    Set Git to save username and password
$ git config --global core.longpaths true Git 'Filename too long
Copy the code

Install the Go


$Wget https://marmotedu-1254073058.cos.ap-beijing.myqcloud.com/tools/go1.16.2.linux-amd64.tar.gz - O / TMP/go1.16.2. Linux - amd64. Tar. Gz

$ mkdir -p $HOME/go
$The tar - XVZF/TMP/go1.16.2. Linux - amd64. Tar. Gz - C$HOME/go
$ mv $HOME/go/go $HOME/ go/go1.16.2


Copy the code

Finally, we append the following environment variables to the $HOME/.bashrc file by executing the following command.


tee -a $HOME/.bashrc <<'EOF'
# Go envsExport GOVERSION= GO1.16.2 # Go Version Settings export GO_INSTALL_DIR=$HOME/ Go # Go Installation directory export GOROOT=$GO_INSTALL_DIR/$GOVERSION # GOROOT export GOPATH=$WORKSPACE/golang # GOPATH Export PATH=$GOROOT/bin:$GOPATH/bin:$PATH # Install to install the binary files added to the PATH PATH export GO111MODULE = "on" Go # open moudles features export GOPROXY = https://goproxy.cn, direct installation Go # Export GOPRIVATE= export GOSUMDB=offCopy the code

To summarize

In general, cloud services are much more convenient than local VMS, with beautiful interfaces, easier operation and faster speed. I will continue to do some research based on cloud servers later.

The resources

Some of the things I’ve been doing, I’ve been following this course on Geek Time.

Address: Go Language Project Development Actual Combat