在CF卡上安装Gentoo

# 配置网卡
livecd ~ # dhcpcd eth0
显示:offered 192.168.100.230 from 192.168.100.1 表示成功 #不同的机子ip不同

# 启动ssh服务
livecd ~ # /eth/init.d/sshd start

# 设置密码
livecd ~ # passwd

# 使用putty登录
# ip地址是刚才配置网卡时自动分配的ip地址 本机是192.168.100.230 #不同的机子ip不同

# 磁盘分区
livecd ~ # fdisk /dev/sda
提示:按M查看帮助
用n分好区,然后输入a设置sda1为启动分区,输入t再输入82设置sda2为交换分区
然后w保存退出

显示:
Disk /dev/sda: 4034 MB, 4034838528 bytes
255 heads, 63 sectors/track, 490 cylinders, total 7880544 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 133119 65536 83 Linux
/dev/sda2 133120 264191 65536 82 Linux swap / Solaris
/dev/sda3 264192 7880543 3808176 83 Linux

表示成功

# 创建文件系统
livecd ~ # mke2fs -j /dev/sda1
显示:
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
表示成功

livecd ~ # mke2fs -j -N 600000 /dev/sda3
显示:
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
表示成功

livecd ~ # mkswap /dev/sda2
显示:
Setting up swapspace version 1, size = 65532 KiB
no label, UUID=86f7c61e-8104-41a3-ada8-7afdff98a548 #ID号每次都不一样
表示成功

livecd ~ # mount /dev/sda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/sda1 /mnt/gentoo/boot
livecd ~ # swapon /dev/sda2

# 使用psftp传输文件
#本地运行cmd进入命令行
C:\Users\Administrator>cd C:\Users\Administrator\Desktop\Linux # C:\Users\Administrator\Desktop\Linux 是我要传输的本地文件所在path
C:\Users\Administrator\Desktop\Linux>psftp 192.168.100.230
login as: root
Using keyboard-interactive authentication.
Password:
Remote working directory is /root
psftp> cd /mnt/gentoo
Remote directory is now /mnt/gentoo
psftp> mput *.bz2
local:portage-20120128.tar.bz2 => remote:/mnt/gentoo/portage-20120128.tar.bz2
local:stage3-i686-20120124.tar.bz2 => remote:/mnt/gentoo/stage3-i686-20120124.tar.bz2
psftp>
表示成功

# 解压stage3和portage
livecd ~ # cd /mnt/gentoo/
livecd gentoo # tar xvjpf stage3-i686-20120124.tar.bz2
# x表示解开(Extract),
# v表示详细信息(Verbose)可以用来查看解压缩时发生了什么(可选参数),
# j表示使用bzip2解压缩,
# p表示保留权限(Preserve permissions),
# 还有f表示我们要解开一个文件,而不是标准输入。
livecd gentoo # tar xvjf portage-20120128.tar.bz2 -C /mnt/gentoo/usr

livecd gentoo # chmod 1777 /mnt/gentoo/tmp

# 挂载/proc和/dev文件系统
livecd gentoo # mount -t proc none /mnt/gentoo/proc
livecd gentoo # mount -o bind /dev /mnt/gentoo/dev

# 进入新的系统环境
livecd gentoo # chroot /mnt/gentoo /bin/bash
livecd / # env-update
提示:>>> Regenerating /etc/ld.so.cache...
表示成功

livecd / # source /etc/profile
livecd / # export PS1="(chroot)$PS1"

# 修改新系统的编译选项/etc/make.conf
# 选项文件/etc/make.conf;

(chroot)livecd ~ # cat /etc/make.conf
CFLAGS="-O2 -march=i686 -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="i686-pc-linux-gnu"
MAKEOPTS="-j4"
GENTOO_MIRRORS="http://192.168.100.10/ http://mirrors.xmu.edu.cn/gentoo/"
USE="-gnome -kde -qt3 -qt4 X tomcat php apache2 mysql java6 java gd hal startup-notification"

# 修改新系统的glibc Locales
# 文件/etc/locale.gen
(chroot)livecd ~ # cat /etc/locale.gen
en_US ISO-8859-1
en_US.UTF-8 UTF-8
zh_CN GBK
zh_CN.UTF-8 UTF-8

# 修改时区
(chroot)livecd ~ cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

# 安装源码编译内核
# 使用putty登录时,某些终端类型如xterm-color会导致man页面乱码,用xterm就可以
(chroot)livecd ~ emerge gentoo-sources
显示
Installing (1 of 1) sys-kernel/gentoo-sources-3.1.10-r1

* If you are upgrading from a previous kernel, you may be interested
* in the following document:
* - General upgrade guide: http://www.gentoo.org/doc/en/kernel-upgrade.xml

* For more info on this patchset, and how to report problems, see:
* http://dev.gentoo.org/~mpagano/genpatches

>>> Recording sys-kernel/gentoo-sources in "world" favorites file...

* Messages for package sys-kernel/gentoo-sources-3.1.10-r1:

* If you are upgrading from a previous kernel, you may be interested
* in the following document:
* - General upgrade guide: http://www.gentoo.org/doc/en/kernel-upgrade.xml

表示成功

(chroot)livecd ~ cd /usr/src/linux
(chroot)livecd linux # make menuconfig
提示:File systems ---> <*> Second extended fs support
[*] Ext2 extended attributes
[ ] Ext2 POSIX Access Control Lists (NEW)
[ ] Ext2 Security Labels (NEW)
[*] Ext2 execute in place support

Device Drivers ---> [*] Network device support ---> [*] Ethernet (1000 Mbit) (NEW) ---> <*> Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support

# 检查以下内核选项
# Processor type and features ---> Processor family
# Device Drivers
# 去掉不需要的驱动;
# 确保开了LVM2,默认有开;
# 确保自己使用的网卡有选上,使用lspci可以查看检测到的硬件;

(chroot)livecd linux # make
显示:
LD arch/x86/boot/setup.elf
OBJCOPY arch/x86/boot/setup.bin
OBJCOPY arch/x86/boot/vmlinux.bin
HOSTCC arch/x86/boot/tools/build
BUILD arch/x86/boot/bzImage
Setup is 12668 bytes (padded to 12800 bytes).
System is 4819 kB
CRC f2082df7
Kernel: arch/x86/boot/bzImage is ready (#1)
Building modules, stage 2.
MODPOST 3 modules
CC arch/x86/kernel/test_nx.mod.o
LD [M] arch/x86/kernel/test_nx.ko
CC drivers/scsi/scsi_wait_scan.mod.o
LD [M] drivers/scsi/scsi_wait_scan.ko
CC net/netfilter/xt_mark.mod.o
LD [M] net/netfilter/xt_mark.ko
表示成功

(chroot)livecd linux # cp arch/x86/boot/bzImage /boot/kernel-3.1.10-gentoo-r1
# "x86"根据CPU的不同可能会不同,注意看编译最后的提示;
(chroot)livecd linux # make modules_install
显示:
INSTALL arch/x86/kernel/test_nx.ko
INSTALL drivers/scsi/scsi_wait_scan.ko
INSTALL net/netfilter/xt_mark.ko
DEPMOD 3.1.10-gentoo-r1
表示成功

(chroot)livecd linux # cat /etc/fstab
/dev/sda1 /boot ext3 noauto,noatime 1 2
/dev/sda3 / ext3 noatime 0 1
/dev/sda2 none swap sw 0 0

# 设置密码
(chroot)livecd linux # passwd

# 安装必要的系统工具
(chroot)livecd linux # emerge distcc
显示:
>>> Installing (12 of 12) sys-devel/distcc-3.1-r5
* Compilation and optimization of Python modules for CPython 2.7 ... [ ok ]
*
* IPv6 has not supported yet by distcc-3.1.
*
* Tips on using distcc with Gentoo can be found at
* http://www.gentoo.org/doc/en/distcc.xml
*
* How to use pump mode with Gentoo:
* # distcc-config --set-hosts "foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo"
* # pump emerge -u world
*
* To use the distccmon programs with Gentoo you should use this command:
* # DISTCC_DIR="" distccmon-text 5
*
* ***SECURITY NOTICE***
* If you are upgrading distcc please make sure to run etc-update to
* update your /etc/conf.d/distccd and /etc/init.d/distccd files with
* added security precautions (the --listen and --allow directives)
*

>>> Recording sys-devel/distcc in "world" favorites file...

* Messages for package sys-devel/distcc-3.1-r5:

*
* IPv6 has not supported yet by distcc-3.1.
*
* Tips on using distcc with Gentoo can be found at
* http://www.gentoo.org/doc/en/distcc.xml
*
* How to use pump mode with Gentoo:
* # distcc-config --set-hosts "foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo"
* # pump emerge -u world
*
* To use the distccmon programs with Gentoo you should use this command:
* # DISTCC_DIR="" distccmon-text 5
*
* ***SECURITY NOTICE***
* If you are upgrading distcc please make sure to run etc-update to
* update your /etc/conf.d/distccd and /etc/init.d/distccd files with
* added security precautions (the --listen and --allow directives)
*
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

* Regenerating GNU info directory index...
* Processed 66 info files.

* IMPORTANT: 2 news items need reading for repository 'gentoo'.
* Use eselect news to read news items.
表示成功

(chroot)livecd linux # distcc-config --set-hosts "192.168.100.10"

(chroot)livecd linux # emerge syslog-ng logrotate vim dhcpcd grub gentoolkit pciutils
显示:
>>> Installing (40 of 41) app-editors/vim-7.3.266
* Updating documentation tags in /usr/share/vim/vim73

* The 'X' USE flag enables vim <-> X communication, like
* updating the xterm titlebar. It does not install a GUI.

* To install a GUI version of vim, use the app-editors/gvim
* package.

* Vim 7 includes an integrated spell checker. You need to install
* word list files before you can use it. There are ebuilds for
* some of these named app-vim/vim-spell-*. If your language of
* choice is not included, please consult vim-spell.eclass for
* instructions on how to make a package.

* Note that the English word lists are no longer installed by
* default.

* To see what's new in this release, use :help version7.txt

* Calling eselect vi update...

>>> Recording app-editors/vim in "world" favorites file...

>>> Emerging (41 of 41) app-vim/gentoo-syntax-20101212
* gentoo-syntax-20101212.tar.bz2 RMD160 SHA1 SHA256 size ;-) ... [ ok ]
>>> Unpacking source...
>>> Unpacking gentoo-syntax-20101212.tar.bz2 to /var/tmp/portage/app-vim/gentoo-syntax-20101212/work
>>> Source unpacked in /var/tmp/portage/app-vim/gentoo-syntax-20101212/work
>>> Compiling source in /var/tmp/portage/app-vim/gentoo-syntax-20101212/work/gentoo-syntax-20101212 ...
>>> Source compiled.
>>> Test phase [not enabled]: app-vim/gentoo-syntax-20101212

>>> Install gentoo-syntax-20101212 into /var/tmp/portage/app-vim/gentoo-syntax-20101212/image/ category app-vim
* Fixing file permissions ... [ ok ]
>>> Completed installing gentoo-syntax-20101212 into /var/tmp/portage/app-vim/gentoo-syntax-20101212/image/


>>> Installing (41 of 41) app-vim/gentoo-syntax-20101212
* Updating documentation tags in /usr/share/vim/vim73
*
* This plugin provides documentation via vim's help system. To
* view it, use:
* :help gentoo-syntax
*
* This plugin makes use of filetype settings. To enable these,
* add lines like:
* filetype plugin on
* filetype indent on
* to your ~/.vimrc file.
*
* Note for developers and anyone else who edits ebuilds:
* This release of gentoo-syntax now contains filetype rules to set
* fileencoding for ebuilds and ChangeLogs to utf-8 as per GLEP 31.
* If you find this feature breaks things, please submit a bug and
* assign it to vim@gentoo.org. You can use the 'ignore-glep31' USE
* flag to remove these rules.


* Messages for package net-misc/dhcpcd-5.2.12:

* You have installed dhcpcd with zeroconf support.
* This means that it will always obtain an IP address even if no
* DHCP server can be contacted, which will break any existing
* failover support you may have configured in your net configuration.
* This behaviour can be controlled with the -L flag.
* See the dhcpcd man page for more details.
*
* Users upgrading from 4.0 series should pay attention to removal
* of compat useflag. This changes behavior of dhcp in wide manner:
* dhcpcd no longer sends a default ClientID for ethernet interfaces.
* This is so we can re-use the address the kernel DHCP client found.
* To retain the old behaviour of sending a default ClientID based on the
* hardware address for interface, simply add the keyword clientid
* to dhcpcd.conf or use commandline parameter -I ''
*
* Also, users upgrading from 4.0 series should be aware that
* the -N, -R and -Y command line options no longer exist.
* These are controled now by nohook options in dhcpcd.conf.

* Messages for package sys-boot/grub-0.97-r10:

* Fallback PaX marking -m
* /var/tmp/portage/sys-boot/grub-0.97-r10/image//sbin/grub
*
* To avoid automounting and auto(un)installing with /boot,
* just export the DONT_MOUNT_BOOT variable.
*
*
* To avoid automounting and auto(un)installing with /boot,
* just export the DONT_MOUNT_BOOT variable.
*
* To interactively install grub files to another device such as a USB
* stick, just run the following and specify the directory as prompted:
* emerge --config =grub-0.97-r10
* Alternately, you can export GRUB_ALT_INSTALLDIR=/path/to/use to tell
* grub where to install in a non-interactive way.

* Messages for package sys-apps/pciutils-3.1.7:

* Providing a backwards compatibility non-compressed pci.ids
* The 'pcimodules' program has been replaced by 'lspci -k'

* Messages for package dev-util/ctags-5.8:

* You can set the version to be started by /usr/bin/ctags through
* the ctags eselect module. "man ctags.eselect" for details.

* Messages for package app-admin/syslog-ng-3.2.5:

* It is highly recommended that app-admin/logrotate be emerged to
* manage the log files. syslog-ng installs a file in /etc/logrotate.d
* for logrotate to use.

* Messages for package app-admin/logrotate-3.8.0:

* If you wish to have logrotate e-mail you updates, please
* emerge virtual/mailx and configure logrotate in
* /etc/logrotate.conf appropriately
*
* Additionally, /etc/logrotate.conf may need to be modified
* for your particular needs. See man logrotate for details.

* Messages for package x11-proto/xcb-proto-1.6-r2:

* Deleting byte-compiled Python modules needlessly generated by build system:
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/state.pyc
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/matcher.pyc
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/expr.pyc
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/xtypes.pyc
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/expr.pyo
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/state.pyo
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/xtypes.pyo
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/__init__.pyo
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/error.pyo
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/matcher.pyo
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/error.pyc
* /var/tmp/portage/x11-proto/xcb-proto-1.6-r2/image/usr/lib/python2.7/site-packages/xcbgen/__init__.pyc
* Please rebuild both libxcb and xcb-util if you are upgrading from version 1.6

* Messages for package app-portage/gentoolkit-0.3.0.4-r5:

*
* glsa-check since gentoolkit 0.3 has modified some output,
* options and default behavior. The list of injected GLSAs
* has moved to /var/lib/portage/glsa_injected, please
* run 'glsa-check -p affected' before copying the existing checkfile.

* Messages for package x11-libs/libxcb-1.7:

* Running elibtoolize in: libxcb-1.7/
* We've already been run in this tree; you should
* avoid this if possible (perhaps by filing a bug)

* Messages for package x11-libs/libX11-1.4.4:

* Running elibtoolize in: libX11-1.4.4/
* We've already been run in this tree; you should
* avoid this if possible (perhaps by filing a bug)

