gentoo linux install 운영체제
2014.04.02 13:48 Edit
gentoo install guide
/etc/init.d/net.eth0 restart nano /etc/ssh/sshd_config passwe root livecd ~ # fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xc64db540.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1): (Enter를 칩니다)
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1044, default 1044): +32MB
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (6-1044, default 6): (Enter를 칩니다)
Using default value 6
Last cylinder, +cylinders or +size{K,M,G} (6-1044, default 1044): +512MB
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (69-1044, default 69): (Enter를 칩니다)
Using default value 69
Last cylinder, +cylinders or +size{K,M,G} (69-1044, default 1044): (Enter를 칩니다)
Using default value 1044
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc64db540
Device Boot Start End Blocks Id System
/dev/sda1 1 5 40131 83 Linux
/dev/sda2 6 68 506047+ 82 Linux swap / Solaris
/dev/sda3 69 1044 7839720 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.livecd ~ # mkfs.ext2 /dev/sda1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
10040 inodes, 40128 blocks
2006 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=41156608
5 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
livecd ~ # mkfs.ext3 /dev/sda3
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
490560 inodes, 1959930 blocks
97996 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2009071616
60 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.livecd ~ # mkswap /dev/sda2
Setting up swapspace version 1, size = 506040 KiB
no label, UUID=ae873bb0-b8ab-4af1-a331-f13a2e3c9e98
livecd ~ # swapon /dev/sda2livecd ~ # mount /dev/sda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/sda1 /mnt/gentoo/boot livecd gentoo # nano /etc/resolv.conf
GNU nano 2.2.4 File: /etc/resolv.conf
# Generated by dhcpcd
# /etc/resolv.conf.head can replace this line
# /etc/resolv.conf.tail can replace this line
nameserver 168.126.63.1lilivecd gentoo # cd /mnt/gentoo
livecd gentoo # wget http://ftp.daum.net/gentoo/releases/x86/current-stage3/stage3-i486-20130716.tar.bz2
livecd gentoo # tar xvjpf stage3-*.tar.bz2
livecd gentoo # wget http://ftp.daum.net/gentoo/snapshots/portage-20130807.tar.bz2
livecd gentoo # tar xvjf /mnt/gentoo/portage-20130807.tar.bz2 -C /mnt/gentoo/usr livecd gentoo # nano -w /mnt/gentoo/etc/make.conf
MAKEOPTS="-j2"
CFLAGS="-O2 -march=i686 -pipe"
CXXFLAGS="${CFLAGS}"livecd gentoo # mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
livecd gentoo # mount -t proc none /mnt/gentoo/proc
livecd gentoo # mount --rbind /sys /mnt/gentoo/sys
livecd gentoo # mount --rbind /dev /mnt/gentoo/dev
"/etc/make.conf", line 2: Invalid token 'CXXFLAGS' (not '=')
!!! Found 2 make.conf files, using both '/etc/make.conf' and '/etc/portage/make.conf'
"/etc/make.conf", line 2: Invalid token 'CXXFLAGS' (not '=')
>>> Regenerating /etc/ld.so.cache...
livecd / # source /etc/profile
livecd / # export PS1="(chroot) $PS1" (chroot) livecd / # eselect profile list
Available profile symlink targets:
[1] default/linux/x86/13.0 *
[2] default/linux/x86/13.0/selinux
[3] default/linux/x86/13.0/desktop
[4] default/linux/x86/13.0/desktop/gnome
[5] default/linux/x86/13.0/desktop/kde
[6] default/linux/x86/13.0/developer
[7] hardened/linux/x86
[8] hardened/linux/x86/selinux
[9] hardened/linux/uclibc/x86
(chroot) livecd / # eselect profile set 3
/boot/initramfs-genkernel-x86-3.8.13-gentoo /boot/kernel-genkernel-x86-3.8.13-gentoo(chroot) livecd / # nano -w /etc/fstab
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
#/dev/BOOT /boot ext2 noauto,noatime 1 2
#/dev/ROOT / ext3 noatime 0 1
#/dev/SWAP none swap sw 0 0
#/dev/cdrom /mnt/cdrom auto noauto,ro 0 0
#/dev/fd0 /mnt/floppy auto noauto 0 0
/dev/sda1 /boot ext2 defaults,noatime 1 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / ext3 noatime 0 1
/dev/cdrom /mnt/cdrom auto noauto,user 0 0(chroot) livecd / # nano -w /etc/conf.d/net
GNU nano 2.3.2 File: /etc/conf.d/net Modified
# 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_eth0="192.168.92.111 netmask 255.255.255.0 brd 192.168.92.255"
routes_eth0="default via 192.168.92.2"
(chroot) livecd init.d # ln -s net.lo net.eth0
(chroot) livecd init.d # rc-update add net.eth0 default
* service net.eth0 added to runlevel default(chroot) livecd / # emerge syslog-ng
(chroot) livecd /# rc-update add syslog-ng default
(chroot) livecd /# emerge vixie-cron
(chroot) livecd /# rc-update add vixie-cron default
(chroot) livecd / # rc-update add sshd default
(chroot) livecd / # nano -w /etc/inittab
###inittab의 직렬 콘솔 주석 해제하기
# SERIAL CONSOLES
s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100
s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100(chroot) livecd init.d # emerge grub
(chroot) livecd init.d # nano /boot/grub/grub.conf (아래 내용 추가)
title Gentoo Linux 2.6.34-r1
root (hd0,0)
kernel /boot/kernel-genkernel-x86-3.8.13-gentoo
(chroot) livecd init.d # grep -v rootfs /proc/mounts > /etc/mtab
(chroot) livecd init.d # grub-install --no-floppy /dev/sda
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(fd0) /dev/fd0
(hd0) /dev/sda
(chroot) livecd init.d # grub --no-floppy
Probing devices to guess BIOS drives. This may take a long time.
grub> root (hd0,0) (/boot 파티션이 있는 곳을 지정합니다)
grub> setup (hd0) (주 시동 레코드(MBR)에 GRUB을 설치합니다)
grub> quit (GRUB 쉘을 빠져 나갑니다)
livecd / # cd
livecd / # umount -l /mnt/gentoo{/boot,/proc,}
livecd / # reboot
tcp6 0 0 :::80 :::* LISTEN 21297/apache2
* You don't appear to have the mysql database installed yet.
* Please run /usr/bin/mysql_install_db to have this done...
* ERROR: mysql failed to startlocalhost ~ # /usr/bin/mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/scripts/mysqlbug script!
localhost ~ # /etc/init.d/mysql start
* Starting mysql ...
[ ok ]
localhost ~ # mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.70-log Gentoo Linux mysql-5.1.70
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password = password('12345') where user='root';
Query OK, 2 rows affected (0.01 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
APACHE2_OPTS에 "-D PHP5"를 추가하여 저장.
localhost apache2 # /etc/init.d/apache2 restart
localhost apache2 # echo "<?php phpinfo(); ?>" > /var/www/localhost/htdocs/index.php
27 AddType application/x-gzip .gz .tgz
28 AddType application/x-httpd-php .php .php3 .html .htm (<- 추가)
124 #DirectoryIndex index.html index.html.var
125 DirectoryIndex index.html index.php index.php3 index.htm(<-추가)
126 </IfModule>
if(
(defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) &&
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')!==false &&
function_exists('ob_gzhandler') &&
extension_loaded('zlib')
) $this->gz_enabled = true;
소스를 아래와 같이 수정
if(
(defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) &&
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')!==false &&
function_exists('ob_gzhandler') &&
extension_loaded('gzip')
) $this->gz_enabled = true;