2013年7月10日水曜日

chef knife-solo インストール

$sudo gem install knife-solo --pre

Successfully installed knife-solo-0.3.0.pre5
1 gem installed

成功

2013年7月9日火曜日

vagrant 設定

$vagrant init
$vi Vagrantfile
$ diff Vagrantfile Vagrantfile.org
112,116d111
< Vagrant::Config.run do |config|
< config.vm.box = "base"
< config.vm.network:hostonly,
< "192.168.50.12"
< end

$vagrant up
#ログインする
$vagrant ssh

成功

vagrant install

chefを利用するためにvagrantをインストールする

Mac OS X 10.7.5

$sudo gem install vagrant
$vagrant box add base http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130427.box

Failed to untar the box file. This is usually because you're
attempting to add a box that isn't a valid box file. Please
double check that the box file is properly packaged.

error
#vagrantのヴァージョンを確認
$ vagrant -v
Vagrant version 1.0.7

調べた
http://nushu123.blogspot.jp/2013/06/vagrant-box-addfailed-to-untar-box.html
https://github.com/mitchellh/vagrant/issues/977

VAGRANT_HOME??

$VAGRANT_HOME=/vagrant/path
$export VARGRANT_HOME
もう一回実行
Failed to untar the box file. This is usually because you're
attempting to add a box that isn't a valid box file. Please
double check that the box file is properly packaged.
同じエラー

http://zakuni.blogspot.jp/2013/06/macvagrant.html
http://docs.vagrantup.com/v2/installation/

------

Gem Install?

Vagrant 1.0.x had the option to be installed as a RubyGem. This installation method has been removed for installers and packages only.
------
アンインストール
$sudo gem uninstall vagrant

vagrant 再インストール
http://downloads.vagrantup.com/tags/v1.2.2/
Vagrant-1.2.2.dmg
インストール

$ which vagrant
/usr/bin/vagrant

$ vagrant -v
Vagrant version 1.2.2

再度実行
Successfully added box 'base' with provider 'virtualbox'!
成功

2013年6月26日水曜日

codeIgniter インストール

$wget http://ellislab.com/codeigniter/download
$unzip CodeIgniter_2.1.3.zip

$mv CodeIgniter_2.1.3 webapp

$cd webapp
$mkdir htdocs

apacheのDocumentRootをhtdocsにする

#systemとapplicationのパスを変更
vi index.php
$ diff index.php index.php.org
59c59
<       $system_path = '../system';
---
>       $system_path = 'system';
75c75
<       $application_folder = '../application';
---
>       $application_folder = 'application';

httpd.confの設定
<IfModule rewrite_module>
    RewriteEngine On
    RewriteCond $1 !^/(index\.php|images/js/css/robot\.txt|favicon\.ico)
    RewriteRule ^(.*)$ /index.php$1 [R,L]
</IfModule>


2013年6月21日金曜日

PNP4 install

PNP4 install

$wget http://sourceforge.net/projects/pnp4nagios/files/latest/download
$ tar -zxmf pnp4nagios-0.6.21.tar.gz
$cd pnp4nagios-0.6.21/
$ ./configure \
> --prefix=/usr/local/nagios/pnp4nagios \
> --with-nagios-user=nagios\
> --with-nagios-group=nagios \
> --with-httpd-conf=/home/httpd/conf

-----
configure: error:  is a directory! PNP needs the Path to the rrdtool binary!
-----
#yum -y install rrdtool

retry

$make all
#make install
#make install-webconf
#make install-config
#make install-init

cd /usr/local/nagios/pnp4nagios/etc
#for file in *.cfg-sample; do mv -i $file `echo $file|sed "s/-sample//g"`; done



2013年6月20日木曜日

nrpe インストール

nrpe インストール

$wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz

