エントリー

サーバソフトウェアのセットアップ

全部まとめて置きたいので既に記載した分も記録

セットアップは玄箱セットアップ記録ATOM D2700DC サーバ構築記録を参考にして設定

最初に起動した後、rootのパスワード設定
cubie@Cubian:~$ sudo passwd root

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for cubie:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
cubie@Cubian:~$
拙者(管理者)が利用しているUIDを登録

(略)

この後、sshで別PCから設定するため

ipconfigでMAC addressを参照してDHCPでIPを固定
sshのポートが36000になっていて不便なので22に戻す
# cd /etc/ssh
# cat sshd_config
# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
#Port 36000
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
(以下略)

ここからsshで操作

とりあえずタイムゾーンを日本に
# echo $TZ

# export TZ=JST-9
# date
Sun Apr 26 19:43:26 JST 2015
システムのタイムゾーンがEtc/UTCになっているのでJSTに設定
# cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
# vi /etc/timezone

(変更)
Asia/Tokyo

#
日本語環境化(追加)
# apt-get install task-japanese

・・・

# vi /etc/locale.gen

270行目のコメントを削除
ja_JP.UTF-8 UTF-8

# locale-gen
Generating locales (this might take a while)...
  en_US.UTF-8... done
  ja_JP.UTF-8... done
Generation complete.
# update-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
# source /etc/default/locale

(確認)

# echo $LANG
ja_JP.UTF-8
# date
2015年  4月 26日 日曜日 20:22:32 JST
#
ファイルシステム構成
# free
             total       used       free     shared    buffers     cached
Mem:        828096     219256     608840          0       9952     164480
-/+ buffers/cache:      44824     783272
Swap:            0          0          0
# ls -l /dev/sd*
brw-rw---T 1 root disk 8, 0  4月 26 11:43 /dev/sda
brw-rw---T 1 root disk 8, 1  4月 26 11:43 /dev/sda1
brw-rw---T 1 root disk 8, 2  4月 26 11:43 /dev/sda2
brw-rw---T 1 root disk 8, 3  4月 26 11:43 /dev/sda3
# mkswap /dev/sda2
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=76e4d415-b6f2-473c-a230-fb22e40f4482
# swapon /devb/sda2
# free
             total       used       free     shared    buffers     cached
Mem:        828096     220272     607824          0       9972     164504
-/+ buffers/cache:      45796     782300
Swap:      2097148          0    2097148
# cat /etc/fstab
#<file system>  <mount point>   <type>  <options>       <dump>  <pass>
/dev/mmcblk0p1  /               ext4    defaults        0       1
tmpfs   /tmp    tmpfs   defaults        0       0
tmpfs   /var/tmp        tmpfs   defaults        0       0
# vi /etc/fstab

(編集)

# cat /etc/fstab
#<file system>  <mount point>   <type>  <options>       <dump>  <pass>
/dev/sda1       /               ext4    defaults        0       1
/dev/sda2       none            swap    sw              0       0
/dev/sda3       /srv            ext4    defaults        0       2
tmpfs           /tmp            tmpfs   defaults        0       0
tmpfs           /var/tmp        tmpfs   defaults        0       0
#
パッケージアップグレード

ソフトウェア情報リストの更新(初期ではapt-getみたい → aptitudeコマンドではないってこと)

# apt-get update

(略)

