一开始看大家使用的都是Ubuntu系统,后来发现这个系统BUG好多,就改用Debian看看了。下面是安装步骤,仅作为记录。
1、自行到商店下载安装Debian,并且设置好用户名和密码
2、因为Debian这个系统太纯净了,连vim功能都没有,需要自己添加源,而我对于vi也不熟悉,所以,我直接在子系统文件上改了。路径是
C:\Users\XXXX\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\LocalState\rootfs\etc\apt
3、使用Debian9的源
deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
4、然后更新一下系统软件
sudo apt-get update
sudo apt-get upgrade
修改一下PIP源
mkdir ~/.pip && vi ~/.pip/pip.conf
将源更新为如下
[global]
trusted-host=mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple/
5、开始安装宝塔
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
6、后面的事情,在这里不多说了,下面将将安装Golang,先从官方下载,或者直接使用如下命令
cd /www/server && wget -O golang.tar.gz https://studygolang.com/dl/golang/go1.11.linux-amd64.tar.gz
下载好之后,解压出来即可
tar -xzvf golang.tar.gz
7、配置GO的相关文件
vim /etc/profile
在最下面添加下面内容,如果profile不可写,请使用sudo
export GOROOT=/www/server/go
export GOBIN=$GOROOT/bin
export GOPKG=$GOROOT/pkg/tool/linux_amd64
export GOARCH=amd64
export GOOS=linux
export GOPATH=/www/wwwroot/Golang
export PATH=$PATH:$GOBIN:$GOPKG:$GOPATH/bin
8、执行和测试
source /etc/profile
然后再输入下面命令就可以看到go版本了
go version
9、最后,创建一下golang的目录,以后golang文件都放那里就可以了
mkdir /www/wwwroot/Golang
好了,9个步骤搞完。用时1小时。