Linux安装与基本配置

1. 安装

1.1. Debian安装

事先在硬盘上准备一个未分区的空间,至少5G。最好先备份硬盘上的重要数据,或者使用完全空闲的硬盘。

下载debian安装光盘的镜像文件。完整版需要很多光盘。如果网络条件许可,使用网络安装版最方便:http://www.debian.org/distrib/netinst

将镜像刻录成光盘,使用这张光盘引导系统。引导后出来安装界面,安照提示一步一步完成即可。其中在选择apt源的时候,选择cn99的http服务器比较快。

1.2. Ubuntu 安装

安装前:

光盘安装过程:

硬盘安装过程:(以Ubuntu-8.04-desktop-i386.iso 为例)

安装完成后,修改ubuntu的源,改成国内的ubuntu源速度比较快。修改文件:/etc/apt/sources.list,从Ubuntu 源列表中选一组替换原来的内容

2. 基本配置

2.1. 存储器管理

2.2. 内核

重新编译内核

  1. 下载内核:http://www.kernel.org/ ,解压缩

  2. 配置内核选项:

    cp /boot/config-`uname -r` ./.config
    make menuconfig
  3. 编译内核:

    make-kpkg clean
    fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
  4. 安装内核:

    dpkg -i linux-image-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb
    dpkg -i linux-headers-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb
  5. 修改引导文件:

    vi /boot/grub/menu.lst
    
    title           Ubuntu, kernel 2.6.18.1-custom
    root            (hd0,0)
    kernel          /boot/vmlinuz-2.6.18.1-custom root=/dev/sda1 ro quiet splash
    initrd          /boot/initrd.img-2.6.18.1-custom
    savedefault
    boot
    
    title           Ubuntu, kernel 2.6.18.1-custom (recovery mode)
    root            (hd0,0)
    kernel          /boot/vmlinuz-2.6.18.1-custom root=/dev/sda1 ro single
    initrd          /boot/initrd.img-2.6.18.1-custom
    boot
  6. 使用新内核重启

2.3. 中文输入法

小企鹅输入法(五笔、拼音等)

apt-get install fcitx

scim(Smart Common Input Method)

apt-get install scim scim-tables-zh

在debian中安装scim后,输入法可能不会随着X启动而自动加载。可以在/etc/X11/Xsession.d/目录中添加文件95scim,内容如下:

export XMODIFIERS="@im=SCIM"
export GTK_IM_MODULE=scim
scim -d

在英文的locale下,无法使用scim中文输入,可以运行:

sudo update-alternatives --config xinput-all_ALL

选择scim

2.4. 中文排序

让文件名是中文的文件按照拼音顺序排列:安装locale-pinyin:

sudo apt-get install locale-pinyin 

然后设置LC_COLLATE=zh_CN@pinyin.utf8,可以通过在/etc/environment文件中添加这一行实现:

LC_COLLATE="zh_CN@pinyin.utf8"

然后重新登录就可以起作用了

2.5. adsl拨号

使用pppoeconf配置拨号的属性

pppoeconf

使用pon进行拨号

pon dsl-provider

使用poff断开

poff dsl-provider

2.6. 网络配置

Debian和Ubuntu的网络配置大多出现在文件/etc/hostname和文件/etc/network/ interfaces里,另从/etc/network目录下的options文件里提供一点儿帮助。 主机名在/etc/hostname文件里设置。这个文件里的名字应该是全名,因为它的值要在各种场合下使用,其中有些场合需要全名。不过,标准的Debian安装在那里留下的不是一个全名。

/etc/hostname           #主机名
/etc/network/interfaces #IP地址、子网掩码、默认网关
/etc/network/options    #IP转发

可以用VI编辑以上文件,也可用"ifconfig"和"route"配置

2.7. 休眠

查看系统支持哪些模式

cat /sys/power/state

echo disk > /sys/power/state

echo mem > /sys/power/state

hp的笔记本从待机恢复后键盘鼠标失去响应的问题,可以在/etc/acpi/suspend.d中新建文件20-i8042-input.sh:

# Unbind the AT keyboard interface.
if [ -f /sys/bus/platform/drivers/i8042/unbind ]; then
  echo -n "i8042" > /sys/bus/platform/drivers/i8042/unbind
fi

在/etc/acpi/resume.d中新建文件80-i8042-input.sh:

