debian 安装ruby +nginx+apache开发环境.
来源:互联网 发布:淘宝怎么关闭私人定制 编辑:程序博客网 时间:2024/04/28 03:04
安装软件
1.很简单, 前提你安装了apache, mysql, nginx 如果没有 加上.
#apt-get installapache2 nginx
2.开启apache的重写.
#a2enmod rewrite
#apt-get install mysql-server
3.下面会安装ruby, apache的ruby模块, mysql的ruby支持, vim的rails支持.
#apt-get install ruby rails rubygems rake libapache2-mod-ruby libdbi-ruby libdbd-mysql-ruby vim-rails ri libruby libfcgi-ruby1.9.1 libxml-ruby libxml2-dev ruby-dev
查看安装的ruby版本
gem 常用命令
- gem list 列出已经安装的包
- gem install xxx 安装包
- gem uninstall xxx 卸载安装包
- gem query xxx 搜索包
- gem cleanup 清除cache
- gem help 帮助.
root@debian:/home/ruby# gem list*** LOCAL GEMS ***rubyzip (1.1.3)
测试ruby和mysql的链接
编写一个简单的脚本来测试链接, 如果显示mysql版本就ok了.
#gvim test.rb
# test.rb - test MySQL script using Ruby DBI modulerequire "dbi"begin # connect to the MySQL server dbh = DBI.connect("dbi:Mysql:mysql:localhost", "root", "") # get server version string and display it row = dbh.select_one("SELECT VERSION()") puts "Server version: " + row[0]rescue DBI::DatabaseError => e puts "An error occurred" puts "Error code: #{e.err}" puts "Error message: #{e.errstr}"ensure # disconnect from server dbh.disconnect if dbhend
root@debian:/home/ruby# ruby ./test.rb Server version: 5.5.37-0+wheezy1-log</span></span>
测试 rails
#cd /home/www 先进入apache, nginx的www目录, 我这里都设置的一个.#rails new_project 来建立一个rails的project.#cd new_project#rm -rf public/index.html 这里删除掉默认页面,以免一直跳转到这里.#vim config/database.yml 修改development开发模式的database: ruby_test#mysql -uroot -p 进入mysql后建一个ruby_test的DBroot@debian:/home/www# mysql -u root -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 40Server version: 5.5.37-0+wheezy1-log (Debian)Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.root@(none) 12:02:44>create database ruby_test;Query OK, 1 row affected (0.00 sec)#script/generate controller Blog 建立一个 Blog 的 controller#script/server 启动 server, 就可以由 http://localhost:3000/ 访问了现在来实现Hello world#vim app/controllers/blog_controller.rb加入def index render :text => "Hello world"end
0 0
- debian 安装ruby +nginx+apache开发环境.
- debian 安装开发环境
- debian安装android开发环境
- Debian开发环境安装指南
- Debian开发环境安装指南
- Ubuntu/Debian上安装Nginx+php环境
- Debian 7安装nginx环境、编译及安装和启动
- Debian下安装GTK+开发环境
- Debian/Ubuntu 常见开发环境安装
- Debian/Ubuntu 常见开发环境安装
- Debian/Ubuntu 常见开发环境安装
- debian 7.4下面安装各种开发环境
- Debian下安装Go开发环境
- debian下安装nginx
- win7安装ruby on rails开发环境
- ruby on rails开发环境安装血泪史
- ubuntu,ruby,rails [rvm]开发环境安装
- 【ruby】【linux】CentOS上安装配置ruby开发环境
- android -- 蓝牙 bluetooth (一) 入门
- 多边形背景生成工具推荐-Trianglify
- HDU 最短路小小结(只涉及初级算法)
- android -- 蓝牙 bluetooth (二) 打开蓝牙
- PDB文件:每个开发人员都必须知道的
- debian 安装ruby +nginx+apache开发环境.
- Android Activity 生命周期的透彻理解
- The installer encountered an error copying files to the hard disk: [Errno 5] Input/output error
- 一个canvas 事件demo
- 《编程珠玑》---找到缺失的整数(位图+二分)
- activity生命周期的onPause和onStop
- scala akka 修炼之路1(使用actor实现一个job的并发计算和task失败重启)
- 使用TOAD工具INSERT STATEMENTS方式导入导出表
- 跨越语言界线,微软将推出实时语音翻译「Skype Translator」