$tar -zxmf nrpe-2.14.tar.gz
$cd nrpe-2.14
$./configure --with-nrpe-user=nagios --with-nrpe-group=nagios
$make
#make install
#cp init-script /etc/init.d/nrpe
#cp sample-config/nrpe.cfg /usr/local/nagios/etc/nrpe.cfg
#chmod 755 /etc/init.d/nrpe
# chkconfig --add nrpe
# chkconfig --list | grep nrpe

nrpe            0:off   1:off   2:on    3:on    4:on    5:on    6:off

nagios plugin インストール

nagios plugin インストール

wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz
tar -zxmf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
su make install

2013年6月18日火曜日

apache mod_cgi install

mod_cgiがはいっていなかったためインストールした。

$sudo -s
#cd /httpd-source-path/modules/generators
#/home/httpd/bin/apxs -i -a -c ./mod_cgi.c
#cd /home/httpd/modules
# ls -al mod_cgi.so
-rwxr-xr-x 1 root root 59202  6月 17 23:57 mod_cgi.so

成功

あとは、httpd.confのLoadModuleを追加して、再起動すればOK

Nagios インストール

Nagios インストール

参考

http://centossrv.com/nagios.shtml
http://www.nagios.org/
http://www.momo-i.org/chapter5/nagios/3.x.html
http://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf

# yum -y install gd-devel
# useradd nagios
# passwd nagios

最新版ダウンロード
nagios-3.4.3
http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.4.3/

$wget http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.4.3/nagios-3.4.3.tar.gz

$tar -zxmf nagios-3.4.3.tar.gz
$wget http://ftp.momo-i.org/pub/other/nagios-jp-3.5.0.patch.gz
$gzip -dc nagios-jp-3.5.0.patch.gz | patch -p1
$./configure

*** Configuration summary for nagios 3.5.0 03-15-2013 ***:

 General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagios
            Embedded Perl:  no
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
                Lock file:  ${prefix}/var/nagios.lock
   Check result directory:  ${prefix}/var/spool/checkresults
           Init directory:  /etc/rc.d/init.d
  Apache conf.d directory:  /etc/httpd/conf.d
             Mail program:  /bin/mail
                  Host OS:  linux-gnu

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):  /bin/traceroute


Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

$make all

*** Compile finished ***

If the main program and CGIs compiled without any errors, you
can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):

  make install
     - This installs the main program, CGIs, and HTML files

  make install-init
     - This installs the init script in /etc/rc.d/init.d

  make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

  make install-config
     - This installs *SAMPLE* config files in /usr/local/nagios/etc
       You'll have to modify these sample files before you can
       use Nagios.  Read the HTML documentation for more info
       on doing this.  Pay particular attention to the docs on
       object configuration files, as they determine what/how
       things get monitored!

  make install-webconf
     - This installs the Apache config file for the Nagios
       web interface

  make install-exfoliation
     - This installs the Exfoliation theme for the Nagios
       web interface

  make install-classicui
     - This installs the classic theme for the Nagios
       web interface


*** Support Notes *******************************************

If you have questions about configuring or running Nagios,
please make sure that you:

     - Look at the sample config files
     - Read the documentation on the Nagios Library at:
           http://library.nagios.com

before you post a question to one of the mailing lists.
Also make sure to include pertinent information that could
help others help you.  This might include:

     - What version of Nagios you are using
     - What version of the plugins you are using
     - Relevant snippets from your config files
     - Relevant error messages from the Nagios log file

For more information on obtaining support for Nagios, visit:

       http://support.nagios.com

*************************************************************

Enjoy.

# make install && make install-init && make install-commandmode && make install-config

#cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
#chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers/

# pwd
/usr/local/nagios/etc
# diff nagios.cfg nagios.cfg.org
52c52
< cfg_dir=/usr/local/nagios/etc/servers
---
> #cfg_dir=/usr/local/nagios/etc/servers
1115c1115
< date_format=iso8601
---
> date_format=us

#mkdir /usr/local/nagios/etc/servers
#cd /usr/local/nagios/etc/servers

# cat contacts.cfg
define contact{
        contact_name    nagiosadmin
        use             generic-contact
        alias           Nagios Admin

        email           email@example.com
}

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