# Rebind the AT keyboard interface.
if [ -f /sys/bus/platform/drivers/i8042/bind ]; then
  echo -n "i8042" > /sys/bus/platform/drivers/i8042/bind
fi

2.8. 节电措施

Suggestion: increase the VM dirty writeback time from 5.00 to 15 seconds with:

  echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

This wakes the disk up less frequenty for background VM activity

2.9. ubuntu读写ntfs分区

在source.list上加上

deb http://flomertens.keo.in/ubuntu/ dapper main
deb-src http://flomertens.keo.in/ubuntu/ dapper main

安装ntfs-3g

apt-get install ntfs-3g ntfs-3g-nautilus-tools

启动fuse模块

modprobe fuse

并在/etc/modules中加入一行

fuse

最后修改/etc/fstab,把对应ntfs的分区类型改成ntfs-3g,比如

/dev/hda1       /mnt/hda1   ntfs-3g defaults,nls=utf8,locale=zh_CN.utf8,umask=007,gid=46  0       1

2.10. X配置

从X.org 7.3和Xrandr1.2起,Linux的图形界面可以动态修改双头显示的配置了。首先将/etc/X11/xorg.conf改为(Intel 945显卡):

Section "Files"
EndSection

Section "InputDevice"
        Identifier      "Generic Keyboard"
        Driver          "kbd"
        Option          "CoreKeyboard"
        Option          "XkbRules"      "xorg"
        Option          "XkbModel"      "pc105"
        Option          "XkbLayout"     "us"
EndSection

Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
        Option          "CorePointer"
        Option          "Device"                "/dev/input/mice"
        Option          "Protocol"              "ImPS/2"
        Option          "ZAxisMapping"          "4 5"
        Option          "Emulate3Buttons"       "true"
EndSection

Section "InputDevice"
        Identifier      "Synaptics Touchpad"
        Driver          "synaptics"
        Option          "SendCoreEvents"        "true"
        Option          "Device"                "/dev/psaux"
        Option          "Protocol"              "auto-dev"
        Option          "HorizScrollDelta"      "0"
EndSection



Section "Device"
        Identifier      "Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"
        Driver          "intel"
        BusID           "PCI:0:2:0"
EndSection

Section "Monitor"
        Identifier      "通用显示器"
        Option          "DPMS"
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Device          "Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"
        Monitor         "通用显示器"
        DefaultDepth    24
        SubSection "Display"
                Virtual 2048 2048
        EndSubSection
EndSection

Section "ServerLayout"
        Identifier      "Default Layout"
        Screen          "Default Screen"
        InputDevice     "Generic Keyboard"
        InputDevice     "Configured Mouse"
        InputDevice     "stylus"        "SendCoreEvents"
        InputDevice     "cursor"        "SendCoreEvents"
        InputDevice     "eraser"        "SendCoreEvents"
        InputDevice     "Synaptics Touchpad"
EndSection

用xrandr命令修改双头设置

usage: xrandr [options]
  where options are:
  -display <display> or -d <display>
  -help
  -o <normal,inverted,left,right,0,1,2,3>
            or --orientation <normal,inverted,left,right,0,1,2,3>
  -q        or --query
  -s <size>/<width>x<height> or --size <size>/<width>x<height>
  -r <rate> or --rate <rate> or --refresh <rate>
  -v        or --version
  -x        (reflect in x)
  -y        (reflect in y)
  --screen <screen>
  --verbose
  --dryrun
  --prop or --properties
  --fb <width>x<height>
  --fbmm <width>x<height>
  --dpi <dpi>/<output>
  --output <output>
      --auto
      --mode <mode>
      --preferred
      --pos <x>x<y>
      --rate <rate> or --refresh <rate>
      --reflect normal,x,y,xy
      --rotate normal,inverted,left,right
      --left-of <output>
      --right-of <output>
      --above <output>
      --below <output>
      --same-as <output>
      --set <property> <value>
      --off
      --crtc <crtc>
  --newmode <name> <clock MHz>
            <hdisp> <hsync-start> <hsync-end> <htotal>
            <vdisp> <vsync-start> <vsync-end> <vtotal>
            [+HSync] [-HSync] [+VSync] [-VSync]
  --rmmode <name>
  --addmode <output> <name>
  --delmode <output> <name>
ch3n2k.com | Copyright (c) 2004-2020 czk.