How to configure installation and ROR applications for Ubuntu Apache
Editor to share with you how to configure Ubuntu Apache installation and ROR applications, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
I am using the Ubuntu Apache-alternate 8.04 command line installation mode, and the following script is suitable for debian distributions and is theoretically incompatible with RedHat distributions. For convenience, I will install the ROR environment by writing a SHELL script that can be executed directly to easily install the ROR environment. The RAILS version used here is 2.0.2.
Execute the script using the sudo prefix:
Install_ror.sh-Copy codewords bind Bash INSTALL_HOME=~/ror_installer if [- d "$INSTALL_HOME"]; then echo INSTALL_HOME directory\ "~ / ror_installer\" already exist. Exit 1 fi mkdir $INSTALL_HOME pushd $INSTALL_HOME # Download files apt-get-d-y install\ ruby libruby-extras\ libyaml-ruby libzlib-ruby libiconv-ruby libxml-ruby\ libdbi-ruby\ libmysql-ruby libdbd-mysql-ruby libdbd-sqlite3-ruby\ libfcgi-ruby1.8wget-T0-T15 http://rubyforge.org/download.php/35283/rubygems-1.1.1.tgz wget-T0-T15 http://rubyforge.org/download.php/29353/actionmailer-2. 0.2.gem wget-t0-T15 http://rubyforge.org/download.php/29350/actionpack-2.0.2.gem wget-t0-T15 http://rubyforge.org/download.php/29551/activerecord-2.0.2.gem wget-t0-T15 http://rubyforge.org/download.php/29552/activeresource-2.0.2.gem wget-t0-T15 http://rubyforge.org/download.php/29553/activesupport-2.0.2.gem wget-t0 -T15 http://rubyforge.org/download.php/29554/rails-2.0.2.gem wget-T0-T15 http://rubyforge.org/download.php/29751/rake-0.8.1.gem# Install ruby apt-get-y install\ ruby libruby-extras\ libyaml-ruby libzlib-ruby libiconv-ruby libxml-ruby\ libdbi-ruby\ libmysql-ruby libdbd-mysql-ruby libdbd-sqlite3-ruby\ libfcgi-ruby1.8 # Install rubygems tar xfv rubygems-1.1 .1.tgz pushd rubygems-1.1.1 ruby setup.rb ln-s / usr/bin/gem1.8 / usr/bin/gem popd # Install Gem gem install rails-l-no-ri-no-rdoc # Clean popd rm-rf $INSTALL_HOME
2) install Ubuntu Apache
For the same SHELL script installation, execute the script using the sudo prefix:
Install_Ubuntu Apache2.sh-Copy codewords binding Bash # Download files apt-get-d-y install Ubuntu Apache2 libUbuntu Apache2-mod-fcgid # Install Ubuntu Apache apt-get-y install Ubuntu Apache2 libUbuntu Apache2-mod-fcgid ln-s / etc/Ubuntu Apache2/mods-available/rewrite.load / etc/Ubuntu Apache2/mods-enabled/rewrite.load
3) configure Ubuntu Apache
For the Ubuntu Apache configuration of ROR application, add the following code at the end of / etc/Ubuntu Apache2/Ubuntu Apache2.conf: Ubuntu Apache2.conf-Copy CodeInclude / etc/Ubuntu Apache2/httpd.conf modifies the httpd.conf to the following:
Httpd.conf-Copy CodeDefaultInitEnv RAILS_ENV production Alias "/ redmine"/ var/www/redmine/public/" Options Indexes ExecCGI FollowSymLinks AllowOverride all Order Deny Allow Allow from All AddHandler fcgid-script .fcgi FCGIWrapper "/ usr/bin/ruby / var/www/redmine/public/dispatch.fcgi" .fcgi RewriteEngine on RewriteBase / redmine RewriteRule ^ $index.html [QSA] RewriteRule ^ ([^.] +) $1.html [QSA] RewriteCond% {REQUEST_FILENAME}!-f RewriteRule ^ (. *) $dispatch.fcgi?$1 [QSA,L]
4) configure ROR application
Configure the ROR application, here for convenience, directly use the sqlite3,ROR program as redmine. Execute the script using the sudo prefix:
Install_app.sh-Copy codewords bind Bash INSTALL_HOME=~/install_redmine if [- d "$INSTALL_HOME"]; then echo INSTALL_HOME directory\ "~ / install_redmine\" already exist. Exit 1 fi mkdir $INSTALL_HOME # Download files pushd $INSTALL_HOME wget-t0-T15 http://rubyforge.org/download.php/36468/redmine-0.7.1.tar.gz popd # Install redmine tar xfv $INSTALL_HOME/redmine-0.7.1.tar.gz-C / var/www/ mv / var/www/redmine-0.7.1 / var/www/redmine cp / var/www/redmine/public/dispatch.fcgi.example / var/www/redmine/public/dispatch .fcgi #-begin database.yml-declare-x START_NO=$LINENO If [0-eq 1]; then production: adapter: sqlite3 database: db/production.sqlite3 timeout: 5000 development: adapter: sqlite3 database: db/development.sqlite3 timeout: 5000 test: adapter: sqlite3 database: db/test.sqlite3 timeout: 5000 fi; declare-x END_NO=$LINENO #-end database.yml-awk'{if (NR > ENVIRON ["START_NO"] & & NR
< ENVIRON["END_NO"]) {print}}' \ $0 >/ var/www/redmine/config/database.yml pushd / var/www/redmine rake db:create RAILS_ENV= "production" rake db:migrate RAILS_ENV= "production" # Load redmine's default data echo en > loc rake redmine:load_default_data RAILS_ENV= "production"
< loc rm -f log/production.log rm -f public/.htaccess popd # Clean rm -rf $INSTALL_HOME 注:如果在 Linux 下部署,并使用 SQLite3 数据库时,***次访问 redmine 无法创建匿名用户,访问时会发生 500 错误,这是属于 redmine 的问题,要解决此问题,执行以下命令:交互式命令 - Copy Codesudo apt-get install sqlite3 cd /var/www/redmine/db sudo sqlite3 production.sqlite3 >INSERT INTO users ("created_on", "status", "last_login_on"
"hashed_password", "language", "updated_on", "admin", "type", "firstname"
"lastname", "mail", "auth_source_id", "mail_notification", "login")
VALUES ('2008-05-21 04) 31 54, 0, NULL,'','', '2008-05-21 04 15 15,' f'
'AnonymousUser',', 'Anonymous',', NULL, 'fallow,')
> .exit
Sudo Ubuntu Apache2ctl restart
Ruby script/server-e production
*, restart Ubuntu Apache2: restart Ubuntu Apache2-Copy Codesudo Ubuntu Apache2ctl restart deployment seems simple.
These are all the contents of the article "how to configure Ubuntu Apache to install and ROR applications". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!