13
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Debian設定メモ

Last updated at Posted at 2014-03-12

諸々の事情により、Debian 6.0.7。

バージョン確認

debian:~# cat /etc/debian_version
6.0.7

debian:~# uname -a
Linux webclass-temp 2.6.32-5-amd64 #1 SMP Fri Feb 15 16:59:37 UTC 2013 x86_64 GNU/Linux

IFの入れ替え

参考: debianでeth0とeth1のNICを反転させる。
/etc/udev/rules.d/70-persistent-net.rulesを編集。

/etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x1096 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="01:23:45:67:89:10", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x1096 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="01:23:45:67:89:11", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

こいつの‘‘NAME=‘‘のところを変更。
再起動で反映。

IPアドレス

/etc/network/interfacesを編集。

/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
  address 192.168.1.11
  netmask 255.255.255.0
  gateway 192.168.1.254

# The secondery network interface
allow-hotplug eth1
iface eth1 inet dhcp

ifdown eth0````ifup eth0で反映。

apt-getとかaptitudeでProxyつかう

/etc/apt/apt.confを編集。(初期状態では存在しなかった。)

/etc/apt/apt.conf
Acquire::ftp::proxy "ftp://proxy.hoge.fuga.com:3128";
Acquire::http::proxy "http://proxy.hoge.fuga.com:3128";
Acquire::https::proxy "https://proxy.hoge.fuga.com:3128";

wgetでProxyつかう

/etc/wgetrcを編集。

/etc/wgetrc
# You can set the default proxies for Wget to use for http, https, and ftp.
# They will override the value in the environment.
https_proxy = https://proxy.hoge.fuga.com:3128/"
http_proxy = http://proxy.hoge.fuga.com:3128/"
ftp_proxy = ftp://proxy.hoge.fuga.com:3128/"

一番後ろの/のつけ忘れに注意。
忘れていると、「bad port」って怒られる。

サービスを止める

update-rc.dを使うとupdate-rc.d: using dependency based boot sequencingと怒られる。
代わりにinsservコマンドを使う。

32ビット版をインストールしたのに64ビットカーネルが入っている

64ビット対応のIAサーバーに、32ビット版DVDからインストール。

debian:~# uname -m
x86_64

なんでだ?

AMD64 移植版#i386 用の最小限の AMD64 動作対応

公式の i386 ディストリビューションにも、実際には最小限の AMD64 対応が含まれて おり、64 ビットカーネル、64 ビットバイナリを作成可能なツールチェイン、サードパーティ製の amd64 バイナリをネイティブの共有ライブラリで動作させるための amd64-libs パッケージ で構成されています。

そういうものらしいです。

時計が9時間ずれる

debian:~# date
Mon Mar 31 18:28:27 JST 2014

実際の時間は9時28分。時計が9時間進んでる。

debian:~# hwclock --show
Mon 31 Mar 2014 09:29:52 AM JST  -0.359495 seconds

CMOSの時間はちゃんと合ってる。

Debianのドキュメントによると、こんな設定があるらしい。

/etc/default/rcS ファイルにある設定で、システムがハードウェアの時計を UTC として解釈するか、現地時間として解釈するかを決定します。

hwclockで思いっきりJSTって認識してるのに、それでもUTCにしてくるのはこいつのせいか!
/etc/default/rcSを変更すればOK。

TMPTIME=0
SULOGIN=no
DELAYLOGIN=no
UTC=no
VERBOSE=no
FSCKFIX=no
RAMRUN=no
RAMLOCK=no

UTCをnoに変更。

debian:~# hwclock --hctosys --localtime
debian:~# date
Mon Mar 31 09:32:49 JST 2014

さらに、システムクロックを手で修正。
hwclock --hctosysで、システムクロックをハードウェアクロック(=CMOS時間)に合わせる。

あとは、再起動したときにちゃんと設定が効いてるか確認。

エディタを変更

Debianではデフォルトのエディタがnanoになっていて、crontab -eとかしたときに使い方が分からなくて困る。

コマンド叩いてVimに変更してあげる。

# update-alternatives --config editor
There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    10        manual mode

Press enter to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode.

crontabのログ

Debian 6.0 (squeeze) での、cronのログ有効化

デフォルトではcronのログが出なくなっている。
/etc/rsyslog.confを編集して、cronのログ出力部分がコメントアウトされているのを解除。

cronを再起動。

# /etc/init.d/cron restart
Restarting periodic command scheduler: cron.
13
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?