征途留存参考-前端总结好文

gentoo安装其实很简单

安装之前,我们应该知道一些关于操作系统的基本知识。

操作系统的结构大体上分为两部分:

  • kernel也就是内核 ,负责为计算机的硬件底层提供接口
  • Shell也就是外壳程序,负责为操作系统层上的应用程序层提供接口

而现在流行的操作系统中也分为两类:

  • 以windows为代表的内核与外壳一体化的操作系统,也就是整个操作系统是一个整体,无法分割
  • 以Linux为代表的内核与外壳分离的操作系统。一个内核可以对应多个外壳,同样一个外壳可以对应多个内核。这样一来,操作系统的灵活 性大大提高。又由于是开源的,你可以为自己定制完全符合你自己需求的操作系统,而不要带上那些对于你来说没有任何作用,但占用宝贵的系统资源的鸡肋功能。

有了以上的认识,再开始安装Linux就很容易理解了。大体上来说,Gentoo的安装分为如下几个大步骤:

  1. 给硬盘至少分3个区:一个启动区,一个交换分区(也就是 Windows下的虚拟内存),一个操作系统所在的分区。当然你也可以分更多的区。
  2. 配置并编译一个kernel内核,放在启动分区
  3. 把外壳程序解压到操作系统分区,并修改好相应的配置文件
  4. 安装设置启动的软件,比如 GRUB,配置好对应系统启动时用哪个内核启动哪个系统

然后你就可以用了

下面就来说说详细的过程。

硬盘分区

用gentoo的liveCD由光驱启动,然后使用“fdisk”降硬盘至少分为3个区:

  1. 第一个区为启动分区,用来存放kernel内核和系统启动软件,一般设定为100M
  2. 第二个区为交换分区,用来存放程序运行时的页面文件(也就是虚拟内存)。根据你的内存大小与硬盘大小决定。在本例中,握设定的为1G
  3. 第三个区是操作系统的安装分区,用来放外壳程序的。
  4. 第四个或者第n个都随你分了,不过Linux最多只能存在4个主分区,如果你的分区大于4个,那么你就要把第四个分区设定为扩展分区,然后在其下面继续分其他的区。

PS:这里提一下Linux的文件管理与Windows不同的地方。在Windows 里面,人们通常看见的都是C:/ D:/ ….., 文件的都是按照不同的分区进行存放。但是在Linux里面,只有“/”这一个根目录,所有的文件都在这一个根目录或者其附属的子目录中存放。硬盘的分区都 被挂载(mount)到某一个目录下。也就是说对于用户来说,只需要关注文件系统的层,而不用关心磁盘的底层。

分完区以后记得给交换分区标记上SWAP的标签,并且把启动分区激活

外壳安装

  1. 把第三个和第一个分区分别挂载(mount)到liveCD的/mnt/gentoo 和/mnt/gentoo/boot目录下
  2. 下载Gentoo Stage 包并解压到/gentoo目录下
  3. 下载Portage包并解压到/gentoo/usr目录下
  4. 修改硬盘系统上的相应的配置,比如,clock等

内核安装

  1. chroot把操作范围设定到硬盘上,也就是/gentoo 目录下
  2. 编译一个内核,放到启动分区下,也就是/gentoo/boot目录下

启动引导工具安装于配置

  1. 用emerge安装一个GRUB,配置启动选项,也就是用什么内核启动什么外壳
  2. 把GRUB的启动分区设定为第一个分区
  3. 修改相应的配置文件fstab,net,passwd等,并安装一些软件,比如syslog等

重新起动系统,然后你就可以使用最基本的Gentoo了。

当然,如果你要使用xWindows的图形操作界面,那就要安装并配置Xserver, 至于图形界面可以根据你的需求考虑使用功能强大的KDE,或者是轻量级的Gnome。

关于Xserver和KDE的安装与配置,我会另外写一篇。

下面贴一个Gentoo 安装的全部命令:

磁盘划分

-----命令行输入:

# fdisk /dev/hda

/dev/hda1 linux

/dev/hda2 linux swap

/dev/hda3 linux

-----给分区创建文件系统

# mke2fs /dev/hda1

# mke2fs –j /dev/hda3

# mkswap /dev/hda2

# swapon /dev/hda2

----挂载分区以及创建挂载点

# mount /dev/hda3 /mnt/gentoo

# mkdir /mnt/gentoo/boot

# mount /dev/hda1 /mnt/gentoo/boot

# mkdir /mnt/gentoo/proc

# mount -t proc none /mnt/gentoo/proc

----- 配置网络

# net-setup

----安装gentoo安装文件

1 设置时间日期

# date MMDDhhmmYYYY

2 解开stage包

