Debian 7 wheezy 安装日志 2014-05-28

最大的社区版本,Ubuntu的发源地
回复
头像
自由建客
帖子: 13468
注册时间: 2008-07-30 23:21
系统: Debian stable AMD64

Debian 7 wheezy 安装日志 2014-05-28

#1

帖子 自由建客 » 2014-05-29 16:57

不解釋
[bash]#!/bin/bash # 该行仅为语法高亮而设,并无它意
##############################################################################
#
# Debian 7 wheezy 安装日志 2014-05-28
#
##############################################################################

# 种鸡系统
# http://ftp.twaren.net/ubuntu-cd/
# 备 ubuntu-12.04.4-desktop-amd64.iso,提 /casper/vmlinuz.efi、/casper/initrd.lz
# grub 引导参数
title ubuntu-12.04.4-desktop-amd64
kernel /vmlinuz.efi boot=casper iso-scan/filename=/soft/os/ubuntu-12.04.4-desktop-amd64.iso ro quiet splash vga=normal nomodeset
initrd /initrd.lz

##############################################################################
# 启动种鸡系统
# 更改 root 口令后打开其登录 shell
sudo passwd root
su -

##############################################################################
# 分区
# grub-legacy 不支持 ext4,故必须留有 /boot 分区
fdisk /dev/sda

# 交换区(若需)
mkswap -L FB_CP2_SWAP /dev/sdaX
swapon -L FB_CP2_SWAP

# 创建文件系统
mkfs.ext2 -L FB_CP2_BOOT /dev/sda1
mkfs.ext4 -L FB_CP2_ROOT /dev/sda2
tune2fs -c 127 -e remount-ro -o user_xattr,acl /dev/sda1
tune2fs -c 127 -e remount-ro -o user_xattr,acl /dev/sda2

# 挂载
DEBIAN_INS_DIR="/mnt/debian"
mkdir "$DEBIAN_INS_DIR"
mount LABEL=FB_CP2_ROOT "$DEBIAN_INS_DIR"
mkdir "${DEBIAN_INS_DIR}/boot" "${DEBIAN_INS_DIR}/home"
mount LABEL=FB_CP2_BOOT "${DEBIAN_INS_DIR}/boot"
mount LABEL=FB_CP2_HOME "${DEBIAN_INS_DIR}/home"

# 令包缓存脱离根分区(必须用相对路径)
mkdir -p "${DEBIAN_INS_DIR}/home/root/archives" "${DEBIAN_INS_DIR}/var/cache/apt"
ln -s ../../../home/root/archives "${DEBIAN_INS_DIR}/var/cache/apt/"
ln -s . "${DEBIAN_INS_DIR}/boot/boot"

# ============================================================================
# 安装 debootstrap
wget http://ftp.tw.debian.org/debian/pool/ma ... u1_all.deb
# 备选1 http://ftp.cn.debian.org/debian/pool/ma ... u1_all.deb
# 备选2 http://ftp.sjtu.edu.cn/debian/pool/main ... u1_all.deb
# 备选3 http://ftp.debian.org/debian/pool/main/ ... u1_all.deb
dpkg -i debootstrap_1.0.48+deb7u1_all.deb

# 安装基本系统,架构 AMD64,版本代号 wheezy
debootstrap --arch amd64 wheezy "$DEBIAN_INS_DIR" http://ftp.tw.debian.org/debian/
# 备选1 http://ftp.cn.debian.org/debian/
# 备选2 http://ftp.sjtu.edu.cn/debian/
# 备选3 http://ftp.debian.org/debian/

# ============================================================================
# 文件系统表
vi "${DEBIAN_INS_DIR}/etc/fstab" #{ 覆 ---------------------------------------
tmpfs /tmp tmpfs size=512M 0 0
tmpfs /urd tmpfs size=1024M,mode=755 0 0

#LABEL=FB_CP2_SWAP none swap sw 0 0
LABEL=FB_CP2_ROOT / ext4 commit=60 0 1
LABEL=FB_CP2_BOOT /boot ext2 noauto 0 2
LABEL=FB_CP2_HOME /home ext4 commit=60 0 2
LABEL=FB_CP2_VM /vm ext4 commit=60 0 2
LABEL=FB_CP2_DATA /data ext4 commit=60 0 2
#} ---------------------------------------------------------------------------
mkdir "${DEBIAN_INS_DIR}/"{urd,vm,data}

# ============================================================================
# 网卡
vi "${DEBIAN_INS_DIR}/etc/network/interfaces" #{ 覆 --------------------------
auto lo
allow-hotplug eth0

iface lo inet loopback

iface eth0 inet dhcp
#} ---------------------------------------------------------------------------

# 计算机名:cp2
echo cp2 >"${DEBIAN_INS_DIR}/etc/hostname"
vi "${DEBIAN_INS_DIR}/etc/hosts" #{ 改
127.0.0.1 localhost cp2
#}

# 复制并检查 /etc/resolv.conf
cp /etc/resolv.conf "${DEBIAN_INS_DIR}/etc/"

# ============================================================================
# shell 相关配置

vi "${DEBIAN_INS_DIR}/etc/profile" #{ 改 --------------------------------------------------------
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
fi
#} ---------------------------------------------------------------------------

rm -f "${DEBIAN_INS_DIR}/etc/skel/.profile"
vi "${DEBIAN_INS_DIR}/etc/skel/.bash_profile" #{ 覆 --------------------------
export MAIL="${HOME}/mail/inbox"
#/etc/init.d/urd-server restore
. ~/.bashrc
date -u '+%n%F [%w] %T %Z'
df -Th | sed -n '1p;/^\/dev\/\(sd\|disk\)/p'
#} ---------------------------------------------------------------------------

vi "${DEBIAN_INS_DIR}/etc/skel/.bash_logout" #{ 覆 ---------------------------
#/etc/init.d/urd-server backup
[ -z "$DISPLAY" ] && clear_console || true
#} ---------------------------------------------------------------------------

