正所谓,预先善其事必先利其器,学习linux命令之前我们要用VMware Workstation Pro来搭建centos系统,并使用一个美观的Tabby Terminal来代替Xshell连接linux系统(当然也可以使用Xshell,个人习惯)。
这里我已经把centos搭建在VMware中,网上也有很多教程,就不一一罗列了,附上我觉得可以的一个链接。
1、配置静态ip
修改etc/sysconfig/network-scripts/ifcfg-ens33配置文件,将类型设为静态static,设置自动重启,配置ip、子网掩码、网关、DNS。 如图:
DNS2可要可不要 vm菜单,选择(编辑 -> 虚拟网络编辑器),页面如下:
配置ip
配置网关
将网关配置
DNS1填上第一个图中DNS1即可
2、连接
新建一个SSH连接
配置centos的ip地址、用户名、密码
3、重启网卡 service network restart
查看ip
现在我们的ip就配置好了
4、关闭防火墙进行远程连接
罗列几个情况给大家参考
查看防火墙状态
systemctl status firewalld
service iptables status
暂时关闭防火墙
systemctl stop firewalld
service iptables stop
永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off
重启防火墙
systemctl enable firewalld
service iptables restart
永久关闭并启动
chkconfig iptables on
5、连接成功
6、踩坑经历
Loading mirror speeds from cached hostfile
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable
To enable custom repositories:
yum-config-manager --enable
解决方案:
解决方法:在终端运行curl -o /etc/yum.repos.d/CentOS-Base.repo mirrors.aliyun.com/repo/Centos…
再运行安装命令:yum -y install wget即可
参考地址:
记得配置成功后存一个镜像,有什么问题也可以在下面讨论,一起学习。
最后附上工具链接:
Tabby Terminal:gitcode.net/mirrors/Eug…