由于在虚拟机上安装ubuntu,为了减轻系统负载,只使用进入字符界面,在本地ssh连接操作
修改显示语言
修改默认进入界面
- ubuntu 18_04
sudo systemctl set-default multi-user.target #默认进入字符界面
sudo systemctl set-default graphical.target #默认进入图形界面
sudo init 5
startx
- ubuntu 14_04
update-grub2
设置固定ip
root@ubuntu:~# vim /etc/network/interfaces
1 # interfaces(5) file used by ifup(8) and ifdown(8)
2 auto lo
3 iface lo inet loopback
4
5
6 iface eth0 inet static
7 address 192.168.3.129
8 netmask 255.255.255.0
9 gateway 192.168.3.1
ubuntu18的固定ip设置https://blog.csdn.net/u010039418/article/details/80934346
yaml配置文件
root@ubuntu:~# netplan apply #应用配置
tom@ubuntu:~$ vim /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2 #注意缩进问题
#renderer: NetworkManager
ethernets:
ens33:
addresses: [192.168.3.129/24]
gateway4: 192.168.3.1
nameservers:
addresses: [219.141.136.10]
更改dns域名服务器地址
[tom@tom-virtual-machine ~]$sudo vim /etc/resolvconf/resolv.conf.d/base
1 nameserver 219.141.136.10
[tom@tom-virtual-machine ~]$service resolvconf restart #重启服务
stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.27" (uid=1000 pid=2350 comm="stop resolvconf ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.28" (uid=1000 pid=2344 comm="start resolvconf ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
[tom@tom-virtual-machine ~]$ping www.baidu.com #可以ping通baidu
PING www.a.shifen.com (182.61.200.7) 56(84) bytes of data.
64 bytes from 182.61.200.7: icmp_seq=1 ttl=51 time=27.9 ms
64 bytes from 182.61.200.7: icmp_seq=2 ttl=51 time=21.6 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1006ms
rtt min/avg/max/mdev = 21.693/24.817/27.942/3.128 ms
/etc/resolv.conf
下有这样的提示
“DO NOT EDIT THIS FILE BY HAND – YOUR CHANGES WILL BE OVERWRITTEN”,这里直接编辑会当时生效,但是重启后会重置。所能需像依上面来进行设置,或者直接写入固定ip配置中-> here。