Tips Archive
[Linux]文字化け等で削除できなくなったファイルの削除の仕方[TIPS]
- i-node番号を調べる
$ ls -li
- 名前を読める名前に変更する
$ find . -inum 99999 -ok mv '{}' hoge.txt \;変更してよければ”y”で続行。
99999はi-node番号。
文字化けしたファイルをhoge.txtへ変更する。 - 削除する
$ rm hoge.txt
以上でちゅ。
- Comments: 0
- Trackbacks: 0
[Linux]Repair filesystem中にReadOnlyモードになっちゃったら。[TIPS]
# mount -o rw,remount /
でファイルへ書き込めるようになる。
新しく買ったHDをサーバーへ追加して、LABEL付けせずに/etc/fstab/へLABEL表記しちゃった。テヘ
- Comments: 1
- Trackbacks: 0
[Ubuntu]Ubuntu8.10へDropboxをインストールしたよ。真似したんですけどね。[Dropbox]
よくDropboxって文字をweb上では見てたんですけど、今まで使ってなかったんですよね。
おれ最前線ねっとにssh-fuseで繋げて必要なファイルをバックアップしたりリストアしたりしてました。
とまぁそれで何も不自由してなかったんですけど、なんか他の人が快適すぎてウマーって言ってるのを見るとちょっと真似してみるかと。
と釣られましたんで以下メモ。インストールはすげー簡単。ubuntuならさらに簡単。Dropboxのサイト上に載ってるのそのままやればOK。
- /etc/apt/sources.listへDropboxのリポジトリを追加する。
deb http://linux.getdropbox.com/ubuntu intrepid main deb-src http://linux.getdropbox.com/ubuntu intrepid main
- インストールする。
$ sudo apt-get update $ sudo apt-get install nautilus-dropbox $ killall nautilus
インストールはこんだけ。
あとはDropBoxを使って、まっさらな環境から5分で継続的で快適な環境を作る方法を真似する。つーか、これ見て「あ、Dropbox入れよう。」と思いました。
そのまま載ってるシェルスクリプトをコピペして実行してみたら動かなかったのでちょっと変えた。
- Dropboxディレクトリの中に環境構築用のドットファイルディレクトリを作る。
- 作ったディレクトリに.vimrcとか.vimとか.zshrcとか↓のシェルスクリプトとかをぶち込む。
- アップロードしたシェルスクリプトに実行権限与えて実行。
- 終わり。
#!/bin/sh path=$(pwd) for i in ".vim" ".vimrc" ".zshrc" ".screenrc" ".vimperatorrc" ".vimperator" ".mozilla" ".inputrc" ".Xmodmap" do mv ~/$i ~/$i.org ln -s $path/$i ~/$i done
- Comments: 0
- Trackbacks: 0
[PHP]CentOSへXCacheをインストールしたメモ。[XCache]
またインストールメモ。今後、サーバーを作る時用の自分用メモばっか書いてますな、最近。
ということで、CentOS5.2へXCacheをインストールしました。
- phpizeの為に、php-deveをインストール。
# yum -y install php-devel
- Xcacheの取得 && インストール。
# cd /usr/local/src # wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz # tar zxvf xcache-1.2.2.tar.gz # cd xcache-1.2.2 # phpize # ./configure --enable-xcache --enable-xcache-coverager # make # make test # make install
インストール後、表示されるパスをメモしておく。↓みたいな。
Installing shared extensions: /usr/lib64/php/modules/
- XCacheのWebインタフェースを公開ディレクトリへコピー。
# cp -R admin /var/www/html/ # cp -R coverager /var/www/html/ # mv /var/www/html/admin /var/www/html/xcache
- XCacheの設定。
# mkdir /tmp/pcov # chown apache.apache /tmp/pcov ##←Apache実行ユーザーへ # cat xcache.ini >> /etc/php.ini # cat /proc/cpuinfo | grep -c processor ##←表示された数値をメモ。 # echo "< ?php echo md5('pass'); ?>" | php ##←表示された文字列をメモ。 # vi /etc/php.ini以下、/etc/php.ini のXCache設定内容。
- zend_extension = インストール後表示されたパスを指定。
- xcache.count = # cat /proc/cpuinfo | grep -c processor で表示された数値。
- xcache.admin.user = “hoge” # 適当なユーザーを指定。
- xcache.admin.pass = # echo “< ?php echo md5('pass'); ?>” | php で表示された文字列。
[xcache-common] ;; install as zend extension (recommended), normally "$extension_dir/xcache.so" ;zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so zend_extension = /usr/lib64/php/modules/xcache.so ; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so ;; For windows users, replace xcache.so with php_xcache.dll ;zend_extension_ts = c:/php/extensions/php_xcache.dll ;; or install as extension, make sure your extension_dir setting is correct ; extension = xcache.so ;; or win32: ; extension = php_xcache.dll [xcache.admin] xcache.admin.enable_auth = On xcache.admin.user = "hoge" ; xcache.admin.pass = md5($your_password) xcache.admin.pass = "******************************" [xcache] ; ini only settings, all the values here is default unless explained ; select low level shm/allocator scheme implemenation xcache.shm_scheme = "mmap" ; to disable: xcache.size=0 ; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows xcache.size = 64M ; set to cpu count (cat /proc/cpuinfo |grep -c processor) xcache.count = 1 ; just a hash hints, you can always store count(items) > slots xcache.slots = 8K ; ttl of the cache item, 0=forever xcache.ttl = 0 ; interval of gc scanning expired items, 0=no scan, other values is in seconds xcache.gc_interval = 0 ; same as aboves but for variable cache xcache.var_size = 8M xcache.var_count = 1 xcache.var_slots = 8K ; default ttl xcache.var_ttl = 600 xcache.var_maxttl = 3600 xcache.var_gc_interval = 300 xcache.test = Off ; N/A for /dev/zero xcache.readonly_protection = Off ; for *nix, xcache.mmap_path is a file path, not directory. ; Use something like "/tmp/xcache" if you want to turn on ReadonlyProtection ; 2 group of php won't share the same /tmp/xcache ; for win32, xcache.mmap_path=anonymous map name, not file path xcache.mmap_path = "/tmp/xcache" ; leave it blank(disabled) or "/tmp/phpcore/" ; make sure it's writable by php (without checking open_basedir) xcache.coredump_directory = "" ; per request settings xcache.cacher = On xcache.stat = On xcache.optimizer = Off [xcache.coverager] ; per request settings ; enable coverage data collecting for xcache.coveragedump_directory and xcache_coverager_start/stop/get/clean() functions (will hurt executing performance) xcache.coverager = On ; ini only settings ; make sure it's readable (care open_basedir) by coverage viewer script ; requires xcache.coverager=On xcache.coveragedump_directory = "/tmp/pcov"
- Apacheを再起動。
# /etc/rc.d/init.d/httpd restart
- /var/www/html/coveragerディレクトリへ.htaccessを設置。↓内容。
AuthUserFile /etc/httpd/conf/.htpasswd AuthGroupFile /dev/null AuthName "XCache Coverage Viewer" AuthType Basic #require valid-user require user hoge
以上。
- Comments: 0
- Trackbacks: 0
[CentOS]Apacheアクセスログ解析にVisitorsをインストールしたメモ。[Apache]
このore.saizensen.netでも使ってきてたApacheアクセスログ解析ソフト「Visitors」を別のサーバーにもインストールしたので、ここにメモ書き程度に残しておきます。
グラフ化しても、たいして見ないのでgraphvizはインストールしません、私は。
- 日本語対応の為に、nkfをインストール。
# yum -y install nkf
- Visitorsの取得 && インストール。
# cd /usr/local/src # wget http://www.hping.org/visitors/visitors-0.7.tar.gz # tar zxvf visitors-0.7.tar.gz # cd visitors_0.7 # make # cp visitors /usr/bin/ # cd
- アクセスログ解析結果出力ティレクトリ作成。
# mkdir /var/www/html/log # chown hoge.hoge /var/www/html/log
- アクセスログ解析スクリプト作成。
# vi accesslog.sh #!/bin/bash # ユーザーネームを記載 username=hoge # アクセス解析用ディレクトリを記載 addlog=/var/www/html/log/ # このスクリプトのログファイル名を記載 logfile=/var/log/logsearch.log function logsearch { date '+%Y/%m/%d(%a) %T' for a in `find /var/log/httpd/* -mtime -2` do log=`basename $a` visitors -A -m 30000 $a -o html > $addlog$log nkf -w -m0 $addlog$log > $addlog$log.html rm -f $addlog$log done } logsearch >> $logfile 2>&1 echo "" >> $logfile; echo "" >> $logfile; chown -R $username:$username $addlog - 作成したaccesslog.shを実行 && cronへ。
# chmod +x accesslog.sh # ./accesslog.sh # mv accesslog.sh /etc/cron.daily/
- アクセスログ公開ティレクトリへ.htaccess設置。↓中身。
Options Indexes Includes ExecCGI FollowSymLinks MultiViews AuthUserFile /etc/httpd/conf/.htpasswd AuthGroupFile /dev/null AuthName "Apache Logs" AuthType Basic require user hoge
終了です。hogeって書いてる所は適当に直してね。
- Comments: 0
- Trackbacks: 0
[CentOS]CentOS5.2サーバーにTorrentflux-b4rtをインストールした。[BitTorrent]
家のCentOS5.2サーバーにTorrentflux-b4rtをインストールして、サーバー上にBitTorrentWEBクライアントを設置しました。
動作環境は、
- A Unix like OS (Win32 not supported) – current tested OSs include:
- Linux: Debian, Ubuntu, Gentoo, RedHat, Fedora, NSLU2, ClarkConnect – amongst others!
- BSD: FreeBSD, OpenBSD, NetBSD
- Apple: Mac OS X
- A Web Server – any Unix like webserver that supports PHP should work. Current supported/tested:
- An SQL-Database – current supported db types are:
- PHP 4.3.x or higher.
- Python 2.2 or higher.
- Perl 5.6 or higher (for the optional fluxd daemon).
と、なっとります。
その時のインストールメモ。
- CentOSサーバー上にApache(or Lighttpd)、MySQL(or SQLite or PostgreSQL)、PHPなLAMP環境を整えておきます。今回は既にLAMP環境は構築済ですので省略。PythonもPerlもyumでインストール済。
-
- Torrentflux-b4rtを取って来る。
- 展開。
- webrootディレクトリへ移動。
- 所有者変更。Apacheユーザーへ
- ダウンロードディレクトリ作成し、Apacheユーザーが書き込めるようにPermission変更。今回はSambaの共有ディレクトリ内へ作りました。
[root@centos ~]# cd /usr/local/src [root@centos ~]# wget http://download.berlios.de/tf-b4rt/torrentflux-b4rt_1.0-beta2.tar.bz2 [root@centos ~]# tar xjvf torrentflux-b4rt_1.0-beta2.tar.bz2 [root@centos ~]# mv torrentflux-b4rt_1.0-beta2 /var/www/html/torrrentflux [root@centos ~]# chown -R apache.apache /var/www/html/torrentflux [root@centos ~]# mkdir /storage_1/downloads [root@centos ~]# chown -R nobody.nobody /storage_1/downloads [root@centos ~]# chmod -R 777 /storage_1/downloads [root@centos ~]# cd
- ブラウザでsetup.phpへアクセスして指示通りにTorrentfluxのインストール。
この時、私の場合だとcksfv、vlc、uudeviewが無いと表示されていたのでyumでインストール。
あと、本体のBitTorrentクライアントをインストール。デフォルトのBitTornadoと無いよと表示されていたTransmission。
TransmissionはTorrentflux-b4rtのアーカイブ内にTransmission-1.06のパッチファイルが収録されているので、それを使用してインストール。[root@centos ~]# yum --enablerepo=rpmforge install cksfv [root@centos ~]# yum --enablerepo=rpmforge install vlc [root@centos ~]# yum --enablerepo=rpmforge install uudeview [root@centos ~]# cd /usr/local/src [root@centos ~]# wget http://download.m0k.org/transmission/files/transmission-1.06.tar.bz2 [root@centos ~]# tar jxvf transmission-1.06.tar.bz2 [root@centos ~]# cd transmission-1.06 [root@centos ~]# tar jxvf /var/www/html/torrentflux/clients/transmission/Transmission-1.06_tfCLI-svn3356.tar.bz2 [root@centos ~]# cp -R /var/www/html/torrentflux/clients/transmission/Transmission-1.06_tfCLI-svn3356/cli ./ [root@centos ~]# ./configure [root@centos ~]# make [root@centos ~]# make install [root@centos ~]# cd /usr/local/src [root@centos ~]# wget http://download2.bittornado.com/download/BitTornado-0.3.18.tar.gz [root@centos ~]# tar zxvf BitTornado-0.3.18.tar.gz [root@centos ~]# cd BitTornado-CVS [root@centos ~]# python setup.py install [root@centos ~]# cd
- iptablesのTCP49160:49300ポートを開ける。
- torrentfluxディレクトリに.htaccessを設置してアクセス制限を掛ける。
以上です。これでいつでもブラウザ上からtorrentを使ってダウンロード出来るようになりました。
- Comments: 0
- Trackbacks: 1
[CentOS]CentOSへ3ware 9650SE-2LPを差してRAID環境作りましたよ。[RAID]
タイトル通り、CentOS5.2-64bit版へ3ware 9650SE-2LPを差してRAID環境作りました。その時のメモ。
まず用意したのが3ware 9650SE-2LPというRAIDカード。
お金無いから、RAID0かRAID1のみ可能な2portカードです。とりあえずRAID1のミラーリングが目的だからこれでいいんです。
で、以下作業。
- まず3wareから最新のドライバーを取ってくる。CentOS5だからRedHatEL5用のを。
- 取ってきたファイルを展開する。中にdriverとinstalldiskの2種、x86用とx86_64用のアーキテクチャ別にアーカイブされているので、今回はCentOSの64bitを新規インストールするのでinstalldisk-x86_64を選んでさらに展開する。展開された中身を全部フロッピーへ突っ込む。
- RAIDカードをサーバーへ取り付けSATAのHD2台へケーブル接続。この時、別に取り付けてたHDを床に落としてしまいIOエラーでご臨終してしまいました・・・
- サーバー本体の電源投入し、3wareのBIOS画面になったらAlt-3キーで設定画面へ。マニュアル通り設定すれば簡単なので詳細はめんどいので除きます。マニュアル無くても設定できるくらいです。とまぁRAIDユニットの作成を完了させます。
- CentOSのインストールディスクとさっき作ったRAIDカードのおドライバーフロッピーを入れ、インストール開始画面になったら
linux dd
で起動する。すると、「何かハードウェアのドライバーディスク持ってるか?」と聞いてくるので「YES」を選んでドライバーをロードする。この時、正常にロードすると
Loading 3w-9xxx driver
と表示される。ここでどっぷりとハマってしまいましたんですけどね。最初、CentOS5.0のインストールディスクを使っていたら、Loading 3w-9xxx driverと全く表示されませんでした。表示されないけどロードしてそうな雰囲気だったので、そのまま作業進めてHD選択画面まで進むとHDが無いみたいなループを約1日続けてました。試しにCentOS5.2のインストールティスクを落とし直して、同作業をするとあっさり終わりましたよと・・・
- あとは、普通にOSのインストールをして完了です。
インストール完了後、試しにHD1台抜いて電源投入してOS起動させたり、別のHDを取り付けてRAIDユニットの再構築してみたりと弄くってました。現在、全く問題無く動いてます。
- Comments: 0
- Trackbacks: 0
DNSサーバーの指定方法
/etc/resolv.conf
nameserver 255.255.255.254 ←DNSサーバーのアドレスを記入する nameserver 255.255.255.255 ←複数のアドレスを並記してもいい
- Comments: 0
- Trackbacks: 0
デュアルディスプレイ設定 – xorg.conf
現状のxorg.confをメモ的に記載しておく。
# File generated by XFdrake (rev 230776)
Section "Extensions"
Option "Composite"
EndSection
# **********************************************************************
# Refer to the xorg.conf man page for details about the format of
# this file.
# **********************************************************************
Section "ServerFlags"
#DontZap # disable (server abort)
#DontZoom # disable / (resolution switching)
AllowMouseOpenFail # allows the server to start up even if the mouse does not work
EndSection
Section "Module"
Load "dbe" # Double-Buffering Extension
Load "v4l" # Video for Linux
Load "extmod"
Load "type1"
Load "freetype"
Load "glx" # 3D layer
Load "dri" # direct rendering
EndSection
Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "latin+level3(ralt_switch)"
Option "XkbOptions" "compose:rwin"
EndSection
Section "InputDevice"
Identifier "Mouse1"
Driver "mouse"
Option "Protocol" "ExplorerPS/2"
Option "Device" "/dev/mouse"
EndSection
Section "InputDevice"
Identifier "Mouse2"
Driver "mouse"
Option "Protocol" "PS/2"
Option "Device" "/dev/psaux"
Option "ZAxisMapping" "4 5"
EndSection
Section "Monitor"
Identifier "monitor1"
VendorName "Generic"
ModelName "Flat Panel 1024x768"
HorizSync 31.5-55
VertRefresh 40-70
# TV fullscreen mode or DVD fullscreen output.
# 768x576 @ 79 Hz, 50 kHz hsync
ModeLine "768x576" 50.00 768 832 846 1000 576 590 595 630
# 768x576 @ 100 Hz, 61.6 kHz hsync
ModeLine "768x576" 63.07 768 800 960 1024 576 578 590 616
EndSection
Section "Monitor"
Identifier "Secondary Monitor"
ModelName "My LCD Panel 1680x1050"
HorizSync 24.0-82.0
VertRefresh 49.0-86.0
Modeline "1280x1024" 108.00 1280 1328 1576 1688 1024 1025 1028 1066 +hsync +vsync
Option "RightOf" "LVDS"
Option "ReducedBlanking"
ModeLine "1600x1200@60" 162.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
ModeLine "1680x1050" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 +hsync -vsync
Option "dpms"
EndSection
Section "Device"
Identifier "device1"
VendorName "Intel Corporation"
BoardName "Intel 810 and later"
Driver "intel"
BusID "PCI:0:2:0"
Option "DPMS"
#Option "MonitorLayout" "NONE,CRT+LFP"
Option "XaaNoOffscreenPixmaps" "1"
Option "DRI" "true"
Option "Monitor-VGA" "Secondary Monitor"
EndSection
Section "Screen"
Identifier "screen1"
Device "device1"
Monitor "monitor1"
DefaultColorDepth 24
Subsection "Display"
Depth 8
Modes "1024x768" "832x624" "800x600" "640x480" "480x360" "320x240"
EndSubsection
Subsection "Display"
Depth 15
Modes "1024x768" "832x624" "800x600" "640x480" "480x360" "320x240"
EndSubsection
Subsection "Display"
Depth 16
Modes "1024x768" "832x624" "800x600" "640x480" "480x360" "320x240"
EndSubsection
Subsection "Display"
Depth 24
Modes "1024x768" "832x624" "800x600" "640x480" "480x360" "320x240"
EndSubsection
EndSection
Section "ServerLayout"
Identifier "layout1"
InputDevice "Keyboard1" "CoreKeyboard"
InputDevice "Mouse1" "CorePointer"
InputDevice "Mouse2" "SendCoreEvents"
Screen "screen1"
Screen 0 "screen1" 0 0
EndSection
Section "Extensions"
Option "Composite" "Enable"
EndSection
Section "DRI"
Mode 0666
EndSection
- Comments: 0
- Trackbacks: 0
[Linux]キーボードの【CapsLk】と【Ctrl】を入れ替える。[Windows]
・Linuxの場合は、
Homeディレクトリ直下に、「.Xmodmap」というファイルを作成して下記を記述する。
remove Lock = Caps_Lock remove Control = Control_L keysym Control_L = Caps_Lock keysym Caps_Lock = Control_L add Control = Control_L add Lock = Caps_Lock
・Windowsの場合は、
- regedit.exeを起動する。
- HKEY_LOCAL_MACHINE\System\CurrentControlSet001\Control\KeyBoard Layoutへ移動する。
- 新規作成で「バイナリ」を選択し、名前を「Scancode Map」に変更
- 変更した「Scancode Map」をクリックし、値を以下のように書き変える。
0000 00 00 00 00 00 00 00 00 0008 03 00 00 00 3A 00 1D 00 0010 1D 00 3A 00 00 00 00 00 0018
- Comments: 0
- Trackbacks: 1
- Search
- Feeds
- Meta