一、root用户
1. centos在安装过程中设置root用户
2. ubuntu先创建user,登录系统后,输入语句设置root密码
sudo passwd root
二、ssh服务启动
ubuntu在用客户端ssh连接时,先连接到创建的user,再切换到root用户
centos的ssh默认安装?
ubuntu
1.查看ssh是否启动
ps -ef | grep ssh
2.查看ssh是否安装
sudo /etc/init.d/ssh restart
3.安装ssh服务器
sudo apt-get install openssh-server
4.如果安装报错 Package ‘xxx’ has no installation candidate
-
备份/etc/apt/sources.list
sudo cp -i /etc/apt/sources.list /etc/apt/sources.list.backup
-
更新repos
vi /etc/apt/sources.list #添加以下内容 deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
-
更新apt-get
sudo apt-get update
-
安装启动
sudo apt-get install openssh-server sudo /etc/init.d/ssh start
三、遇到问题
1、ping www.baidu.com 报错
错误情况:
ping: www.lxx1.com: Temporary failure in name resolution
ping: www.lxx1.com: System error
ping: www.lxx1.com: Unknown host www.baidu.com
解决方法
- 确认已配置好DNS:
-
方法一:
vi /etc/resolv.conf
添加nameserver 114.114.114.114 nameserver 223.5.5.5
-
方法二:
vi /etc/sysconfig/network-scripts/ifcfg-***
添加
DNS1=114.114.114.114
DNS2=223.5.5.5
-
查看
vi /etc/nsswitch.conf
修改
hosts: files dns -
查看防火墙有没有把dns的53端口限制住了
netstat -anp | grep 53
- 没看,运行
systemctl iptables stop
关闭防火墙试试,可行,进行第3步 - 防火墙开放53端口
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT