rbenv 㧠Ruby ã®åãæ¿ã
global 㨠local ã®ãªãã·ã§ã³ãç解ããã
- ãã¼ã¸ã§ã³ä¸è¦§
$ rbenv versions
system
1.8.7-p374
ï¼1.9.3-p448 (set by /usr/local/rbenv/version)
- ã·ã¹ãã å ¨ä½ã§ä½¿ç¨ãããã¼ã¸ã§ã³ãåãæ¿ãã(global)
$ rbenv global 1.8.7-p374
$ rbenv versions
system
ï¼1.8.7-p374 (set by /usr/local/rbenv/version)
1.9.3-p448
- ç¹å®ãã£ã¬ã¯ããªä»¥ä¸ã§ä½¿ç¨ãããã¼ã¸ã§ã³ãæå®ãã(local)
$ cd ~
$ mkdir local_dir
$ mkdir global_dir
$ cd local_dir/
$ rbenv local 1.9.3-p448
$ rbenv versions
system
1.8.7-p374
ï¼1.9.3-p448 (set by /home/user/local_dir/.ruby-version)
$ cd ../global_dir/
$ rbenv versions
system
ï¼1.8.7-p374 (set by /usr/local/rbenv/version)
1.9.3-p448
- localæå®ã解é¤ãã
$ cd ~
$ cd local_dir/
$ rbenv versions
system
1.8.7-p374
ï¼1.9.3-p448 (set by /home/user/local_dir/.ruby-version)
$ rbenv local --unset
$ rbenv versions
system
ï¼1.8.7-p374 (set by /usr/local/rbenv/version)
1.9.3-p448
rbenv ã¤ã³ã¹ãã¼ã«
ã¤ã³ã¹ãã¼ã«å
㯠ã·ã¹ãã ã¯ã¤ãã¨ã㦠/usr/local ã¨ããã
ã¾ããRubyå©ç¨è
ã staff ã°ã«ã¼ãã«å±ãã¦ãããã¨ãåæã«ãå
¨ã¦ã¼ã¶ã¸ç°å¢å¤æ°ãé©ç¨ããã
- rbenvã¤ã³ã¹ãã¼ã«
$ cd /usr/local
$ sudo git clone https://github.com/sstephenson/rbenv.git rbenv
$ /usr/local/rbenv/bin/rbenv
rbenv 0.4.0-67-g3300587
(snip)
$ sudo chgrp -R staff rbenv
$ sudo chmod -R g+rwxXs rbenv
- ç°å¢å¤æ°è¨å®
$ sudo vi /etc/profile.d/rbenv.sh
$ cat /etc/profile.d/rbenv.sh
# rbenv
export RBENV_ROOT="/usr/local/rbenv"
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"
- åãã°ã¤ã³
- ruby-build ã¤ã³ã¹ãã¼ã«
$ mkdir /usr/local/rbenv/plugins
$ cd /usr/local/rbenv/plugins
$ git clone git://github.com/sstephenson/ruby-build.git
$ chgrp -R staff ruby-build
$ chmod -R g+rwxs ruby-build
- rbenv install 確èª
$ rbenv install
Usage: rbenv install [-f|--force] [-k|--keep] [-v|--verbose]
rbenv install [-f|--force] [-k|--keep] [-v|--verbose]
rbenv install -l|--list
(snip)
- ã¤ã³ã¹ãã¼ã«å¯è½ãªä¸è¦§
$ rbenv install -l
Available versions:
1.8.6-p383
(snip)
- rubyã¤ã³ã¹ãã¼ã«
$ rbenv versions
ï¼ system (set by /usr/local/rbenv/version)
$ rbenv install 1.8.7-p374
$ rbenv install 1.9.3-p448
- åæ
$ rbenv rehash
- ã¤ã³ã¹ãã¼ã«ãããã®ã確èª
$ rbenv versions
ï¼ system (set by /usr/local/rbenv/version)
1.8.7-p374
1.9.3-p448
- å©ç¨ãããã¼ã¸ã§ã³ãæå®
$ rbenv global 1.9.3-p448
$ rbenv versions
system
1.8.7-p374
ï¼1.9.3-p448 (set by /usr/local/rbenv/version)
$ ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [i686-linux]
åè
èªä½ã³ã³ãã¼ãã³ãã§ã»ãã·ã§ã³ã³ã³ãã¼ãã³ããnon-obj
CakePHP2.2.5 ã§èªä½ã³ã³ãã¼ãã³ãä¸ã§ã»ãã·ã§ã³ã³ã³ãã¼ãã³ãã使ããã¨ãã¦ã¨ã©ã¼ãèµ·ãã¾ããã
PHP message: PHP Fatal error: Call to a member function check() on a non-object in
åå ã¯èªä½ã³ã³ãã¼ãã³ãã®ã³ã³ã¹ãã©ã¯ã¿å
ã§è¦ªã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ãå¼ã³åºãã¦ããªãããã§ãããã
public function __construct ($request, $response) { parent::__construct($request, $response);# ããå¤§äº }
ã¯ããã¦ã® node.js
CentOSä¸ã§ node.js ã触ã£ãè¨é²ã§ãã
â node.js(以ä¸ãnode) ã¨ã¯
ãµã¼ããµã¤ãJavaScript
ãã³ããããã³ã°I/Oã¨ã¤ãã³ãã«ã¼ããç¹å¾´
â ç°å¢
CentOS 6.0 on VMWare
â node ã¤ã³ã¹ãã¼ã«
$ cd /usr/local/src $ wget http://nodejs.org/dist/v0.8.6/node-v0.8.6.tar.gz $ tar xvfz node-v0.8.6.tar.gz $ cd node-v0.8.6 $ ./configure $ make $ sudo make install $ make clean <|| éä¸ g++ ãå¿ è¦ã ã£ãã®ã§ã¤ã³ã¹ãã¼ã«ãã¦ãã >|| $ sudo yum install gcc-c++.i686
â ããã±ã¼ã¸ç®¡çãã¼ã« npm
node ãã¤ã³ã¹ãã¼ã«ããã¨ãä¸ç·ã«æ¨æºã§ã¤ã³ã¹ãã¼ã«ãããã
ã»ã¤ã³ã¹ãã¼ã«ï¼ ã°ãã¼ãã«
$ sudo npm install -g ããã±ã¼ã¸å
npm ã®ã¤ã³ã¹ãã¼ã«å ´æã«ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãã
ã¤ã³ã¹ãã¼ã«å
/usr/local/lib/node_modules/ããã±ã¼ã¸å
ã»ã¤ã³ã¹ãã¼ã«ï¼ ãã¼ã«ã«
$ sudo npm install ããã±ã¼ã¸å
ã«ã¬ã³ããã£ã¬ã¯ããªã«ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãã
ã»ã¤ã³ã¹ãã¼ã«æ¸ã¿ä¸è¦§ã®ç¢ºèª
$ npm list [-g]
ã»ããã±ã¼ã¸ã®ã¢ãããã¼ã
$ npm update [-g]
â Webã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯(express)ã®ã¤ã³ã¹ãã¼ã«
$ sudo npm install -g express
â ã¢ããªã±ã¼ã·ã§ã³ä½æ
ã¢ããªã±ã¼ã·ã§ã³ä½æå
ã®ãã£ã¬ã¯ããªç¨æ
$ cd /usr/local/ $ sudo mkdir node-apps $ sudo chown ringio:ringio node-apps $ cd node-apps
ã¢ããªã±ã¼ã·ã§ã³ä½æ
$ express firstapp create : firstapp create : firstapp/package.json create : firstapp/app.js create : firstapp/public create : firstapp/public/javascripts create : firstapp/public/images create : firstapp/public/stylesheets create : firstapp/public/stylesheets/style.css create : firstapp/routes create : firstapp/routes/index.js create : firstapp/views create : firstapp/views/layout.jade create : firstapp/views/index.jade install dependencies: $ cd firstapp && npm install run the app: $ node app $ cd firstapp $ sudo npm link express jade
nodeèµ·å
$ node app
ãã©ã¦ã¶ããã¢ã¯ã»ã¹ç¢ºèª
http://localhost:3000/
nodeåæ¢
node app.js ã®ã³ã³ã½ã¼ã«ã Ctl + c
â åè
http://gihyo.jp/dev/serial/01/nodejs
http://d.hatena.ne.jp/ruedap/20110620/node_js_express_app_generate
nginx ã yum ã§ã¤ã³ã¹ãã¼ã«ãã
yum ã« nginx ç¨ã® Repository ã追å ãã
$ sudo vi /etc/yum.repos.d/nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/6/$basearch/ gpgcheck=0 enabled=1
ã¤ã³ã¹ãã¼ã«
$ sudo yum install -y nginx
èµ·å
$ sudo nginx $ ps -ef | grep nginx | grep -v grep root 2360 1 0 06:58 ? 00:00:00 nginx: master process nginx nginx 2361 2360 0 06:58 ? 00:00:00 nginx: worker process
åæ¢
$ sudo nginx -s stop $ ps -ef | grep nginx | grep -v grep
åè
nginx + php-fpm 㧠PHP ãåãã
nginx ã®ã¤ã³ã¹ãã¼ã«ã¯コチラ
次ã«ãphp-fpmãã¤ã³ã¹ãã¼ã«ãã
ã¾ã㯠remi Repository ã追å ãã
$ sudo rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi $ wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm $ wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm $ sudo rpm -ivh remi-release-6.rpm epel-release-6-7.noarch.rpm
php é¢é£ãã¤ã³ã¹ãã¼ã«ãã
$ sudo yum --enablerepo=remi install php php-fpm php-devel php-cli php-xml php-mysql php-mbstring php-gd $ php-fpm -v PHP 5.3.15 (fpm-fcgi) (built: Jul 20 2012 12:53:18) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologi
php-fpm ãèµ·åãã
$ sudo /etc/init.d/php-fpm start
nginx ã®è¨å®ãã¡ã¤ã«ãç·¨éãã
$ cd /etc/nginx/conf.d $ sudo cp default.conf default.conf.org $ sudo vi default.conf
- default.conf
server { listen 80 default_server; server_name localhost; #charset koi8-r; charset utf-8; #access_log /var/log/nginx/log/host.access.log main; location / { root /usr/share/nginx/html; index index.php index.html index.htm; } location = /robots.txt { access_log off; log_not_found off; } location = /favicon.ico { access_log off; log_not_found off; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
nginx ãåèµ·åãã
$ sudo /etc/init.d/nginx restart
nginxãSSLä»ãã§ã¤ã³ã¹ãã¼ã«ããã
ã¤ã³ã¹ãã¼ã«
$ wget http://nginx.org/download/nginx-1.3.3.tar.gz $ tar xvfz nginx-1.3.3.tar.gz $ cd nginx-1.3.3 $ sudo yum install pcre pcre-devel openssl openssl-devel $ ./configure \ --prefix=/usr/local/nginx-1.3.3 \ --with-http_ssl_module \ --with-pcre (snip) Configuration summary + using system PCRE library + using system OpenSSL library + md5: using OpenSSL library + sha1: using OpenSSL library + using system zlib library (snip) $ make $ sudo make install $ make clean
èµ·å
$ sudo /usr/local/nginx/sbin/nginx
åæ¢
$ sudo /usr/local/nginx/sbin/nginx -s stop
- åèãµã¤ã