先日諸般の事情で、Amazon EC2にOracle11gXEをインストールして利用する必要があったのですが、一つ困った事があったのでメモ。
■問題
インストールも簡単にでき重宝していたのですが、EC2インスタンスをStop -> Startすると外部から接続できなくなりました。
FWとかSecurity Groupとか確認したのですが問題を発見できず。
サーバにログインしておもむろにプロセスを確認すると、何と ”リスナー” が起動していないのです!
■原因&対処方法
EC2インスタンスをStop -> StartするとIPおよびホスト名が変わります。ところがOracle11gXEをインストールすると、listener.ora内にインストール時点のホスト名が埋まってしまいます。よって再起動後は前のホスト名に対してリスナーを起動しようとする為、上手くいかなります。
ホスト名を変更し、/etc/init.d/oracle-xe stop / startすると、めでたく起動できました!
■追記
↑な事をtwitterでぼやいていたら、Rails contributor仲間のyahondaさんより、「Host名を空にする」という方法を教えて頂きました。これだとインスタンス起動毎に変更しなくてよいので楽ちんです。
2012年9月29日土曜日
2012年5月1日火曜日
rails自体の開発環境を作る2012
■概要
さくらvpsを新プランに乗り換えたので、またまた"rails自体"の開発環境を作ります。
■パッケージ管理・導入(centos6.2 x86_64 2Gプラン)
○パッケージの最新化
# yum -y update
(yum -y upgrade)
○必要そうなパッケージをインストール
# yum -y install git nmap telnet
# yum -y install screen zsh
(# yum -y install httpd httpd-devel)
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# yum --enablerepo=remi,remi-test -y install mysql mysql-server mysql-devel
# yum -y install sqlite sqlite-devel
# rpm -Uvh http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
# yum -y install postgresql91 postgresql91-contrib postgresql91-devel postgresql91-libs postgresql91-server
# yum --disablerepo=pgdg91 -y install libevent libevent-devel memcached memcached-devel
# yum -y install openssl-devel curl-devel readline-devel zlib-devel libxml2 libxml2-devel libxslt-devel libyaml-devel libffi-devel
# yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel java-1.6.0-openjdk-src
(参考) http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/
(参考) http://www.oss-d.net/postgresql/9.1
■設定
○日本語化
# vim /etc/sysconfig/i18n
LANG="C" から LANG="ja_JP.UTF-8" に変更
○不要デーモンの停止設定
# chkconfig auditd off
# chkconfig haldaemon off
# chkconfig mdmonitor off
# chkconfig messagebus off
# chkconfig netfs off
# chkconfig restorecond off
# chkconfig smartd off
(参考) http://tanaka.sakura.ad.jp/archives/001065.html
○FW設定
# system-config-firewall-tui
SSH/HTTPS/HTTP/3000(tcp)
後は未設定
○時間同期設定
(さくらVPSでは最初から設定されていました)
# yum -y install ntp
# vim /etc/ntp.conf
# ntpdate ntp.nict.jp (とりあえず一旦近づけておく)
# /etc/init.d/ntpd start
# chkconfig ntpd on
○selinux停止
(さくらVPSでは最初から設定されていました)
# vim /etc/sysconfig/selinux
SELINUX=disabled
# reboot
○作業用ユーザ作成
# useradd kennyj
# passwd kennyj
○sudo設定
# /usr/sbin/visudo
(一番下に追記)
kennyj ALL=(ALL) ALL
○ssh設定
# vim /etc/ssh/sshd_config
(42行目)
PermitRootLogin no
(47行目)
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
(65行目)
PermitEmptyPasswords no
PasswordAuthentication no
# /etc/init.d/sshd restart
# su - kennyj
$ ssh-keygen -t rsa
$ mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
(秘密鍵をローカルにダウンロード。秘密鍵のみでログインできる事を確認する。)
$ rm ~/.ssh/id_rsa
$ exit
○postgresql準備
# service postgresql-9.1 initdb
○mysql準備
# vim /etc/my.cnf
(文字列エンコーディングをUTF-8に設定)
[mysqld]
...
character-set-server = utf8
[mysqld_safe]
...
character-set-server = utf8
[mysql]
...
default-character-set = utf8
# mysql_install_db
# service mysqld start
# mysql_secure_installation
○必要に応じてサービス起動設定
(# chkconfig httpd on)
# chkconfig mysqld on
# chkconfig postgresql-9.1 on
# chkconfig memcached on
○再起動
# reboot
○サービス稼動確認
# ps aux | grep -E 'http|postgre|mysql|memcache'
■rails環境構築
○javascript関係インストール
# wget http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm
# yum localinstall --nogpgcheck nodejs-stable-release.noarch.rpm
# yum install nodejs-compat-symlinks npm
(# npm install express -g)
(# npm install jade -g)
(# npm install socket.io -g)
# npm install coffee-script -g
(参考) https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
○ruby関係インストール
(kennyjユーザで)
$ curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
$ source ~/.rvm/scripts/rvm
$ rvm install ree-1.8.7-2012.02
$ rvm install 1.9.3-p194
$ rvm install jruby-1.6.7
$ rvm use --default 1.9.3
($ rvm ree,1.9.3,jruby do gem install rails --no-rdoc --no-ri)
■rails開発環境
○mysqlの設定
$ mysql -u root
mysql> GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost';
mysql> GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost';
mysql> flush privileges;
mysql> quit
○postgresqlの設定
$ sudo -u postgres createuser --superuser $USER
○github公開鍵の準備
(参考) http://help.github.com/win-set-up-git/
○gitの設定
$ git config --global user.name kennyj # 名前
$ git config --global user.email kennyj@gmail.com # メールアドレス
○gitの補完機能設定
$ cd $HOME
$ wget https://raw.github.com/gitster/git/master/contrib/completion/git-completion.bash -O .git-completion.bash
$ vim $HOME/.bashrc
source $HOME/.git-completion.bash
PS1='\w$(__git_ps1 "(%s)")\$ '
$ souce ~/.bashrc
○rails開発環境
$ git clone git://github.com/(自分)/rails.git (先にgithub上でforkしておく)
$ cd rails
$ gem install pg -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config
$ bundle update
$ bundle exec rake mysql:build_databases
$ bundle exec rake postgresql:build_databases
○hstore準備
$ psql activerecord_unittest
> CREATE EXTENSION hstore;
> \q
$ psql activerecord_unittest2
> CREATE EXTENSION hstore;
> \q
○テスト稼動確認
$ cd ..
$ bundle exec rake (テスト稼動確認)
○docrailsも準備
$ cd $HOME
$ git clone git://github.com/lifo/docrails.git
○適宜関連gemの開発環境
$ git clone git://github.com/(自分)/mail.git
$ git clone git://github.com/(自分)/journey.git
$ git clone git://github.com/(自分)/sprockets.git
$ git clone git://github.com/(自分)/sprockets-rails.git
...
ラベル:
centos,
linux,
rails,
sakura vps
2011年8月20日土曜日
javaの32bitと64bitの使い分けにはご注意を
最近では64bit OS環境が広く利用されている事と思います。
一般的に64bit環境での32bitコマンドの実行は問題が無いと思いますが、java関係で二つ程問題が発生したので記録しておきます。
■Tomcatが起動出来なくなった。
64bit => 32bit javaに変更した所、Tomcatが起動しなくなりました。調べてみるとTomcat本体の問題では無かったのですが、jsvcを利用して起動している為、問題が発生しているようです(TOMCAT_HOME/bin/startup.sh等では問題なく起動しました)。
一部推測混じりですが
・jsvcを利用するにはコンパイルが必要
・コンパイル時には、configureを実行
・configureのログをよく見てみると、linux自体を"x86_64"と判定
・よってjavaは64bit版を想定してコンパイルしてしまう(推測)
という理由で上手く行かなくなったのではと思われます。
結論:jsvcを利用する場合は、32/64bitをOSとあわせる必要があります。
■rjb(ruby java bridge)が動かなくなった。
こちらも64bit => 32bit javaに変更した所、動かなくなりました。ruby側からJava VMを作成できなくなるようです。
但し上記問題を解決しても、javaのマイナーバージョン違いで急に動かなくなる場合を確認しています(jdk6u22 => jdk6u23)。ログを見た限りではGC発生タイミングでseg faultしてしまうようです。
リリースノートを見ている限りでは、hotspot vmのバージョンが上がったから?等推測してますが根本原因は判明しませんでした。
結論:rjbを利用する場合は、32/64bitをOSとあわせる必要があります。またマイナーバージョン含め実績のあるjava/rubyのバージョン組み合わせ・設定を大事にする必要があります。
一般的に64bit環境での32bitコマンドの実行は問題が無いと思いますが、java関係で二つ程問題が発生したので記録しておきます。
■Tomcatが起動出来なくなった。
64bit => 32bit javaに変更した所、Tomcatが起動しなくなりました。調べてみるとTomcat本体の問題では無かったのですが、jsvcを利用して起動している為、問題が発生しているようです(TOMCAT_HOME/bin/startup.sh等では問題なく起動しました)。
一部推測混じりですが
・jsvcを利用するにはコンパイルが必要
・コンパイル時には、configureを実行
・configureのログをよく見てみると、linux自体を"x86_64"と判定
・よってjavaは64bit版を想定してコンパイルしてしまう(推測)
という理由で上手く行かなくなったのではと思われます。
結論:jsvcを利用する場合は、32/64bitをOSとあわせる必要があります。
■rjb(ruby java bridge)が動かなくなった。
こちらも64bit => 32bit javaに変更した所、動かなくなりました。ruby側からJava VMを作成できなくなるようです。
但し上記問題を解決しても、javaのマイナーバージョン違いで急に動かなくなる場合を確認しています(jdk6u22 => jdk6u23)。ログを見た限りではGC発生タイミングでseg faultしてしまうようです。
リリースノートを見ている限りでは、hotspot vmのバージョンが上がったから?等推測してますが根本原因は判明しませんでした。
結論:rjbを利用する場合は、32/64bitをOSとあわせる必要があります。またマイナーバージョン含め実績のあるjava/rubyのバージョン組み合わせ・設定を大事にする必要があります。
2011年8月17日水曜日
2011年3月31日木曜日
最近のOSでsubversion1.4.xがコンパイルしたい
■概要
ubuntu 10.4等最近のOSで、subversion1.4.xをconfigure => make => make install しようとするとconfigureの段階で問題が発生します。
どうもlibtoolの変更に伴う問題みたいなので(仕方なく)調べました。
■解決方法
参考ページによると*.m4系の内容が別々のファイルに分離したのが問題っぽいので乱暴ながら一時的に一つにするといいみたいです。
これで下記の手順でビルド&インストールできます!
■参考ページ
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/262251
ubuntu 10.4等最近のOSで、subversion1.4.xをconfigure => make => make install しようとするとconfigureの段階で問題が発生します。
$ tar zxvf subversion-1.4.6.tar.gz
$ cd subversion-1.4.6
$ ./autogen.sh
...
configure.in:146: warning: LTOPTIONS_VERSION is m4_require'd but not m4_defun'd
build/libtool.m4:67: LT_INIT is expanded from...
build/libtool.m4:102: AC_PROG_LIBTOOL is expanded from...
configure.in:146: the top level
configure.in:146: warning: LTSUGAR_VERSION is m4_require'd but not m4_defun'd
configure.in:146: warning: LTVERSION_VERSION is m4_require'd but not m4_defun'd
configure.in:146: warning: LTOBSOLETE_VERSION is m4_require'd but not m4_defun'd
Creating configure...
configure.in:146: warning: LTOPTIONS_VERSION is m4_require'd but not m4_defun'd
build/libtool.m4:67: LT_INIT is expanded from...
build/libtool.m4:102: AC_PROG_LIBTOOL is expanded from...
configure.in:146: the top level
configure.in:146: warning: LTSUGAR_VERSION is m4_require'd but not m4_defun'd
configure.in:146: warning: LTVERSION_VERSION is m4_require'd but not m4_defun'd
configure.in:146: warning: LTOBSOLETE_VERSION is m4_require'd but not m4_defun'd
configure:5904: error: possibly undefined macro: m4_ifval
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure:8391: error: possibly undefined macro: _LT_SET_OPTIONS
configure:8391: error: possibly undefined macro: LT_INIT
...
どうもlibtoolの変更に伴う問題みたいなので(仕方なく)調べました。
■解決方法
参考ページによると*.m4系の内容が別々のファイルに分離したのが問題っぽいので乱暴ながら一時的に一つにするといいみたいです。
$ cd /usr/share/aclocal $ sudo cp libtool.m4 libtool.m4.org $ sudo chmod 666 libtool.m4 $ sudo cat lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 >> libtool.m4
これで下記の手順でビルド&インストールできます!
$ cd subversion-1.4.6 $ ./autogen.sh $ ./configure $ make $ sudo make install
■参考ページ
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/262251
ラベル:
linux,
subversion,
ubuntu
2011年1月3日月曜日
CoffeeScript面白そう
CoffeeScriptとは「javascript悪くないけどね...文法がちょっと...」という人の為の言語で、
コンパイルするとjavascriptのソースが出力されます。
という私にぴったり。ちなみに37 signalsも使っているらしいですね
下記は「centos 5.5」に動く環境を作成するまでの記録です(2011/1/3現在)
■node.jsのインストール(v8もインストールされるようです)
# wget http://nodejs.org/dist/node-v0.2.6.tar.gz
# tar zxvf node-v0.2.6.tar.gz
# cd node-v0.2.6
# ./configure
# make
(# make test)
# make install
centos5.xにはshasumコマンドが存在しないようので、make testでエラーが発生します。
http://groups.google.com/group/nodejs/browse_thread/thread/4f8290fc06baab3b?pli=1
の様な話があるので
# ln -s /usr/bin/sha1sum /usr/bin/shasum
としておけば、落ちたテストは通ります。
(上記を実行しても私の環境的に multicast はテストが通りません...)
■npm(the Node Package Manager)のインストール
# curl http://npmjs.org/install.sh | sh
# npm -v (確認)
0.2.13-3
危ないからrootで実行するなとか言われましたが「It worked」だそうなのでほっときました。
■coffee scriptのインストール
# npm install coffee-script
# coffee -v (確認)
CoffeeScript version 1.0.0
■とりあえず実行してみる
# vim test.coffee で下記のように記載
debug = (x) -> console.log(x)
debug num for num in [1, 2, 3]
# coffee test.coffee
1
2
3
って表示されればOkay!
あとは、CoffeeScriptのサンプルを見てみましょう!
コンパイルするとjavascriptのソースが出力されます。
- ruby(やpython)が大好き
- "var"って書くのを忘れる
- "function"って綴り長げー
- "return"書きたくない
- "if"を一行で書きたい
という私にぴったり。ちなみに37 signalsも使っているらしいですね
下記は「centos 5.5」に動く環境を作成するまでの記録です(2011/1/3現在)
■node.jsのインストール(v8もインストールされるようです)
# wget http://nodejs.org/dist/node-v0.2.6.tar.gz
# tar zxvf node-v0.2.6.tar.gz
# cd node-v0.2.6
# ./configure
# make
(# make test)
# make install
centos5.xにはshasumコマンドが存在しないようので、make testでエラーが発生します。
http://groups.google.com/group/nodejs/browse_thread/thread/4f8290fc06baab3b?pli=1
の様な話があるので
# ln -s /usr/bin/sha1sum /usr/bin/shasum
としておけば、落ちたテストは通ります。
(上記を実行しても私の環境的に multicast はテストが通りません...)
■npm(the Node Package Manager)のインストール
# curl http://npmjs.org/install.sh | sh
# npm -v (確認)
0.2.13-3
危ないからrootで実行するなとか言われましたが「It worked」だそうなのでほっときました。
■coffee scriptのインストール
# npm install coffee-script
# coffee -v (確認)
CoffeeScript version 1.0.0
■とりあえず実行してみる
# vim test.coffee で下記のように記載
debug = (x) -> console.log(x)
debug num for num in [1, 2, 3]
# coffee test.coffee
1
2
3
って表示されればOkay!
あとは、CoffeeScriptのサンプルを見てみましょう!
ラベル:
coffeescript,
linux,
nodejs
登録:
投稿 (Atom)