# apt-get upgrade
パッケージリストを読み込んでいます... 0%パッケージリストを読み込んでいます... 100%パッケージリストを
読み込んでいます... 完了
依存関係ツリーを作成しています... 0%          依存関係ツリーを作成しています... 0%依存関係ツリーを作
成しています... 50%依存関係ツリーを作成しています... 50%依存関係ツリーを作成しています... 92%依存関係
ツリーを作成しています      
状態情報を読み取っています... 0%状態情報を読み取っています... 0%状態情報を読み取っています... 完了
以下のパッケージはアップグレードされます:
  ajenti apt apt-utils at base-files bash bind9-host ca-certificates cpio dbus
  debian-archive-keyring dmsetup dpkg e2fslibs e2fsprogs exim4-base
  exim4-config exim4-daemon-light file gnupg gpgv heirloom-mailx initscripts
  krb5-locales libapt-inst1.5 libapt-pkg4.12 libbind9-80 libc-bin libc6
  libcomerr2 libdbus-1-3 libdevmapper1.02.1 libdns88 libevent-2.0-5 libexpat1
  libfreetype6 libgcrypt11 libgnutls26 libgssapi-krb5-2 libisc84 libisccc80
  libisccfg82 libjpeg8 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0
  libldap-2.4-2 liblwres80 libmagic1 libss2 libssl1.0.0 libsystemd-login0
  libtasn1-3 libx11-6 libx11-data libxfont1 libxml2 locales mime-support
  multiarch-support ntpdate openssh-client openssh-server openssl perl
  perl-base perl-modules python python-catcher python-exconsole
  python-gevent-socketio python-imaging python-lxml python-minimal
  python-reconfigure python-requests python2.7 python2.7-minimal rsyslog ssh
  sudo sysv-rc sysvinit sysvinit-utils tzdata udevil unzip wget wpasupplicant
アップグレード: 90 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。
54.3 MB のアーカイブを取得する必要があります。
この操作後に追加で 949 kB のディスク容量が消費されます。
続行しますか [Y/n]? y

(略)

# shutdown -r now

一旦、リスタート

