星期一, 三月 28, 2011

Setting up my small linux box

I have a small Linux box called fit-pc2.  Its function is very week.  But it consume little power. I am using it as a temporary file server. Its address is http://yu.selfip.net.

This box came along with a Ubuntu 8.04.  Its support is outdated.  Updating it resulted in a graphical mode crappy. As I am more familiar with Fedora, I installed one running @ run level 3.  The article is about configuring it to run level 3.

There are 7 run levels:

  • 0 - halt (Do NOT set initdefault to this)
  • 1 - Single user mode
  • 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
  • 3 - Full multiuser mode
  • 4 - unused or Admin
  • 5 - X11
  • 6 - reboot (Do NOT set initdefault to this) 
There are 3 ways to change startup level:
  1. Change /etc/inittab, usually the last line, from id:5:initdefault: to id:3:initdefault:. e.g.
    # sed -i s/id:5:/id:3:/ /etc/inittab
  2. Change current level
    su -c 'telinit 3'
  3. Changing the runlevel at boot time. (aka Grub Method)
    1. Reboot then press and hold a key until the grub menu appears
    2. Choose your desired kernel and press "a" to modify the kernel arguments.
    3. Simply add a 3 to the line for runlevel 3 or 1 for single user mode and Press "enter".  After pressing enter press "b" to boot with the changes you have made. (NOTE: If you are having booting issues you might want to remove "quiet" and "rhgb.")
    4. Log in and do the damage you desire. If you are booting to single user you do not need to login you will simply be presented with a prompt.
    5. Logout, change runlevels or reboot as needed.

For the last one, once can also add a option runlevel=3 in /boot/grup/menu.lst (perhaps).
As my box will start automatically with out screen and keyboard, I changed /etc/inittab only.

1 条评论:

xijiang 说...

In Fedora 15, /etc/inittab has following contents:

# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To set a default target, run:
#
# ln -s /lib/systemd/system/.target /etc/systemd/system/default.target
#