エラーがでなかったらOK

vimの更新

vimの更新

参考
http://nob-log.info/2012/01/20/vim-install-use-mercurial/
http://www.limemo.net/blog/2012/03/yum-segmentation-fault.html
http://serverfault.com/questions/256385/yum-segmentation-fault-in-centos

#yum remove -y vim-enhanced

#yum install -y python-devel python-setuptools easy_install mercurial

⇒セグメンテーション違反ですエラー


ソースからインストールしたzlibをアンインストール
#cd /source/dir/zlib-*.*.*
#make uninstall

インストールできた。

# cd /usr/local/src/
# hg clone https://vim.googlecode.com/hg vim
# cd vim
./configure \
--with-features=huge \
--enable-multibyte \
--enable-rubyinterp \
--enable-pythoninterp \
--enable-perlinterp \
--enable-gpm \
--enable-cscope \
--enable-fontset

#make
#make test
#make install

なぜvimをアップデートしようかと考えたのは、
syntasticを使おうと思いインストールしたが、
vimを開くと
-------------------------
function <SNR>21_BufWinEnterHook..20..21 の処理中にエラーが検出されました:
行    1:
E117: 未知の関数です: getmatches

E15: 無効な式です: getmatches()
-------------------------
のエラーが出たから。

http://bugrammer.g.hatena.ne.jp/nisemono_san/20130618/1371491115
https://pypi.python.org/pypi/pyflakes

2013年6月11日火曜日

gem mysql2 インストールエラー

railsでmysqlを使おうと思い、mysql2をgemで設定

bundle install

----mysql2でエラー
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby
        --with-mysql-config
        --without-mysql-config


Gem files will remain installed in /home/rails/.bundler/tmp/5253/gems/mysql2-0.3.11 for inspection.
Results logged to /home/rails/.bundler/tmp/5253/gems/mysql2-0.3.11/ext/mysql2/gem_make.out

An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
-----------------------------

mysql.hが読み込まれない

mysql.hのファイルの場所は
/usr/local/mysql/include/mysql.h
なので、includeを設定


-----------err----------------------
# gem install mysql2 -- --with-opt-include=/usr/local/mysql/include
Building native extensions with: '--with-opt-include=/usr/local/mysql/include'
This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb --with-opt-include=/usr/local/mysql/include
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile

make
compiling result.c
./mysql2_ext.h:39 から include されたファイル中,
                 result.c:1 から:
./client.h:42:7: 警告: ファイル末尾に改行がありません
result.c: In function ‘rb_mysql_result_fetch_row’:
result.c:186: 警告: ‘rb_thread_blocking_region’ is deprecated (declared at /usr/local/include/ruby-2.0.0/ruby/intern.h:835)
result.c: In function ‘rb_mysql_result_fetch_fields’:
result.c:381: 警告: 符合付きと符合無しとの比較です
compiling client.c
./mysql2_ext.h:39 から include されたファイル中,
                 client.c:1 から:
