ArchLinux 安装日志 2014-06-12

回复
头像
自由建客
论坛版主
帖子: 13445
注册时间: 2008-07-30 23:21
系统: Debian stable AMD64
来自: [email protected]
送出感谢: 12 次
接收感谢: 113 次
联系:

ArchLinux 安装日志 2014-06-12

#1

帖子 自由建客 » 2014-06-12 22:49

今天就装了这么多,明天继续 :em06
[bash]#!/bin/bash # 该行仅为语法高亮而设,并无它意
##############################################################################
#
# ArchLinux 安装日志 2014-06-12
#
##############################################################################

# 种鸡系统
# 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 -

##############################################################################
# bootstrap 环境
wget https://mirrors.kernel.org/archlinux/is ... _64.tar.gz
wget http://mirrors.163.com/archlinux/extra/ ... pkg.tar.xz
tar xpf archlinux-bootstrap-2014.06.01-x86_64.tar.gz -C /tmp/
tar xpf haveged-1.9.1-1-x86_64.pkg.tar.xz -C /tmp/root.x86_64/

# 设源
vi /tmp/root.x86_64/etc/pacman.d/mirrorlist #{ 改
Server = http://mirrors.163.com/archlinux/$repo/os/$arch
#}

##############################################################################
# 分区
# 任何时候留有 /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

# 挂载
SYS_INS_DIR="/tmp/root.x86_64/mnt"
mkdir -p "$SYS_INS_DIR"
mount LABEL=FB_CP2_ROOT "$SYS_INS_DIR"
mkdir "${SYS_INS_DIR}/"{boot,home}
mount LABEL=FB_CP2_BOOT "${SYS_INS_DIR}/boot"
mount LABEL=FB_CP2_HOME "${SYS_INS_DIR}/home"

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

# ============================================================================
# 换根入 bootstrap 环境
/tmp/root.x86_64/bin/arch-chroot /tmp/root.x86_64/
SYS_INS_DIR="/mnt"

##############################################################################
# 初始化
haveged -w 1024
pacman-key --init
pacman-key --populate archlinux

# 安装基本系统
pacstrap "$SYS_INS_DIR" base base-devel

# ============================================================================
# 换根入新系统
unset LANGUAGE LS_COLORS
arch-chroot "$SYS_INS_DIR" /bin/bash

##############################################################################
# 文件系统表
vi /etc/fstab #{ 覆 ---------------------------------------
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 {urd,vm,data}

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

vi /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 /etc/skel/.bash_logout #{ 覆 ---------------------------
#/etc/init.d/urd-server backup
[ -z "$DISPLAY" ] && clear_console || true
#} ---------------------------------------------------------------------------

vi /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;\[email protected]\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 /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 /root -maxdepth 1 -mindepth 1 -exec rm -rf {} \;
cp /etc/skel/{.bash*,.inputrc} /root
sed -i '/^#\?\/etc\/init\.d\/urd-server /d' /root/.bash_{profile,logout}
sed -i 's/^alias ls=.*/alias ls="ls -AF"/' /root/.bashrc

# ============================================================================
# 令 shell 相关配置生效
exec bash

##############################################################################
# 主机名:cp2
echo cp2 >/etc/hostname

# ============================================================================
# 时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

# 时钟基准
# 硬时钟若非 UTC,则将 --utc 换成 --localtime
#hwclock --systohc --utc

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

vi /etc/locale.gen #{ 覆
en_US.UTF-8 UTF-8
ja_JP.UTF-8 UTF-8
ko_KR.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_HK.UTF-8 UTF-8
zh_SG.UTF-8 UTF-8
zh_TW.UTF-8 UTF-8
#}

locale-gen

vi /etc/locale.conf #{ 覆
LANG=zh_CN.UTF-8
LANGUAGE=zh_CN:zh_SG:zh_TW:zh_HK
#}

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 控制台键盘、字体
vi /etc/vconsole.conf #{ 改
KEYMAP=us
FONT=
#}

# ============================================================================
# 引导器
pacman -S grub
grub-install --target=i386-pc --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

# ============================================================================
# 设置口令
passwd

# 退出新系统环境
exit

# 退出 bootstrap 环境
exit

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

# 卸载
umount "${SYS_INS_DIR}/"{boot,home,}

# 重启
shutdown -r now
[/bash]
ubunbates
帖子: 120
注册时间: 2014-04-30 15:44
系统: linux
送出感谢: 5 次
接收感谢: 4 次

Re: ArchLinux 安装日志 2014-06-12

#2

帖子 ubunbates » 2014-06-13 6:50

求开发调教种鸡教程
回复

回到 “Arch发行版”