1、安装VirtualBox

2、安装CentOS系统

3、SSH(MacOs,VirtualBox,CentOS)

配置网络为NAT,然后配置端口转发。
https://stackoverflow.com/questions/5906441/how-to-ssh-to-a-virtualbox-guest-externally-through-a-host
The best way to login to a guest Linux VirtualBox VM is port forwarding. By default, you should have one interface already which is using NAT. Then go to the Network settings and click the Port Forwarding button. Add a new Rule. As the rule name, insert “ssh”. As “Host port”, insert 3022. As “Guest port”, insert 22. Everything else of the rule can be left blank.
or from the command line

  1. VBoxManage modifyvm myserver --natpf1 "ssh,tcp,,3022,,22"

where ‘myserver’ is the name of the created VM. Check the added rules:

  1. VBoxManage showvminfo myserver | grep 'Rule'

That’s all! Please be sure you don’t forget to install an SSH server in the VM:

  1. sudo apt-get install openssh-server

To SSH into the guest VM, write:

  1. ssh -p 3022 user@127.0.0.1

Where user is your username within the VM.

4、常用软件

gcc

  • yum -y install gcc

    Go

  • yum -y install wget

  • wget -c https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz
  • tar -C /usr/local/ -zxvf go1.11.5.linux-amd64.tar.gz
  • mkdir /go
  • vi /etc/profile
    1. export GOROOT=/usr/local/go
    2. export GOBIN=$GOROOT/bin
    3. export GOPKG=$GOROOT/pkg/tool/linux_amd64
    4. export GOPATH=/go
    5. export PATH=$PATH:$GOBIN:$GOPKG:$GOPATH/bin
  • source /etc/profile
  • go env查看是否正确

    Git

  • yum -y install git

5、加速Github

vi /etc/hosts
加这些:

  1. 151.101.185.194 github.global.ssl.fastly.net
  2. 192.30.253.112 github.com
  3. 151.101.112.133 assets-cdn.github.com
  4. 151.101.184.133 assets-cdn.github.com
  5. 185.199.108.153 documentcloud.github.com
  6. 192.30.253.118 gist.github.com
  7. 185.199.108.153 help.github.com
  8. 192.30.253.120 nodeload.github.com
  9. 151.101.112.133 raw.github.com
  10. 23.21.63.56 status.github.com
  11. 192.30.253.1668 training.github.com
  12. 192.30.253.112 www.github.com
  13. 151.101.13.194 github.global.ssl.fastly.net
  14. 151.101.12.133 avatars0.githubusercontent.com
  15. 151.101.112.133 avatars1.githubusercontent.com

6、Docker

注意CentOS默认不支持AUFS,此时使用Docker会使用Overlay2文件系统来存储镜像,需要手动安装AUFS,再装Docker。
grep aufs /etc/filesystems 查看是否支持aufs

  • 安装AUFS:

    1. # 进入repo目录
    2. cd /etc/yum.repos.d
    3. # 下载文件
    4. wget https://yum.spaceduck.org/kernel-ml-aufs/kernel-ml-aufs.repo
    5. # 安装
    6. yum install -y kernel-ml-aufs
  • 修改内核:

    1. vi /etc/default/grub
    2. # 修改参数, 表示启动时选择第一个内核
    3. ###################################
    4. GRUB_DEFAULT=0
    5. ###################################
    6. # 重新生成grub.cfg
    7. grub2-mkconfig -o /boot/grub2/grub.cfg
    8. # 重启计算机
    9. reboot
  • 依赖:

    1. sudo yum install -y yum-utils \
    2. device-mapper-persistent-data \
    3. lvm2
    4. sudo yum-config-manager \
    5. --add-repo \
    6. https://download.docker.com/linux/centos/docker-ce.repo
  • 本体

    1. sudo yum install docker-ce docker-ce-cli containerd.io
  • 将默认存储驱动修改为aufs

    • vi /usr/lib/systemd/system/docker.service
    • ExecStart=/usr/bin/dockerd --storage-driver=overlay
  • systemctl daemon-reload
  • 启动
    1. systemctl start docker