Gentoo 安装笔记 -- 2014/2/23

来源:互联网 发布:声优聊天软件 编辑:程序博客网 时间:2024/05/01 06:37

第三次安装了,这次能成功吗?


主要参考文章:

http://blog.segmentfault.com/genedna/1190000000338952

及官方的:

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml

安装从这个“Installing the Gentoo Installation Files:看起走。



下面我开始说明安装步骤


1.下载好三个文件:

install-x86-minimal-20140211.iso

portage-20140222.tar.bz2

stage3-i486-20140211.tar.bz2


2.进入LiveCD

建VMware虚拟机,加载install-x86-minimal-20140211.iso进入LiveCD。我选的是Other 3.x kernel.


3.设置网络

Minimal Install CD 光盘启动进入到 livecd 的环境,在安装前需要设置网络环境。 如果网络环境里配置了DHCP,通过命令ifconfig 命令检查机器是否分配到IP。

可以通过下面的几条命令自行设置,也可以使用 net-setup 命令进行设置:

ifconfig eth0 192.168.1.10/24 #设置IP地址:192.168.1.10route add default gw 192.168.1.1 #设置网关:192.168.1.1echo nameserver 192.168.1.1 > /etc/resolv.conf #设置域名解析服务器

Important

实际过程中有可能遇到从 Minimal Install CD 启动后,系统无法找到网卡,使得安装无法进行下去。遇到此类问题需要查看网卡的硬件情况,查看是否有加载对应的驱动模块。譬如在DELL R610 机型中使用Broadcom Corporation NetXtreme II 5709C 双端口千兆以太网卡时遇到虽然加载了驱动模块,但是依然无法识别网卡的情况,最终先将驱动模块删除再重新加载后才使得网卡设备被识别。

lspci -k #查询到网卡的驱动模块为bnx2。lsmod #查询是否加载了bnx2驱动模块。rmmod bnx2 #移除加载的bnx2驱动模块。modprobe bnx2 #重新加载驱动模块。net-setup eth0 #设置网络。

Important

如果使用新版本的 Minimal Install CD,由于 udev 版本已经升级到 200 以上,不一定能使用 eth0 来连接网络,新的连接的名称可以用以下代码来获得:

udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null

名称一般为 enps


4.设置密码及启动ssh

# psswd root

#/etc/init.d/sshd start


5.上传文件

用Windows 连接上刚才的Gentoo Install LiveCD虚拟机,上传portage-20140222.tar.bz2到/mnt/gentoo/下。上传stage3-i486-20140211.tar.bz2到/mnt/gentoo/usr/下

好!文件准备好了。


6.格式化磁盘

# cfdisk

#mkfs.ext4 /dev/sad1

#mkswap /dev/sda2

#/mkfs.ext4 /dev/sda3

#partprobe


7.解压文件到目录

解压portage-20140222.tar.bz2到/mnt/gentoo/下。

解压stage3-i486-20140211.tar.bz2到/mnt/gentoo/usr/下


8.配置编译选项

nano -w /mnt/gentoo/portage/make.conf

添加:

MAKEOPTS="-j3"设置:
USE="bindist unicode bash-completion vim-syntax jpeg png mmx sse sse2"make.conf 例子:
  1. cat /etc/make.conf
  2. # These settings were set by the catalyst build script that automatically
  3. # built this stage.
  4. # Please consult /usr/share/portage/config/make.conf.example for a more
  5. # detailed example.
  6. ACCEPT_KEYWORDS=[color=Red]"~amd64"[/color]
  7. CFLAGS="-O2 -pipe  -march=core2 "
  8. CXXFLAGS="${CFLAGS}"
  9. # WARNING: Changing your CHOST is not something that should be done lightly.
  10. # Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
  11. CHOST="x86_64-pc-linux-gnu"
  12. # These are the USE flags that were used in addition to what is provided by the
  13. # profile used for building.
  14. USE="mmx apng boost aqua a52 aac acpi cairo canna cvs dbus dri gd glut lame mad mng mp4 mplayer multilib smp svg theora usb wifi x264 xvid  alsa nvidia  sasl ssl sse sse2 X -gnome qt4 dvd alsa cdr kde bash-completion bzip2 cjk curl cvs cxx iconv jpeg jpek2k openmp opengl openal png therads lzma lzo"
  15. MAKEOPTS="-j8"
  16. FEATURES="parallel-fetch"
  17. INPUT_DEVICES="keyborad mouse"
  18. VIDEO_CARDS="nvidia"
  19. LINGUAS=" zh zh_CN"
  20. GENTOO_MIRRORS="http://mirrors.163.com/gentoo/ http://mirrors.sohu.com/gentoo/"
 添加镜像地址:
GENTOO_MIRRORS="http://mirrors.sohu.com/gentoo/"SYNC="rsync://rsync.cn.gentoo.org/gentoo-portage"


9.复制DNS信息
cp -L /etc/resolv.conf /mnt/gentoo/etc/


10.挂载/proc and /dev
# mount -t proc proc /mnt/gentoo/proc# mount --rbind /sys /mnt/gentoo/sys# mount --rbind /dev /mnt/gentoo/dev


11.chroot
# chroot /mnt/gentoo /bin/bash# source /etc/profile# export PS1="(chroot) $PS1"


12.Running emerge-webrsync to install a Portage snapshot
# emerge-webrsync


13.Updating the Portage tree

# emerge --sync


14.Choose the right profile

list profile

# eselect profile list

#eselecct profile set n



15.Viewing available USE flags

# less /usr/portage/profiles/use.desc

16. 编辑make.conf

第8步时已经修改过了。

VMWare安装注意make.conf中应是:

INPUT_DEVICES="evdev vmmouse"

VIDEO_CARDS="vmware"

要不然可以会出现"no screen found"错误

17.设置时区

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

18.Configure locales
# nano -w /etc/locale.gen
要用的locale都配置上。
可参考:

gentoo的中文化一直是gentoo新手的遇到的一个特别头痛的问题,比如说,桌面的中文化,中文输入法的安装,amarok中文乱码,挂载分区的乱码,等等。
其中的一些基本问题我已经在我的博客中总结了:

http://zhongbeyond.blog.sohu.com/114005695.html   

下面我总结一下中文locale的设定:
1.
先修改locale.gen文件
#gedit /etc/locale.gen   

代码:
en_US  ISO-8859-1
en_US.UTF-8  UTF-8
zh_CN  GB18030
zh_CN.GBK  GBK
zh_CN.GB2312  GB2312
zh_CN.UTF-8  UTF-8

保存执行locale-gen:

#locale-gen  

2.建立 /etc/env.d/02locale
#gedit /etc/env.d/02locale  
 
在文本中输入:  
LANG="zh_CN.GBK"
LC_CTYPE="zh_CN.GBK"
LC_NUMERIC="zh_CN.GBK"
LC_TIME="zh_CN.GBK"
LC_COLLATE="zh_CN.GBK"
LC_MONETARY="zh_CN.GBK"
LC_MESSAGES="zh_CN.GBK"
LC_PAPER="zh_CN.GBK"
LC_NAME="zh_CN.GBK"
LC_ADDRESS="zh_CN.GBK"
LC_TELEPHONE="zh_CN.GBK"
LC_MEASUREMENT="zh_CN.GBK"
LC_IDENTIFICATION="zh_CN.GBK"

保存后执行:
#env-update && source /etc/profile 

如果要安装scim输入法的话,你还需要建立: /etc/env.d/100i18n 文件。
#gedit /etc/env.d/100i18n

输入:
LANG=en_US.UTF-8
LC_CTYPE=zh_CN.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"  

保存后执行:
#env-update && source /etc/profile

19.使locale生效
Running locale-gen

#locale-gen

20.选择locale
# eselect locale list# eselect locale set n21.Reload shell environment
# env-update && source /etc/profile22.用genkernel安装kernel先执行:#emerge gentoo-sources 
# emerge genkernelemerge时可能会提示应使用用"genkernel-next",修改"nano -w /usr/portage/profiles/targets/systemd/package.mask"后正常完成。
#genkernel all


23.编辑fstab
# nano -w /etc/fstab

Code Listing 1.3: A full /etc/fstab example

/dev/sda2   /boot        ext2    defaults,noatime     0 2/dev/sda3   none         swap    sw                   0 0/dev/sda4   /            ext4    noatime              0 1/dev/cdrom  /mnt/cdrom   auto    noauto,user          0 024.Setting the host name
# nano -w /etc/conf.d/hostname


25.Setting the domainname
# nano -w /etc/conf.d/net(Set the dns_domain variable to your domain name)dns_domain_lo="homenetwork"
Automatically obtaining an IP address for eth0
添加config_eth0="dhcp"添加routes_eth0="default via 192.168.1.1" (稍后会添加DHCP. )
由于新的udev使用了新的命名规则,eth0现在是enp...的形式。

使用下面方法改回eth0:

touch /etc/udev/rules.d/80-net-name-slot.rules


26.编辑hosts文件Opening /etc/hosts
# nano -w /etc/hosts

Code Listing 2.9: Filling in the networking information

