コンピュータ関連の操作メモ、トラブル記録。

Linuxシステム設定

マシン起動時のアプリケーション自動起動

ルート権限で/etc/rc.d/init.dに起動用スクリプトを作成する。
postgresqlならば、/etc/rc.d/init.d/postgresとしておく。
内容は、
============ここから========================
#!/bin/sh
#
# postgres - This script is used to start/stop
# the postgreSQL listener process.
#
# Usage
#
# You can use this script manually, and/or you
# can install this script into the runlevel system
# by running "sh postgres.init.sh install"
#
# Credits
#
# Thomas Lockhart
# modified from other startup files in the
# RedHat Linux distribution
#
# Clark Evans
# cleaned up, added comments, etc.
#
# modified for PostgreSQL book written by Tatsuo Ishii
#
# RedHat Stuff
#
# chkconfig: 345 85 15
# description: Starts and stops the PostgreSQL backend daemon\
# that handles all database requests.
# processname: postmaster
#
# Config Variables
#
PGACCOUNT="postgres"
#
# The non-root user account which will be used to run the
# PostgreSQL executeable. For this script to work, the
# shell for this account must be SH/BASH.
#
PGDATA="/usr/local/pgsql/data"
POSTMASTER="/usr/local/pgsql/bin/postmaster"
PG_CTL="/usr/local/pgsql/bin/pg_ctl"
#
# The executable program which is to be run, in this case
# it is the listener, which waits for requests on the port
# specified during configuration.
#
# Source function library.
. /etc/rc.d/init.d/functions

#
# See how we were called.
#
case "$1" in
 start)
  echo -n "Starting postgres: "
  su - $PGACCOUNT -c "$POSTMASTER -D $PGDATA"
  echo
  touch /var/lock/subsys/postgres
  ;;
 
 stop)
  echo -n "Stopping postgres: "
  $PG_CTL -m f -D $PGDATA stop
  echo
  rm -f /var/lock/subsys/postgres
  ;;
 *)
 echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0

--------ここまで------------------- 作成した起動用スクリプトのパーミッションを755に変更。
ex. # chmod 755 postgres

chkconfigコマンドで起動スクリプトを追加。
ex. # chkconfig -add postgres

この方法で追加した場合、RedhatではGUIメニューでの有効/無効のチェックはできない。
chkconfigコマンドで行う。

リモートでXアプリケーションが動作しないときの対処

CentOS 4.xの場合

/etc/X11/gdm/gdm.confを編集する。

#DisallowTCP=true
と書かれている行(CentOS4.5では190行付近)を
DisallowTCP=false
に変更する。

CentOS 5.xの場合

/etc/gdm/custom.confを編集する。
元々は、ほとんど何も記述されていないファイルなので、以下の内容を追記する。
Xをリモートで使うだけならば、[secutity]の項を追加すればOK。
他のマシンからxdmcpでログイン(Xのログイン画面が表示される)する場合には、[xdmcp]の項も追加し、177番ポートを開ける。

[security]
DisallowTCP=false

[xdmcp]
Enable=true
Port=177

設定ファイル変更後の取り扱い

それぞれの設定ファイル変更後にXを再起動すれば、環境変数DISPLAYで設定したディスプレイ上でXアプリケーションが動作するようになる。

念のため、ps コマンドで Xの引数に -nolisten tcp が付いていないこと確認する。

NVIDIA Quadro FX-4500使用時の環境設定(/etc/X11/xorg.conf)

GUIで設定するコマンドは nvidia-settings (当然、ドライバをインストールしないと動作しない)
下記の設定で2つのモニターを1画面として扱うことができ、VoxelGeoのピッキングも問題なく動作する。

======== /etc/X11/xorg.conf の内容 ここから =======================
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 1.0 (buildmeister@builder26) Mon Feb 26 23:38:28 PST 2007

Section "ServerLayout"
  Identifier "Layout0"
  Screen 0 "Screen0" 0 0
  InputDevice "Keyboard0" "CoreKeyboard"
  InputDevice "Mouse0" "CorePointer"
EndSection

Section "Files"
  RgbPath "/usr/X11R6/lib/X11/rgb"
  FontPath "unix/:7100"
EndSection

Section "Module"
  Load "dbe"
  Load "extmod"
  Load "type1"
  Load "freetype"
  Load "glx"
EndSection

Section "ServerFlags"
  Option "Xinerama" "0"
EndSection