./client.h:42:7: 警告: ファイル末尾に改行がありません
client.c: In function ‘rb_raise_mysql2_error’:
client.c:98: 警告: ISO C90 forbids mixed declarations and code
client.c: In function ‘rb_connect’:
client.c:215: 警告: ‘rb_thread_blocking_region’ is deprecated (declared at /usr/local/include/ruby-2.0.0/ruby/intern.h:835)
client.c:219: 警告: ‘rb_thread_blocking_region’ is deprecated (declared at /usr/local/include/ruby-2.0.0/ruby/intern.h:835)
client.c: In function ‘rb_mysql_client_close’:
client.c:238: 警告: ‘rb_thread_blocking_region’ is deprecated (declared at /usr/local/include/ruby-2.0.0/ruby/intern.h:835)
client.c: In function ‘do_send_query’:
client.c:261: 警告: ‘rb_thread_blocking_region’ is deprecated (declared at /usr/local/include/ruby-2.0.0/ruby/intern.h:835)
client.c: In function ‘rb_mysql_client_async_result’:
client.c:309: 警告: ‘rb_thread_blocking_region’ is deprecated (declared at /usr/local/include/ruby-2.0.0/ruby/intern.h:835)
client.c:315: 警告: ‘rb_thread_blocking_region’ is deprecated (declared at /usr/local/include/ruby-2.0.0/ruby/intern.h:835)
client.c: In function ‘rb_mysql_client_socket’:
client.c:590: 警告: ISO C90 forbids mixed declarations and code
client.c: In function ‘rb_mysql_client_ping’:
client.c:636: 警告: ‘rb_thread_blocking_region’ is deprecated (declared at /usr/local/include/ruby-2.0.0/ruby/intern.h:835)
client.c: In function ‘init_connection’:
client.c:728: 警告: ‘rb_thread_blocking_region’ is deprecated (declared at /usr/local/include/ruby-2.0.0/ruby/intern.h:835)
compiling mysql2_ext.c
./mysql2_ext.h:39 から include されたファイル中,
                 mysql2_ext.c:1 から:
./client.h:42:7: 警告: ファイル末尾に改行がありません
linking shared-object mysql2/mysql2.so
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld はステータス 1 で終了しました
make: *** [mysql2.so] エラー 1


Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
-----------------------------
lib群も一緒に読み込ませた。

# gem install mysql2 -- --with-opt-include=/usr/local/mysql/include --with-opt-lib=/usr/local/mysql/lib
Building native extensions with: '--with-opt-include=/usr/local/mysql/include --with-opt-lib=/usr/local/mysql/lib'
This could take a while...
Successfully installed mysql2-0.3.11
Parsing documentation for mysql2-0.3.11
unable to convert "\xA0" from ASCII-8BIT to UTF-8 for lib/mysql2/mysql2.so, skipping
Installing ri documentation for mysql2-0.3.11
1 gem installed

成功


2013年3月29日金曜日

nginx install

nginx install

http://wiki.nginx.org/Install

# cd /etc/yum.repos.d/
# vi nginx.repo

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

# yum install nginx


# which nginx
/usr/sbin/nginx


php-fpm install

cd <phpソースディレクトリ>
$./configure --enable-fpm
$make
$make test
$su -
#make install

#cd /usr/local/etc/php-fpm.conf.default
#cp php-fpm.conf.default php-fpm.conf

#/usr/local/sbin/php-fpm

<br />
<b>Warning</b>:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-zts-20090626/curl.so' - /usr/local/lib/php/extensions/no-debug-zts-20090626/curl.so: undefined symbol: file_globals_id in <b>Unknown</b> on line <b>0</b><br />
<br />
<b>Warning</b>:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-zts-20090626/imagick.so' - /usr/local/lib/php/extensions/no-debug-zts-20090626/imagick.so: undefined symbol: core_globals_id in <b>Unknown</b> on line <b>0</b><br />

#warningが出た

#原因は調査中

ex) http://shiken.infrabu.info/nginx/nginx%E3%81%A8php-fpm%E3%81%AE%E7%B5%84%E3%81%BF%E5%90%88%E3%82%8F%E3%81%9B%E8%A8%AD%E5%AE%9A/



2013年3月19日火曜日

php pdo_mysql インストール

#pecl install pdo_mysql

