◆当blogは、Linuxサーバ構築する際の実際の設定手順を個人的メモとして記載しております。LinuC試験の役に立つ情報があるかも…?
[root@A]# cat /etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
/dev/VolGroup00/LogVol03 /tmp ext3 defaults 1 2
/dev/VolGroup00/LogVol02 /var ext3 defaults,usrquota,grpquota 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
[root@A]# cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
[root@A]# cat /etc/mtab
/dev/mapper/VolGroup00-LogVol00 / ext3 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
[root@A]# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 rw,data=ordered 0 0
/dev /dev tmpfs rw 0 0
[root@A]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
[root@A]# sync
[root@A]# dd if=/dev/zero of=/tmp/swapfile bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB) copied, 0.117411 seconds, 447 MB/s
[root@A]# mkswap /tmp/swapfile
Setting up swapspace version 1, size = 52424 kB
[root@A]# swapon /tmp/swapfile
[root@A]# swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 1048568 0 -1
/tmp/swapfile file 51192 0 -2
[root@A]# cat /proc/swaps
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 1048568 0 -1
/tmp/swapfile file 51192 0 -2
[root@A]# cdrecord -scanbus
Cdrecord-Clone 2.01 (cpu-pc-linux-gnu) Copyright (C) 1995-2004 Jg Schilling
Note: This version is an unofficial (modified) version with DVD support
Note: and therefore may have bugs that are not present in the original.
Note: Please send bug reports or support requests to http://bugzilla.redhat.com/bugzilla
Note: The author of cdrecord should not be bothered with problems in this version.
cdrecord: Invalid or incomplete multibyte or wide character. Cannot open SCSI driver.
cdrecord: For possible targets try 'cdrecord -scanbus'.
cdrecord: For possible transport specifiers try 'cdrecord dev=help'.
[root@A]# dumpe2fs /dev/sda1 | more
Inode count: 26104
Block count: 104388
Reserved block count: 5219
Free blocks: 89012
Free inodes: 26070
First block: 1
Block size: 1024
Group 1: (Blocks 8193-16384)
Backup superblock at 8193, Group descriptors at 8194-8194
[root@A]# fsck.ext3
Emergency help:
-p Automatic repair (no questions)
-n Make no changes to the filesystem
-y Assume "yes" to all questions
-c Check for bad blocks and add them to the badblock list
-f Force checking even if filesystem is marked clean
-v Be verbose
-b superblock Use alternative superblock
-B blocksize Force blocksize when looking for superblock
-j external_journal Set location of the external journal
-l bad_blocks_file Add to badblocks list
-L bad_blocks_file Set badblocks list
[root@A]# e2fsck
Emergency help:
-p Automatic repair (no questions)
-n Make no changes to the filesystem
-y Assume "yes" to all questions
-c Check for bad blocks and add them to the badblock list
-f Force checking even if filesystem is marked clean
-v Be verbose
-b superblock Use alternative superblock
-B blocksize Force blocksize when looking for superblock
-j external_journal Set location of the external journal
-l bad_blocks_file Add to badblocks list
-L bad_blocks_file Set badblocks list
[root@A]# tune2fs -l /dev/sda1
Inode count: 26104
Block count: 104388
Reserved block count: 5219
Free blocks: 89012
Free inodes: 26070
First block: 1
Block size: 1024
[root@A]# badblocks /dev/sda1
[root@A]# debugfs /dev/sda1
debugfs 1.39 (29-May-2006)
debugfs: ls
2 (12) . 2 (12) .. 11 (20) lost+found 16065 (36) grub
12 (16) message 17 (44) initrd-2.6.18-128.el5.img
13 (36) System.map-2.6.18-128.el5 14 (32) config-2.6.18-128.el5
15 (36) symvers-2.6.18-128.el5.gz 16 (780) vmlinuz-2.6.18-128.el5
debugfs: quit
[root@A]# cat /etc/auto.master
/misc /etc/auto.misc
[root@A]# /etc/init.d/autofs restart
automount を停止中: [ OK ]
automount を起動中: [ OK ]
[root@A]# ls -l /etc/auto.*
-rw-r--r-- 1 root root 717 1月 21 2009 /etc/auto.master
-rw-r--r-- 1 root root 581 1月 21 2009 /etc/auto.misc
-rwxr-xr-x 1 root root 1292 1月 21 2009 /etc/auto.net
-rwxr-xr-x 1 root root 715 1月 21 2009 /etc/auto.smb
[root@A]# cat /etc/auto.master
/misc /etc/auto.misc
[root@A]# cat /etc/auto.misc
cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
[root@A]# ls -l /dev/sda{,1,2}
brw-r----- 1 root disk 8, 0 1月 5 16:42 /dev/sda
brw-r----- 1 root disk 8, 1 1月 5 16:42 /dev/sda1
brw-r----- 1 root disk 8, 2 1月 5 16:42 /dev/sda2
[root@A]# ls -l /dev/{ttyS0,input/mice,lp0}
crw------- 1 root root 13, 63 1月 5 16:42 /dev/input/mice
crw-rw---- 1 root lp 6, 0 1月 5 16:42 /dev/lp0
crw-rw---- 1 root uucp 4, 64 1月 5 16:41 /dev/ttyS0
[root@A]# cat /proc/devices
Character devices:
1 mem
4 ttyS
5 /dev/tty
5 /dev/console
6 lp
10 misc
180 usb
189 usb_device
Block devices:
1 ramdisk
2 fd
8 sd
9 md
[root@A]# ls /etc/udev/rules.d
05-udev-early.rules 51-hotplug.rules 60-pcmcia.rules
61-uinput-stddev.rules 90-alsa.rules 95-pam-console.rules
40-multipath.rules 60-libsane.rules 60-raw.rules
[root@A]# cat /etc/udev/rules.d/50-udev.rules
KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule"
[root@A]# udevinfo -q path -n /dev/sda1
/block/sda/sda1
root@A]# udevinfo -q env -n /dev/sda1
ID_VENDOR=VMware,
ID_MODEL=VMware_Virtual_S
ID_REVISION=1.0
[root@A]# dmesg | more
Linux version 2.6.18-128.el5 (mockbuild@builder16.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed
Jan 21 10:44:23 EST 2009
[root@A]# cat /etc/inittab
id:5:initdefault:
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
[root@A]# ls /etc/rc3.d
K01dnsmasq K35dovecot K88wpa_supplicant S08iptables
S19rpcgssd S50snmpd S90xfs K02NetworkManager
K35smb K89dund S08mcstrans S22messagebus
[root@A]# ls -l /etc/rc3.d/S85httpd
lrwxrwxrwx 1 root root 15 羈0 2010 /etc/rc3.d/S85httpd -> ../init.d/httpd
[root@A]# /etc/init.d/httpd start
httpd を起動中: [ OK ]
[root@A]# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@A]# chkconfig httpd off
[root@A]# chkconfig httpd on
[root@A]# chkconfig --level 235 httpd on
[root@A]# ntsysv
[root@A]# cat /boot/grub/menu.lst
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-128.el5.img
[root@A]# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> displaymem
EISA Memory BIOS Interface is present
Address Map BIOS Interface is present
Lower memory: 640K, Upper memory (to first chipset hole): 3072K
[Address Range Descriptor entries immediately follow (values are 64-bit)]
Usable RAM: Base Address: 0x0 X 4GB + 0x0,
Length: 0x0 X 4GB + 0xa0000 bytes
Reserved: Base Address: 0x0 X 4GB + 0xa0000,
Length: 0x0 X 4GB + 0x60000 bytes
Usable RAM: Base Address: 0x0 X 4GB + 0x100000,
Length: 0x0 X 4GB + 0x300000 bytes
grub> quit
[root@A]# cat /etc/lilo.conf
[root@A]# /sbin/lilo
[root@A]# cat /proc/cmdline
ro root=/dev/VolGroup00/LogVol00 rhgb quiet
[root@A]# uname -a
Linux sentos5.localdomain 2.6.18-128.el5 #1 SMP Wed Jan 21 10:44:23 EST 2009 i686 i686 i386 GNU/Linux
[root@A]# uname -r
2.6.18-128.el5
[root@A]# uname -m
i686
[root@A]# cat /proc/version
Linux version 2.6.18-128.el5 (mockbuild@builder16.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed Jan 21 10:44:23 EST 2009
[root@A]# head -4 /usr/src/linux/Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL =18
EXTRAVERSION = -128.el5
[root@A]# ls /boot/vmlinuz*
/boot/vmlinuz-2.6.18-128.el5
[root@A]# ls -ld /lib/modules/2.6.18-128.el5/kernel/*
drwxr-xr-x 3 root root 4096 羇 2010 /lib/modules/2.6.18-128.el5/kernel/arch
drwxr-xr-x 39 root root 4096 羇 2010 /lib/modules/2.6.18-128.el5/kernel/drivers
drwxr-xr-x 30 root root 4096 羇 2010 /lib/modules/2.6.18-128.el5/kernel/fs
drwxr-xr-x 2 root root 4096 羇 2010 /lib/modules/2.6.18-128.el5/kernel/kernel
drwxr-xr-x 4 root root 4096 羇 2010 /lib/modules/2.6.18-128.el5/kernel/lib
drwxr-xr-x 21 root root 4096 羇 2010 /lib/modules/2.6.18-128.el5/kernel/net
[root@A]# lsmod
Module Size Used by
nfsd 202097 17
exportfs 9665 1 nfsd
lockd 61257 2 nfsd
nfs_acl 7617 1 nfsd
[root@A]# cat /proc/modules
nfsd 202097 17 - Live 0xe0c3a000
exportfs 9665 1 nfsd, Live 0xe0b72000
lockd 61257 2 nfsd, Live 0xe0bf7000
nfs_acl 7617 1 nfsd, Live 0xe0b6f000
auth_rpcgss 43105 1 nfsd, Live 0xe0bd7000
[root@A]# modinfo ext3
filename: /lib/modules/2.6.18-128.el5/kernel/fs/ext3/ext3.ko
license: GPL
description: Second Extended Filesystem with journaling extensions
author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
[root@A]# modinfo -n ext3
/lib/modules/2.6.18-128.el5/kernel/fs/ext3/ext3.ko
[root@A]# modinfo -l ext3
GPL
[root@A]# modinfo -d ext3
Second Extended Filesystem with journaling extensions
[root@A]# modinfo -a ext3
Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
[root@A]# insmod /lib/modules/2.6.18-128.el5/kernel/fs/ext2/ext2.ko
[root@A]# modprobe -c
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
alias eth0 pcnet32
[root@A]# modprobe -lt fs
/lib/modules/2.6.18-128.el5/kernel/fs/autofs4/autofs4.ko
/lib/modules/2.6.18-128.el5/kernel/fs/cachefiles/cachefiles.ko
/lib/modules/2.6.18-128.el5/kernel/fs/cifs/cifs.ko
[root@A]# modprobe --show-depends ext3
insmod /lib/modules/2.6.18-128.el5/kernel/fs/jbd/jbd.ko
insmod /lib/modules/2.6.18-128.el5/kernel/fs/ext3/ext3.ko
[root@A]# ls /lib/modules/2.6.18-128.el5/modules.dep
/lib/modules/2.6.18-128.el5/modules.dep
[root@A]# cat /etc/modprobe.conf
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
alias eth0 pcnet32
[root@A]# ls -l /etc/modprobe.d/*
-rw-r--r-- 1 root root 810 羚 2009 /etc/modprobe.d/blacklist
-rw-r--r-- 1 root root 83 羃2 2009 /etc/modprobe.d/blacklist-firewire
-rw-r--r-- 1 root root 6111 羃1 2009 /etc/modprobe.d/modprobe.conf.dist
[root@A]# cat /etc/modprobe.d/modprobe.conf.dist
alias usb-uhci uhci-hcd
alias usb-ohci ohci-hcd
install scsi_hostadapter /bin/true
install usbmouse /sbin/modprobe --first-time --ignore-install usbmouse && { /sbin/modprobe hid; /bin/true; }
remove usbmouse { /sbin/modprobe -r hid; } ; /sbin/modprobe -r --first-time --ignore-remove usbmouse
remove nfsd { /bin/umount /proc/fs/nfsd > /dev/null 2>&1 || :; } ; /sbin/modprobe -r --first-time --ignore-remove nfsd
[root@A]# ls -ld /proc/sys/kernel/*
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/ctrl-alt-del
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/domainname
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/hostname
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/hotplug
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/modprobe
-r--r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/osrelease
-r--r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/ostype
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/sem
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/shmall
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/shmmax
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/shmmni
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/sysrq
-r--r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/tainted
-rw-r--r-- 1 root root 0 羌 17:26 /proc/sys/kernel/threads-max
[root@A]# ls -ld /proc/sys/fs/*
-rw-r--r-- 1 root root 0 羌 17:29 /proc/sys/fs/file-max
-r--r--r-- 1 root root 0 羌 17:29 /proc/sys/fs/file-nr
[root@A]# ls -ld /proc/sys/net/*
dr-xr-xr-x 6 root root 0 羌 17:30 /proc/sys/net/ipv4
dr-xr-xr-x 6 root root 0 羌 17:30 /proc/sys/net/ipv6
[root@A]# ls -ld /proc/sys/net/ipv4/*
-rw-r--r-- 1 root root 0 羌 17:31 /proc/sys/net/ipv4/ip_forward
-rw-r--r-- 1 root root 0 羌 17:31 /proc/sys/net/ipv4/icmp_echo_ignore_all
-rw-r--r-- 1 root root 0 羌 17:31 /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
[root@A]# cat /etc/sysctl.conf
net.ipv4.ip_forward = 0
[root@A]# cat /etc/rc.local
net.ipv4.ip_forward = 0
[root@A]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
[root@A]# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
[root@A]# sysctl -a
sunrpc.max_resvport = 1023
sunrpc.min_resvport = 665
sunrpc.tcp_slot_table_entries = 16
[root]# mail←未読メールを読む場合
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 5 messages 5 new
>N 1 root@reverie.example Fri Oct 15 23:42 19/819 "Anacron job 'cron.daily'"
N 2 root@reverie.example Tue Oct 19 22:30 56/1735 "LogWatch for reverie.example.com"
N 3 root@reverie.example Tue Oct 19 22:31 19/821 "Anacron job 'cron.daily'"
N 4 root@reverie.example Mon Nov 1 14:52 19/818 "Anacron job 'cron.daily'"
N 5 root@dgx.example.com Wed Nov 3 15:29 19/796 "Anacron job 'cron.daily'"
& t1←メールを選択
Message 1:
From root@reverie.example.com Fri Oct 15 23:42:19 2010
Date: Fri, 15 Oct 2010 23:42:18 +0900
From: root@reverie.example.com (Anacron)
To: root@reverie.example.com
Subject: Anacron job 'cron.daily'
/etc/cron.daily/tripwire-check:
**** Error: Tripwire database for reverie.example.com not found. ****
**** Run /etc/tripwire/twinstall.sh and/or tripwire --init. ****
[root]# ls -al mbox
-rw------- 1 root root 5044 11月 3 15:38 mbox
[root]# mail -f←既読メールを読む場合
[root]# mail -s test-mail reverie@example.com←メールを作成して送る
TEST MAIL.
.
Cc:
[root]# tail /var/log/maillog←メールのログ確認
Nov 3 15:43:11 reverie sendmail[1764]: oA36hBj5001764: from=root, size=55, class=0, nrcpts=1, msgid=<201011030643.oA36hBj5001764@reverie.example.com>, relay=root@localhost
Nov 3 15:43:11 reverie sendmail[1766]: oA36hB0K001766: from=<root@reverie.example.com>, size=346, class=0, nrcpts=1, msgid=<201011030643.oA36hBj5001764@reverie.example.com>, proto=ESMTP, daemon=Daemon0, relay=localhost.localdomain [127.0.0.1]
Nov 3 15:43:11 reverie sendmail[1764]: oA36hBj5001764: to=reverie@example.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30044, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (oA36hB0K001766 Message accepted for delivery)
Nov 3 15:43:11 reverie sendmail[1767]: oA36hB0K001766: to=<reverie@example.com>, ctladdr=<root@reverie.example.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=pmlocal, pri=30549, dsn=2.0.0, stat=Sent