ubuntu1804安装后设置
注意开始默认为NAT模式
ubuntu默认以普通用户身份登陆,切换到root
ubuntu切换到root用户,使用su root命令去切换到root权限,此时会提示输入密码
,可是怎么也输不对,提示“Authentication failure”
此时有两种情况一个是密码真的错了,另一种就是刚安装好的Linux系统,没有给root设置密码
解决办法:给root 用户设置密码,输入命令: sudo passwd root,输入密码,并确认密码
重新输入命令:su root,然后输入密码,便可切换到root权限了
返回普通用户exit,或者使用命令su username
修改配置文件默认登陆为root账户登陆
修改配置文件vim /etc/ssh/sshd_config
#PermitRootLogin prohibit-password #找到此项修改如下
PermitRootLogin yes
#UseDNS no #找到此项去掉注释,修改如下
UseDNS no
修改主机名
hostnamectl set-hostname ubuntu1804
Ubantu网络配置
网卡名称:
默认ubantu的网卡名称和Centos7类似,如:ens33,ens38等
修改网卡名称为传统命名方式:(最好在装系统时就改好,在安装界面输入net.ifnames=0 biosdevname=0)
修改配置文件为下面形式
vi /etc/default/grub
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
生效新的grub.cfg文件
grub-mkconfig -o /boot/grub/grub.cfg #Centos里面是grub2
重启reboot
官方文档
https://help.ubuntu.com/lts/serverguide/network-configuration.html.zh-CN
配置自动获取IP(注意缩进格式)
cat /etc/netplan/01-netcfg.yaml
network
version: 2
renderer: networkd
ethernets:
ens33:
dhcp4: yes
修改网卡配置文件后需执行命令生效:netplan apply
配置静态IP:
cat /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 192.168.56.64/24
- 10.20.156.23/24
gateway4: 192.168.56.1
nameservers:
search: [mydomain,otherdomain]
addresses: [114.114.114.114]
查看IP和gateway
ip addr
route -n
查看DNS
ls -l /etc/resolv.conf
systemd-resolve --status
同步时间
sudo apt-get update??
Ubuntu最小化没有selinux,不用关闭
没有防火墙,验证一下
systemctl disable firewalld
systemctl disable iptables
清空防火墙规则iptables -F
iptable -vnL查看
更改为阿里云的yum源
vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
sudo apt-get update更新apt源
[c:\~]$ Connecting to 192.168.247.64:22...
Connection established.
To escape to local shell, press ‘Ctrl+Alt+]‘.
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-29-generic x86_64)
- Documentation: https://help.ubuntu.com
- Management: https://landscape.canonical.com
-
Support: https://ubuntu.com/advantage
System information disabled due to load higher than 2.0
234 packages can be updated.
117 updates are security updates.
通过Xshell远程链接后如下
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
/usr/bin/xauth: file /root/.Xauthority does not exist
root@ubuntu-torrent:~#