個人的なメモ置き場ブログに書くほどのものでもないことを書きます

rootfsの大きさが小さすぎた。面倒なので最初からインストールをやりなおす。

インストール

インストール用USBメモリの作成

CDイメージのダウンロード
UNETbootinのダウンロード

無線LANドライバのダウンロード

http://sourceforge.jp/projects/sfnet_kanapi/downlo...
上記からダウンロードしてUSBメモリに入れておく

インストール手順

USBメモリを刺してF12キーを押す

Select a language ->Japanese
場所の選択->日本
キーボードの設定->日本語
ネットワークハードウェアの検出->リムーバブルメディアから見つからないファームウェアをロードしますか?->はい
インストールっプロセス中に使用する無線ネットワークを選択してください->家の無線LANのESSIDを指定
wlan0の無線ネットワークの種類->WPA/WPA0 PAK
wlan0のWPA/WPA2パスフレーズ ->キーを入力
ホスト名->適当な名前を入力
ドメイン名->cielo-ee.mydns.jp
rootのパスワード->適当なパスワード
ユーザアカウント->適当な名前
ユーザ名->適当な名前
新しいユーザのパスワード->適当なパスワード
ディスクのパーティショニング->ガイド
パーティショニング機構->/homeパーティションの分割 & LVM

インストールの完了->続ける

無線LANの設定

http://greenleaf.sakuraweb.com/index.php?WPA-PSK%E...
auto wlan0
iface wlan0 inet dhcp
        wpa-ssid SSID
        wpa-psk  PASS

sshdのインストール

#aptitude install sshd

sudo

http://www.ep.sci.hokudai.ac.jp/~epwww/dvlop/sudo....
# aptitude install sudo
# visudo
以下を加える
username   ALL=(ALL)   ALL

aptitude


コンソールの日本語が文字化けするのをなんとかする。

http://nomnel.net/blog/debian-enable-japanese/

1ページ目でそのままOK=>2ページ目で「なし」を選択

無線LANの設定2

アドレスの固定化

/etc/network/interfaces
auto wlan0
iface wlan0 inet static
        wpa-ssid ESSID
        wpa-psk PASS
        address 192.168.11.128
        netmask 255.255.255.0
        network 192.168.11.0
        gateway 192.168.11.1
#sudo /etc/init.d/networking restart

以下はアドレス192.168.11.128で固定となる。

ESSID等をinterfacesファイルに書かない


$ sudo aptitude install wpasupplicant  
$ sudo sh -c "wpa_passphrase ESSID PASS > /etc/wpa_supplicant/wpa_supplicant.conf"
$ sudo vi wpa_supplicant.conf 
できたファイル
    network={
        ssid="0123456789"
        #psk="hogehoge"
        psk=PASSSSS
    }
#psk="hogehoge"の部分を削除する
$ sudo vi /etc/network/interface
auto wlan0
iface wlan0 inet static
        wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
        address 192.168.11.128
        netmask 255.255.255.0
        network 192.168.11.0
        gateway 192.168.11.1
$ sudo /etc/init.d/networking restart
なぜかこの後再起動しないと正常に動かなかった。

バックライトをoff

$ sudo aptitude install vbetool
$ sudo vbetool dpms off #オフになる
$ suco vbetool dpms on  #オンになる

sshdの設定

$ cat id_rsa.pub >> ~/.ssh/authorized_keys

手元のcygwin
~/.ssh/config に以下を追加
Host 192.168.11.128
 User syu
 Hostname 192.168.11.128
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/id_rsa

$ sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.default
$ sudo vi /etc/ssh/sshd_config
PermitRootLogin no #ルートでのログインを禁止
PasswordAuthentication no #パスワードでのログインを禁止
PermitEmptyPasswords no #空パスワードを禁止
$ sudo /etc/init.d/networking restart

ユーザの追加

# useradd -D -b/home 
# useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/sh
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no
# useradd bot