vi "${DEBIAN_INS_DIR}/etc/skel/.bashrc" #{ 覆 --------------------------------
if [ -z "$DISPLAY" ]; then
[ "${LANG%%.*}" != "en_US" ] && export LANG=en_US.UTF-8
unset LANGUAGE
PS1='\n\[\e[1m\]>$?<\[\e[0m\] \W\$ '
else
PS1='\n\[\e]2;\u@\h\a\]\[\e[1m\e[4m\]>$?<\[\e[0m\] \W\$ '
[ "$GTK2_RC_FILES" != "${HOME}/.gtkrc-2.0" ] && export GTK2_RC_FILES="${HOME}/.gtkrc-2.0"
fi
HISTSIZE=10000
unset MAILCHECK
set -o ignoreeof
set -o vi
[ -z "$BASH_COMPLETION" -a -r /etc/bash_completion ] && . /etc/bash_completion
alias ls="ls -F"
alias woman="man -LC"
#} ---------------------------------------------------------------------------

vi "${DEBIAN_INS_DIR}/etc/skel/.inputrc" #{ 覆 -------------------------------
$if bash
set keymap emacs
"\C-p": history-search-backward
"\C-n": history-search-forward
set keymap vi
"\C-p": history-search-backward
"\C-n": history-search-forward
"\C-k": kill-line
"k": history-search-backward
"j": history-search-forward
"K": previous-history
"J": next-history
"\e[A": previous-history
"\e[B": next-history
set keymap vi-insert
"\C-p": history-search-backward
"\C-n": history-search-forward
"\e[A": history-search-backward
"\e[B": history-search-forward
"\C-k": kill-line
"\C-l": forward-char
"\C-ol": forward-char
"\C-oh": backward-char
"\C-o\C-l": clear-screen
$endif
#} ---------------------------------------------------------------------------

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 为 root 帐户应用配置,并稍作特殊处理
find "${DEBIAN_INS_DIR}/root" -maxdepth 1 -mindepth 1 -exec rm -rf {} \;
cp "${DEBIAN_INS_DIR}/etc/skel/"{.bash*,.inputrc} "${DEBIAN_INS_DIR}/root"
sed -i '/^#\?\/etc\/init\.d\/urd-server /d' "${DEBIAN_INS_DIR}/root/.bash_"{profile,logout}
sed -i 's/^alias ls=.*/alias ls="ls -AF"/' "${DEBIAN_INS_DIR}/root/.bashrc"

# ============================================================================
# 挂载 /proc、/sys、/dev
mount -t proc proc "${DEBIAN_INS_DIR}/proc"
mount -t sysfs sysfs "${DEBIAN_INS_DIR}/sys"
mount -o bind /dev "${DEBIAN_INS_DIR}/dev"

# 换根
unset LANGUAGE LS_COLORS
LANG=C.UTF-8 chroot "$DEBIAN_INS_DIR" /bin/bash

##############################################################################
# 包管理器设置
# 此处虽如此设置,但本文件所记各安装命令仍带有 -R 以求突出
# 视具体情况,部分软件可能用 -r,此并非笔误
vi /etc/apt/apt.conf #{ 改
APT::Install-Recommends "false";
#}

# 设源
cat >/etc/apt/sources.list <<EOF
deb http://ftp.tw.debian.org/debian wheezy main contrib non-free
deb http://security.debian.org/debian-security wheezy/updates main contrib non-free
deb http://ftp.tw.debian.org/debian wheezy-updates main contrib non-free
# deb http://ftp.tw.debian.org/debian wheezy-proposed-updates main contrib non-free
deb http://ftp.tw.debian.org/debian-multimedia wheezy main non-free
deb http://ftp.tw.debian.org/debian wheezy-backports main contrib non-free

#deb http://ftp.cn.debian.org/debian wheezy main contrib non-free
#deb http://ftp.cn.debian.org/debian-security wheezy/updates main contrib non-free
#deb http://ftp.cn.debian.org/debian wheezy-updates main contrib non-free
## deb http://ftp.cn.debian.org/debian wheezy-proposed-updates main contrib non-free
#deb http://ftp.cn.debian.org/debian-multimedia wheezy main non-free
#deb http://ftp.cn.debian.org/debian wheezy-backports main contrib non-free

#deb http://ftp.sjtu.edu.cn/debian wheezy main contrib non-free
#deb http://security.debian.org/debian-security wheezy/updates main contrib non-free
#deb http://ftp.sjtu.edu.cn/debian wheezy-updates main contrib non-free
## deb http://ftp.sjtu.edu.cn/debian wheezy-proposed-updates main contrib non-free
#deb http://ftp.cn.debian.org/debian-multimedia wheezy main non-free
#deb http://ftp.sjtu.edu.cn/debian wheezy-backports main contrib non-free

#deb http://ftp.debian.org/debian wheezy main contrib non-free
#deb http://security.debian.org/debian-security wheezy/updates main contrib non-free
#deb http://ftp.debian.org/debian wheezy-updates main contrib non-free
## deb http://ftp.debian.org/debian wheezy-proposed-updates main contrib non-free
#deb http://www.deb-multimedia.org wheezy main non-free
#deb http://ftp.debian.org/debian wheezy-backports main contrib non-free
EOF

# 刷表(提示「W: GPG error:」,无视之)
aptitude update

# 安装多媒体源公钥(提示「无法验证数字签名,是否安装」,输入「Yes」同意安装)
aptitude install -R deb-multimedia-keyring

# 再次刷过
aptitude update

# 更新(stable 版本必须)
aptitude full-upgrade

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 若上一步有更新,就先退出后再次进入 chroot 环境
exit
LANG=C.UTF-8 chroot "$DEBIAN_INS_DIR" /bin/bash

##############################################################################
# 先装 ACL 工具
aptitude install -R acl

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 硬时钟若非 UTC
vi /etc/adjtime #{ 改,若无则新建
LOCAL # UTC 行
#}

# 时区
dpkg-reconfigure tzdata #{ 交互
Asia/Shanghai
#}

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 本地化

aptitude install -R locales
dpkg-reconfigure locales #{ 交互
en_US.UTF-8
ja_JP.UTF-8
ko_KR.UTF-8
zh_CN.UTF-8 # 默认
zh_HK.UTF-8
zh_SG.UTF-8
zh_TW.UTF-8
#}

