CentOS7的一些初始化
默认最小化安装
[root@GVMCET001 ~]# nmtui 设置网络,主机名等
[root@GVMCET001 ~]# yum update 更新系统
SSH
[root@GVMCET001 ~]# ss -ntl 查看SSH端口状态
[root@GVMCET001 ~]# systemctl status sshd 查看SSH服务状态
[root@GVMCET001 ~]# vi /etc/ssh/sshd_config 配置SSH服务
防火墙
[root@GHKVPS001 ~]# systemctl start firewalld
[root@GHKVPS001 ~]# systemctl enable firewalld
[root@GHKVPS001 ~]# systemctl status firewalld
[root@GHKVPS001 ~]# firewall-cmd --list-all
[root@GHKVPS001 ~]# firewall-cmd --add-service=http --permanent #添加http服务,永久生效
[root@GHKVPS001 ~]# firewall-cmd --add-service=https --permanent #添加https服务,永久生效
[root@GHKVPS001 ~]# firewall-cmd --reload
新建用户并禁用root登录 更改登录端口
[root@GHKVPS001 ~]# useradd lyndon
[root@GHKVPS001 ~]# passwd lyndon
[root@GHKVPS001 ~]# vi /etc/ssh/sshd_config
#Port 22 //删除
Port 33389 //添加
PermitRootLogin no
[root@GHKVPS001 ~]# systemctl restart sshd.service
[root@GHKVPS001 ~]# firewall-cmd --permanent --add-port=33389/tcp
[root@GHKVPS001 ~]# firewall-cmd --permanent --remove-service=ssh
授权用户root使用密码xxx从指定ip为103.224.83.42的主机连接到mysql服务器
GRANT ALL PRIVILEGES ON *.* TO 'root'@'103.224.83.42' IDENTIFIED BY 'XXX' WITH GRANT OPTION;
flush privileges;