-- ubuntu系统
1.安装
2.进行网络配置
选择 虚拟机-->设置-->网络适配器-->改为NAT模式
选择 编辑-->虚拟网络适配器-->NAT设置-->网关IP:192.168.121.2
-->取消DHCP自动分配模式(使用本地DHCP服务将IP地址分配给虚拟机)
-->子网IP:192.168.121.0
-->子网掩码:255.255.255
打开本地网络-->更改适配器选项-->VMware Network Adpter-->IPv4
-->设置IP地址:192.168.121.1
-->子网掩码:255.255.255
3.手动进行配置ubuntu系统中的网络
点击wifi图标-->Edit Connections-->选择Wired connection1
-->IPv4Settings -->add Addresses -->Address:192.168.121.131、Netmask:24、Gateway:192.168.121.2-->DNS servers:8.8.8.8/跟Gateway一样也可以
xshell远程链接ubuntu服务器:
要使本机开放SSH服务就需要安装openssh-server
sudo apt-get install openssh-server
确认sshserver是否启动了:
ps -e |grep ssh
如果看到sshd那说明ssh-server已经启动了。
如果没有则可以这样启动:sudo /etc/init.d/ssh start
连接不上的问题:
1、在虚拟机终端使用root帐号登录,编辑/etc/ssh/sshd_config文件
gedit /etc/ssh/sshd_config
2、找到Authentication配置部分,将PermitRootLogin without-password修改为PermitRootLogin yes,然后保存。
说明:sshd_config是ssh的配置文件,其中有一个选项 PermitRootLogin 用来配置是否允许root用户登录,默认的without-password表示不允许使用密码进行全登录认证,yes则是允许root登录。
-------------------------------------------------------------------------------------------------------------------------
-- centos
centos6.x
操作防火墙:service iptables status/start/stop/restart
chkconfig
--list
chkconfig iptables off
service mysqld status
查看ip地址:ifconfig
centos7.x
操作防火墙:systemctl status/start/stop/restart firewalld
systemctl list-unit-files
systemctl enable/disabled firewalld
systemctl status mysqld
查看ip地址:ip addr