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
VBoxManage modifyvm myserver --natpf1 "ssh,tcp,,3022,,22"
where ‘myserver’ is the name of the created VM. Check the added rules:
VBoxManage showvminfo myserver | grep 'Rule'
That’s all! Please be sure you don’t forget to install an SSH server in the VM:
sudo apt-get install openssh-server
To SSH into the guest VM, write:
ssh -p 3022 user@127.0.0.1
Where user is your username within the VM.
4、常用软件
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
export GOROOT=/usr/local/goexport GOBIN=$GOROOT/binexport GOPKG=$GOROOT/pkg/tool/linux_amd64export GOPATH=/goexport PATH=$PATH:$GOBIN:$GOPKG:$GOPATH/bin
- source /etc/profile
-
Git
yum -y install git
5、加速Github
vi /etc/hosts
加这些:
151.101.185.194 github.global.ssl.fastly.net192.30.253.112 github.com151.101.112.133 assets-cdn.github.com151.101.184.133 assets-cdn.github.com185.199.108.153 documentcloud.github.com192.30.253.118 gist.github.com185.199.108.153 help.github.com192.30.253.120 nodeload.github.com151.101.112.133 raw.github.com23.21.63.56 status.github.com192.30.253.1668 training.github.com192.30.253.112 www.github.com151.101.13.194 github.global.ssl.fastly.net151.101.12.133 avatars0.githubusercontent.com151.101.112.133 avatars1.githubusercontent.com
6、Docker
注意CentOS默认不支持AUFS,此时使用Docker会使用Overlay2文件系统来存储镜像,需要手动安装AUFS,再装Docker。grep aufs /etc/filesystems 查看是否支持aufs
安装AUFS:
# 进入repo目录cd /etc/yum.repos.d# 下载文件wget https://yum.spaceduck.org/kernel-ml-aufs/kernel-ml-aufs.repo# 安装yum install -y kernel-ml-aufs
修改内核:
vi /etc/default/grub# 修改参数, 表示启动时选择第一个内核###################################GRUB_DEFAULT=0#################################### 重新生成grub.cfggrub2-mkconfig -o /boot/grub2/grub.cfg# 重启计算机reboot
依赖:
sudo yum install -y yum-utils \device-mapper-persistent-data \lvm2sudo yum-config-manager \--add-repo \https://download.docker.com/linux/centos/docker-ce.repo
本体
sudo yum install docker-ce docker-ce-cli containerd.io
将默认存储驱动修改为aufs
vi /usr/lib/systemd/system/docker.serviceExecStart=/usr/bin/dockerd --storage-driver=overlay
- systemctl daemon-reload
- 启动
systemctl start docker
