Article Directory
Outline
In this chapter is mainly on machines to do a unified configuration and installation
Unified environment configuration
Note: It is recommended to unify configured, and then cloned, otherwise a bit thin blue
Close swap space
swapoff -a
Avoid boot swap space
# 注释 swap 开头的行
vi /etc/fstab
Turn off the firewall
ufw disable
Modify the hostname
- Set the host name
# 使用 hostnamectl 命令修改,其中 kubernetes-master 为新的主机名
hostnamectl set-hostname kubernetes-master
- Modify cloud.cfg
# 如果有该文件
vi /etc/cloud/cloud.cfg
# 该配置默认为 false,修改为 true 即可
preserve_hostname: true
- View hostname
root@kubernetes-master:~# hostnamectl
Static hostname: kubernetes-master
Icon name: computer-vm
Chassis: vm
Machine ID: 33011e0a95094672b99a198eff07f652
Boot ID: 8c0fd75d08c644abaad3df565e6e4cbd
Virtualization: vmware
Operating System: Ubuntu 18.04.2 LTS
Kernel: Linux 4.15.0-48-generic
Architecture: x86-64
Installation docker
Ready to install the necessary docker
- Edit Data Source
vi /etc/apt/sources.list
- Amended to delete all content and
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
- Update the data source
apt-get update
Installation docker
- Update software source
apt-get update
- Install the required dependencies
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
- GPG installation certificate
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
- New software source information
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
- In this update software source
sudo apt-get -y update
- Installation docker
sudo apt-get -y install docker-ce
Configuration docker accelerator
Note: For the systemd system, the following /etc/docker/daemon.json write (if the file does not exist Please new file)
- Configuration accelerate
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
- Verify that the configuration is successful
sudo systemctl restart docker
docker info
# 出现如下语句即表示配置成功
Registry Mirrors:
https://registry.docker-cn.com/
Installation docker-compose
curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose