Gentoo Linux是一个基于portage进行包管理的Linux发行版,最早版本始于2002年。其官方官网为http://www.gentoo.org
目前,Gentoo Linux已经在在互联网企业中使用,其它最大的应用就是豆瓣网。据说豆瓣网的服务器全都使用Gentoo Linux。
Gentoo Linux的安装和RHEL SUSE等这些发行版有一些不同,其安装方式一般采用mini CD +stage3 进行安装。首先,是网易有gentoo镜像上下载安装包,共3个
包. 地址为http://mirrors.163.com/gentoo/releases/ 下载包,
install-amd64-minimal-20130711.iso LiveCD,使用这个iso来引导系统
stage3-amd64-20130711.tar.bz2 stage3是一个/目录的文件进行打包
portage-20130704.tar.bz2 这是gentoo的ebuild的集合
用 install-amd64-minimal-20130711.iso引导系统,进行系统后,设置root密码,设置IP地址,启动sshd服务,对硬盘进行分区, 挂载分区,将stage3-amd64-20130711.tar.bz2和 portage-20130704.tar.bz2文件上传至硬盘,将这两个文件解压至相应目录。chroot到新环境下,安装gentoo内核,emerge gentoo-sources, 再安装gentoo内核编译工具,emerge genkernel, 重新编译内核,安装grub,修改grub配置文件,设置网络,修改/etc/fstab文件等。
查看Gentoo Linux系统相关信息
gentoo ~ # emerge --info Portage 2.1.12.2 (default/linux/amd64/13.0, gcc-4.6.3, glibc-2.15-r3, 3.8.13-gentoo x86_64) ================================================================= System uname: Linux-3.8.13-gentoo-x86_64-Intel-R-_Core-TM-_i5-2435M_CPU_@_2.40GHz-with-gentoo-2.2 KiB Mem: 1009420 total, 898752 free KiB Swap: 0 total, 0 free Timestamp of tree: Fri, 12 Jul 2013 23:15:01 +0000 ld GNU ld (GNU Binutils) 2.23.1 app-shells/bash: 4.2_p45 dev-lang/python: 2.7.5, 3.2.5-r1 dev-util/pkgconfig: 0.28 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.11.8 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.69 sys-devel/automake: 1.12.6 sys-devel/binutils: 2.23.1 sys-devel/gcc: 4.6.3 sys-devel/gcc-config: 1.7.3 sys-devel/libtool: 2.4-r1 sys-devel/make: 3.82-r4 sys-kernel/linux-headers: 3.7 (virtual/os-headers) sys-libs/glibc: 2.15-r3 Repositories: gentoo ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -pipe" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://mirrors.163.com/gentoo/" #使用网易镜像,加快软件的下载速度 LDFLAGS="-Wl,-O1 -Wl,--as-needed" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://mirrors.163.com/gentoo-portage" #使用网易的rsync源,加快portage同步速度 USE="acl amd64 berkdb bindist bzip2 cli cracklib crypt cxx dri fortran gdbm gpm iconv ipv6 mmx modules mudflap multilib ncurses nls nptl openmp pam pcre readline session sse sse2 ssl tcpd unicode zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-4" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Gentoo的网络、主机等配置信息位于/etc/conf.d/目录下
-rw-r--r-- 1 root root 328 Jul 11 06:03 bootmisc -rw-r--r-- 1 root root 876 Jul 11 06:03 consolefont -rw-r--r-- 1 root root 412 Jul 11 04:58 crypto-loop -rw-r--r-- 1 root root 117 Jul 11 06:03 dmesg -rw-r--r-- 1 root root 1402 Jul 11 06:03 fsck -rw-r--r-- 1 root root 580 Jul 11 05:15 gpm -rw-r--r-- 1 root root 56 Jul 13 07:23 hostname #主机名配置信息 -rw-r--r-- 1 root root 877 Jul 11 06:03 hwclock #硬件时间配置信息 -rw-r--r-- 1 root root 918 Jul 11 06:03 keymaps #键盘配置信息 -rw-r--r-- 1 root root 105 Jul 11 06:03 killprocs -rw-r--r-- 1 root root 121 Jul 11 06:03 localmount -rw-r--r-- 1 root root 898 Jul 11 06:03 modules -rw-r--r-- 1 root root 336 Jul 13 10:45 net #网络配置信息 lrwxrwxrwx 1 root root 3 Jul 13 10:49 net.enp2s1 -> net -rw-r--r-- 1 root root 1335 Jul 11 06:03 netmount -rw-r--r-- 1 root root 271 Jul 11 05:54 pydoc-2.7 -rw-r--r-- 1 root root 271 Jul 11 05:32 pydoc-3.2 -rw-r--r-- 1 root root 149 Jul 11 05:23 rsyncd -rw-r--r-- 1 root root 396 Jul 11 06:06 sshd -rw-r--r-- 1 root root 76 Jul 11 06:03 tmpfiles -rw-r--r-- 1 root root 1639 Jul 11 06:07 udev -rw-r--r-- 1 root root 282 Jul 11 06:03 urandom
主机配置:
gentoo conf.d # more hostname # Set to the hostname of this machine hostname="gentoo" gentoo conf.d #
网络配置信息
gentoo conf.d #more net # This blank configuration will automatically use DHCP for any net.* # scripts in /etc/init.d. To create a more complete configuration, # please review /usr/share/doc/openrc*/net.example* and save your configuration # in /etc/conf.d/net (this file :]!). config_enp2s1=("192.168.222.132/24") #网卡符号为enp2s1 routes_enp2s1=("default via 192.168.222.2") #网关配置信息
gentoo的ebuild的集合位于系统的/usr/portage目录下,系统进行了按应用、开发、游戏、媒体等进行了分类
gentoo portage # ls app-accessibility app-portage dev-ruby games-simulation media-libs net-print sec-policy www-misc app-admin app-shells dev-scheme games-sports media-plugins net-proxy skel.ChangeLog www-plugins app-antivirus app-text dev-tcltk games-strategy media-radio net-voip skel.ebuild www-servers app-arch app-vim dev-tex games-util media-sound net-wireless skel.metadata.xml x11-apps app-backup app-xemacs dev-texlive gnome-base media-tv net-zope sys-apps x11-base app-benchmarks dev-ada dev-util gnome-extra media-video perl-core sys-auth x11-drivers app-cdr dev-cpp dev-vcs gnustep-apps metadata profiles sys-block x11-libs app-crypt dev-db distfiles gnustep-base net-analyzer razorqt-base sys-boot x11-misc app-dicts dev-dotnet eclass gnustep-libs net-dialup rox-base sys-cluster x11-plugins app-doc dev-embedded games-action gpe-base net-dns rox-extra sys-devel x11-proto app-editors dev-games games-arcade gpe-utils net-firewall sci-astronomy sys-firmware x11-terms app-emacs dev-haskell games-board header.txt net-fs sci-biology sys-freebsd x11-themes app-emulation dev-java games-emulation java-virtuals net-ftp sci-calculators sys-fs x11-wm app-forensics dev-lang games-engines kde-base net-im sci-chemistry sys-infiniband xfce-base app-i18n dev-libs games-fps kde-misc net-irc sci-electronics sys-kernel xfce-extra app-laptop dev-lisp games-kids licenses net-libs sci-geosciences sys-libs app-leechcraft dev-lua games-misc lxde-base net-mail sci-libs sys-power app-misc dev-ml games-mud mail-client net-misc sci-mathematics sys-process app-mobilephone dev-perl games-puzzle mail-filter net-nds sci-misc virtual app-office dev-php games-roguelike mail-mta net-news sci-physics www-apache app-officeext dev-python games-rpg media-fonts net-nntp sci-visualization www-apps app-pda dev-qt games-server media-gfx net-p2p scripts www-client
Gentoo Linux对于一个软件包,有以下几个描述文件,
gentoo ktorrent # ls ChangeLog #修改日志 Manifest files #gentooo为软件包打的patch ktorrent-4.3.1.ebuild #ebuild文件 metadata.xml #元数据文件