実は -mオプションが必要だったらしい
http://osanay.hatenablog.com/entry/20110318/130046...
やり直し
Debian系のOSだと、adduserをつかったほうがいいらしい
# adduser bot
Adding user `bot' ...
Adding new group `bot' (1001) ...
Adding new user `bot' (1001) with group `bot' ...
Creating home directory `/home/bot' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for bot
Enter the new value, or press ENTER for the default
        Full Name []: 
        Room Number []: 
        Work Phone []: 
        Home Phone []: 
        Other []: 
Is the information correct? [Y/n] y
# su bot
$ cd ~
$ ls
$ pwd
/home/bot

cpan

# aptitude install make
# cpan
初期設定する。デフォルトでOK。
ためしにインストールしてみる。
# yes '' | cpan Net::POP3
OK

DDNSの設定

以下のperlスクリプトを書く。
#!/usr/bin/perl 
use Net::POP3;
use strict;
use warnins;

my %AC = (
	'USERNAME' => 'PASSWORD'
);

my $pop_mydns;
my $mail_list;

foreach(keys %AC){
    $pop_mydns = Net::POP3->new('mail.MyDNS.JP') || die "connection failed.\n";
    $pop_mydns->login($_,$AC{$_}) || die "Authentication failed.\n";
    $mail_list = $pop_mydns->list;
    $pop_mydns->quit;
}

exit;

$ chmod u+x mydns.pl
$ crontab -e
以下を記入
15 * * * * /home/bot/mydns/mydns.pl

git

$ aptitude install git
後は以下の通り
http://blog.livedoor.jp/cielo_cielo/archives/65792...

apache2

インストール


$ sudo aptitude install apache2
$ sudo /etc/init.d/apache2 start
ipアドレスにブラウザで表示させ、"It Works!"と表示されればOK

ディレクトリ一覧を表示させない/OSやApacheのバージョンを表示させない

$ sudo vi /etc/apache2/sites-available/default
$ $ diff    /etc/apache2/sites-available/default /etc/apache2/sites-available/default.default
3d2
<       ServerSignature Off
11c10
<               Options -Indexes FollowSymLinks MultiViews
---
>               Options Indexes FollowSymLinks MultiViews

/etc/apache2/sites-available/default
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerSignature Off

(中略)
        <Directory /var/www/>
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

(中略)

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

ユーザディレクトリの設定

http://httpd.apache.org/docs/2.2/ja/howto/public_h...
$ sudo a2enmod userdir
Enabling module userdir.
To activate the new configuration, you need to run:
  service apache2 restart
$ sudo /etc/init.d/apache2 restart
ディレクトリ一覧を表示させない
$ sudo cp /etc/apache2/mods-available/userdir.conf /etc/apache2/mods-available/userdir.conf.default
$ sudo vi /etc/apache2/mods-available/userdir.conf
$ diff /etc/apache2/mods-available/userdir.conf /etc/apache2/mods-available/userdir.conf.defau
lt
7c7
<                 Options MultiViews -Indexes SymLinksIfOwnerMatch IncludesNoExec
---
>                 Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
ホームディレクトリ以下にpublic_htmlというディレクトリを作って、その中にindex.htmlを置くと、
http://192.168.1.1/~username/index.html
でアクセスできる。

CGI,SSIの許可

/etc/apache2/mods-enabled/userdir.conf
  1. Includes ExecCGIを追加

<IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root

        <Directory /home/*/public_html>
                AllowOverride FileInfo AuthConfig Limit Indexes
                Options MultiViews -Indexes SymLinksIfOwnerMatch IncludesNoExec +Includes ExecCGI
                <Limit GET POST OPTIONS>
                        Order allow,deny
                        Allow from all
                </Limit>
                <LimitExcept GET POST OPTIONS>
                        Order deny,allow
                        Deny from all
                </LimitExcept>
        </Directory>
</IfModule>
/etc/apache2/mods-available/mime.conf
$ sudo cp /etc/apache2/mods-available/mime.conf /etc/apache2/mods-available/mime.conf.default
$ sudo vi /etc/apache2/mods-available/mime.conf
$ diff cp /etc/apache2/mods-available/mime.conf /etc/apache2/mods-available/mime.conf.default
$ diff /etc/apache2/mods-available/mime.conf /etc/apache2/mods-available/mime.conf.default
219c219
< AddHandler cgi-script .cgi
---
> #AddHandler cgi-script .cgi
モジュールを有効にする
$sudo a2enmod  cgi
$sudo a2enmod include
$sudo /etc/init.d/apache2 restart
テスト
$ mkdir cgi-bin
$ chmod 755 cgi-bin
$ cd cgi-bin
テスト用のスクリプト
File Edit Options Buffers Tools Help
#!/usr/bin/perl
print "Content-type: text/html;\n\n";
print "<html><body><h1>test cgi</h1></body></html>\n";


exit;


普通にperlのスクリプトとして動くかどうか確認
$ chmod 755 test.cgi
$ ./test.cgi
Content-type: text/html;

<html><body><h1>test cgi</h1></body></html>

ブラウザで/cgi-bin/test.cgiにアクセスし、表示されればOK

mod_proxyを使う

インストール

$ sudo aptitude install samba

確認

$ sudo /etc/init.d/samba start   
同じLANにつながっているWindowsマシンから、コンピュータが見えていればOK

設定

$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.default                                                                                     
$ sudoedit /etc/samba/smb.conf                                                                                                                
$ diff /etc/samba/smb.conf /etc/samba/smb.conf.default                                                                                        
102c102
<    security = user
---
> #   security = user
250,251c250
< #   read only = yes
<     writable = yes
---
>    read only = yes
$ sudo /etc/init.d/samba restart

ユーザの追加

http://irobot.csse.muroran-it.ac.jp/index.php?%A5%...
同名のLinuxのユーザをあらかじめ作ってから、
$ sudo smbpasswd -a USERNAME

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

フリーエリア

メニューバーA

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

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