运行环境
- 树莓派4B 4核8G
- CentOS 7
关闭SELinux和Firewalld
getenforce
cat /etc/sysconfig/selinux
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
关闭SSH usedns
cat /etc/ssh/sshd_config
systemctl restart sshd
换源
sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#baseurl=http://mirror.centos.org/altarch/|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-altarch/|g' -e 's|^#baseurl=http://mirror.centos.org/$contentdir/|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-altarch/|g' -i.bak /etc/yum.repos.d/CentOS-*.repo
yum clean all
yum repolist
yum makecache
生成密钥&放置密钥
ssh-keygen -C "root@pi.abu.pub"
ssh-copy-id 127.0.0.1
修改时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
关闭交换分区
cat /etc/fstab
安装命令提示
yum install bash-com* -y
查看WiFi
nmcli device wifi
连接WiFi
nmcli connection modify f66add19-f3d4-3b93-811b-26d8915273e6 con-name eth0
nmcli device wifi connect "Serverless" password "123456" name wlan0
nmcli connection modify wlan0 ipv4.method manual ipv4.addresses 192.168.1.50/24
nmcli connection modify wlan0 ipv4.gateway 192.168.1.1
nmcli connection modify wlan0 ipv4.dns-search abu.pub
nmcli connection modify wlan0 autoconnect yes
nmcli connection down wlan0
nmcli connection up wlan0
配置EPEL源
yum install wget
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
配置Kubernetes源
cat << EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
安装Docker-CE
yum install yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i s%download.docker.com%mirrors.aliyun.com/docker-ce%g /etc/yum.repos.d/docker-ce.repo
yum install docker-ce docker-ce-cli -y
systemctl enable docker
systemctl start docker
docker version
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://yln6o2wd.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
docker pull hello-world
docker images
docker run --rm hello-world
docker ps -a
docker system prune -a
安装Golang
wget -O go1.15.7.src.tgz https://golang.google.cn/dl/go1.15.7.src.tar.gz
wget -O go1.15.7.linux-arm64.tar.gz https://dl.google.com/go/go1.15.7.linux-arm64.tar.gz
tar -C /usr/local/ -xvzf go1.15.7.linux-arm64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version
安装Etcd
wget -O etcd-v3.4.14.src.tgz https://github.com/etcd-io/etcd/archive/v3.4.14.tar.gz
yum install etcd -y
cat /etc/etcd/etcd.conf
etcd --version
etcdctl set /testdir/testkey "Hello world"
etcdctl get /testdir/testkey
etcdctl update /testdir/testkey "Hello"
etcdctl rm /testdir/testkey
etcdctl ls
etcdctl member list
安装基础工具
yum install git -y
安装Kubernetes
有疑问加站长微信联系(非本文作者)