-
Notifications
You must be signed in to change notification settings - Fork 0
Linux Machine
Hector Correa edited this page Nov 19, 2024
·
8 revisions
First we install the dependencies:
apt install ruby
apt-get install puma
git clone https://github.com/hectorcorrea/webdev-nutshell.git
cd webdev-nutshell
gem install sinatra rackup
Testing that Ruby runs:
ruby hello.rb
Testing a web program in Ruby:
ruby webdemo1.rb
You should be able to view the result by going to http://xx.xx.xx.xx:3000/ where xx.xx.xx.xx is the IP address of the Linux box. Notice that this is running on port 3000 by default.
Let's update webdemo1.rb program to use port 80 and the active IP:
set :port, 80
set :bind, 'xx.xx.xx.xx'
and run it
ruby webdemo1.rb
Browse to http://xx.xx.xx.xx
This use to work with webrick but it seems that it does not anymore. Not sure if this is an Ubuntu 24 issue or an issue with the latest Sinatra/rackup gems.
apt install ruby
git clone https://github.com/hectorcorrea/webdev-nutshell.git
cd webdev-nutshell
gem install sinatra
gem install webrick