Linux Cubian 3.4.75-sun7i #35 SMP PREEMPT Sat Feb 8 02:10:31 CST 2014 armv7l

      ______  __    __  .______    __       ___      .__   __.
     /      ||  |  |  | |   _  \  |  |     /   \     |  \ |  |
    |  ,----'|  |  |  | |  |_)  | |  |    /  ^  \    |   \|  |
    |  |     |  |  |  | |   _  <  |  |   /  /_\  \   |  . `  |
    |  `----.|  `--'  | |  |_)  | |  |  /  _____  \  |  |\   |
     \______| \______/  |______/  |__| /__/     \__\ |__| \__|

                        http://cubian.org

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login:
Sun Apr 26 11:44:02 2015 from 192.168.24.54
$ df
ファイルシス   1K-ブロック   使用    使用可 使用% マウント位置
rootfs            16513960 978784  14696316    7% /
/dev/root         16513960 978784  14696316    7% /
devtmpfs            413924      0    413924    0% /dev
tmpfs                82812    164     82648    1% /run
tmpfs                 5120      4      5116    1% /run/lock
tmpfs               585040      0    585040    0% /run/shm
/dev/sda3        942855404 204512 894756536    1% /mnt
tmpfs               414048      0    414048    0% /tmp
tmpfs               414048      0    414048    0% /var/tmp
$ free
             total       used       free     shared    buffers     cached
Mem:        828096      89784     738312          0       9064      34156
-/+ buffers/cache:      46564     781532
Swap:      2097148          0    2097148
$

aptitudeコマンドが使えるようになっている

カーネル再構築は・・・準備のみに留める
# aptitude install linux-headers-3.4.79-sun7i
# aptitude install linux-source-3.4.79-sun7i

# aptitude install p7zip-full

# cd /usr/src
# 7z x -so linux-source-3.4.79-sun7i.tar.7z | tar xf - -C .

# cp ../linux-headers-3.4.79-sun7i/.config .
# cp ../linux-headers-3.4.79-sun7i/Module.symvers .

(未実施)
SAMBA
# aptitude install samba
# vi /etc/samba/smb.conf

(略)

# service samba restart
[....] Stopping Samba daemons: nmbd smbd[ ok .
[....] Starting Samba daemons: nmbd smbd[ ok .
#
HTTPD

高速かつ軽量で高機能なWebサーバという振れ込みで人気の「nginx」(エンジンエックス)にも興味があるが、ひとまず慣れ親しんだapache2を導入

# aptitude install apache2

(略)
php5

玄箱セットアップのとおり、バージョン違いにより設定項目がなくなっている部分があった

eAccelerator

HP(http://eaccelerator.net/)ができていたので最新版(1.0になっていた)をダウンロードして、玄箱セットアップのとおり作成して設置した

MySQL

玄箱セットアップのとおり設定したが起動しない

[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!

/etc/mysql/my.cnfの変更が問題?ログも出力されないので困った

/var/log/debugというファイルになんか関係しそうなログが出ていたが、

# tail debug
Apr 27 14:07:41 Cubian /etc/init.d/mysql[7829]: 0 processes alive and '/usr/bin/mysqladmin --defaults
-file=/etc/mysql/debian.cnf ping' resulted in
Apr 27 14:07:41 Cubian /etc/init.d/mysql[7829]: #007/usr/bin/mysqladmin: connect to server at 'localh
ost' failed
Apr 27 14:07:41 Cubian /etc/init.d/mysql[7829]: error: 'Can't connect to local MySQL server through s
ocket '/var/run/mysqld/mysqld.sock' (2)'
Apr 27 14:07:41 Cubian /etc/init.d/mysql[7829]: Check that mysqld is running and that the socket: '/v
ar/run/mysqld/mysqld.sock' exists!
Apr 27 14:07:41 Cubian /etc/init.d/mysql[7829]:

時間はEtc/UTCになっている、またログから直接の原因が判らない、/etc/mysql/debian.cnfが怪しそうでググってみる・・・判らなかった

(後に判明)→ my.cnfを修正(ミス?)したせいだった

MySQLの文字コードのデフォルトをutf8にするにはmy.cnfを以下のように編集する(赤字部が間違っていた)

[client]
default-character-set = utf8

[mysqld]
skip-character-set-client-handshake
character-set-server = utf8
collation-server = utf8_general_ci

[mysqldump]
default-character-set = utf8

[mysql]
default-character-set = utf8
sudoのユーザ登録

suduを使えるユーザは事前に登録が必要(になっていた)

$ sudo aptitude update
[sudo] password for hoge:
hogeは sudoers ファイル内にありません。この事象は記録・報告されます。
$

# cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

sudoグループにいればsudoが使えるようなのでusermodで登録

# usermod -G sudo hoge
# grep hoge /etc/group
sudo:x:27:hoge

再ログインしないと不可

gettyが多いので消す(コンソールだけあれば良い)
# ps -ef
・・・
root      3347     1  0 13:08 tty1     00:00:00 /sbin/getty 38400 tty1
root      3348     1  0 13:08 tty2     00:00:00 /sbin/getty 38400 tty2
root      3349     1  0 13:08 tty3     00:00:00 /sbin/getty 38400 tty3
root      3350     1  0 13:08 tty4     00:00:00 /sbin/getty 38400 tty4
root      3351     1  0 13:08 tty5     00:00:00 /sbin/getty 38400 tty5
root      3352     1  0 13:08 tty6     00:00:00 /sbin/getty 38400 tty6
・・・
# vi /etc/inittab

(編集)必要ないので全部コメントアウト

#1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6

おそらく以下は必要ない

# vi /etc/default/console-setup

(編集)

#ACTIVE_CONSOLES="/dev/tty[1-6]"

#
不必要なサービスを停止(自動起動しない)

atdはatコマンドを使わないのであれば必要ない。

# update-rc.d -f atd remove
update-rc.d: using dependency based boot sequencing
#

Debian 6.0から「update-rc.d」ではなく「insserv」を使う作法に変わったのだった

# insserv -h
Usage: insserv [<options>] [init_script|init_directory]
Available options:
  -h, --help       This help.
  -r, --remove     Remove the listed scripts from all runlevels.
  -f, --force      Ignore if a required service is missed.
  -v, --verbose    Provide information on what is being done.
  -p <path>, --path <path>  Path to replace /etc/init.d.
  -o <path>, --override <path> Path to replace /etc/insserv/overrides.
  -c <config>, --config <config>  Path to config file.
  -n, --dryrun     Do not change the system, only talk about it.
  -s, --showall    Output runlevel and sequence information.
  -d, --default    Use default runlevels a defined in the scripts
#

 

# insserv -r atd
# insserv -r avahi-daemon

このコマンド何らメッセージ出力がないので不安である

cpufreq-info

何とクロック調整可能(サーバで使うべきか?)

hotsanic

温度センサのためのパッケージをセットアップしてみると

hddtemp: OK

lm-sensors: NG

CPU温度を監視したかったのに何故・・・ググってみるとCPU温度は取得できないとのコメントがあったので悲しいことに断念(将来カーネル再構築時に考えよう)

rcの登録

# cp /opt/HotSaNIC/rrdgraph /etc/init.d
# insserv -d rrdgraph
DNS(bind9)
# aptitude install bind9 dnsutils dns-browse

(略)
ddclient

玄箱にセットアップしたものを全部もってきて上書き

# aptitude install ddclient

(上書き)
問題発生

再起動後、ボード上の青LEDが点滅状態となる

「青のLEDはネットワーク状態を表示します。このLEDは1秒間隔で点滅する場合は、システムはネットワークに接続されていない状態です。システムがネットワークに接続完了後、このLEDは消灯します。」

とあるが、ネットワークは問題なく接続されている

LEDに関してググってみる(http://linux-sunxi.org/Cubieboard/Programming/StatusLEDs)

rcのどこかでOFFしてるのではないかと思ったが調べるのが面倒なんで強制的にOFFした

# vi /etc/rc.local

# 起動時にLED(緑・青)をOFFにする
echo 0 > /sys/class/leds/green:ph20:led1/brightness
echo 0 > /sys/class/leds/blue:ph21:led2/brightness
Cubian update
It's a good idea to keep the kernel and drivers, firmwares to the latest version.

$ sudo apt-get install cubian-update
$ sudo cubian-update

というのがあったので実行したら

これが・・・

# aptitude install cubian-update
以下の新規パッケージがインストールされます:
  cubian-update
更新: 0 個、新規インストール: 1 個、削除: 0 個、保留: 0 個。
8,038  バイトのアーカイブを取得する必要があります。展開後に 0  バイトのディスク 領域が新たに消費されます。
取得: 1 http://packages.cubian.org/ wheezy/main cubian-update all 1.3-7 [8,038 B]
Fetched 8,038 B in 1秒 (7,806 B/s)
以前に未選択のパッケージ cubian-update を選択しています。
(データベースを読み込んでいます ... 現在 49718 個のファイルとディレクトリがイン ストールされています。)
(.../cubian-update_1.3-7_all.deb から) cubian-update を展開しています...
cubian-update (1.3-7) を設定しています ...

# cubian-update
*** Performing self-update
*** Cubian updater v1.3.6 http://cubian.org
*** Downloading Firmware/Updates (this may take a while)
*** Updating firmware
*** Updating kernel
*** Updating modules
*** Depmod 3.4.79-sun7i
*** Updating fs
*** Checking updates from server
*** Your firmware is up to date
#

終了まで随分と掛かり3時間も消費した

システムを安定化する(http://cubieboard.jp/archives/771)というのがあり、関係ないだろうと思っていたが、観るとCPU温度が表示されている

この安定化はシステムのアップデートを行ったので実行されているはずだが、実は/bootはSDカードにあるので対象となる肝心な部分が変更されてなかった

自動化対策は後に行うとして今回は手動で対応

cpuburn-sunxi(CPUが負荷が高い場合にフリーズするかどうかをチェック)というテストプログラム内に、

cat sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input

があり1つではあるがCPU温度を取得している(temp2というのは無かった)

hotsanicのセンサに追加してCPU温度取得できるようにした

MySQLの外部接続(ローカル)に一部問題発生

MySQLをインストールした別PCのDebianからの接続は問題ないのだがWindowsから接続異常となる(未決)

運用

5/1未明から運用開始(一部のソフトは玄箱で運用)

(追加:5/12)

昔のcgiプログラムが動作しないことに気付く(エラー番号500)

解決:/usr/local/bin/perl が無かった

ページ移動

コメント

  • コメントはまだありません。

コメント登録

  • コメントを入力してください。
登録フォーム
名前
メールアドレス
URL
コメント
閲覧制限
投稿キー(スパム対策に、投稿キー を半角で入力してください。)

ユーティリティ

検索

エントリー検索フォーム
キーワード

過去ログ

Feed