checking for mysql_config... not found
configure: error: Cannot find MySQL header files under
ERROR: `/tmp/pear/temp/PDO_MYSQL/configure' failed

⇒headerファイルがないのでインストールできなかった。

ソースをダウンロード
$pecl download pdo_mysql
cd PDO_MYSQL-1.0.2
$ ./configure --with-pdo-mysql=shared,/usr/local/mysql
make 
make test
su 
make install

pdo_mysql.soが出来る
/usr/local/lib/php/extensions/no-debug-zts-20090626/

php.iniを修正
extension=pdo_mysql.so

phpindo()のPDOにmysqlが表示されていればOK

2013年3月9日土曜日

rails console エラー


$ rails console
/usr/local/lib/ruby/1.9.1/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /usr/local/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands/console.rb:3:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands/console.rb:3:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:38:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:38:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
#readlineがないのでinstallする
sudo yum install libreadline

#Gemfile編集
gem 'rb-readline' #を追加
$bundle install
Installing rb-readline (0.4.2)
#↑が出てくる
#もう一度
$rails console
#成功

Ruby on Rails をインストール

$gem install rails

Fetching: rails-3.2.12.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /usr/local/lib/ruby/gems/1.9.1 directory.
$sudo /usr/local/bin/gem install rails


Successfully installed rails-3.2.12
1 gem installed
Installing ri documentation for rails-3.2.12...
Installing RDoc documentation for rails-3.2.12...


$ gem which rails
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails.rb

$ rails -v
Rails 3.2.12
$rails new AppName
#AppNameが作成される
cd AppName
#動かしてみる
$rails start

/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
from /usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler.rb:132:in `require'
from /home/yoshioka/myBooks/config/application.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:53:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
#エラー。。
#autodetect が見つからない?
#https://github.com/sstephenson/execjs を見てみる
#README.md

Installation

$ gem install execjs
#試してみる
$gem install execjs
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /usr/local/lib/ruby/gems/1.9.1 directory.

$sudo /usr/local/bin/gem install execjs

Successfully installed execjs-1.4.0
1 gem installed
Installing ri documentation for execjs-1.4.0...
Installing RDoc documentation for execjs-1.4.0...
#もう一度実行してみる
$rails server
/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
#同じエラー
#Gemfileを編集した。

$ diff Gemfile Gemfile.20130309
18c18
<    gem 'therubyracer', :platforms => :ruby
---
>   # gem 'therubyracer', :platforms => :ruby






#再度実行

$ rails server
=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-03-09 11:41:51] INFO  WEBrick 1.3.1
[2013-03-09 11:41:51] INFO  ruby 1.9.3 (2011-10-30) [x86_64-linux]
[2013-03-09 11:41:51] INFO  WEBrick::HTTPServer#start: pid=5481 port=3000
#動いた


2013年2月23日土曜日

rubygem install

scp rubygems-1.8.25.tar yourserver:yourpath

yourserver login
cd yourserver
tar -xvmf rubygems-1.8.25.tar
cd rubygems-1.8.25

$ ruby setup.rb
/usr/local/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /usr/local/lib/ruby/site_ruby/1.9.1/rubygems

Permission denied だったので、
root権限でインストール
sudo /usr/local/bin/ruby setup.rb

インストールできた。
$which gem

/usr/local/bin/gem
$gem -v
/usr/local/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
1.8.25

??
errorが出てる 
調査中
exciteで翻訳した
-------------

/usr/local/lib/ruby/1.9.1/yaml.rb:56:「<トップ(必須)>'で:
あなたのルビー設置は見当たらない心理学(YAML出力用の)であるように見えます。
この警告を除去するために、libyamlをインストールして、ルビーを再インストールしてください。
1.8.25
----------------
libyamlがない??



$ yum list installed | grep yam
$
installされてない。

installする
#yum install libyaml libyaml-devel

$yum list installed | grep yam
libyaml.x86_64       0.1.3-1.el6        @epel                                
libyaml-devel.x86_64 0.1.3-1.el6        @epel


ruby 再インストール
#./configure --prefix=/usr/local
make
make test
sudo make install
error
------------

make install
CC = gcc
LD = ld
LDSHARED = gcc -shared
CFLAGS = -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS =   -I. -I.ext/include/x86_64-linux -I./include -I.
DLDFLAGS =
SOLIBS =
generating known_errors.inc
make: ruby: コマンドが見つかりませんでした
make: *** [known_errors.inc] エラー 127
------------
rubyコマンド確認

$ sudo which ruby
which: no ruby in (/sbin:/bin:/usr/sbin:/usr/bin)


