一、网络配置

1、配置静态ip

vim /etc/network/interfaces
#interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto ens33
iface ens33 inet static
address 192.168.40.201
gateway 192.168.40.2
netmask 255.255.255.0
dns-nameservers 114.114.114.114  8.8.8.8  (/etc/resolv.conf 自动会去读取 )

# /etc/init.d/networking restart  (或者ifup ens33 重启网卡)
[ ok ] Restarting networking (via systemctl): networking.service

# cat /etc/resolv.conf 
nameserver 114.114.114.114

解决:
root@ubuntu:~# route  查看路由
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.40.0    *               255.255.255.0   U     0      0        0 ens33
192.168.122.0   *               255.255.255.0   U     0      0        0 virbr0
root@ubuntu:~# route add default gw 192.168.40.2 (添加本机的路由)

root@ubuntu:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.40.2    0.0.0.0         UG    0      0        0 ens33
192.168.40.0    *               255.255.255.0   U     0      0        0 ens33
192.168.122.0   *               255.255.255.0   U     0      0        0 virbr0

root@ubuntu:~# ping baidu.com
PING baidu.com (220.181.38.148) 56(84) bytes of data.
64 bytes from 220.181.38.148: icmp_seq=1 ttl=128 time=51.3 ms
64 bytes from 220.181.38.148: icmp_seq=2 ttl=128 time=34.3 ms
64 bytes from 220.181.38.148: icmp_seq=3 ttl=128 time=34.6 ms

2、配置阿里源

vim  /etc/apt/sources.list  

ubantu16.04:
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

ubantu18.04:
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 

sudo apt-get upgrade 

sudo apt-get dist-upgrade

二、常见问题

1、root账户问题

1、初始登录的时候root密码是随机的,自己改一个。

ubuntu

2、登录界面没有root选项

 ubuntu

解决:

gedit /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

第三行加入:greeter-show-manual-login=true

 ubuntu

再次登录出现“登录”选项

 ubuntu

进入最小化界面

ctrl+alt+f1

ubantu18.04版本不一样,请参照

http://www.c3389.com/index.php/post/454.html

问题

ubuntu重启后进入桌面版,nvidia-driver报错 Failed to initialize NVML: Driver/library version mismatch

解决:(遗留问题,每次重启服务器,nvidia-driver就需要重新装一次)

#查看运行级别为5
runlevel

#查看默认运行级别
systemctl  get-default

#修改默认运行级别为3
sudo systemctl set-default multi-user.target

2、vi编辑器问题

Ubuntu安装完成后vi编辑器键盘不能正常使用,使用下面方法解决:

vim /etc/vim/vimrc.tiny
将“compatible”改成“nocompatible”非兼容模式;
并添加一句:set backspace=2 

3、跨系统粘贴复制

在Ubuntu的命令行中执行一下命令(报错找六)

# apt-get autoremove open-vm-tools
# apt-get install open-vm-tools
# apt-get install open-vm-tools-desktop

记得重启系统

4、root登录一直索要密码

安装apt-get install openssh-server

注意:/etc/ssh/ssh_config下不能瞎动

正确修改文件:/etc/ssh/sshd_config

5、安装vm-tools失败

root@zjz:~# apt-get install open-vm-tools  (报  错)
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是
因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件
包尚未被创建或是它们已被从新到(Incoming)目录移出。
下列信息可能会对解决问题有所帮助:
下列软件包有未满足的依赖关系:
 open-vm-tools : 依赖: libdumbnet1 (>= 1.8) 但无法安装它
                 依赖: libxmlsec1 (>= 1.2.20) 但无法安装它
                 依赖: libxmlsec1-openssl (>= 1.2.20) 但无法安装它
                 推荐: zerofree 但无法安装它
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

解决:更新系统的源  (也可以先更新apt源,在下载就可以)

ubuntu

6、root登录报错mesg:ttyname failed

ubuntu

 方法一:
将/root/.profile文件中的mesg n

替换成tty -s && mesg n

重启

方法二:

将非root账户目录中的.profile复制到/root/:

例如:cp /home/username/.profile /root/

重启

 

 

阿里云镜像下载地址:https://mirrors.aliyun.com/ubuntu-releases/

相关文章:

  • 2021-05-17
  • 2021-07-25
猜你喜欢
  • 2022-12-23
  • 2021-11-20
  • 2021-10-26
  • 2022-01-13
  • 2021-12-11
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案