尋尋覓覓中我找到了arch,折騰這個系統需要很強的動手能力,因為它信奉的是kiss哲學,它默認提供了很少的包,甚至沒有圖形界面……但它的有點是不言而喻的,簡單,靈活,輕快,最新……安裝最基本的系統也並不是一件簡單的事!網上有很多圖文教程,下面我僅列出一些重要的點,供以后參考,arch官網是:https://wiki.archlinux.org/index.php/Main_Page_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)。
一、前期准備
1.備份數據
這個很有必要,arch的安裝界面是字符的,很容易就會把自己的數據給格掉!
2.收集信息
主要是顯卡型號,cpu類型,聯網軟件(需要編譯源碼)等,因為以后要裝驅動,設置IP等。
3.下載鏡像
一般的網絡條件都不是太好,下載一個CORE鏡像刻盤(或USB),比較保險。
http://releng.archlinux.org/isos/ 測試版本,比較新
http://mirrors.163.com/archlinux/iso/ 正式版本,注意選對iso類型
二、光盤引導
1.輸入root登錄后, 用 /arch/setup 進行一步一步設置
2.分區比較重要,而且容易出錯,最好是格盤,讓系統自動分區
3.選擇包,對於不熟悉軟件包的同學,還是都選上吧
4.配置系統
這應該是最重要,最復雜的一步了,主要是個配置文件的設置,這里將重要的配置文件貼出來。
a. /etc/rc.conf 系統語言,時區,主機名,網絡接口等(參見 man 5 rc.conf)
#
# /etc/rc.conf - Main Configuration for Arch Linux
#
# See 'man 5 rc.conf' for more details
#
# LOCALIZATION
# ------------
HARDWARECLOCK="localtime"
TIMEZONE="Asia/Shanghai"
KEYMAP="us"
CONSOLEFONT=
CONSOLEMAP=
LOCALE=
DAEMON_LOCALE="yes"
USECOLOR="yes"
# HARDWARE
# --------
MODULES=()
USEDMRAID="no"
USEBTRFS="no"
USELVM="no"
# NETWORKING
# ----------
HOSTNAME=xiangzi888
interface=eth0
address=222.222.222.143
netmask=255.255.255.0
broadcast=222.222.222.255
gateway=222.222.222.254
NETWORK_PERSIST="no"
# DAEMONS
# -------
#
DAEMONS=(syslog-ng network crond alsa)
注:有點英語基礎的還是不要設置 LOCALE 了吧,默認就是英語,如果設置成中文 zh_CN.utf8 很容易出問題。由於本人使用的是靜態 IP,所以設置的內容比較多。另外關於 DAEMONS,這是系統的守護進程,以后可以根據需要添加,比如 alsa 是添加聲音支持的,注意修改相應參數哦。
b. /etc/fstab 確定文件系統及掛載點,不用編輯
c. /etc/locale.gen 包含系統所支持的區域及字符集,對於國內的用戶,還是要添加中文支持的,只需 uncomment 以下幾行:
zh_CN.GB18030 GB18030
zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
zh_CN GB2312
d. /etc/resolv.conf DNS地址
#
# /etc/resolv.conf
#
#search <yourdomain.tld>
nameserver 222.222.222.242
nameserver 222.222.222.131
# End of file
5.設置root密碼
6.設置pacman源
/etc/pacman.d/mirrorlist,找到China,修改以下幾個就OK了
## China
Server = http://mirrors.163.com/archlinux/$repo/os/$arch
Server = http://mirror.bjtu.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirror6.bjtu.edu.cn/archlinux/$repo/os/$arch
Server = ftp://mirror.lzu.edu.cn/archlinux/$repo/os/$arch
Server = http://mirror.lzu.edu.cn/archlinux/$repo/os/$arch
#Server = ftp://mirrors.stuhome.net/archlinux/$repo/os/$arch
Server = http://mirrors.stuhome.net/archlinux/$repo/os/$arch
7.安裝引導程序grub
/boot/grub/menu.lst
# Config file for GRUB - The GNU GRand Unified Bootloader
# /boot/grub/menu.lst
# DEVICE NAME CONVERSIONS
#
# Linux Grub
# -------------------------
# /dev/fd0 (fd0)
# /dev/sda (hd0)
# /dev/sdb2 (hd1,1)
# /dev/sda3 (hd0,2)
#
# FRAMEBUFFER RESOLUTION SETTINGS
# +-------------------------------------------------+
# | 640x480 800x600 1024x768 1280x1024
# ----+--------------------------------------------
# 256 | 0x301=769 0x303=771 0x305=773 0x307=775
# 32K | 0x310=784 0x313=787 0x316=790 0x319=793
# 64K | 0x311=785 0x314=788 0x317=791 0x31A=794
# 16M | 0x312=786 0x315=789 0x318=792 0x31B=795
# +-------------------------------------------------+
# for more details and different resolutions see
# https://wiki.archlinux.org/index.php/GRUB#Framebuffer_resolution
# general configuration:
timeout 0
default 0
color light-blue/black light-cyan/blue
hiddenmenu
# boot sections follow
# each is implicitly numbered from 0 in the order of appearance below
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*
# (0) Arch Linux
title Arch Linux
root (hd0,0)
kernel /vmlinuz-linux root=/dev/disk/by-uuid/e5f77c78-9c29-414c-bcd7-f873dd2b4479 ro vga=0x34D
initrd /initramfs-linux.img
# (1) Arch Linux
title Arch Linux Fallback
root (hd0,0)
kernel /vmlinuz-linux root=/dev/disk/by-uuid/e5f77c78-9c29-414c-bcd7-f873dd2b4479 ro vga=0x34C
initrd /initramfs-linux-fallback.img
# (2) Windows
#title Windows
#rootnoverify (hd0,0)
#makeactive
#chainloader +1
8.退出,重啟,安裝完成
三、安裝系統軟件
1.首先,要建一個普通賬戶,這個很重要!不僅是安全性上面,如果先安裝軟件,可能沒有出現針對普通用戶的配置文件!建議登錄和安裝軟件都用普通用戶!當然要修改一下權限了。
#useradd -m -s /bin/bash xiangzi888
#passwd xiangzi888
/etc/sudoers 添加普通用戶權限,加一行就OK了。
##
## User privilege specification
##
root ALL=(ALL) ALL
## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL
xiangzi888 ALL=(ALL) NOPASSWD: ALL
2.更新系統
sudo pacman -Syu
3.安裝xorg
X.org是X Window System 的開源實現,如果要運行圖形化程序,那么這個包是必不可少的。包括X.org的服務器,工具,字體,鍵盤鼠標顯卡驅動等。
sudo pacman -S xorg
默認的顯卡驅動不是太好,需要安裝一個閉源的NVIDIA驅動:
sudo pacman -S nvidia nvidia-utils
遇到了軟件包沖突,卸載 libgl ,ok
sudo pacman -Rdd libgl
自動設置相關選項(目錄 /etc/X11/xorg.conf):
sudo nvidia-xconfig
4.xfce4桌面,字體及輸入法
字體一定要安裝阿,默認的巨丑無比,而且chromium還會亂碼!具體參見 :https://wiki.archlinux.org/index.php/Fonts_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
sudo pacman -S xfce4
sudo pacman -S ttf-arphic-uming ttf-arphic-ukai ttf-bitstream-vera
sudo pacman -S ibus ibus-pinyin
5.聲音支持
sudo pacman -S alsa-utils
sudo gpasswd -a xiangzi888 audio #將當前用戶添加到audio用戶組
同時,將 alsa 添加到 /etc/rc.conf 配置文件的DAEMONS 中,注意設置打開音量哦
DAEMONS=(syslog-ng network crond alsa)
6.其他常用軟件
sudo pacman -S ntfs-3g flashplugin vim
sudo pacman -S bash-completion #bash智能補齊,很強大
sudo pacman -S firefox chromium liferea thunderbird transmission-gtk
sudo pacman -S brasero gnome-mplayer #注意 mplayer 是沒有gui界面的!
sudo pacman -S dia scrot chmsee evince lftp gqview file-roller virtualbox notification-daemon gedit codeblocks
四、常用配置
1.vim /etc/vimrc
" add by xiangzi888
syntax on
set nu
set ai
set smartindent
set tabstop=4
set mouse=a
set ignorecase
" no bell,禁止終端響鈴
set vb t_vb=
" bad encoding
set fileencodings=utf-8,gbk,gb2312,gb18030
set termencoding=utf-8
set encoding=prc
2.禁止終端響鈴 /etc/inputrc(.inputrc)
# do not bell on tab-completion
set bell-style none
3. /etc/inittab 系統啟動信息,啟動X可以在這里修改
#
# /etc/inittab
#
# Runlevels:
# 0 Halt
# 1(S) Single-user
# 2 Not used
# 3 Multi-user
# 4 Not used
# 5 X11
# 6 Reboot
## Only one of the following two lines can be uncommented!
# Boot to console
id:3:initdefault:
# Boot to X11
#id:5:initdefault:
rc::sysinit:/etc/rc.sysinit
rs:S1:wait:/etc/rc.single
rm:2345:wait:/etc/rc.multi
rh:06:wait:/etc/rc.shutdown
su:S:wait:/sbin/sulogin -p
# -8 options fixes umlauts problem on login
c1:2345:respawn:/sbin/agetty -8 -s 38400 tty1 linux
c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux
c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux
c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux
c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux
c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux
# Serial Virtual Console for KVM and others VMs
#s0:2345:respawn:/sbin/agetty -8 -s 9600 ttyS0 linux
# Hypervisor Virtual Console for Xen and KVM
#h0:2345:respawn:/sbin/agetty -8 -s 38400 hvc0 linux
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
# Example lines for starting a login manager
x:5:respawn:/usr/bin/xdm -nodaemon
#x:5:respawn:/usr/sbin/gdm -nodaemon
#x:5:respawn:/usr/bin/kdm -nodaemon
#x:5:respawn:/usr/bin/slim >/dev/null 2>&1
# End of file
4.bash配置文件 ~/.bashrc
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
alias ll='ls -al'
alias m='sudo mentohust'
alias vi='sudo vim'
alias x='startxfce4'
alias s='sudo shutdown -h 0'
#PS1='[\u@\h \W]\$ '
PS1='${arch_chroot:+($arch_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$'
export LANG=en_US.UTF-8
#force_color_prompt=yes
set bell-style none
setterm -blength 0
xset -b
/etc/bash.bashrc 禁止關機響鈴,及鼠標滾動響鈴
setterm -blength 0
xset b off
PS1='${arch_chroot:+($arch_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$'
五、pacman及其他一些技巧
啟動xfce4:
startxfce4
查看文件類型及編碼方式:
file -i filename
查看守護進程(DAEMONS),及啟動:
rc.d list
ls /etc/rc.d/
/rc.d/gdm start
killall gnome-session
命令行啟動無線聯網設備(root權限):
ifconfig eth0 down #關閉有線網卡
iwconfig wlan0 txpower on #打開無線網卡電源
iwlist wlan0 scan #列出無線網絡詳細信息
iwconfig wlan0 essid "wirelessname" key wirelesskey #鏈接
ifconfig wlan0 up #啟用無線網卡
dhcpcd/dhclient wlan0 #打開DHCP鏈接
不出意外的話,ping 一 下就可以通了!
六、其他
正寫這篇博客的時候,小妮姐打電話過來說生了個男孩,搞得我興奮了半天。2012年3月8日,農歷二月十六,六斤四兩。不知怎的,對這個外甥有種特別的情愫。這正是我折騰opensuse和arch的時期,看來這兩個linux版本注定是與他有緣了,等他長大了,我會讓他知道的!可能需要幾年!
