0%

2014.05.15 18:11:14字数 581阅读 977

前期准备

远程登录:

  • 开启ssh服务:

  • 设置密码:

以便使用putty、ssh client远程登录上传stage等(有时在线下载很慢,而局域网上传很快)

准备磁盘:

  • 分区:

/dev/sda1 : /boot 100M(32-100M) 设启动笔记-a
/dev/sda2 : / 20G
/dev/sda3 : /home 20G
/dev/sda5 : /swap 1G (内存< 512 MB,分区分配2倍内存大小的空间;> 1024 MB,可以分配较少的空间甚至不需要swap 分区。)-t 82

  • 创建文件系统:
1
2
3
4
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
mkswap /dev/sda5
  • 挂载分区:
1
2
3
4
5
6
mount /dev/sda2 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot
mkdir /mnt/gentoo/home
mount /dev/sda3 /mnt/gentoo/home
swapon /dev/sda5

安装系统

安装stage及portage:

  • 正确设置日期/时间:

如果显示的日期/时间不正确,可以使用date MMDDhhmmYYYY命令

  • 下载Stage3 Tarbll:
1
2
cd /mnt/gentoo
links http://www.gentoo.org/main/en/mirrors.xml

选择国内速度较快的镜像,进入releases/x86/autobuilds/目录里。你将会看到所有适合你的计算机体系结构的stage文件(它们也可能放在各个独立的子体系名称的子目录里)。选择一个,然后按D来下载。下载完以后,再按Q退出浏览器。

或使用SSH Secure Shell登录上传stage3文件

  • 解开Stage3 Tarball:
1
tar xvjpf stage3-*.tar.bz2
  • 下载Portage:

打开links(或者lynx)然后到我们的Gentoo镜像列表。选择一个离你最近的镜像,打开snapshots/目录。然后选择最新的Portage快照(portage-latest.tar.bz2)并按D来下载它。

1
links http://www.gentoo.org/main/en/mirrors.xml

或使用SSH Secure Shell登录上传portage文件

  • 解压Portage:
1
tar -xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr (install a Portage snapshot)

编译前准备:

  • 配置编译选项:
1
nano -w /mnt/gentoo/etc/portage/make.conf

CFLAGS=”-march=native -O2 -pipe”

CXXFLAGS=”${CFLAGS}” # 两个变量使用相同的设置
MAKEOPTS=”-j3” #MAKEOPTS定义在安装软件的时候同时可以产生并行编译的数目,CPU数目加一是个不错的选择

查看cpu信息:

  • 选择镜像站点:
1
2
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
mirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf

**Warning:**app-portage/mirrorselect has not been updated to handle modifying the target chrootsrepos.conf/gentoo.conf file yet. Also, the SYNC variable in make.conf is deprecated and no longer used by portage. This section needs to be updated, please skip for the time being…

  • 拷贝DNS信息:
1
cp -L /etc/resolv.conf /mnt/gentoo/etc/

Chroot进入新系统环境:

Chroot:

  • 挂载 /proc, /dev, /sys文件系统:
1
2
3
mount -t proc none /mnt/gentoo/proc
mount --rbind /dev /mnt/gentoo/dev
mount --rbind /sys /mnt/gentoo/sys
  • 进入新的系统环境:
1
2
3
chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) $PS1"

新环境配置:

  • 更新portage树:
1
2
3
emerge --sync (Updating the Portage tree)

emerge-webrsync(fetch the latest portage snapshot)
  • 选择Profile:
1
2
eselect profile list
eselect profile set ×
  • 设置时区:
1
2
3
ls /usr/share/zoneinfo
echo "Europe/Brussels" > /etc/timezone
emerge --config sys-libs/timezone-data
  • 设置locale:
1
2
3
4
nano -w /etc/locale.gen
locale-gen
eselect locale list
eselect locale set x
  • 更新环境变量:
1
env-update && source /etc/profile

更多精彩内容下载简书APP

“小礼物走一走,来简书关注我”

还没有人赞赏,支持一下

孤逐王- 传承Unix哲学思想,关注Linux开源技术,情有独钟Gentoo!
- 分享投资理…

总资产1 (约0.10元)共写了9.3W字获得803个赞共326个粉丝

被以下专题收入,发现更多相似内容

推荐阅读更多精彩内容

  • Ubuntu的发音 Ubuntu,源于非洲祖鲁人和科萨人的语言,发作 oo-boon-too 的音。了解发音是有意…

  • linux资料总章2.1 1.0写的不好抱歉 但是2.0已经改了很多 但是错误还是无法避免 以后资料会慢慢更新 大…

  • 先读一下前面这段话,以决定是否要看下去: 这是写给纯小白的Arch Linux安装步骤。Arch的可配置自由度太高…

    沉沦的菩提阅读 28,228评论 73赞 194

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智…

  • Linux系统磁盘基本管理命令挂载文件系统――mount mount命令语法: mount [参数] [设备名称]…