Install Ruby__linux under Linux

Source: Internet
Author: User
Tags unpack nameserver
Ruby Installation for Linux systems

Ruby installation Package
Download Address: http://www.ruby-lang.org/en/downloads/
Ruby-1.8.6-p111.tar.gz
Unpack and install:
Tar-xvzf ruby-1.8.6-p111.tar.gz
CD ruby-1.8.6-p111
./configure-prefix=/opt/modules/ruby
Make
Make install
Operating system path PATH:
Export Path=/opt/modules/ruby/bin: $PATH

Rails Remote Installation:
Gem Download Address: http://rubyforge.org/projects/rubygems/
Unpack and install:
Tar xzvf rubygems-1.0.1.tgz
CD RUBYGEMS-1.0.1/
Ruby Setup.rb
Ruby/bin/gem Install Rails--remote
Mysql_ruby driver Installation
Download Address: http://www.tmtm.org/en/mysql/ruby/
Unpack and install:
Tar-xvzf mysql-ruby-2.7.4.tar.gz
CD mysql-ruby-2.7.4
Ruby Extconf.rb--with-mysql-dir=/opt/modules/mysql/
Make && make install
FAST-CGI Installation:
Download Address: http://www.fastcgi.com/dist/
Unpack and install:
Tar xzvf fcgi-2.4.0.tar.gz
CD fcgi-2.4.0
./configure--prefix=/opt/modules/fcgi
Make && make install
Install Ruby's fcgi support library:
Tar xzvf ruby-fcgi-0.8.7.tar.gz
CD ruby-fcgi-0.8.7
Ruby install.rb config----with-fcgi-include=/opt/modules/fcgi/include--with-fcgi-lib=/opt/modules/fcgi/lib
Ruby INSTALL.RB Setup
Ruby Install.rb Install

LIGHTTPD Installation:
Download Address: http://www.lighttpd.net/download/
Note: Check the Linux pcre before installing, the default installation of Pcre-4.5-3.2.rhel4 in Redhat, this version does not support LIGHTTPD.
Two additional rpm,grep-2.5.1-32.2.i386.rpm and pcre-devel-4.5-3.2.sel4.i386.rpm must be downloaded,
Download Address: http://scientificlinux.physik.uni-muenchen.de/mirror/scientific/43/i386/errata/fastbugs/RPMS/grep-2.5.1-32.2.i386.rpm
Download Address: ftp://ftp.pbone.net/mirror/www.startcom.org/AS-4.0.0/os/i386/StartCom/RPMS/pcre-devel-4.5-3.2.SEL4.i386.rpm

The installation command is: RPM-IVH RPM package Name

Unpack and install:
Tar xzvf lighttpd-1.4.18.tar.gz
./configure--PREFIX=/OPT/MODULES/LIGHTTPD
Make && make install

Configuration environment:
1. Put the LIGHTTPD configuration file into the/etc/lighttpd/
CP DOC/SYSCONFIG.LIGHTTPD/ETC/SYSCONFIG/LIGHTTPD
Mkdir/etc/lighttpd
CP doc/lighttpd.conf/etc/lighttpd/lighttpd.conf

2. Put the boot file of the startup server into the user's directory
CP DOC/RC.LIGHTTPD.REDHAT/ETC/INIT.D/LIGHTTPD
Edit this file:
Lighttpd_bin=/usr/sbin/lighttpd
To
Lighttpd_bin=/usr/local/lighttpd/sbin/lighttpd

You want the server to start lighttpd when it starts, then:
Chkconfig lighttpd on


Configure LIGHTTPD

Modify/etc/lighttpd/lighttpd.conf

1) server.modules
Uncomment the module that needs to be used, and mod_rewrite,mod_access,mod_fastcgi,mod_simple_vhost,mod_cgi,mod_compress,mod_accesslog is generally needed.

2) Server.document-root, server.error-log,accesslog.filename need to specify the appropriate directory

3 What permissions to use to run LIGHTTPD, the default will be run using the root user.
Server.username = "Nobody"
Server.groupname = "Nobody"
From a security standpoint, it is not recommended to run Web server with root permissions, and you can specify normal user rights yourself.

