gentoo linux 上配置ruby on rails 3生产环境的过程记录
' 110503的模拟环境的安装笔记
# emacs /etc/make.conf
CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
USE="mmx sse sse2
jpeg gif tiff png cairo
fbcondecor subversion xcb glitz svg
hal mysql imap libwww maildir sasl ssl"
# oci8-instant-client oracle
LINGUAS="zh_CN zh"
ACCEPT_LICENSE="*"
GENTOO_MIRRORS="http://mirrors.sohu.com/gentoo/"
# emerge --sync
# emerge -av portage
# eix-update
# env-update && source /etc/profile
# emerge -av emacs vim lrzsz gentoolkit eix ufed genlop euses portage-utils dbus rar unrar unzip lvm2 netkit-telnetd nfs-utils app-admin/sudo
# USE="-dso" emerge -av dev-vcs/git
# rc-update add rpc.statd default
# emerge -av mysql
# emerge --config =dev-db/mysql-5.1.51
# /etc/init.d/mysql start
# rc-update add mysql default
# USE="gnutls" emerge -av curl
# NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi geo gzip limit_req limit_zone map memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi passenger stub_status" USE="vim-syntax" emerge -av nginx
# emacs /etc/nginx/fastcgi_params
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
其实如果是你包含fastcgi.conf的话 就不需要加这一样了
# USE="threads mysql apache2 curl" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias proxy proxy_connect proxy_http proxy_balancer" emerge -av apache
# USE="threads mysql apache2 curl crypt cgi ctype fpm pcre session xmlwriter xsl bcmath calendar sqlite3 force-cgi-redirect soap mhash unicode xml json ftp sqlite gd truetype xmlreader xmlrpc zip" emerge -av php
# cd /usr/share/doc/php-5.3.6/
# bzip2 -d php.ini-production.bz2
# cp php.ini-production /etc/php/
# emacs /etc/php/fpm-php5.3/php.ini
post_max_size =8M
file_uploads = On
upload_tmp_dir = "/tmp"
upload_max_filesize =8M
memory_limit = 256M
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server
这里还要改端口
# emacs /etc/php/fpm-php5.3/php-fpm.conf
user = www-data
group = www-data
listen = 127.0.0.1:12280
pm.start_servers = 5
# emacs /etc/nginx/fastcgi_params
加上
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# USE="threads mysql apache2 curl crypt ctype pcre session unicode xml json ftp sqlite gd truetype xmlreader xmlrpc zip" emerge -av phpmyadmin
如果没有安装解压phpmyadmin
# /usr/sbin/webapp-config -I -h localhost -u root -d /phpmyadmin phpmyadmin 3.3.8.1
安装ruby187 rubygems172
# ./configure --prefix=/opt/ruby187
# make && make install
# cd rubygems-1.7.2
# RUBYOPT=""
# /opt/ruby187/bin/ruby setup.rb
安装最新的rails
# /opt/ruby187/bin/gem install rails
安装mysql sqlite的lib
# /opt/ruby187/bin/gem install mysql
# /opt/ruby187/bin/gem install sqlite3-ruby
# /opt/ruby187/bin/gem install sqlite3
新建一个项目来完成余下的安装
# /opt/ruby187/bin/rails new blog -d mysql
# cd blog/
# /opt/ruby187/bin/bundle install
# 安装passenger
# /opt/ruby187/bin/gem install passenger
# /opt/ruby187/bin/passenger-install-nginx-module
/opt/ruby187/lib/ruby/gems/1.8/gems/passenger-3.0.7/
/opt/ruby187/bin/ruby
# groupadd www-data
# useradd -g www-data -m www-data
# mkdir -p /app/www/www.domain.com/htdocs
# chown -R www-data.www-data /app/
/opt/nginx/sbin/nginx
#####################################################################################################################
#-#beigin#-#并没有安装的
#####################################################################################################################
# USE="X jpeg png tiff svg jpeg2k" emerge -av imagemagick
# emacs /etc/conf.d/git-daemon
GITDAEMON_OPTS="--syslog –enable=upload-pack –enable=upload-archive --enable=receive-pack --export-all --base-path=/opt/git /opt/git"
#chown nobody.nobody /opt/git
#####################################################################################################################
#-#end#-#并没有安装的
#####################################################################################################################