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

成功