# tar –xvjpf /mnt/cdrom/stages/stage3-i686.2006.1.tar.bz2 –C /mnt/gentoo

3 解开portage包

# tar –xvjpf /mnt/cdrom/snapshot/portage.2006.1.tar.bz2 –C /mnt/gentoo/usr

4 复制源代码

# mkdir /mnt/gentoo/usr/portage/distfiles

# cp /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles

------安装gentoo基本系统

1 选择镜像

# mirrorselect -a -s4 -o | grep -ve ‘^Netselect’ >;>; /mnt/gentoo/etc/make.conf

2 复制DNS信息

# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

3 进入新的环境

# chroot /mnt/gentoo /bin/bash

# env-update

# source /etc/profile

----配置内核

1选择时区

# ln -sf /usr/share/zoneinfo/RPC /etc/localtime

2 安装内核源码

# emerge gentoo-sources

3 改变内核源码的符号链接

# rm /usr/src/linux

# cd /usr/src

# ln -s linux-2.4.25-gentoo linux

4编译内核

#make menuconfig

#make && make modules_install

#cp arch/i386/boot/bzImage /boot/

-----配置系统

1 配置文件系统

# nano –w /etc/fstab

/dev/hda1 /boot ext2 noauto,noatime 1 2

/dev/hda2 none swap sw 0 0

/dev/hda3 / ext3 noatime 0 1

none /proc proc defaults 0 0

none /dev/shm tmpfs defaults 0 0

/dev/cdroms/cdrom0 /mnt/cdrom auto noauto,user 0 0

2 配置网络信息

# nano –w /etc/conf.d/hostname

HOSTNAME=”Squall”

# nano –w /etc/conf.d/domainname

DNSDOMAIN=”squall.com”

# nano –w /etc/conf.d/net

Config-eth0=( “192.168.0.110 netmask 255.255.255.0” )

Routes-eth0=( “default gw 192.168.0.1” )

# rc-update add net.eth0 default

-----配置grub

# emerge grub

# grub

grub>; root (hd0,0)

grub>; setup (hd0)

grub>; quit

# nano -w /boot/grub/grub.conf

default 0

timeout 30

splashimage=(hd0,0)/grub/splash.xpm.gz

title Gentoo Linux

root (hd0,0)

kernel /bzImage root=/dev/hda3

----安装必须的系统工具

# emerge syslog-ng

# rc-update add syslog-ng default

----- 完成安装

1 修改root密码

# passwd

2 重启系统

# exit

# cd /

# umount /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo

# reboot

