ラベル Ubuntu の投稿を表示しています。 すべての投稿を表示
ラベル Ubuntu の投稿を表示しています。 すべての投稿を表示

4.27.2012

WordPress (1)

27th Apr 2012

UbuntuにWordPressをインストールした時のメモ。

cd dev
wget http://wordpress.org/latest.tar.gz
tar zxf latest.tar.gz
rm latest.tar.gz
ls wordpress/
sudo ln -s /home/sotaro/dev/wordpress /var/www/wp
sudo chmod 777 wordpress

mysql> create database wordpress;
mysql> CREATE USER 'wp'@'localhost' IDENTIFIED BY 'wordpress'
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO 'wp'@'localhost';

http://localhost/wp からログイン、DBに関する情報を入力して終了。

と思いきや、、、
テーマの追加を試み、FTPが必要であることが判明。
で、FTP。

sudo apt-get install proftpd
(xinetd or standaloneで xinetd を選ぶ)


ProFTPD warning: cannot start neither in standalone nor in inetd/xinetd mode. Check your configuration.
vi /etc/init.d/proftpd

といことで、/etc/init.d/proftpdを見ると

 49   if egrep -qi "server[[:space:]]*=[[:space:]]*/usr/sbin/proftpd" /etc/xinetd.conf 2>/dev/null || \
 50      egrep -qi "server[[:space:]]*=[[:space:]]*/usr/sbin/proftpd" /etc/xinetd.d/* 2>/dev/null || \
 51      egrep -qi "^ftp.*/usr/sbin/proftpd" /etc/inetd.conf 2>/dev/null 

そういえば、sshdもあげてないし、xinetdが無いのか!ってことで

sudo apt-get install xinetd
sudo vi /etc/xinetd.d/ftp
cat /etc/xinetd.d/ftp
service ftp
{
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/sbin/proftpd
}
sudo /etc/init.d/xinetd restart

アカウントは

sudo useradd -g www-data -M wordpress
sudo passwd wordpress

で用意し、再度テーマの追加に挑む。が、permissionで色々怒られ

sudo chown -R wordpress:www-data *
sudo find . -type d -exec chmod 775 {} \;
sudo find . -type f -exec chmod 666 {} \;

でようやく完了。

※追記
apacheの設定に下記を追加


  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all

3.11.2012

vim x github

11 Mar 2012

ゴールは、家でvimrcやpluginを調整し、それを会社でさくっと導入し、より早く開発できるようにすること。で、良さそうなpluginがgithubで公開されているので、家と会社をつなぐのもgithubで。

まずはgit/githubの練習。github.comでアカウント作り、テスト用のリポジトリを作ると、下記のような一連のコマンドが表示されるので簡単。

$ mkdir hello-Git
$ cd hello-Git/
$ git init
$ touch README
$ vi README
$ git add README
$ git commit -m 'first commit'
$ git remote add origin git@github.com:sotaro/hello-Git.git
$ git push -u origin master
$ git push git@github.com:sotaro/hello-Git.git
続いてplugin。
自動補完のneocomplcache + vimproc、リスティング(以外にも使えるらしい)のunite.vim、vim上でコマンドが使えるvimshellの4つと、「vundle」というplugin管理用のpluginの計5つをインストールする。

$ git clone git://github.com/gmarik/vundle.git ~/.vim/vundle.git
$ vi ~/.vimrc
(抜粋)
set nocompatible
filetype off

set rtp+=~/.vim/vundle.git/
call vundle#rc()

Bundle 'Shougo/unite.vim'
Bundle 'Shougo/vimshell'
Bundle 'Shougo/neocomplcache'
Bundle 'Shougo/vimproc'

filetype plugin indent on

let g:neocomplcache_enable_at_startup = 1
とし、vim上で

:BundleInstall
とすれば、インストール完了。
で、いよいよautocompleteを試すべく適当なファイルを編集しようとすると

.vim/bundle/vimproc/autoload/proc.so" is not found.
となり、

:help vimproc
でヘルプを読むとproc.soを作る必要があるとのことで、

$ cd ~/.vim/bundle/vimproc/
$ make -f make_gcc.mak
$ ls autoload/proc.so 
autoload/proc.so
で、いろいろ試すこと数時間。
使いこなすまでには相当の時間を要するが、どれも便利。

会社では

$ sudo apt-get install git-core
$ mkdir ~/.vim ~/github
$ git clone git://github.com/gmarik/vundle.git ~/.vim/vundle.git
$ git clone git://github.com/sotaro/hello-Git.git ~/github/hello-Git.git
$ cp ~/github/hello-Git.git/.vimrc ~/
$ vi .vimrc
(:BundleInstall)
$ cd ~/.vim/bundle/vimproc/
$ make -f make_gcc.mak
で導入できるはず!

3.07.2012

