1.修改源

最新版本 openEuler 21.09 的默认源存在问题
/etc/yum.repos.d/openEuler.repo 文件中
http://repo.openeuler.org/openEuler-21.09/EPOL/$basearch/
修改为:
http://repo.openeuler.org/openEuler-21.09/EPOL/main/$basearch/

1
2
yum clean all
yum makecache

2.服务器编译和运行

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

##切换到root用户
sudo su

## 安装C++依赖环境
yum -y install wget gcc gcc-c++ automake autoconf libtool make 

## 安装Golang环境
mkdir -p /xuperchain/golang/gopath \
&& wget -q https://golang.google.cn/dl/go1.14.15.linux-amd64.tar.gz \
&& tar -C /xuperchain/golang -xzf go1.14.15.linux-amd64.tar.gz \
&& echo -e "export GOROOT=/xuperchain/golang/go \n export GOPATH=/xuperchain/golang/gopath \n  export PATH=$PATH:/xuperchain/golang/go/bin:/xuperchain/golang/gopath/bin \n " >> /etc/profile \
&& source /etc/profile \
&& go env -w GOPROXY=https://goproxy.cn,direct 

## 下载XuperChain
cd /xuperchain/ \
&& wget https://github.com/xuperchain/xuperchain/archive/refs/tags/v5.1.0.zip \
&& unzip v5.1.0.zip \
&& cd xuperchain-5.1.0

## 编译XuperChain
make

## 运行XuperChain
cd ./output \
&& chmod 755 ./control.sh \
&& ./control.sh start

3.桌面开发环境

3.1 安装界面

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## 更新系统
sudo yum -y update

## 安装dde图形环境,比较漫长,耐心等待
sudo yum -y install dde

## 如果安装 gnome 桌面
# sudo yum -y install gnome-shell gdm gnome-session gnome-terminal firefox ibus-pinyin 
## gnome 开机启动
# sudo systemctl enable gdm.service



## 安装字体
sudo yum -y groupinstall fonts

## 设置界面默认启动
sudo systemctl set-default graphical.target

## 切换回命令行请使用下面的命令
## sudo systemctl set-default multi-user.target

## 重启
init 6

dde桌面会默认创建 openeuler账户,密码openeuler,后续使用openeuler账户,root在桌面环境受限制

3.2 安装golang

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 安装C++依赖环境
sudo yum -y install wget git gcc gcc-c++ automake autoconf libtool make 

## 安装golang
sudo mkdir -p /home/openeuler/golang/gopath \
&& wget -q https://golang.google.cn/dl/go1.14.15.linux-amd64.tar.gz \
&& tar -C /home/openeuler/golang -xzf go1.14.15.linux-amd64.tar.gz \
&& echo -e "export GOROOT=/home/openeuler/golang/go \n export GOPATH=/home/openeuler/golang/gopath \n  export PATH=$PATH:/home/openeuler/golang/go/bin:/home/openeuler/golang/gopath/bin \n " >> /etc/profile \
&& source /etc/profile \
&& chown -R openeuler:openeuler /home/openeuler/golang 
## 设置 golang 国内代理
go env -w GOPROXY=https://goproxy.cn,direct 

3.3 安装VSCode

1
2
3
4
5
6
7
## 安装密钥和仓库
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'

##安装最新稳定版
sudo yum check-update
sudo yum install code

3.4 处理异常

vscode 安装golang插件依赖,会提示 dlv-dap 依赖 go 1.16 版本,本机安装的是1.14版本,造成安装 dlv-dap 安装失败.

1
2
3
go get github.com/go-delve/delve/cmd/dlv
#go get -u github.com/go-delve/delve/cmd/dlv
cp -rf /home/openeuler/golang/gopath/bin/dlv /home/openeuler/golang/gopath/bin/dlv-dap