Rails3 on Ubuntu 以及虚拟机Virtualbox 安装 笔记--可以节省你两天的折腾

本文详细介绍如何在Windows系统上安装Ubuntu虚拟机,包括选择合适的Ubuntu版本、安装VirtualBox、配置网络设置以及安装必要的软件如GNOME桌面环境、Ruby、Rails等。此外还提供了实现跨平台复制粘贴的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[size=large]#在windows上安装Ubuntu 虚拟机[/size]
1. download Ubuntu desktop 32 bit (developer to use ubuntu desktop version may is better)
http://www.ubuntu.com/desktop/get-ubuntu/download

[size=large]2. install virtualbox and set the downloaded ubuntu iso as virtul disk[/size] driver and get server installed as step by step
http://www.virtualbox.org/wiki/Downloads
设置虚拟机内存为512M,可根据你机器内存来设置

[size=large]3. add another network card for virtual machine in box controller [/size]machine,
关闭虚拟机后,用 box manager给 给虚拟机增加一个网卡(在设置里面)
具体请细读
http://muffinresearch.co.uk/archives/2010/02/08/howto-ssh-into-virtualbox-3-linux-guests/

vim /etc/network/interfaces

auto eth1
iface eth1 inet static
address 192.168.56.5
netmask 255.255.255.0

sudo ifup eth1

reboot

外部有两个网卡,为虚拟机创建,为192.168.56.x字段
内部也有两个网卡, 一个为自动分配成10.0.2.15字段
外部网卡一个要设置为nat,一个设置为host-only

虚拟机安装要诀:
虚拟机安装后,要能够从windows xp host上能够访问到虚拟机,
本地有虚拟机的两张网卡, 内部有两个网卡, 一个为eth0,一个为eth1
把eth1设置成和host虚拟机两张网卡同一网段,就可以访问。

putty 上去虚拟机后,有时候发现有断掉的情形, 在make的时候,其他的时候还可以。

[size=large]#install ubuntu gnome for server (如果直接安装桌面,就不用了)[/size]
sudo apt-get install x-window-system-core xserver-xorg gnome-desktop-environment
ref:http://ubuntuforums.org/showthread.php?t=186298
自动下载要一个小时左右, 安装也要半个小时左右,安装大小在1.5G左右
download-->uppack-->set up

[size=large]#start vnc server for ubuntu server or desktop[/size]
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &
# twm &

但是好像装了以后,按s 会有问题

[size=large]# 安装一个guest additional for guest ubuntu[/size]
在虚拟机里面设置光驱为:VBoxLinuxAdditions.iso
cd /media/cdrom0/
sudo ./VBoxLinuxAdditions.run

[size=large]#ubuntu copy/paste with windows host is OK[/size]
using buttion in middle of mouse to copy or just right click to copy
then paste to windows, windows also can be paste into ubuntu, that is great.

[size=large]#you need install some third party in ubuntu before install ruby [/size]
sudo apt-get zlib1g-dev
sudo apt-get install libsqlite3-dev

[size=large]#you must need install ruby 1.9.2 Rc1 as I has tryed others will fail [/size]as rails3 official required also
ref =http://www.ruby-lang.org/en/news/2010/07/02/ruby-1-9-2-rc1-is-released/
tar xvzf ...
$ cd ruby.../
$ ./configure
$ make
$ sudo make install

check ruby version by
ruby --version

[size=large]#install ruby gems[/size]
ref=http://grigio.org/how_install_rails_3_0_beta_ubuntu_linux_step_step
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar -xvf rubygems-1.3.5.tgz
cd rubygems-1.3.5
sudo ruby1.9 setup.rb
sudo ln -s /usr/bin/ruby1.9.1 /usr/bin/ruby
sudo ln -s /usr/local/bin/gem /usr/bin/gem

sudo gem update --system


[size=large]#install sqlite3-ruby gem[/size]
sudo gem install sqlite3-ruby

#安装thin服务器

sudo gem install thin

#
[size=large]#install rails 3[/size]
sudo gem install rails --pre
it take about 5 minutes to show something, be patient
total take 10 minutes to install 22 gem related with rails


[size=large]#create new rails application[/size]
#rails new bolg
#cd blog

thin start

in windows host, you can visit
http://192.168.56.5:3000/

rails3 welcome is there.

安装成功,继续你的网站开发。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值