Ubuntu ~ NIC ~ e1000e

7 Mar 2012

WindowとUbuntuのデュアルブートで、Windowsからは問題なくネット接続できるのに、Ubuntuからはダメ、という状況からの復旧手順メモ。

ネットワークカードは、 Intel® 82579LM Gigabit Ethernet Controller 。

$ ifconfig
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
(snip)
表示されるのはLoopbackのみ

$ lspci -nn | grep -i ethernet
Ethernet controller [0200]: Intel Corporation Device [8086:1502] (rev 04)
$ modprobe -l | grep e1000e
kernel/drivers/net/e1000e/e1000e.ko
対応するドライバはあるようだが、、、

$ modinfo e1000e | grep 1502
$
何も表示されず、枝番とでも言うのかな?まで一致するドライバがない

という訳でここからe1000eの最新版をダウンロード。あとは

$ tar zxf e1000e-1.9.5.tar.gz
$ cd e1000e-1.9.5/src
$ sudo make install
$ sudo rmmod e1000e
$ sudo modprobe e1000e
$ modprobe -l | grep e1000e
kernel/drivers/net/e1000e/e1000e.ko

接続完了!

2.25.2012

ssh into iPhone without password authentication

25 Feb 2012

To ssh into your iPhone without password authentication,

1.  add user on iPhone

# cat /etc/master.passwd > ~/master.passwd
# echo 'hoge:*:1001:1001::0:0:User:/var/hoge:/bin/sh' >> ~/master.passwd
# diff /etc/master.passwd ~/master.passwd
> hoge:*:1001:1001::0:0:User:/var/hoge:/bin/sh
# mv ~/master.passwd /etc/master.passwd
# passwd hoge
New password: (type password for hoge)
Retype new password: (retype password for hoge)
# cd /var; mkdir hoge; chown hoge hoge;

2 make identity.pub on Ubuntu

% ssh-keygen -t rsa -f ~/.ssh/identity -N ""
% scp ~/.ssh/identity.pub hoge@192.168.1.2
hoge@192.168.1.2's password: (type password for hoge)
% ssh hoge@192.168.1.2
hoge@192.168.1.2's password: (type password for hoge)

3 place identity.pub and modify sshd config on iPhone

# mkdir .ssh ; chmod 700 .ssh
# mv identity.pub .ssh/authorized_keys
# chmod 600 .ssh/authorized_keys
# su
Password: (type password for root)
# cat /etc/ssh/sshd_config > ~/sshd_config
# echo 'RSAAuthentication yes' >> ~/sshd_config
# echo 'PubkeyAuthentication yes' >> ~/sshd_config
# echo 'AuthorizedKeysFile .ssh/authorized_keys' >> ~/sshd_config
# diff /etc/ssh/sshd_config ~/sshd_config
> RSAAuthentication yes
> PubkeyAuthentication yes
> AuthorizedKeysFile .ssh/authorized_keys
# mv ~/sshd_config /etc/ssh/sshd_config
# reboot

4. now you can ssh with password authentication

Your-Ubuntu:~ hoge% ssh 192.168.1.2


2.16.2012

Zend Framework ~ install & setup on Ubuntu

16 Feb 2012

1. install
Zend Framework 1.11.11 full をインストールする
(参考) http://tutology.net/category/zend-framework/how-install-zend-framework-ubuntu

2. Vitrual host 関連
2.1 enable mod_rewrite
$ cd /etc/apache2/mods-enabled
$ sudo vi rewrite.load
$ cat rewrite.load
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
$ sudo /etc/init.d/apache2 restart

2.2 add virtual host setting
$ cd /etc/apache2/sites-available
$ sudo cp default zf
$ sudo vi zf
$ cat zf

(snip)
<VirtualHost *:80>
 ServerAdmin webmaster@localhost
 DocumentRoot /var/www/zf
 ServerName zf.com

 <Directory /var/www/zf/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  DirectoryIndex index.php
  Order allow,deny
  allow from all
 </Directory>

 RewriteEngine Off

 <Location />
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php
 </Location>
</VirtualHost>
$ sudo a2ensite zf
$ sudo /etc/init.d/apache2 restart
$ cd /var/www
$ sudo mkdir zf
$ cd zf
$ sudo vi index.php
$ cat index.php
<?php
echo 'hello';
?>
$ sudo vi /etc/hosts
$ cat /etc/hosts | grep zf
127.0.0.1 zf.com
これで準備完了で、いよいよZend Framework。
(参考) http://framework.zend.com/manual/en/learning.quickstart.html


12.26.2011

Yahoo!メッセンジャー

26 Dec 2011

Using only Ubuntu for nearly a month, I found a problem when I try to use Yahoo! Japan Messenger as I'm going back to Japan Next January.