4) Static file compression
Compress.cache-dir = "/tmp/lighttpd/cache/compress"
Compress.filetype = ("Text/plain", "text/html", "Text/javascript", "Text/css")
You can specify that some static resource types use compression to save bandwidth, which can greatly improve page loading speed for a large number of AJAX applications.

Some problems encountered during installation: (Installation of Fan)
1. During the installation of rails, the installation was unsuccessful because of the need to install rails remotely
Command prompt:
Error:while Executing gem ... (Gem::remotefetcher::fetcherror)
Getaddrinfo:temporary failure in name resolution (SOCKETERROR)
Getting size of http://gems.rubyforge.org/Marshal.4.8
The reason is that this server does not have DNS set up and cannot access the network externally.
Workaround:
#>vi/etc/resolv.conf
NameServer 202.106.46.151
NameServer 202.106.196.115
NameServer 211.98.2.4
NameServer 211.98.4.1
2. When installing LIGHTTPD, because the original PCRE package does not support this service, you need to install a Linux kernel pack pcre-devel-4.5-3.2.sel4.i386.rpm,
However, it is not installed properly.
Command prompt:
Warning:pcre-devel-4.5-3.2.sel4.i386.rpm:v3 DSA Signature:nokey, key ID 652E84DC
error:failed dependencies:
Pcre = 4.5-3.2.sel4 is needed by pcre-devel-4.5-3.2.sel4.i386

The reason is that this installation package cannot be installed directly, and another grep RPM package must be installed for normal installation.
Workaround:
#>rpm-ivh grep-2.5.1-32.2.i386.rpm
#>rpm-ivh pcre-devel-4.5-3.2.sel4.i386.rpm

3.LIGHTTPD configuration, the service does not start properly, the start step is as follows:
#>/etc/init.d/lighttpd status
Command prompt:
Lighttpd dead but PID file exists
In the configuration process because the contents of the configuration file is not very familiar, so have to take the configuration can be run compared to, after debugging found that there are several needs to adjust,
1) server.pid-file = "/var/run/lighttpd.pid"
Here is the current project runtime PID;
2) Compress.cache-dir = "/opt/modules/lighttpd/compress"
The directory required to be built manually, otherwise the load will fail.
3) Fastcgi.server = (
". fcgi" => (
"Rails" => (
"Socket" => "/tmp/lighttpd/socket/rails.socket",
"Bin-path" => "/opt/pptv-data/pptvcms/public/dispatch.fcgi",
"Bin-environment" => ("rails_env" => "development"),
"Min-procs" => 10,
"Max-procs" => 10
)
)
)
The above code is the path of the project to which the service is added. This project starts 10 processes and establishes 10 rails.socket to ensure that the directory where the socket is established exists.
The physical address of the project is correct (/opt/pptv-data/pptvcms/public/dispatch.fcgi).
4) Index-file.names = ("dispatch.fcgi", "index.php", "index.html", "index.htm", "default.htm")
Add "dispatch.fcgi" as the access page.
5 See if the first line in the corresponding public/dispatch.fcgi of the project is the Ruby installation path for the current server.
Ruby Installation path:/opt/modules/ruby
The first line in dispatch.fcgi: #!/opt/modules/ruby/bin/ruby
The files that need to be modified include: dispatch.cgi,dispatch.rb,dispatch.fcgi

4 LIGHTTPD is properly configured, the service starts normally, and the project is not properly accessed:
Command prompt:
Error access number 500, page does not exist,
The reason for the problem is that you need to specify the version number of rails in the environment.rb file.
Such as:
rails_gem_version = ' 1.2.6 ' unless defined? Rails_gem_version
The view version found that the rails version was 2.0.2, and because of the 1.2.6 version that was used at development time, you need to uninstall the current 2.0.2 version and install the 1.2.6 version.
Workaround:
Gem Uninstall Rails
Gem install Rails--version ' =1.2.6 '
Restart the service and everything OK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.