CentOS初始配置

最近安装了一台CentOS虚拟机,记录一下装完之后的事情

网络配置

# vi /etc/sysconfig/network-scripts/ifcft-ens33

ONBOOT 默认为 no,改为 yes 意思是:系统在启动时激活网卡

启动网卡

# ifup ens33

重启网卡服务

# systemctl restart network

更换源

[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Base.repo
## 修改为如下内容 CentOS-Base.repo
[BaseOS]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@localhost ~]# vi /etc/yum.repos.d/CentOS-AppStream.repo
## CentOS-AppStream.repo
[AppStream]
name=CentOS-$releasever - AppStream
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

linux的防火墙

查看防火墙状态

[root@localhost ~]# systemctl status firewalld;

关闭防火墙

[root@localhost ~]# systemctl stop firewalld:

SSH服务

查看是否安装 ssh

# rpm -qa | grep ssh

没有安装则使用 yum安装 ssh

# yum install openssh-server

修改 ssh 配置文件

# vi /etc/ssh/sshd_config
Port 22					// 去掉前面得#
PermitRootLogin yes 	// 如果需要使用 root 连接则 yes 反之则 no 即可

好了 这样就可以使用ssh连接后 无忧无虑的玩了

posted @ 2020-03-13 14:52  ZMemory  阅读(166)  评论(0编辑  收藏  举报