なかったので、Makefikeを編集した

$ diff Makefile Makefile.bak
21c21
< BASERUBY = ruby
---
> BASERUBY = /usr/local/bin/ruby

改めて
$sudo make install

成功
gem も確認


$ gem -v
1.8.25
エラーが消えた 
成功





ruby install

http://rubyonrails.org/download
ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz

scp ruby-1.9.3-p0.tar yourserver:yourpath

server login
cd yourpath
tar -xvf ruby-1.9.3-p0.tar
cd ruby-1.9.3-p0
./configure
make
make test
sudo make install


$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

2013年2月12日火曜日

Webサーバー 再登録(suexec)

Webサーバー 再登録(suexec)

tar -zxmf httpd-2.4.3.tar.gz


tar -zxmf apr-1.4.6.tar.gz
tar -zxmf apr-util-1.5.1.tar.gz
tar -zxmf apr-iconv-1.2.1.tar.gz

mv apr-1.4.6 apr
mv apr-util-1.5.1 apr-util
mv apr-iconv-1.2.1 apr-iconv

mv apr apr-util apr-iconv httpd-2.4.3/srclib/


./configure \
--prefix=/home/httpd-2.4.3-suexec \
--enable-shared \
--enable-dav=yes \
--enable-ssl \
--with-ssl=/home/openssl-1.0.1c \
--enable-module=so \
--enable-rewrite \
--with-included-apr \
--enable-suexec \
--with-suexec-caller=www \
--with-suexec-userdir=public_html \
--with-suexec-docroot=/home \
--with-suexec-logfile=/home/httpd-suexec/logs/suexec_log \
--with-suexec-uidmin=500 \
--with-suexec-gidmin=100

make
sudo make install



2013年1月28日月曜日

apache mod_suexec install 失敗

apache mod_suexec install

開発環境にてヴァーチャルホストで、
ユーザー、グループの違うディレクトリを参照したいため
mod_suexecを利用したいと考えインストールする。

rootになる
$sudo -s
apacheをインストールしたディレクトリに移動
#cd httpd-2.4.3/modules
moduleを探す
find . -name '*suexec*'

./generators/mod_suexec.c
./generators/mod_suexec.h
モジュールファイルに移動
cd generators
モジュールインストール
/home/httpd/bin/apxs -i -a -c mod_suexec.c


----------------------------------------------------------------------

