页面“Debian配置网络”与“Debian设置开机启动命令行界面 默认不开启图形界面”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
docker>Evan
 
docker>Evan
 
第1行: 第1行:
<pre>
 
cat  /etc/network/interfaces
 
# This file describes the network interfaces available on your system
 
# and how to activate them. For more information, see interfaces(5).
 
 
source /etc/network/interfaces.d/*
 
 
# The loopback network interface
 
auto enp0s3 # #设置开机自动连接网络
 
allow-hotplug enp0s3
 
iface enp0s3 inet static #static表示使用固定IP地址上网,dhcp表示使用动态ip
 
address 192.168.88.3  #设置静态ip地址
 
netmask 255.255.255.0 #子网掩码
 
gateway 192.168.88.1  #网关
 
 
auto lo
 
iface lo inet loopback
 
 
#重启网络不成功
 
service networking restart
 
  
</pre>
+
=问题来了=
 +
现在的Linux发行版一般都支持图形界面,然而我们作为服务器并不需要图形界面,不需要相关的进程在开机的时候启动。红帽系列的Linux发行版提供/etc/inittab文件进行此配置,将其中的“id:5:initdefault:”中的5换成3即可。具体原因可自行google(关系到文件夹/etc/rc*.d/文件夹,其中*的取值为1-5)。
 +
但是对于Debian,好像就不是那么简单了,即使做了上述的更改,仍会启动图形界面。
  
=my eg=
+
=解决办法=
 +
修改启动程序grub配置文件实现
 
<pre>
 
<pre>
# The primary network interface
+
1.打开grup配置文件:/etc/default/grub
auto enp0s3
+
2.修改GRUB_CMDLINE_LINUX=”” 为GRUB_CMDLINE_LINUX=”text”
allow-hotplug enp0s3
+
3.更新grub:update-grub
iface enp0s3 inet static
+
4.更新系统服务管理器配置:systemctl set-default multi-user.target
address 192.168.88.68
+
5.重启:init 6</pre>
netmask 255.255.255.0
+
[[category:debian]]
gateway 192.168.88.1
 
 
 
auto lo
 
iface lo inet loopback
 
 
 
</pre>
 
=参考=
 
[https://www.debian.cn/archives/1246 Debian中如何设置静态IP地址 ]
 
 
 
[http://www.voidcn.com/article/p-youlbtpa-bqt.html debian9.x配置网络]
 
  [[category:ops]]
 

2018年2月23日 (五) 14:30的版本

问题来了

现在的Linux发行版一般都支持图形界面,然而我们作为服务器并不需要图形界面,不需要相关的进程在开机的时候启动。红帽系列的Linux发行版提供/etc/inittab文件进行此配置,将其中的“id:5:initdefault:”中的5换成3即可。具体原因可自行google(关系到文件夹/etc/rc*.d/文件夹,其中*的取值为1-5)。 但是对于Debian,好像就不是那么简单了,即使做了上述的更改,仍会启动图形界面。

解决办法

修改启动程序grub配置文件实现

1.打开grup配置文件:/etc/default/grub 
2.修改GRUB_CMDLINE_LINUX=”” 为GRUB_CMDLINE_LINUX=”text” 
3.更新grub:update-grub 
4.更新系统服务管理器配置:systemctl set-default multi-user.target 
5.重启:init 6