Rc.conf (简体中文)
From ArchWiki
i18n |
---|
English |
Italiano |
简体中文 |
Contents |
概述
rc.conf文件(/etc/rc.conf)是Archlinux的一个最基础的系统配置文件。这个文件包含了一般常见设置项,如时区,键盘布局,内核模块,和启动服务,通过修改这个文本文件就可以很方便的修改系统设置。
下面的是一个典型的rc.conf文件。
# # /etc/rc.conf - Main Configuration for Arch Linux # # # ----------------------------------------------------------------------- # LOCALIZATION # ----------------------------------------------------------------------- # # LOCALE: available languages can be listed with the 'locale -a' command # HARDWARECLOCK: set to "UTC" or "localtime" # TIMEZONE: timezones are found in /usr/share/zoneinfo # KEYMAP: keymaps are found in /usr/share/kbd/keymaps # CONSOLEFONT: found in /usr/share/kbd/consolefonts (only needed for non-US) # CONSOLEMAP: found in /usr/share/kbd/consoletrans # USECOLOR: use ANSI color sequences in startup messages # LOCALE="en_US.utf8" HARDWARECLOCK="localtime" TIMEZONE="Canada/Pacific" KEYMAP="us" CONSOLEFONT= CONSOLEMAP= USECOLOR="yes" # # ----------------------------------------------------------------------- # HARDWARE # ----------------------------------------------------------------------- # # Scan hardware and load required modules at bootup MOD_AUTOLOAD="yes" # Module Blacklist - modules in this list will never be loaded by udev MOD_BLACKLIST=() # # Modules to load at boot-up (in this order) # - prefix a module with a ! to blacklist it # MODULES=() # Scan for LVM volume groups at startup, required if you use LVM USELVM="no" # # ----------------------------------------------------------------------- # NETWORKING # ----------------------------------------------------------------------- # HOSTNAME="myhost" # # Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available # interfaces. # # Interfaces to start at boot-up (in this order) # Declare each interface then list in INTERFACES # - prefix an entry in INTERFACES with a ! to disable it # - no hyphens in your interface names - Bash doesn't like it # # Note: to use DHCP, set your interface to be "dhcp" (eth0="dhcp") # eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" INTERFACES=(eth0) # # Routes to start at boot-up (in this order) # Declare each route then list in ROUTES # - prefix an entry in ROUTES with a ! to disable it # gateway="default gw 192.168.0.1" ROUTES=(!gateway) # # Enable these network profiles at boot-up. These are only useful # if you happen to need multiple network configurations (ie, laptop users) # - set to 'menu' to present a menu during boot-up (dialog package required) # - prefix an entry with a ! to disable it # # Network profiles are found in /etc/network-profiles # #NET_PROFILES=(main) # # ----------------------------------------------------------------------- # DAEMONS # ----------------------------------------------------------------------- # # Daemons to start at boot-up (in this order) # - prefix a daemon with a ! to disable it # - prefix a daemon with a @ to start it up in the background # DAEMONS=(syslog-ng network netfs crond) # End of file
地区
- LOCALE: 这个是用来设置系统语言的,对所有的支持多国语言的程序工具都有效。你可以通过运行locale -a来查看所有可能的地区(locale)设置,而系统可用locale是在/etc/locale.gen文件之中启用。默认是为英语/美国。
- HARDWARECLOCK: 指定系统在启动和关机时和硬件时钟同步那种时区的时间,是UTC时间还是本地时间。一般来说UTC时间更加方便,因为可以很方便的改变时区。但是如果你使用windows,使用UTC可能会造成系统时间混乱,因为windows只能保存本地时间。
- TIMEZONE: 指定时区。你可以从/usr/share/zoneinfo文件夹里面查看到可用的时区。比如德国时区可以是Europe/Berlin,相应目录是/usr/share/zoneinfo/Europe/Berlin。对于中国用户来说,一般使用Asia/Shanghai或者Asia/Chongqing或者Hong_Kong,都指的是一个时区。
- KEYMAP: 指定你的键盘布局。一般键盘布局都是us,或者说只会有少数布局不一样。可用的键盘布局在/usr/share/kbd/keymaps下可以找到。请注意这里说的只是针对TTY(控制台)下,而不是图形界面(Xorg)下的键盘布局。xorg有自己的一套设置。
- CONSOLEFONT: 设置启动时通过setfont加载哪种控制台字体。可选的字体可以在/usr/share/kbd/consolefonts下找到。更多请看:Fonts in console
- CONSOLEMAP: 设置启动时通过setfont加载哪种控制台布局(console map)。可能的布局在/usr/share/kbd/consoletrans下可以找到。你可以设置适合你地区语言的布局。(例如 8859-1 for Latin1)。如果你使用utf8的locale,使用的程序输出8bit。如果你很少很少使用控制台,而常使用X,那么这个选项就不用管了,因为这个只会对控制台起作用。
- USECOLOR: 是否启用启动信息的彩色输出。
硬件
- MOD_AUTOLOAD: 如果设置的是"yes",在启动时Arch就会自动检测你的硬件然后自动加载需要的模块。这些都会通过udev完成。
- MOD_BLACKLIST: 失效了。需要禁止加载模块就在模块名称前面加上(!)然后添加到MODULES行里面去。
- MODULES: 在这个组里面你可以添加你项在启动时候加载的模块,可以不用在modprobe.conf里面绑定设置。只需在这个组里要添加模块名称,然后在modprobe.conf里面添加必须的参数就可以了。这样的一个好处就是网卡的模块将不会被覆盖,而只是使用你指定的。(A benefit of specifying networking modules here is that ethernet cards covered by the listed modules will always be detected in the order the modules are listed.)这样就防止了每次启动随机的指定你的网卡接口。当然更好的解决这个问题的方法是手动配置udev并且指定使用静态的接口。
- USELVM: 开机扫描LVM分区,当你使用了LVM的时候需要你设置成为YES,这样就会在系统初始化(sysinit)的时候运行vgchange。
网络
- HOSTNAME: 设置本台机器的主机名,但是没有域名部分。这完全根据你自己的需要,可以是常见的字符。但是也别太标新立异了,如果不知道如何设置,默认就好了。
- INTERFACES: 这里指定你网络的接口。Here you define the settings for your networking interfaces. The default lines and the included comments explain the setup well enough. If you do not use DHCP to configure a device, just keep in mind that the value of the variable (whose name must be equal to the name of the device which is supposed to be configured) equals the line which would be appended to the ifconfig command if you were to configure the device manually in the shell.
- ROUTES: 你可以在这里指定你静态局域网的路由。You can define your own static network routes with arbitrary names here. Look at the example for a default gateway to get the idea. Basically the quoted part is identical to what you'd pass to a manual route add command, therefore reading man route is recommended if you don't know what to write here, or simply leave this alone.
- NETWORKS: 这里设置启用高级网络配置文件。This enables certain network profiles at bootup. Network profiles provide a convenient way of managing multiple network configurations, and are intended to replace the standard INTERFACES/ROUTES setup that is still recommended for systems with only one network configuration. If your computer will be participating in various networks at various times (eg, a laptop) then you should take a look at the /etc/network.d/ directory to set up some profiles. There are template files included there (/etc/network.d/examples/) that can be used to create new profiles. ( Note: Since the introduction of netcfg v2.0 NET_PROFILES has been changed to this. This new version also contains many revisions, including the path to the stored profiles, please see Network Profiles for more info. In general the NETWORKS line should work the same way as the NET_PROFILES line, assuming you have the profiles in the new path (/etc/network.d/), and have changes any syntax neccessary to accomadate for the new version. )
服务
- DAEMONS: 这里添加包含在/etc/rc.d/下的文件名,那么这个服务将在启动时候启动。如果名称前面有个(!),这个服务就不会启动。如果前面有个(@),这个服务将在后台启动,也就是说系统启动不会等待这个服务启动完成,而是继续,一般是会等每个服务启动完成才继续,这样做某些时候可以提高系统启动速度。一般你不需要修改默认设置就可以启动一个可以使用的系统,但是如果你安装了一些软件,并且需要开机的时候自行启动,那么就需要修改这个组了。这个是Arch特有的做法,大多数别的linux系统会在/etc/init.d文件夹下建立一些脚本文件打到同样的目的。
注意: 这里的列表里面服务的先后次序非常重要,因为这也就定义了系统系统时候服务启动的先后顺序!