Section "InputDevice"
  # generated from data in "/etc/sysconfig/mouse"
  Identifier "Mouse0"
  Driver "mouse"
  Option "Protocol" "IMPS/2"
  Option "Device" "/dev/input/mice"
  Option "Emulate3Buttons" "no"
  Option "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
  # generated from data in "/etc/sysconfig/keyboard"
  Identifier "Keyboard0"
  Driver "kbd"
  Option "XkbLayout" "jp"
  Option "XkbModel" "jp106"
EndSection

Section "Monitor"
  # HorizSync source: edid, VertRefresh source: edid
  Identifier "Monitor0"
  VendorName "Unknown"
  ModelName "IBM T120"
  HorizSync 30.0 - 83.0
  VertRefresh 56.0 - 85.0
  Option "DPMS"
EndSection

Section "Device"
  Identifier "Videocard0"
  Driver "nvidia"
  VendorName "NVIDIA Corporation"
  BoardName "Quadro FX 4500"
EndSection

Section "Screen"
  Identifier "Screen0"
  Device "Videocard0"
  Monitor "Monitor0"
  DefaultDepth 24
  Option "TwinView" "1"
  Option "metamodes" "DFP-0: nvidia-auto-select +0+0, DFP-1: nvidia-auto-select +1600+0; DFP-0: 800x600 +0+0, DFP-1: NULL; DFP-0: 640x480 +0+0, DFP-1: NULL"
  Option "Overlay"
  SubSection "Display"
    Depth 24
    Modes "1600x1200" "1280x1024" "1024x768" "800x600" "640x480"
  EndSubSection
EndSection

======== /etc/X11/xorg.conf の内容 ここまで =======================

デバイス関連

CPU情報の調べ方

/proc/cpuinfo ファイルを開く。~

PCIバスのデバイスの調べ方

lspci [Enter]~
  • オプション~
~-v : 詳細情報の表示。~
~-s : 引数に指定したバス、スロット、機能のデバイス情報のみ表示。~

liloブートローダ

設定ファイル : /etc/lilo.conf~
設定更新後は、/sbin/lilo を実行し、liloをインストールし直す。~

GRUBブートローダ

設定ファイル : /boot/grub/grub.conf~

SCSI機器管理

新規にディスク、テープなどのSCSI機器を増設する際には、下記の手順で処理する。~
(1) マシン本体、既接続の外部機器の電源を切る。~
(2) 既接続のSCSI機器のSCSI IDを確認し、新規接続のSCSI IDを重複がないように設定する。~
(3) SCSIコネクタにケーブルを接続する。~
(4) マシン本体の電源を入れる。通常は起動時に新規デバイスのチェックを自動的に行うので、特に変わったことをする必要はない。ただし、SCSI BIOSで認識されているかどうかは確認すること。~
(5) OS起動後、テープ機器であれば、/dev以下にデバイスファイルが作成されているかどうかを確認。テープを入れて、mt -f /dev/st[n] statと入力し、OS上で認識されているかどうかを確認する。~
Linuxでは/dev/st[n]が巻き戻しありのテープデバイス、/dev/nst[n]が巻き戻しなしのテープデバイスとなる。~
(6) OS起動後、ディスクであれば、フォーマット、ファイルシステムの構築を行わなければならない。~
(6-1) フォーマット~
fdiskコマンドで行う。fdiskコマンドはヘルプがあり、簡単に使い方が分かる。主に使用するのは、パーティションの削除、作成、ラベル書き込み、設定したパーティション情報の保存などである。~
通常LinuxのディスクデバイスはSCSI機器ならば、/dev/sd[a-z], IDE機器なら/dev/hd[a-z]となる。
デバイス番号がは、マウント時に必要になる情報なので、メモしておくことが望ましい。~
(6-2) ファイルシステムの作成
fdiskコマンドでフォーマットが済んだら、mkfsコマンドでファイルシステムを作成する。~
使い方は、mkfs -t ext3 /dev/sda[n](最後の/以下はデバイス番号)となる。~
~-tオプションは作成されるファイルシステムのタイプで、この例ではext3形式でファイルシステムを作成する。通常はext3で問題ないと思われる。詳細なオプションは、ヘルプを参照のこと。~
(7) マウント
ファイルシステムの作成が済んだら、OSからrootでマウントポイントを作成し、マウントすれば、ストレージとして利用可能になる。~

ファイル管理

ddコマンド

Wiki内検索

Menu

ここは自由に編集できるエリアです。

管理人/副管理人のみ編集できます