# /home/httpd/bin/apxs -i -a -c mod_suexec.c
/home/httpd-2.4.3/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic   -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/home/httpd-2.4.3/include  -I/home/httpd-2.4.3/include   -I/home/httpd-2.4.3/include   -c -o mod_suexec.lo mod_suexec.c && touch mod_suexec.slo
/home/httpd-2.4.3/build/libtool --silent --mode=link gcc -std=gnu99    -o mod_suexec.la  -rpath /home/httpd-2.4.3/modules -module -avoid-version    mod_suexec.lo
/home/httpd-2.4.3/build/instdso.sh SH_LIBTOOL='/home/httpd-2.4.3/build/libtool' mod_suexec.la /home/httpd-2.4.3/modules
/home/httpd-2.4.3/build/libtool --mode=install install mod_suexec.la /home/httpd-2.4.3/modules/
libtool: install: install .libs/mod_suexec.so /home/httpd-2.4.3/modules/mod_suexec.so
libtool: install: install .libs/mod_suexec.lai /home/httpd-2.4.3/modules/mod_suexec.la
libtool: install: install .libs/mod_suexec.a /home/httpd-2.4.3/modules/mod_suexec.a
libtool: install: chmod 644 /home/httpd-2.4.3/modules/mod_suexec.a
libtool: install: ranlib /home/httpd-2.4.3/modules/mod_suexec.a
libtool: finish: PATH="/sbin:/bin:/usr/sbin:/usr/bin:/sbin" ldconfig -n /home/httpd-2.4.3/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /home/httpd-2.4.3/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /home/httpd-2.4.3/modules/mod_suexec.so
[activating module `suexec' in /home/httpd-2.4.3/conf/httpd.conf]


インストールが出来たと思う。
確認のためdiffをとってみた

# diff httpd.conf httpd.conf.bak
146d145
< LoadModule suexec_module      modules/mod_suexec.so

成功

apacheの再起動
/home/httpd/apachectl restart

error、、、
SuexecUserGroup configured, but suEXEC is disabled: Missing suexec binary /home/httpd-2.4.3/bin/suexec

excite翻訳してみた。
-----------

形成されたSuexecUserGroup、しかし、suEXECは無効になります:
見当たらないsuexecの2進法の/home/httpd-2.4.3/ビン/suexec
------------

# ls -l /home/httpd-2.4.3/bin/suexec
ls: cannot access /home/httpd-2.4.3/bin/suexec: そのようなファイルやディレクトリはありません

suexecがない

調べてみたら、
デフォルトではsuexecはインストールされてないらしい。。

改めてapacheをインストールをしないといけないそうです。

参照
http://bitarts.jp/tech/linux/suexec.html


2013年1月4日金曜日

php インストール

php

freetype2
freetype-2.4.0.tar.gz
tar -zxmf freetype-2.4.0.tar.gz
cd freetype-2.4.0
./configure --enable-shared
make
sudo make install

libxml
ftp://xmlsoft.org/libxml2/
tar -zxmf libxml2-2.9.0.tar.gz
cd libxml2-2.9.0
./configure --enable-shared
make
sudo make install

zlib
http://sourceforge.net/projects/libpng/files/zlib/1.2.7/
tar -zxmf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure --enable-shared
make
sudo make install

libpng
tar -zxmf libpng-1.5.13.tar.gz
cd libpng-1.5.13
./configure --prefix=/usr/local
make
make test
sudo make install

jpeg
http://www.ijg.org/files/
tar -zxmf jpegsrc.v8d.tar.gz
cd jpeg-8d/
./configure --prefix=/usr/local
sudo make install

php
http://php.net/get/php-5.4.10.tar.gz/from/a/mirror
tar -zxmf php-5.4.10.tar.gz
cd php-5.4.10

./configure \
--with-apxs2=/home/httpd/bin/apxs \
--with-gd \
--with-jpeg-dir=/usr/local/lib \
--with-png-dir=/usr/local/lib \
--with-zlib-dir=/usr/local/lib \
--with-freetype-dir=/usr/local \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-mysql=/usr/local/mysql \
--enable-mbstring \
--enable-mbregex \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-mcrypt \
--disable-posix-threads

error
configure: error: mcrypt.h not found. Please reinstall libmcrypt.

yum -y install libmcrypt-devel

make
make test
sudo make install

インストール後に書かれていた内容のメモ
-------------

Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
/home/user/packages/php-5.4.10/build/shtool install -c ext/phar/phar.phar /usr/local/bin
ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar
Installing PDO headers:          /usr/local/include/php/ext/pdo/

--------------


cp php.ini-development /usr/local/lib/php.ini

/home/user/packages/php-5.4.10/build/shtool install -c ext/phar/phar.phar /usr/local/bin/




mysql インストール

mysql

http://www-jp.mysql.com/


sudo -s

サーバーのユーザー設定
groupadd mysql
useradd -g mysql mysql
passwd mysql
su - mysql
mkdir packages

サーバーにアップ
scp -P YourPort mysql-5.5.29.tar.gz user@host:~user/packages/

tar -zxmf mysql-5.5.29.tar.gz
cd mysql-5.5.29

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make
sudo make install

cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .

./scripts/mysql_install_db --user=mysql


# ./scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h hostname password 'new-password'

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!



cd /etc/
mv my.cnf my.cnf.org

cd /usr/local/mysql
cp -i support-files/my-large.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysql.server

./bin/mysqladmin -u root password '******'
./bin/mysqladmin -u root -h hostname password '******'

./bin/mysql_secure_installation