vi /etc/default/locale #{ 改,针对 LANGUAGE
LANG=zh_CN.UTF-8
LANGUAGE=zh_CN:zh_SG:zh_TW:zh_HK
#}

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 键盘

aptitude install -R console-setup # 有交互,暂直接用默认配置

# 重新配置

dpkg-reconfigure console-setup #{ 交互 ---------------------------------------
Encoding to use on the console: UTF-8
Character set to support: # Latin1 and Latin5 - western Europe and Turkic languages
Font for the console: Do not change the boot/kernel font
#} ---------------------------------------------------------------------------

dpkg-reconfigure keyboard-configuration #{ 交互 ------------------------------
Keyboard model: Generic 104-key PC
Keyboard layout: English (US)
Key to function as AltGr: The default for the keyboard layout
Compose key: No compose key
#} ---------------------------------------------------------------------------

# 交换 Ctrl_L 与 CapsLock(控制台、X 统一)
vi /etc/default/keyboard #{ 改
XKBOPTIONS="ctrl:swapcaps"
#}

# ============================================================================
# 引导器
# 若有其它系统则可再装上 os-prober,以便 update-grub 能自动发现
aptitude install -R grub-legacy
grub-install /dev/sda
update-grub
sed -i 's/^\(\s*#\s*kopt=\).*/\1root=LABEL=FB_CP2_ROOT ro nomodeset/;
s/^\(\s*#\s*defoptions=\).*/\1iommu=noaperture vga=0x305/' /boot/grub/menu.lst

# 内核
aptitude install -R linux-image-amd64

# AMD K8 处理器降频
echo "powernow_k8" >>/etc/modules

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 加密 grub

grub-md5-crypt # 生成加密口令,复制生成结果

vi /boot/grub/menu.lst #{ 改 -------------------------------------------------
timeout 3
# 全局口令,限制临时编辑引导项。位于所有 title 行之前
# --md5 后面一串为刚才 grub-md5-crypt 命令生成结果
password --md5 $1$nQu9j0$sPBsHQJw8VBY.3/baiS4j.

# 局部口令,限制进入单用户模式
title Debian GNU/Linux, kernel 3.2.0-4-amd64 (single-user mode)
password --md5 $1$nQu9j0$sPBsHQJw8VBY.3/baiS4j.
#} ---------------------------------------------------------------------------

# ============================================================================
# 系统调整

cp -p "${CFG_DIR}/iptables.sh" /etc/init.d/
insserv iptables.sh

# 唯 adm 组成员可用 su
vi /etc/pam.d/su #{ 改
auth required pam_wheel.so group=adm
#}

vi /etc/inittab #{ 改
1:2345:respawn:/sbin/getty --noclear 38400 tty1
#}

vi /etc/sysctl.conf #{ 改 ---------------------------------------------------
kernel.printk = 4 4 1 7

vm.laptop_mode = 5
vm.dirty_expire_centisecs = 6000
vm.dirty_writeback_centisecs = 1000

net.ipv4.ip_default_ttl = 128
#} --------------------------------------------------------------------------

# ============================================================================
# 保存包列表一份,供日后研究
dpkg -l >pkg.000.lst

# 设置口令
passwd

# 退出 chroot 环境
exit

##############################################################################
# 清目重建
rm -rf "${DEBIAN_INS_DIR}/"{tmp,run}
mkdir "${DEBIAN_INS_DIR}/"{tmp,run}
chmod 1777 "${DEBIAN_INS_DIR}/tmp"

# 卸载
umount "${DEBIAN_INS_DIR}/"{dev,sys,proc}
umount "${DEBIAN_INS_DIR}/"{boot,home,}

# 退出并重启
exit

##############################################################################
# 重启进入新系统后

# 挂载 /boot 备用(若独立而未挂载)
mount /boot

# ============================================================================
# 卸载 nano 及 tasksel
aptitude purge nano tasksel tasksel-data

# 基本工具及文档
aptitude install -R dosfstools sudo anacron ntp ntp-doc \
less lsof file tree rsync \
bash-completion command-not-found tcsh dialog \
gpm vim hexedit exuberant-ctags convmv \
tcpdump dnsutils dnsmasq lftp w3m exim4 msmtp getmail4 procmail mutt \
manpages manpages-posix manpages-zh debconf-doc
rm /etc/profile.d/bash_completion.sh

# vim 配置
cp "${CFG_DIR}/vimrc" /etc/vim/

# 设置 cron 路径、时间
vi /etc/crontab #{ 改 --------------------------------------------------------
# m h dom mon dow user command
13 * * * * root cd / && run-parts --report /etc/cron.hourly
25 7 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 7 * * 3 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 7 9 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#} ---------------------------------------------------------------------------

# 先手动更新一遍 command-not-found 再添加自动任务
update-command-not-found
source ~/.bashrc
ln -s /usr/sbin/update-command-not-found /etc/cron.monthly/

# 阻止一些服务自动启动
insserv -r gpm
insserv -r rsync

# 用户内存盘服务
tar xf "${LOCALPKG}/urd-server.tar.gz" -C /
insserv urd-server

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# DNS 缓存配置

vi /etc/dnsmasq.conf #{ 改 ---------------------------------------------------
no-resolv
no-poll

# 202.103.225.68、202.103.224.68,我区电信
server=/baidu.com/202.103.225.68
server=/baidu.com/202.103.224.68
server=/qq.com/202.103.225.68
server=/qq.com/202.103.224.68
server=/youku.com/202.103.225.68
server=/youku.com/202.103.224.68
server=/vnet.cn/202.103.225.68
server=/vnet.cn/202.103.224.68
# OpenDNS
server=208.67.222.222
server=208.67.220.220
# GoogleDNS
#server=8.8.8.8
#server=8.8.4.4

listen-address=127.0.0.1
no-dhcp-interface=eth0
no-hosts
addn-hosts=/etc/hosts.dnsmasq
#} ---------------------------------------------------------------------------

vi /etc/dhcp/dhclient.conf #{ 改
prepend domain-name-servers 127.0.0.1;
#}

cp "${CFG_DIR}/hosts.dnsmasq" /etc/

service dnsmasq restart
ifdown eth0
ifup eth0

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 时钟同步

vi /etc/ntp.conf #{ 改
server cn.pool.ntp.org iburst
#}

service ntp restart

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 特权配置
visudo #{ 改 -----------------------------------------------------------------
Defaults env_reset, timestamp_timeout=1

%users localhost=NOPASSWD: /sbin/shutdown -r now, /sbin/shutdown -h now
%users localhost=NOPASSWD: /sbin/hdparm -B /dev/sd?
%users localhost=NOPASSWD: /usr/sbin/hddtemp /dev/sd?
%users localhost=NOPASSWD: /usr/sbin/service gpm *

%adm localhost= /usr/sbin/service dnsmasq restart
%adm localhost= /usr/sbin/service iptables.sh status

%mldonkey localhost= /usr/sbin/service mldonkey-server *
#} ---------------------------------------------------------------------------

# ============================================================================
# 基本构建工具及内核头文件
aptitude install -R build-essential autoconf automake cmake libtool libltdl-dev \
fakeroot linux-headers-amd64

# samba 服务
aptitude install -R samba smbclient cifs-utils samba-common-bin libpam-smbpass
cp "${CFG_DIR}/smb.conf" /etc/samba/

# ============================================================================
# Xorg
aptitude install -R xorg

# 图形驱动
aptitude install -R nvidia-glx nvidia-kernel-dkms nvidia-xconfig

# 生成和修改图形配置(不知为何有时生成的是 XF86Config 有时是 xorg.conf)
nvidia-xconfig
vi /etc/X11/xorg.conf #{ 改 --------------------------------------------------
# Touchpad Synaptics
Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
MatchIsTouchpad "on"
Option "VertEdgeScroll" "TRUE"
Option "HorizEdgeScroll" "TRUE"
Option "TapButton1" "1"
EndSection
# Graphic card
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "DPI" "96x96"
Option "NoLogo" "TRUE"
Option "RegistryDwords" "PerfLevelSrc=0x3333"
Option "RandRRotation" "TRUE"
EndSection
#} ---------------------------------------------------------------------------

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 解决「$HOME/.xsession-errors 体积过涨」
vi /etc/X11/Xsession #{ diff unified 格式 ------------------------------------
@@ -74,7 +74,11 @@
errormsg "unable to create X session log/error file; aborting."
fi

-exec >>"$ERRFILE" 2>&1
+[ `stat -c %s "$ERRFILE"` -ge 8388608 ] \
+ && rm -f "$ERRFILE"
+
+exec >/dev/null
+exec 2>>"$ERRFILE"

echo "$PROGNAME: X session started for $LOGNAME at $(date)"
#} ---------------------------------------------------------------------------

# ============================================================================
# 音频设备
aptitude install -R alsa-utils alsa-base

# 音量及试听
alsamixer
aplay /usr/share/sounds/alsa/*

# ============================================================================
# 电源管理及硬件相关
aptitude install -R acpi-support hdparm pm-utils vbetool ethtool \
powertop lm-sensors fancontrol hddtemp
insserv -r hddtemp
insserv -r fancontrol

# 笔记本硬盘 APM 设置
vi /etc/hdparm.conf #{ 改
/dev/sda {
apm = 192
}
#}

# 开机自动调整笔记本屏幕亮度
tar xf "${LOCALPKG}/brightness.tar.gz" -C /
insserv brightness

# ============================================================================
# 字体及输入法
aptitude install -R ttf-unifont \
ttf-dejavu fonts-liberation ttf-adf-libris \
ttf-wqy-zenhei ttf-arphic-ukai \
otf-ipaexfont-gothic otf-ipaexfont-mincho \
fonts-unfonts-core \
im-switch \
fcitx fcitx-frontend-gtk2 fcitx-frontend-gtk3 fcitx-frontend-qt4 \
fcitx-ui-classic fcitx-config-gtk fcitx-tools \
fcitx-pinyin fcitx-chewing fcitx-table-array30-big
cp -r "${FONT}/*" /usr/local/share/fonts
tar xf "${LOCALPKG}/fbfontconf.tar.gz" -C /
tar xf "${LOCALPKG}/fcitx-dict.tar.gz" -C /

vi /etc/environment #{ 改
FONTCONFIG_PATH="/etc/fbfontconf"
#}

# 解决 fcitx 僵尸进程问题
vi /etc/X11/xinit/xinput.d/fcitx #{ 改
XIM_PROGRAM_SETS_ITSELF_AS_DAEMON=1
#}

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 桌面
aptitude install -R gksu policykit-1 xscreensaver xscreensaver-gl \
openbox obconf feh lxpanel parcellite xpad \
libnotify-bin \
xdg-user-dirs-gtk xdg-utils gamin gvfs \
p7zip-full unzip unrar cabextract arj genisoimage \
thunar tumbler thunar-volman thunar-archive-plugin file-roller \
xfce4-terminal leafpad vim-gtk \
stardict-gtk stardict-plugin gpicview scrot galculator \
qpdfview mupdf poppler-data poppler-utils \
djview4 djvulibre-desktop djvulibre-plugin djvulibre-bin archmage \
ifplugd cups cups-pdf qv4l2 \
iceweasel iceweasel-l10n-zh-cn iceweasel-l10n-zh-tw \
xchat openfetion \
qt4-qtconfig lxappearance gtk2-engines gnome-icon-theme \
dconf-tools nvidia-settings

# 新版 notification-daemon 及 notify-osd 流,皆不好用
# http://packages.debian.org/squeeze/notification-daemon
# http://packages.debian.org/squeeze/libnotify1
dpkg -i notification-daemon_0.5.0-2_amd64.deb libnotify1_0.5.0-2_amd64.deb
aptitude install -R libcanberra-gtk0
aptitude markauto libcanberra-gtk0 libnotify1
aptitude hold notification-daemon libnotify1
sed -i '/^NoDisplay=/d' /usr/share/applications/notification-properties.desktop

# 一些调整
rm /usr/share/xsessions/openbox*.desktop
rm /usr/share/applications/{feh,debian-uxterm,gksu}.desktop
rm /usr/share/applications/exo-{web-browser,mail-reader}.desktop
rm /usr/share/applications/lxde-x-{www-browser,terminal-emulator}.desktop

# 搞定「xdg-open 行为错乱」
rm /usr/bin/xdg-open
ln -s exo-open /usr/bin/xdg-open

# X 注销、关机对话框
tar xf "${LOCALPKG}/xlogout-dialog.tar.gz" -C /

# 让守护进程给桌面发送弹出消息
tar xf "${LOCALPKG}/notify-send2.tar.gz" -C /

# 主题
tar xf "${LOCALPKG}/theme-clearlooks-coffee.tar.xz" -C /
tar xf "${LOCALPKG}/icon-humanity.tar.xz" -C /

# 将默认终端设为 xterm
update-alternatives --config x-terminal-emulator

# gvim 配置
cp "${CFG_DIR}/gvimrc" /etc/vim/

# vim 中文文档
# http://vimcdoc.sourceforge.net/
tar xf vimcdoc-1.9.0.tar.gz
cp -r vimcdoc-1.9.0/doc /usr/share/vim/vim73/

# 截屏脚本
tar xf "${LOCALPKG}/getscreenshot.tar.gz" -C /

# gpicview 有问题,借用 Ubuntu 同版本包
# http://packages.ubuntu.com/raring/gpicview
dpkg -i gpicview_0.2.3+git20130101-0ubuntu1_amd64.deb

# 打印机配置
vi /etc/cups/cups-pdf.conf #{ 改
Out ${HOME}/urd/pdf
#}

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 词典

# http://www.stardict.cn/forum/
find "$DICT_DIR" -name "*.tar.bz2" -exec tar xf {} -C /usr/share/stardict/dic/ \;

# 纠正权限
chown -R root:root /usr/share/stardict/dic
find /usr/share/stardict/dic -type d -exec chmod 755 {} \;
find /usr/share/stardict/dic -type f -exec chmod 644 {} \;

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 优盘挂载
vi /etc/polkit-1/localauthority/50-local.d/10-udisks.pkla #{
[udisks]
Identity=unix-group:plugdev
Action=org.freedesktop.udisks.drive-eject;org.freedesktop.udisks.filesystem-mount
ResultAny=yes
#}

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ifplugd 网卡监视器配置

tar xf "${LOCALPKG}/ifplugd-action.tar.gz" -C /
vi /etc/default/ifplugd #{ 改
INTERFACES="eth0"
ARGS="-q -f -u3 -d10 -I"
#}

vi /etc/network/interfaces #{ 改
#allow-hotplug eth0
#}

# ============================================================================
# flash 插件
# http://www.adobe.com/go/EN_US-H-GET-FLASH
tar xf install_flash_player_11_linux.x86_64.tar.gz
mkdir -p /usr/lib/mozilla/plugins
cp libflashplayer.so /usr/lib/mozilla/plugins/

# ============================================================================
# 下载工具

# 稍后问是否开机启动 mldonkey,一定要答 <NO>
aptitude install -R filezilla mldonkey-server qbittorrent
tar xf "${LOCALPKG}/mldonkey-popmsg.tar.gz" -C /

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# mldonkey 配置

mkdir /home/mldonkey
touch /home/mldonkey/downloads.ini
chown -R mldonkey:mldonkey /home/mldonkey

vi /etc/default/mldonkey-server #{ 改
MLDONKEY_DIR=/home/mldonkey
LAUNCH_AT_STARTUP=true
#}

visudo #{
mldonkey localhost=NOPASSWD: /usr/bin/notify-send2
#}

# ============================================================================
# X 相关配置

vi /etc/skel/.xinitrc #{ 覆
#!/bin/sh
export LANG=zh_CN.UTF-8
export LANGUAGE=zh_CN:zh_SG:zh_TW:zh_HK
. /etc/X11/Xsession
#}

vi /etc/skel/.xsession #{ 覆 -------------------------------------------------
#!/bin/sh
/etc/init.d/urd-server restore

# Firefox start speed
FirefoxDir="${HOME}/.mozilla/firefox"
FirefoxDir="${FirefoxDir}/`sed -n 's/^Path=//p' ${FirefoxDir}/profiles.ini`"
cat "${FirefoxDir}/places.sqlite" "${FirefoxDir}/urlclassifier3.sqlite" >/dev/null
unset FirefoxDir

#export FONTCONFIG_PATH="/etc/fbfontconf/user"
export GTK2_RC_FILES="${HOME}/.gtkrc-2.0"
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=lcd"

feh --bg-scale "${HOME}/.config/wallpaper" &
aplay "${HOME}/.config/login.wav" &
thunar --daemon &
lxpanel &
parcellite &
(sleep 6; exec xpad -N) &
stardict -h &
xscreensaver -no-splash &

#xmodmap -e "pointer = 3 2 1"
#synclient TapButton1=3
#xset m 0.7

openbox

xpad -q
thunar --quit
/etc/init.d/urd-server backup
#} ---------------------------------------------------------------------------

cat >/etc/skel/.Xresources <<EOF
*multiClickTime:400

Xft.hintstyle:hintslight

XTerm.termName:xterm-256color
!XTerm.vt100.altSendsEscape:true
!XTerm.vt100.metaSendsEscape:true
XTerm.vt100.locale:true
XTerm.vt100.utf8Title:true
XTerm.vt100.forcePackedFont:true
XTerm.vt100.faceName:DejaVu Sans Mono:size=9
!XTerm.vt100.faceNameDoublesize:WenQuanYi Zen Hei Mono:size=10
!XTerm.vt100.faceNameDoublesize:Droid Sans Fallback:size=10
XTerm.vt100.faceNameDoublesize:MS_YaHei:size=10
XTerm.vt100.scaleHeight:1.01
XTerm.vt100.geometry:100x30
XTerm.vt100.background:#FFFFFF
XTerm.vt100.foreground:#000000
EOF

# ~/.gtkrc-2.0 日后会被 lxappearance 等工具覆盖,此处目的在于提供初始配置
vi /etc/skel/.gtkrc-2.0 #{ 覆 ------------------------------------------------
gtk-theme-name="Clearlooks-Coffee"
gtk-icon-theme-name="Humanity"
gtk-font-name="Sans 9"
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
gtk-toolbar-icon-size=GTK_ICON_SIZE_MENU
gtk-button-images=0
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintslight"
gtk-xft-rgba="rgb"
#}

# ============================================================================
# 创建新帐户 fb,主组 users
adduser --ingroup users fb
gpasswd -a fb adm
gpasswd -a fb audio
gpasswd -a fb video
gpasswd -a fb plugdev
gpasswd -a fb mldonkey

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 用 fb 代收 root 的邮件
vi /etc/aliases #{ 追加
root: fb
#}

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 重启系统,以使一些新配置生效
shutdown -r now

##############################################################################
# 重启进入新系统后

# 挂载 /boot 备用(若独立而未挂载)
mount /boot

# ============================================================================
# 用 fb 登录并进入桌面后部分设置

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 创建用户内存盘目录链接
ln -s /urd/fb ~/urd

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# lxpanel 面板设置

# 文件管理器:thunar %s
# 终端仿真器:x-terminal-emulator
# 注销命令:xlogout-dialog

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# thunar 自定义动作

# 设为桌面背景
# 说明:thunar 对图片文件默认有个“设为壁纸”菜单,但不能用,自定义一个,区别“设为壁纸”
# 命令:
ln -snf %f "${HOME}/.config/wallpaper" && feh --bg-scale "${HOME}/.config/wallpaper"
# 文件模式:*
# 包含:图像文件

# 设为启动音
# 命令:
ln -snf %f "${HOME}/.config/login.wav" && aplay "${HOME}/.config/login.wav"
# 文件模式:*.wav;*.WAV
# 包含:声音文件

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# firefox 设置

# about:config
# 转移 Cache 目录
# 新建字符串 browser.cache.disk.parent_directory = /urd/fb/.firefox
# 保存会话间隔(单位:毫秒)
# browser.sessionstore.interval = 360000
# 禁止图片动画
# image.animation_mode = once

# 扩展组件
# HTTPS Everywhere
# AutoProxy # 代理
# FlashGot # 下载
# DownThemAll # 下载
# Pearl Crescent Page Saver Basic # 截图
# ChmFox # chm
# UnMHT # mht
# Session Manager
# 搜索组件
# Ubuntu packages
# Zdic.net 汉典

# ============================================================================
# 虚拟机

aptitude install -t wheezy-backports -R qemu-system qemu-utils

# 修正载入模块时的胡乱警告
vi /etc/init.d/qemu-system-x86 #{ diff unified 格式 --------------------------
@@ -46,6 +46,8 @@
exit 1
fi
if modprobe -b vhost-net ; then
+ log_success_msg "Loading module vhost-net"
+ else
log_warning_msg "Module vhost-net failed to load"
fi
;;
#} ---------------------------------------------------------------------------

# 给 plugdev 组(不推荐 kvm 组)赋予 USB 设备操作权
vi /etc/udev/rules.d/10-usb-plugdev.rules #{ 覆
SUBSYSTEM=="usb_device", GROUP="plugdev", MODE="0664"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", MODE="0664"
#}

# 入组
gpasswd -a fb kvm

# ============================================================================
# 虚拟网络

aptitude install -R vde2 bridge-utils

# 建议显式指出加载 tun 模块,否则启动时虚拟网卡可能会初始化失败
vi /etc/modules #{ 改
tun
#}

vi /etc/network/interfaces #{ 覆 ---------------------------------------------
auto lo tap1
#allow-hotplug eth0

iface lo inet loopback
pre-up [ "`runlevel`" = "unknown" ] && echo 'eth0=br0' >/var/run/ifplugd.ifupdown.map || true
#pre-up runlevel >/root/runlevel

iface eth0 inet dhcp
pre-up ifdown br0
post-up sed -i '/^eth0=/d' /var/run/ifplugd.ifupdown.map || true

## Bridge VM
iface tap0 inet static
address 192.168.0.1
netmask 255.255.255.0
vde2-switch -
up ip link set tap0 down
up ip link set tap0 address 52:53:00:00:00:00
up ip link set tap0 up
iface br0 inet dhcp
pre-up ifdown eth0
pre-up ifup tap0
pre-up ifconfig tap0 0.0.0.0
bridge_ports eth0 tap0
post-up sed -i '/^eth0=/d' /var/run/ifplugd.ifupdown.map || true
post-up echo 'eth0=br0' >>/var/run/ifplugd.ifupdown.map

## NAT VM
iface tap1 inet static
address 192.168.10.1
netmask 255.255.255.0
vde2-switch -
#vde2-slirp -n 192.168.10.0 -dhcp
up ip link set tap1 down
up ip link set tap1 address 52:53:00:00:00:01
up ip link set tap1 up
#} ---------------------------------------------------------------------------

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# tap1 端内网 DHCP 及 DNS 服务

vi /etc/dnsmasq.conf #{ 改
interface=tap1
no-dhcp-interface=eth0,br0,wlan0
bind-interfaces
dhcp-range=192.168.10.100,192.168.10.200,255.255.255.0,2h
#}

# 宿主机名加入解析
vi /etc/hosts.dnsmasq #{ 改
192.168.10.1 cp2
#}

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# tap1 端内网 NAT 服务

vi /etc/sysctl.conf #{ 改
net.ipv4.ip_forward = 1
net.ipv4.ip_dynaddr = 1
#}

vi /etc/init.d/iptables.sh #{ 改
iptables -t nat -F
iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#}

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 设置特权,方便切换
visudo #{
%vde2-net localhost= /sbin/ifup br0, /sbin/ifdown br0
%vde2-net localhost= /sbin/ifup eth0, /sbin/ifdown eth0
%vde2-net localhost= /sbin/ifup tap0, /sbin/ifdown tap0
%vde2-net localhost= /sbin/ifup tap1, /sbin/ifdown tap1
#}

# 入组
gpasswd -a fb vde2-net

# ============================================================================
# 远程控制
aptitude install -R openssh-client rdesktop

# ============================================================================
# 基本构建工具文档
aptitude install -R cpp-doc gcc-doc make-doc diffutils-doc \
autoconf-doc m4-doc libtool-doc gettext-doc gnu-standards

# 系统调用、内核、C/C++ 库文档
aptitude install -R manpages-dev manpages-posix-dev linux-doc \
glibc-doc glibc-doc-reference libstdc++6-4.7-doc

# deb 包制作维护工具及文档
aptitude install -R dh-make devscripts fakeroot lintian pbuilder cowdancer \
debian-policy developers-reference

# 调试器
aptitude install -R strace gdb gdb-doc cgdb

# 版本控制
aptitude install -R subversion subversion-tools git git-doc

# Qt
aptitude install -R libqt4-dev libqt4-opengl-dev libqtwebkit-dev \
qt4-dev-tools qt4-designer qt4-doc

# boost
aptitude install -R libboost-all-dev libboost-doc

# Java
aptitude install -R openjdk-6-jdk openjdk-6-doc

# Python
aptitude install -R python-doc

# Lisp
aptitude install -R clisp clisp-doc

# Haskell
aptitude install -R hugs haskell-doc

# 数据库
aptitude install -R sqlite3 libsqlite3-dev sqlite3-doc
vi ~/.sqliterc #{ 改
PRAGMA foreign_keys = ON;
#}

# 文档工具
aptitude install -R docbook5-xml docbook-xsl-ns xsltproc fop \
doxygen doxygen-gui doxygen-doc \
graphviz graphviz-doc

# IDE
aptitude install -R qtcreator qtcreator-doc

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 建模工具(ArgoUML)

# http://argouml.tigris.org/
tar xf ArgoUML-0.34.tar.gz -C /opt/
chown -R root:root /opt/argouml-0.34/
ln -s /opt/argouml-0.34/argouml.sh /usr/local/bin/argouml
ln -s /opt/argouml-0.34/icon/argouml2.svg /usr/share/icons/hicolor/scalable/apps/argouml2.svg
update-icon-caches /usr/share/icons/hicolor/

vi /usr/share/mime/packages/argouml.xml #{ 覆 --------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/argouml-compressed-project">
<sub-class-of type="application/zip"/>
<comment>ArgoUML compressed project file</comment>
<comment xml:lang="zh_CN">ArgoUML 项目压缩文件</comment>
<generic-icon name="package-x-generic"/>
<glob pattern="*.zargo"/>
</mime-type>
<mime-type type="application/argouml-project">
<comment>ArgoUML project file</comment>
<comment xml:lang="zh_CN">ArgoUML 项目文件</comment>
<generic-icon name="image-x-generic"/>
<glob pattern="*.uml"/>
</mime-type>
</mime-info>
#} ---------------------------------------------------------------------------
update-mime-database /usr/share/mime/

cat >/usr/share/applications/argouml.desktop <<EOF
[Desktop Entry]
Encoding=UTF-8
Name=ArgoUML
Exec=/opt/argouml-0.34/argouml.sh
Terminal=false
Type=Application
Icon=argouml2
Categories=Development
MimeType=application/argouml-compressed-project;application/argouml-project;
EOF
update-desktop-database

# ============================================================================
# 办公
aptitude install -R libreoffice libreoffice-gtk \
libreoffice-l10n-zh-cn libreoffice-help-zh-cn \
libreoffice-l10n-zh-tw libreoffice-help-zh-tw

# 项目管理
# http://sourceforge.net/projects/projectlibre/
dpkg -i projectlibre_1.5.9-1.deb
vi /usr/bin/projectlibre #{ diff unified 格式 ------------------------------------
@@ -113,7 +113,7 @@
"$JAVA_EXE" -version > "$VERSION_FILE" 2>&1 || rm -f "$VERSION_FILE"

if [ -r "$VERSION_FILE" ]; then
- JAVA_VERSION=`cat "$VERSION_FILE" | head -n 1 | awk '{ print substr($3, 2, length($3)-2); }'`
+ JAVA_VERSION=`grep -m 1 '^java version ' "$VERSION_FILE" | awk '{ print substr($3, 2, length($3)-2); }'`
if [ "x$OS_NAME" = "xSunOS" ]; then
echo " Java version: $JAVA_VERSION \c"
else
#} ---------------------------------------------------------------------------

# 思维导图
aptitude install -R freemind freemind-plugins-svg

# CAD
aptitude install -R freecad freecad-doc

# 电子
aptitude install -R \
geda geda-gschem geda-gnetlist geda-gattrib geda-gsymcheck geda-utils \
geda-doc geda-examples \
pcb gerbv iverilog gtkwave ngspice ngspice-doc

# 科学
aptitude install -R octave liboctave-dev octave-htmldoc qtoctave \
gnuplot-qt gnuplot-doc

# 统计
aptitude install -R r-base r-mathlib r-base-dev r-base-html r-doc-html

# 天文
aptitude install -R stellarium celestia-glut

# ============================================================================
# 图形图像
aptitude install -R dia inkscape gimp blender fontforge

# 媒体播放、解码、编码、转换器
aptitude install -R mplayer smplayer smplayer-translations mencoder lame
sed -i 's/^Exec=.*/Exec=smplayer/' /usr/share/applications/smplayer.desktop
rm /usr/share/applications/smplayer_enqueue.desktop

# 音频播放
aptitude install -R audacious

# MIDI 及音色库
aptitude install -R fluidsynth qsynth jackd qjackctl \
fluid-soundfont-gm fluid-soundfont-gs

# 作曲
aptitude install -R rosegarden swh-plugins

# 音频编辑
aptitude install -R audacity ardour

# 屏幕录像
aptitude install -R gtk-recordmydesktop

# 视频编缉
aptitude install -R avidemux cinelerra-cv

# ============================================================================
# 中国象棋
aptitude install -R gmchess libeval0-dev

# ============================================================================
# 最后再看看有无更新
aptitude update
aptitude full-upgrade
[/bash]
ipposis
帖子: 333
注册时间: 2013-12-23 13:42

Re: Debian 7 wheezy 安装日志 2014-05-28

#2

帖子 ipposis » 2014-05-29 17:04

脚本安装吧?这是?
头像
nkadun
帖子: 444
注册时间: 2008-06-10 12:40

Re: Debian 7 wheezy 安装日志 2014-05-28

#3

帖子 nkadun » 2014-05-29 17:18

我擦,太有毅力了!
Macbook Pro 15 with Debian
又剁了一只手
头像
highwind
帖子: 1362
注册时间: 2008-09-05 23:31
系统: LinuxMint17

Re: Debian 7 wheezy 安装日志 2014-05-28

#5

帖子 highwind » 2014-05-29 22:00

请教个旁的事情,论坛的bash语法高亮怎么实现的呀?
头像
qy117121
论坛版主
帖子: 50587
注册时间: 2007-12-14 13:40
系统: Winbuntu
来自: 志虚国乌由市
联系:

Re: 回复: Debian 7 wheezy 安装日志 2014-05-28

#6

帖子 qy117121 » 2014-05-30 6:13

highwind 写了:请教个旁的事情,论坛的bash语法高亮怎么实现的呀?

代码: 全选

[bash]bashdaima[/bash]
[python]python daima[/python]
支持的语言非常多
代码高亮用的geshi

来自 紫萌冰 的小唧唧 ʕ•ﻌ•ʔ
渠月 · QY   
本人只会灌水,不负责回答问题
无聊可以点一下→ http://u.nu/ubuntu

邮箱 [email protected]
头像
麦斯特
帖子: 1034
注册时间: 2005-03-28 0:00
系统: Gentoo x64
来自: ☸我佛山人

Re: Debian 7 wheezy 安装日志 2014-05-28

#7

帖子 麦斯特 » 2014-05-30 13:03

果然,楼主的毛病又犯了。话说,这到底是第几个系列的Debian安装教程了。 :em01
Je ne suis pas d'accord avec ce que vous dites, mais je me battrai jusqu'à la mort pour que vous ayez le droit de le dire.
头像
自由建客
帖子: 13468
注册时间: 2008-07-30 23:21
系统: Debian stable AMD64

Re: Debian 7 wheezy 安装日志 2014-05-28

#8

帖子 自由建客 » 2014-05-30 14:58

麦斯特 写了:果然,楼主的毛病又犯了。话说,这到底是第几个系列的Debian安装教程了。 :em01
等 Debian 8 的時候改用繁體了。
头像
自由建客
帖子: 13468
注册时间: 2008-07-30 23:21
系统: Debian stable AMD64

Re: Debian 7 wheezy 安装日志 2014-05-28

#9

帖子 自由建客 » 2014-05-30 20:39

重新整理,虛擬機一節
[bash]# 虚拟机

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# VirtualBox

aptitude install -t wheezy-backports -R virtualbox virtualbox-dkms \
virtualbox-qt virtualbox-guest-additions-iso

# 开启 USB 2.0 支持
# https://www.virtualbox.org/wiki/Downloads
# 双击安装 Oracle_VM_VirtualBox_Extension_Pack-4.3.12-93733.vbox-extpack

# 入组
gpasswd -a fb vboxusers

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# qemu / kvm

aptitude install -t wheezy-backports -R qemu-system qemu-utils

# 修正模块载入操作的若干问题
# /etc/init.d/qemu-system-x86 问题多多,用稳定版代替
# 提取 https://packages.debian.org/wheezy/qemu-kvm 中的 /etc/init.d/qemu-kvm
# 并做适当修改,增加 vhost-net 功能
vi /etc/init.d/qemu-kvm #{ diff unified 格式 --------------------------
@@ -41,9 +41,14 @@
log_success_msg "/dev/kvm already exists. Not doing anything."
exit 0
fi
- if modprobe "$module"
+ if modprobe -b "$module"
then
log_success_msg "Loading kvm module $module"
+ if modprobe -b vhost-net ; then
+ log_success_msg "Loading module vhost-net"
+ else
+ log_warning_msg "Module vhost-net failed to load"
+ fi
else
log_failure_msg "Module $module failed to load"
exit 1
@@ -60,6 +65,7 @@
then
log_success_msg "Succesfully unloaded kvm module $module"
rmmod kvm
+ rmmod vhost-net || true
else
log_failure_msg "Failed to remove $module"
exit 1
#} ---------------------------------------------------------------------------

insserv -r qemu-system-x86
insserv qemu-kvm

# 给 plugdev 组(不推荐 kvm 组)赋予 USB 设备操作权
vi /etc/udev/rules.d/10-usb-plugdev.rules #{ 覆
SUBSYSTEM=="usb_device", GROUP="plugdev", MODE="0664"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", MODE="0664"
#}

# 入组
gpasswd -a fb kvm

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# VBox / KVM 切换

vi /usr/local/bin/swapvm #{ 覆 -----------------------------------------------
#!/bin/sh
set -e

case "$1" in
kvm)
if [ "`lsmod | awk '$1=="vboxdrv" {print $3-split($4,a,",")}'`" -ne 0 ]; then
echo "ERROR: Module vboxdrv is in use" >&2
exit 1
fi
service virtualbox stop
service qemu-kvm start
;;
vbox)
service qemu-kvm stop
service virtualbox start
;;
*)
echo "Usage: $0 {kvm|vbox}" >&2
exit 2
;;
esac

exit 0
#} ---------------------------------------------------------------------------
chmod +x /usr/local/bin/swapvm

# 若以 VBox 为主 KVM 为辅,则
insserv -r qemu-kvm
# 反之,则
insserv -r virtualbox

# 设置特权,方便切换
visudo #{
%kvm localhost= /usr/local/bin/swapvm
%vboxusers localhost= /usr/local/bin/swapvm
#}
[/bash]
头像
麦斯特
帖子: 1034
注册时间: 2005-03-28 0:00
系统: Gentoo x64
来自: ☸我佛山人

Re: Debian 7 wheezy 安装日志 2014-05-28

#10

帖子 麦斯特 » 2014-05-31 12:24

看是有排才能换吧,话说wheezy不是出来才13个月而已吗? :em04
Je ne suis pas d'accord avec ce que vous dites, mais je me battrai jusqu'à la mort pour que vous ayez le droit de le dire.
头像
lisaac
帖子: 2
注册时间: 2007-12-19 11:38

Re: Debian 7 wheezy 安装日志 2014-05-28

#11

帖子 lisaac » 2014-07-17 21:44

楼主的笔记风格不错,mark下
回复