Gentoo Linux Setup メモ1 (Logrotate, lm_sensors, sudo)

今日というわけではないですが、
新しいPCを作ったので、Gentoo Linuxをインストール中です。

メモメモ

順番も内容もてきとーです。。。

logrotate

ログファイルが肥大化しないように一定周期で分割するためのものです。

参考ページ
http://gentoo-wiki.com/HOWTO_Setup_Logrotate

cronが使われるのでデーモンじゃないです。

インストール

# emerge logrotate

/var/log/messages 向け

/var/log/messages {
daily
compress
rotate 7
sharedscripts
postrotate
/etc/init.d/syslog-ng reload > /dev/null 2>&1 || true
endscript
}

/var/log/emerge.log 向け

/var/log/emerge.log{
weekly
rotate 2
compress
create 0660 portage portage
}

sudo

ユーザを切り替えてコマンドを実行するコマンドです。
ようは、ユーザでrootコマンドを使えるようにするために使います。

僕の場合はコマンドの種類わけをして、それを組み合わせています。
以前(1年以上前)、この設定にしていたころはなぜかできませんでした。
今は出きるのでいいですが、、、

インストール

# emerge sudo

visudo

# visudo

# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification

# User alias specification
User_Alias ROOTLV = ktomoya

# Cmnd alias specification
Cmnd_Alias EMERGES = /usr/bin/emerge, /usr/sbin/emerge-webrsync, /usr/bin/ebuild
Cmnd_Alias TEXTEDITS = /usr/bin/vi, /usr/bin/vim, /usr/bin/nano, /usr/bin/less
Cmnd_Alias MOUNTS = /bin/mount, /bin/umount
Cmnd_Alias SYSUPDATES = /usr/sbin/env-update, /usr/sbin/etc-update, /usr/sbin/update_modules, /sbin/modules-update, /usr/sbin/update_usbids, /usr/sbin/update_pciids, /usr/bin/revdep-rebuild, /usr/sbin/prelink
Cmnd_Alias POWERS = /sbin/shutdown, /sbin/reboot
Cmnd_Alias FILECMD = /bin/cp, /bin/mv, /bin/rm , /bin/mkdir, /bin/ls, /bin/ln
Cmnd_Alias SYSEDITERS = /usr/sbin/visudo
Cmnd_Alias FILESYSTEMS = /sbin/mkfs.*
Cmnd_Alias INITD = /etc/init.d/*
# Defaults specification

# Reset environment by default
Defaults env_reset

# Uncomment to allow users in group wheel to export variables
# Defaults:%wheel !env_reset

# Allow users in group users to export specific variables
# Defaults:%users env_keep=TZ

# Allow specific user to bypass env_delete for TERMCAP
# Defaults:user env_delete-=TERMCAP

# Set default EDITOR to vi, and do not allow visudo to use EDITOR/VISUAL.
# Defaults editor=/usr/bin/vim, !env_editor

# Runas alias specification

# *** REMEMBER ***************************************************
# * GIVING SUDO ACCESS TO USERS ALLOWS THEM TO RUN THE SPECIFIED *
# * COMMANDS WITH ELEVATED PRIVILEGES. *
# * *
# * NEVER PERMIT UNTRUSTED USERS TO ACCESS SUDO. *
# ****************************************************************

# User privilege specification
root ALL=(ALL) ALL

# Uncomment to allow people in group wheel to run all commands
#%wheel ALL=(ALL) ALL

# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

# Users in group www are allowed to edit httpd.conf using sudoedit, or
# sudo -e, without a password.
# %www ALL=(ALL) NOPASSWD: sudoedit /etc/httpd.conf

# Samples
# %users ALL=/bin/mount /cdrom,/bin/umount /cdrom
# %users localhost=/sbin/shutdown -h now


# root settings
ROOTLV ALL = EMERGES, TEXTEDITS, MOUNTS, SYSUPDATES, POWERS, SYSEDITERS, FILECMD, FILESYSTEMS, INITD

lm_Sensors

マザーボードのセンサー等の情報を見るためのものです。

電圧やCPUの温度、FANの回転数等が見れます。

インストール

# emerge lm_sensors
# sensors-detect
# rc-update add lm_sensors default

実行結果

# sensors

w83627dhg-isa-0290
Adapter: ISA adapter
VCore: +1.08 V (min = +0.00 V, max = +1.74 V)
12V: +11.46 V (min = +3.80 V, max = +1.43 V) ALARM
AVCC: +3.25 V (min = +0.24 V, max = +1.41 V) ALARM
3VCC: +3.25 V (min = +3.26 V, max = +3.42 V) ALARM
in4: +1.66 V (min = +1.86 V, max = +0.33 V) ALARM
in5: +1.68 V (min = +1.54 V, max = +0.34 V) ALARM
in6: +5.30 V (min = +3.05 V, max = +3.17 V) ALARM
VSB: +3.25 V (min = +1.92 V, max = +2.54 V) ALARM
VBAT: +3.25 V (min = +2.62 V, max = +3.46 V)
Case Fan: 0 RPM (min = 175 RPM, div = 128) ALARM
CPU Fan: 1188 RPM (min = 1095 RPM, div = 8)
Aux Fan: 0 RPM (min = 878 RPM, div = 128) ALARM
fan5: 1622 RPM (min = 383 RPM, div = 32)
Sys Temp: +35°C (high = +15°C, hyst = +90°C) [thermistor]
CPU Temp: +32.0°C (high = +80.0°C, hyst = +75.0°C) [CPU diode ]
AUX Temp: -5.5°C (high = +80.0°C, hyst = +75.0°C) [thermistor]