《征途留存参考-前端总结好文》有30条留言

  1. A lot of thanks for all your efforts on this site. Gloria loves engaging in investigation and it’s easy to understand why. Almost all know all concerning the dynamic means you give helpful items on the web blog and as well encourage contribution from others on that concern plus our daughter is always discovering a lot. Have fun with the remaining portion of the new year. You’re the one conducting a good job.

    回复
  2. Thank you for every one of your hard work on this web page. My aunt really likes making time for investigations and it’s really obvious why. Most of us learn all of the lively mode you offer precious suggestions through this web site and even increase participation from some other people on the matter so our favorite girl is now learning a lot of things. Take advantage of the rest of the year. You are always doing a really great job.

    回复
  3. I am glad for writing to make you know what a nice encounter my wife’s girl had studying your web site. She mastered several pieces, which include what it’s like to possess an awesome helping nature to let other individuals very easily know precisely some problematic subject matter. You truly exceeded people’s expectations. Thank you for presenting these practical, trusted, informative and in addition fun tips about this topic to Kate.

    回复
  4. My spouse and i felt now fulfilled that Ervin could deal with his investigations out of the ideas he got out of the web page. It’s not at all simplistic to just choose to be giving freely instructions that many other folks have been selling. And we also figure out we have the website owner to be grateful to for that. The entire explanations you have made, the simple site menu, the friendships you can give support to engender – it’s got everything fantastic, and it’s really facilitating our son and the family feel that the issue is entertaining, and that is incredibly indispensable. Thank you for all the pieces!

    回复
  5. I am also writing to make you know what a impressive encounter my friend’s girl gained reading through your web page. She learned plenty of pieces, which include what it’s like to possess an amazing helping mood to let most people smoothly know several impossible subject matter. You truly exceeded our own expectations. Thank you for offering these invaluable, safe, explanatory and even fun tips about this topic to Julie.

    回复
  6. I’m commenting to let you be aware of of the awesome discovery my child developed browsing the blog. She came to find a good number of details, including how it is like to have a great coaching character to get certain people completely comprehend a number of advanced issues. You actually did more than her desires. I appreciate you for coming up with such effective, dependable, edifying and cool guidance on that topic to Emily.

    回复
  7. I precisely had to appreciate you all over again. I am not sure the things that I might have followed in the absence of the entire information documented by you directly on such industry. It had become a real distressing crisis in my circumstances, however , encountering the skilled form you managed that made me to jump over fulfillment. I’m just happier for this guidance and even hope you find out what a great job you are doing instructing other individuals through your blog post. I am sure you have never encountered all of us.

    回复
  8. My spouse and i felt now fortunate that Emmanuel could conclude his investigation out of the ideas he gained in your web page. It’s not at all simplistic to just choose to be giving freely information and facts that many other folks have been selling. And we all figure out we have the website owner to be grateful to for that. The explanations you have made, the simple site menu, the friendships you can give support to engender – it’s got everything fabulous, and it’s really facilitating our son and the family feel that the idea is enjoyable, and that is incredibly important. Thank you for all the pieces!

    回复
  9. I am only writing to make you understand what a really good experience my wife’s princess obtained viewing your webblog. She noticed some things, which included what it is like to possess an ideal teaching spirit to make others without difficulty learn about specific tortuous things. You undoubtedly surpassed readers’ expected results. Thanks for rendering those productive, trusted, informative as well as unique tips on your topic to Mary.

    回复
  10. I am glad for writing to make you know what a magnificent encounter my friend’s girl gained studying your web site. She learned several pieces, which include what it’s like to possess an awesome helping nature to let other folks very easily know just exactly several multifaceted subject matter. You truly exceeded people’s expectations. Thank you for presenting these powerful, safe, explanatory and in addition fun tips about this topic to Kate.

    回复
  11. I’m also commenting to let you be aware of of the cool discovery my child encountered checking your blog. She came to understand a lot of details, including how it is like to have a marvelous coaching heart to get folks easily fully grasp a variety of complicated issues. You actually did more than my desires. I appreciate you for delivering such good, dependable, edifying and also cool guidance on that topic to Ethel.

    回复
  12. My husband and i felt absolutely ecstatic Edward could complete his inquiry from the ideas he discovered from your very own site. It’s not at all simplistic just to be giving for free hints that men and women could have been making money from. And we do know we have the blog owner to appreciate because of that. Most of the explanations you’ve made, the easy blog navigation, the relationships you will help to instill – it’s got most overwhelming, and it’s really leading our son in addition to the family reason why the situation is exciting, which is rather mandatory. Thank you for the whole lot!

    回复
  13. Thanks for the tips on credit repair on all of this blog. What I would advice people is to give up the mentality that they can buy now and pay later. As a society we tend to do this for many things. This includes vacations, furniture, and items we want. However, you need to separate your wants from all the needs. While you are working to improve your credit score you have to make some sacrifices. For example you can shop online to save money or you can go to second hand stores instead of expensive department stores for clothing.

    回复
  14. Thanks for the suggestions about credit repair on this particular web-site. The things i would offer as advice to people is usually to give up this mentality that they buy at this point and fork out later. Being a society most of us tend to make this happen for many factors. This includes trips, furniture, in addition to items we’d like. However, it is advisable to separate one’s wants from the needs. As long as you’re working to raise your credit ranking score actually you need some trade-offs. For example you may shop online to economize or you can check out second hand outlets instead of high priced department stores intended for clothing.

    回复
  15. Thank you for your entire labor on this web site. My mom take interest in participating in investigations and it is obvious why. My partner and i learn all regarding the lively tactic you produce simple thoughts through your web site and in addition invigorate response from the others on the subject then our favorite princess is truly studying a whole lot. Take advantage of the rest of the year. You have been doing a superb job.

    回复
  16. I’m just commenting to let you be aware of of the extraordinary discovery my cousin’s daughter enjoyed going through your site. She discovered lots of issues, most notably how it is like to have a very effective giving mindset to have many others just gain knowledge of certain extremely tough matters. You really did more than our desires. Many thanks for distributing the important, healthy, educational and as well as easy thoughts on the topic to Gloria.

    回复
  17. This unique blog is really entertaining and diverting. I have chosen many interesting advices out of this blog. I ad love to return over and over again. Thanks a bunch! Lorrayne Hashim Bullen

    回复
  18. When I initially left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on whenever a comment is added I receive 4 emails with the same comment. Is there a way you are able to remove me from that service? Kudos! Athena Alleyn Shaver

    回复
  19. An interesting discussion is definitely worth comment. I do think that you ought to publish more on this subject, it might not be a taboo subject but usually people do not talk about these topics. To the next! Many thanks!! Shena Nicol Hawk

    回复
  20. Hi there. I found your web site by the use of Google at the same time as searching for a comparable matter, your web site came up. It appears good. I have bookmarked it in my google bookmarks to visit then. Erma Sonnie Krissie

    回复

留下评论