• arch安装及配置xfce4桌面


      寻寻觅觅中我找到了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版本注定是与他有缘了,等他长大了,我会让他知道的!可能需要几年!

  • 相关阅读:
    好用的 convert freestyle jenkins jobs to pipeline 插件使用
    MkDocs 搭建试用
    当前云安全问题&&一些想法
    asciidoctor 安装试用
    gradle asciidoc 使用
    apache phoenix 安装试用
    parceljs 基本使用———又一个前端构建工具
    tidb 集群扩容
    tidb 安装试用&&以及安装几个问题解决
    caddy quic 协议试用&& 几个问题
  • 原文地址:https://www.cnblogs.com/xiangzi888/p/2393444.html
Copyright © 2020-2023  润新知