更新源:
sudo gedit /etc/apt/sources.list
替换为:
#网易163的更新源
deb http://mirrors.163.com/ubuntu/ karmic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ karmic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ karmic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ karmic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ karmic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ karmic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ karmic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ karmic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ karmic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ karmic-backports main restricted universe multiverse
更新源信息
sudo apt-get update
---------------------------------------------------------------
安装ubuntu编译环境
sudo apt-get install build-essential
---------------------------------------------------------------
安装ruby
www.rubyonrails.org下载ruby (ruby-1.8.7-p174.tar.gz)和 Gem(rubygems-1.3.6.tgz) 和rails
安装ruby依赖库文件
sudo apt-get install zlib1g-dev libssl-dev libreadline5 libreadline5-dev
下载后进度目录,运行./configure
然后make (编译)
然后sudo make install
然后 ruby -v (查看版本)
irb require "openssl" (查看openssl是否安装正确,返回true正确)
安装rubygem
sudo ruby setup.rb (到他到目录安装GEM)
gem -v (查看版本)
安装rails
sudo gem install rails (安装rails)
sudo apt-get install git-core sqlite3 libsqlite3-dev(安装sqlite和git)
sudo gem install sqlite3-ruby (安装sqlite和ruby的链接)
sudo gem install thin (安装thin服务器)
sudo apt-get install imagemagick libmagick9-dev (安装图片处理程序)
sudo gem install rmagick (安装ruby图片处理插件)
git clone [email protected]:/home/git/snkme.git(从服务器把最新版本取下来)
启动服务
badwolf@badwolf-desktop:~/workspace/snkme$ ./script/server thin
---------------------------------------------------------------
安装Gedit插件
插件站: http://github.com/gmate/gmate
1. 添加一个源在源管理里面
ppa:ubuntu-on-rails/ppa
2. Install gedit-gmate package:
$ sudo apt-get install gedit-gmate
---------------------------------------------------------------
ubuntu flash中文乱码
cd /etc/fonts/conf.d/
sudo gedit ./49-sansserif.conf
<match target=”pattern”>
<test qual=”all” name=”family” compare=”not_eq”>
<string>wqy-zenhei</string>
</test>
<test qual=”all” name=”family” compare=”not_eq”>
<string>wqy-zenhei</string>
</test>
<test qual=”all” name=”family” compare=”not_eq”>
<string>monospace</string>
</test>
<edit name=”family” mode=”append_last”>
<string>wqy-zenhei</string>
</edit>
</match>
---------------------------------------------------------------
sudo gem (ruby的安装程序)
ctrl+shift+T (新建一个cmd)
---------------------------------------------------------------
版本管理git
git st (查看状态)
git add . (选择变更内容)
git diff(查看变更具体内容)
git commit -m '数据库' (更新到本地版本库)
git push (提交到服务器)
脚手架常用命令:
-------------------------------------------------
0. 创建一个项目
rails demoshop
-------------------------------------------------
1. 用脚手架创建产品(控制 模型 显示 数据)
script/generate scaffold product title:string description:text image_url:string
-------------------------------------------------
2. 如果创建错了销毁这些(destroy 销毁 scaffold 脚手架 pronduct产品对象)
script/destroy scaffold pronduct
-------------------------------------------------
3. 来创建一个sqlite的表(必须有上一步到创建)
rake db:migrate
-------------------------------------------------
4. 用sqlite命令来查看当前项目migrate当前版本
sqlite3 db/development.sqlite3 "select version from schema_migrations"
-------------------------------------------------
5. 查看路由情况
rake routes
-------------------------------------------------
6. 数据库迁移增加一个字段脚手架
script/generate migration add_price_to_product price:decimal
然后执行3的步骤
-------------------------------------------------
7. 调试
script/console
-------------------------------------------------
8. 只创建一个controller的一个action
ruby script/generate controller store index
hreoku.com 版本库管理方法
1.登录hreoku.com注册帐号 [email protected] *****
2. 登录邮箱激活
3.sudo gem install hreoku #安装keroku
4.heroku create rorbet #创建项目 rorbet.hreoku.com
5.ssh-keygen #创建一个ssh密钥
6.git clone [email protected]:rorbet.git #找一个目录先git一下服务器的版本库到本地
7.然后在这个目录添加文件..
8.git st #查看本地版本与服务器之间差别
9.git add . #添加要提交的内容范围
10.git commit -m “201005120951-first-commit”
11.git push origin master #指定分支 以后就git push
12.heroku logs #查看日志
13.heroku help #查看heroku命令
14.heroku console #运行console
15.heroku rake db:migrate #在heroku运行db:migrate
# 如果你migrate没问题 跳过16~17步骤
16.rake db:schema:dump #把本地数据库生成migrate文件
17.heroku rake db:schema:load #把migrate文件生成数据库文件