* Messages for package app-editors/vim-core-7.3.266:

* Vim 7 includes an integrated spell checker. You need to install
* word list files before you can use it. There are ebuilds for
* some of these named app-vim/vim-spell-*. If your language of
* choice is not included, please consult vim-spell.eclass for
* instructions on how to make a package.
* Note that the English word lists are no longer installed by
* default.

* Messages for package app-editors/vim-7.3.266:

* The 'X' USE flag enables vim <-> X communication, like
* updating the xterm titlebar. It does not install a GUI.
* To install a GUI version of vim, use the app-editors/gvim
* package.
* Vim 7 includes an integrated spell checker. You need to install
* word list files before you can use it. There are ebuilds for
* some of these named app-vim/vim-spell-*. If your language of
* choice is not included, please consult vim-spell.eclass for
* instructions on how to make a package.
* Note that the English word lists are no longer installed by
* default.
* To see what's new in this release, use :help version7.txt

* Messages for package app-vim/gentoo-syntax-20101212:

*
* This plugin provides documentation via vim's help system. To
* view it, use:
* :help gentoo-syntax
*
* This plugin makes use of filetype settings. To enable these,
* add lines like:
* filetype plugin on
* filetype indent on
* to your ~/.vimrc file.
*
* Note for developers and anyone else who edits ebuilds:
* This release of gentoo-syntax now contains filetype rules to set
* fileencoding for ebuilds and ChangeLogs to utf-8 as per GLEP 31.
* If you find this feature breaks things, please submit a bug and
* assign it to vim@gentoo.org. You can use the 'ignore-glep31' USE
* flag to remove these rules.
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

* Regenerating GNU info directory index...
* Processed 74 info files.

* IMPORTANT: 2 news items need reading for repository 'gentoo'.
* Use eselect news to read news items.
表示成功


(chroot)livecd linux # rc-update add sshd default
显示:
* service sshd added to runlevel default
表示成功

(chroot)livecd linux # rc-update add syslog-ng default
显示:
* service syslog-ng added to runlevel default
表示成功

# 配置启动
# 修改新系统的/boot/grub/grub.conf

default 0
timeout 5

title Gentoo Linux 3.1.10-r1
root (hd0,0)
kernel /boot/kernel-3.1.10-gentoo-r1 root=/dev/sda3

title Gentoo Linux 3.1.10-r1(rescue)
root (hd0,0)
kernel /boot/kernel-3.1.10-gentoo-r1 root=/dev/sda3 init=/bin/bb


# 修改新系统的/boot/grub/device.map,去掉fd0
(chroot)livecd ~ grep -v rootfs /proc/mounts > /etc/mtab
(chroot)livecd ~ grub-install --no-floppy /dev/sda


# 重启更新系统
(chroot)livecd linux # exit
livecd gentoo # reboot


# 从硬盘启动系统
# 输入账户,密码

# 配置网卡
livecd ~ # dhcpcd eth0
显示:offered 192.168.100.230 from 192.168.100.1 表示成功 #不同的机子ip不同

# 把配置网络设置为自动启动
livecd ~ # cd /etc/init.d
livecd init.d # ln -s net.lo net.eth0
livecd init.d # rc-update add net.eth0 boot


# 配置tomcat,apache...
livecd ~ # rc-update add apache2 default
livecd ~ # rc-update add tomcat-6 default
# 修改/etc/tomcat-6/tomcat-users.xml
<role rolename="manager"/>
<role rolename="admin"/>
<user username="arlen" password="iloveu" roles="manager,admin"/>
# 进入http://www:8080/manager/html,发布smarthome.war
# 修改/etc/conf.d/apache2
livecd conf.d # grep APACHE2_OPTS /etc/conf.d/apache2
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5 -D JK"
# 修改/etc/apache2/jk-workers.properties
# 修改/etc/apache2/vhosts.d/00_default_vhost.conf
JkMount /smarthome/* balancer
JkMount /jks jk-status
# 重启tomcat,apache,使用http://www/smarthome/*可以转给tomcat处理了
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值