Archlinux安装简介
2012-07-16 17:11
387 查看
今天从http://releng.archlinux.org/isos/2012.07.16_04-00-01下载了最新的archlinux安装盘,发现现在仅仅提供netinstall形式的安装盘。启动后安装,发现熟悉的/arch/setup已经不再存在。询问万能的Google同学后,得知这是新的安装方法(为啥要换呢?难道老的方式不好维护了?),现记录下来。
Step 1
准备好磁盘用户安装,创建磁盘分许与文件系统。如果需要使用LVM/RAID类似的功能,同样创建之。
[/code]
Step 2
根据文件系统,挂载root分区到/mnt,当然同样包含其他需要使用的相应分区。例如,mount /dev/sda1 /mnt/boot
[/code]
Step 3
连接因特网用于过去软件包,dhcpcd之。
修改mirrorlist到mirrors.163.com,这是我获取仓库最快的地址。
Step 1
准备好磁盘用户安装,创建磁盘分许与文件系统。如果需要使用LVM/RAID类似的功能,同样创建之。
[code] cfdisk /dev/sda
mkfs.ext4 -L ROOT /dev/sda1
mkswap -L SWAP /dev/sda2
[/code]
Step 2
根据文件系统,挂载root分区到/mnt,当然同样包含其他需要使用的相应分区。例如,mount /dev/sda1 /mnt/boot
[code] mount /dev/sda1 /mnt
swapon /dev/sda2
[/code]
Step 3
连接因特网用于过去软件包,dhcpcd之。
修改mirrorlist到mirrors.163.com,这是我获取仓库最快的地址。
[code]# Add "Server = http://mirrors.163.com/archlinux/$repo/os/$arch"[/code]vi /etc/pacman.d/mirrorlist
[/code]
Step 4
下载软件包并安装,这是最重要的一个环节。使用pacstrap /mnt base{,-devel} [more packages...],其根基是pacman。pacstrap是一个bash脚本,咱们看看就知道它都干了什么。[code]#!/bin/bash## Assumptions:# 1) User has partitioned, formatted, and mounted partitions on /mnt# 2) Network is functional# 3) Arguments passed to the script are valid pacman targets# 4) A valid mirror appears in /etc/pacman.d/mirrorlist#shopt -s extglobout() { printf "$1 $2\n" "${@:3}";}error() { out "==> ERROR:" "$@";} >&2msg() { out "==>" "$@";}msg2() { out " ->" "$@";}die() { error "$@";exit 1;}in_array() {local ifor i in "${@:2}"; do[[ $1 = "$i" ]] && returndone}api_fs_mount() {if ! mountpoint -q "$1"; thenmount -B "$1" "$1" && ROOT_IS_BIND=1fi &&mount -t proc proc "$1/proc" -o nosuid,noexec,nodev &&mount -t sysfs sys "$1/sys" -o nosuid,noexec,nodev &&mount -t devtmpfs udev "$1/dev" -o mode=0755,nosuid &&mount -t devpts devpts "$1/dev/pts" -o mode=0620,gid=5,nosuid,noexec &&mount -t tmpfs shm "$1/dev/shm" -o mode=1777,nosuid,nodev &&mount -t tmpfs run "$1/run" -o nosuid,nodev,mode=0755 &&mount -t tmpfs tmp "$1/tmp" -o mode=1777,strictatime,nodev,nosuid,size=50M}api_fs_umount() {umount \"$1/tmp" \"$1/run" \"$1/dev/shm" \"$1/dev/pts" \"$1/dev" \"$1/sys" \"$1/proc"(( ROOT_IS_BIND )) && umount "$1"}valid_number_of_base() {local base=$1 len=${#2} i=for (( i = 0; i < len; i++ )); do(( (${2:i:1} & ~(base - 1)) == 0 )) || returndone}mangle() {local i= chr= out=unset {a..f} {A..F}for (( i = 0; i < ${#1}; i++ )); dochr=${1:i:1}case $chr in[[:space:]\\])printf -v chr '%03o' "'$chr"out+=\\;;&# fallthrough*)out+=$chr;;esacdoneprintf '%s' "$out"}unmangle() {local i= chr= out= len=$(( ${#1} - 4 ))unset {a..f} {A..F}for (( i = 0; i < len; i++ )); dochr=${1:i:1}case $chr in\\)if valid_number_of_base 8 "${1:i+1:3}" ||valid_number_of_base 16 "${1:i+1:3}"; thenprintf -v chr '%b' "${1:i:4}"(( i += 3 ))fi;;&# fallthrough*)out+=$chresacdoneprintf '%s' "$out${1:i}"}fstype_is_pseudofs() {# list taken from util-linux source: libmount/src/utils.clocal pseudofs_types=('anon_inodefs''autofs''bdev''binfmt_misc''cgroup''configfs''cpuset''debugfs''devfs''devpts''devtmpfs''dlmfs''fuse.gvfs-fuse-daemon''fusectl''hugetlbfs''mqueue''nfsd''none''pipefs''proc''pstore''ramfs''rootfs''rpc_pipefs''securityfs''sockfs''spufs''sysfs''tmpfs')in_array "$1" "${pseudofs_types[@]}"}newroot=/mnthostcache=0usage() {cat <<EOFusage: ${0##*/} [options] root [packages...]Options:-c Use the package cache on the host, rather than the target-d Allow installation to a non-mountpoint directorypacstrap installs packages to the specified new root directory. If no packagesare given, pacstrap defaults to the "base" group.EOF}if [[ -z $1 || $1 = @(-h|--help) ]]; thenusageexit $(( $# ? 0 : 1 ))fi(( EUID == 0 )) || die 'This script must be run with root privileges'while getopts ':cd' flag; docase $flag ind)directory=1;;c)hostcache=1;;:)die '%s: option requires an argument -- '\''%s'\' "${0##*/}" "$OPTARG";;?)die '%s: invalid option -- '\''%s'\' "${0##*/}" "$OPTARG";;esacdoneshift $(( OPTIND - 1 ))(( $# )) || die "No root directory specified"newroot=$1; shiftpacman_args=("${@:-base}")if (( ! hostcache )); thenpacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg")fi[[ -d $newroot ]] || die "%s is not a directory" "$newroot"if ! mountpoint -q "$newroot" && (( ! directory )); thendie '%s is not a mountpoint!' "$newroot"fi# create obligatory directoriesmsg 'Creating install root at %s' "$newroot"mkdir -p "$newroot/var/lib/pacman" "$newroot"/{dev,proc,sys,run,tmp,etc}# always call umount on quit after this pointtrap 'api_fs_umount "$newroot" 2>/dev/null' EXIT# mount APIfilesystemsapi_fs_mount "$newroot" || die "failed to setup APIfilesystems in new root"msg 'Installing packages to %s' "$newroot"if ! pacman -r "$newroot" -Sy --noconfirm "${pacman_args[@]}"; thendie 'Failed to install packages to new root'fi# if there's a keyring on the host, copy it into the new root, unless it exists alreadyif [[ -d /etc/pacman.d/gnupg && ! -d $newroot/etc/pacman.d/gnupg ]]; thencp -a /etc/pacman.d/gnupg "$newroot/etc/pacman.d/"fi# install the host's mirrorlist onto the new rootcp -a /etc/pacman.d/mirrorlist "$newroot/etc/pacman.d/"# vim: et ts=2 sw=2 ft=sh:
[/code]
我的操作命令是[code] pacstrap /mnt base syslinux vim
[/code]
Step 5
如果你忘记安装了必要的包,现在可以通过如下指令补救:[code] pacman -r /mnt -Sy package
[/code]
在漫长的等待之后,基本上接下来的工作就是系统配置了。首先,我们切换root目录[code]arch-chroot /mnt
[/code]
Setp 6
配置bootloader,我这里使用syslinux[code] syslinux-install_update -iamvim /boot/syslinux/syslinux.cfg
[/code]
Step 7
配置系统
[code]exit#exit arch-chrootgenfstab -p /mnt >> /mnt/etc/fstabarch-chroot /mntcd /etcecho "hostname" > hostnameecho "en_US.UTF-8" > locale.confvi locale.genlocale-genln -s /usr/share/zoneinfo/Zone/Subzone localtimeexitcp /etc/mkinitcpio.conf /mnt/etc/arch-chroot /mntmkinitcpio -p linuxexitumount /mntreboot
[/code]
相关文章推荐
- 在Archlinux删除仅知命令或安装后的二进制文件软件的方法(pacman 用法简介)
- Archlinux 硬盘安装使用 小结
- mysql学习笔记(1-安装简介)
- nginx之 nginx-1.9.7 编译安装、理论简介
- BIRT 安装流程简介
- apache apollo安装和简介
- Linux下redis的安装和配置简介
- 【Cacti】Cacti简介与安装
- Windows 安装 Ant 简介
- WindowBuilder的安装与简介
- 技术【Maven系列一】之简介和安装配置篇
- Composer 的简介、安装及使用
- Phoenix简介及安装部署使用
- memcached 的简介、安装、命令
- Python入门(简介、安装)
- NodeJS的简介和安装配置
- 如何安装ArchLinux
- Linux系统简介 、 安装Linux系统 、 RHEL6基本操作
- Rattle :基于R的数据挖掘工具:简介和安装
- Helm简介,安装与使用