At first, I tried the web version but, I think, I couldn't type in Japanese because of Flash.
Secondly, I installed it on Wine then got terrible character corruption as a base language is English.
Finally, I tried Empathy and it made it with the following configuration.

 Server : cs2.msg.vip.ogk.yahoo.co.jp
 Port : 80

Ubuntu Onlyになってもうすぐ1ヶ月。年明け日本へ帰る関係でYahoo!メッセンジャーを使いたくなり、ちょっと困る。

まずはWeb版。Flash(?)のせいで入力言語を切り替えられないので断念。
次はWineでメッセンジャーをインストールするも、ベースが英語なせいで化け化け。
最後はEmpathy。

初期設定
 Server : cs.msg.yahoo.co.jp
 Port : 8080 (?)
ではつながらず、
 Server : cs1.msg.vip.ogk.yahoo.co.jp
 Port : 80
でつながるという情報があり、試してみるが変わらず。

何となくcs2.msg.vip.ogk.yahoo.co.jpってあるのかな?っとlookupするとあり、cs2.msg.vip.ogk.yahoo.co.jpに変更したら接続!

グループが全部表示されなかったり万全ではないが、入力周りの不便がないのでOK!!

12.04.2011

Getting used to 101

4 Dec 2011

I've been using 106-Key keyboard for over 10 years which is the most common in Japan. It has a nearly same layout with 101-Key keyboard but some keys such as ', @, \, &, are placed differently. Therefore, I need to get used to 101 and tried a practice problem from NZPC, New Zealand Programming Contest.

長年慣れ親しんだ106キーボード、キーの配置は101キーボードのそれとほぼ同じだが、@マークやクォート等、記号の配置が微妙に異なる。半角/全角など、キーを増やすのは分かるが、なぜレイアウトまで変えちゃうのよ?!と小言を言いつつ、NZPC - New Zealand Programming Contestで新しいレイアウトに慣れる。NZPCはIT学科の大学院生が教えてくれたサイトで、その名の通りプログラミングコンテスト。

現在は受付を終了していて、こちらの練習問題、Word Finderに挑戦。

英語の理解にちょっと苦労するが、
1.行列のサイズ
2.行列に配置する単語(順番は、左→右、上→下で行列にぴったり収まる)
3.行列中に存在するか検索する文字列
の3種類のパラメータを標準入力から受け取り、検索文字列の有無、有る場合はその位置(開始・終了)を表示する、という感じ。

で、配列を使って、こんな感じかな?っと何となく取っ掛かりのイメージができた所で、行き当たりばったりのコーディングを開始。書き終えて、ざっと動作確認をして、ソースをきれいにした所で3時間半。もうちょっと(大分)早くできる思ったけど、、、

おかげで新しいキー配置にはかなり慣れることができました。
ソースはこちら。コンテストでは使えないPHPで書いた。

12.03.2011

Ubuntu x ThinkPad x Wheel

3 Dec 2011

After installing Ubuntu10.04 on Thinkpad X61 yesterday, I found wheel didn't work well so I fixed as below.

sotaro@sotaro-laptop:~$ cat bin/sh/thinkpad.sh
xinput set-prop 'TPPS/2 IBM TrackPoint' "Evdev Wheel Emulation" 1
xinput set-prop 'TPPS/2 IBM TrackPoint' "Evdev Wheel Emulation Button" 2
xinput set-prop 'TPPS/2 IBM TrackPoint' "Evdev Wheel Emulation Timeout" 200
sotaro@sotaro-laptop:~$ sh bin/sh/thinkpad.sh 

I also add the script to Startup Applications to avoid running it every time.

sotaro@sotaro-laptop:~$ chmod +x bin/sh/thinkpad.sh
Add the script to System>Preferences>Startup Applications

スクロールが動作しないことに気づいたので、下記の方法で修正。

↑のスクリプトを実行する。
次回以降何もしなくて良いようにスタートアップアプリケーションにも追加する。

12.02.2011

さらばWindows

2 Dec 2011

デュアルブートの道もあったが、そろそろ(?)Windows8が登場するらしいこのご時世に未だXpを使っていたり、ITを学ぶ学生と英語とITをexchangeする中でCの環境があると良かったり、OSいくつもあっても結局どっちか1つしか使わないっしょ、などなど、ちょっとずつ色んな理由があって、そんな塵積な流れから思い切ってUbuntuでWindowsを上書き。

インストール自体はUNetbootinであっさり完了。マシンはThinkPad X61でざっと使った限り、無線LANもマウスポインタ(赤いの)も問題なく動くのでバッチリ。

日本語の入力はIBusに日本語を追加するだけ(Language Supportも?)。ちなみにベースの(ログイン時に選択する)言語は英語。

その他では今のところBrowserの各種設定をexport/importした程度。

使っていく内に色々見つかると思うのでまたその内に続報を。