(This defines the current system)127.0.0.1     tux.homenetwork tux localhost(Define extra systems on your network,they need to have a static IP to be defined this way.)192.168.0.5   jenny.homenetwork jenny192.168.0.6   benny.homenetwork benny

Save and exit the editor to continue.

If you don't have PCMCIA, you can now continue with System Information. PCMCIA-users should read thefollowing topic on PCMCIA.



27.Automatic start networking at boot
Adding net.eth0 to the default runlevel

# cd /etc/init.d# ln -s net.lo net.eth0# rc-update add net.eth0 default

If you have several network interfaces, you need to create the appropriatenet.* files just like you did with net.eth0.

If you later find out the assumption about the network interface name (which wecurrently document as eth0) was wrong, then

  1. update the /etc/conf.d/net file with the correct interface name (like enp3s0instead of eth0),
  2. create new symbolic link (like /etc/init.d/net.enp3s0),
  3. remove the old symbolic link (rm /etc/init.d/net.eth0),
  4. add the new one to the default runlevel, and
  5. remove the old one using rc-update del net.eth0 default.

28.Setting root password
#passwd

29.open /etc/rc.conf
# nano -w /etc/rc.conf

当你完成对/etc/rc.conf的配置后,保存并退出。

正如你所看到的,为了帮助你完成必要变量的配置,这个文件有丰富的注释信息。你可以让你的系统使用unicode并定义你的默认编辑器和你的显示管理器(比如gdm或者kdm)。

30.config keymaps
# nano -w /etc/conf.d/keymaps

Take special care with the keymap variable. If you select the wrongkeymap, you will get weird results when typing on your keyboard.

When you're finished configuring /etc/conf.d/keymaps, save andexit.

Gentoo uses /etc/conf.d/hwclock to set clock options. Edit itaccording to your needs.



31.

Opening /etc/conf.d/hwclock

# nano -w /etc/conf.d/hwclock

If your hardware clock is not using UTC, you need to add clock="local"to the file. Otherwise you will notice some clock skew.

When you're finished configuring /etc/conf.d/hwclock, save andexit.


32.: Installing a system logger

# emerge syslog-ng# rc-update add syslog-ng default


33.Cronie
A cron daemon executes scheduled commands. It is very handy if you need to execute some command regularly (for instance daily, weekly or monthly).

Gentoo offers several possible cron daemons, including bcron, dcron, fcron and cronie. Installing one of themis similar to installing a system logger. However, dcron andfcron require an extra configuration command, namely crontab/etc/crontab. If you don't know what to choose, use cronie.

Code Listing 2.1: Installing a cron daemon

# emerge cronie# rc-update add cronie default(Only if you have chosen dcron or fcron) # crontab /etc/crontab


34.File Indexing

If you want to index your system's files so you are able to quicklylocate them using the locate tool, you need to installsys-apps/mlocate.

Code Listing 3.1: Installing mlocate

# emerge mlocate


35.Remote Access
# rc-update add sshd default

36./etc/inittab 编辑
Uncommenting serial consoles in inittab
# SERIAL CONSOLESs0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100


37.Filesystem tool install
ext4的自动会装

38.Installing a DHCP client
Installing dhcpcd
# emerge dhcpcd



39.如果须要安装PPPoE

Installing ppp
# emerge ppp

40.安装GRUB2
Installing GRUB2
# emerge sys-boot/grub

Installing the GRUB2 files in /boot/grub
# grub2-install /dev/sda

Generating GRUB2 configuration
# grub2-mkconfig -o /boot/grub/grub.cfgGenerating grub.cfg ...Found linux image: /boot/kernel-3.3.8-gentooFound initrd image: /boot/initramfs-genkernel-x86-3.3.8-gentoodone
上面方法应至少要找到一个linux system.


41.完成上面步聚后重启计算机。


42.安装KDE桌面

#emerge xorg-x11 or #emerge Xorg-server

修改make.conf:

VMware修改:

INPUT_DEVICES="evdev vmmouse"

VIDEO_CARDS="vmware"

也可参考(http://forums.gentoo.org/viewtopic-t-885754-start-0.html):

这样:

Yikes. It looks like you have drivers for everything installed, which is not ... optimal, but I don't think it is your primary problem. Now you have to emerge those packages again, or at least the one for your hardware. We can get rid of the extraneous ones later if you want.
代码:
eix -ICc x11-drivers | grep -v ^Found | awk '{print $2}' | xargs emerge -v1
will remerge all of those. If you know which is for your hardware, then
代码:
emerge -av1 x11-drivers/my-driver
will suffice. If you want help trimming the drivers for hardware you don't have, post
代码:
cat /etc/make.conf
lspci

#emerge kdebase-meta

#startx




0 0
原创粉丝点击