跳转至

服务器环境的配置#

2022-04-11  1 分钟阅读 教程教程

新购买的服务器的环境配置

修改主机名#

[root@VM-0-16-centos ~]# hostnamectl set-hostname jimyag
[root@VM-0-16-centos ~]# vim /etc/hosts
127.0.0.1 jimyag
127.0.0.1 localhost.localdomain localhost
127.0.0.1 localhost4.localdomain4 localhost4

::1 jimyag jimyag
::1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
[root@VM-0-16-centos ~]# reboot

SHELL

更新源#

yum update

SHELL

安装docker#

yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

SHELL

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum makecache fast

SHELL

yum install -y docker-ce

SHELL

systemctl start docker.service

SHELL

systemctl enable docker.service

SHELL

curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

SHELL

chmod +x /usr/local/bin/docker-compose

SHELL

go环境安装#

在Linux安装Go环境 | 步履不停 (jimyag.cn)

git配置.配置一个用于提交代码的用户,输入指令:#

git config –global user.name “Your Name” 同时配置一个用户的邮箱,输入命令:

git config --global user.email "email@example.com"

SHELL

生成公钥和私钥(用于github)

ssh-keygen -t rsa -C "youremail@example.com"

SHELL

参考#

DaoCloud | Docker 极速下载