标签 centos 下的文章

1)生成SSH密钥对

ssh-keygen -t rsa

2)将公钥添加到服务器的.ssh/authorized_keys文件中

3)修改SSH配置文件

编辑/etc/ssh/sshd_config文件,找到PasswordAuthentication yes这一行,并将其修改为PasswordAuthentication no,以禁用密码登录。

4)重启SSH服务

systemctl restart sshd

yum update -y
yum install -y java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64 \
    lrzsz lsof net-tools bind-utils iputils traceroute telnet curl wget vim \
    gzip tar zip unzip git htop perf gcc gcc-c++ openssl openssl-devel patch tree \
    tcpdump iftop iotop sysstat nethogs

修改/etc/resolv.conf

chattr -i /etc/resolv.conf
sed -i '1i nameserver 8.8.8.8' /etc/resolv.conf
chattr +i /etc/resolv.conf

修改/etc/security/limits.conf

cat >>/etc/security/limits.conf<<EOF

root soft nofile 100001
root hard nofile 100002
* soft nofile 100001
* hard nofile 100002
* soft memlock unlimited
* hard memlock unlimited
EOF

修改/etc/sysctl.conf

sysctl -p

安装命令

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker

设置registry-mirrors

vim /etc/docker/daemon.json,添加以下内容:

{
    "registry-mirrors": [
        "https://xxx.mirror.xxx.com"
    ]
}

重启服务

sudo systemctl daemon-reload
sudo systemctl restart docker