Ruby, RBENV, RAILS, ShareTribe on Ubuntu 22.04

READ: https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-22-04
INSTALL RUBY ENVIRONMENT MANAGER RBENV
NOTE: NEED TO REMOVE THE CURRENT DEFAULT INSTALLED RUBY BY UBUNTU 22.04

INSTALL RBENV

CHECK THE RBENV VERSION

INSTALL RUBY WITH RUBY BUILD
CHECK AVAILABLE VERSION

INSTALL RUBY 3.2.2 (ACCORDING SHARETRIBE https://github.com/sharetribe/sharetribe)

MAKE IT GLOBAL

RUBY VERSION

RUBY GEMS
INSTALL BUNDLER

GEM ENVIRONMENT TO FIND OUT WHERE THE GEMS ARE INSTALLED

INSTALL RAILS

REHASH AND CHECK RAILS VERSION

INSTALL SHARETRIBE
READ: https://github.com/sharetribe/sharetribe
https://sangram.hashnode.dev/self-hosted-sharetribe-go-community-edition-on-ubuntu
CLONE FROM GITHUB THEN GO TO THE DIR

NOTE: BEFORE INSTALLING THE BUNDLE, PLS INSTALL MYSQL LIB

IF NOT, YOU’D GET THIS ERROR

INSTALL THE BUNDLE

INSTALL NODE MODULES

CREATE database.yml

THEN FILL THE DB USER AND PASSWORD.
NOTE: DON’T CREATE THE DB MANUALLY VIA PHPMYADMIN!
CREATE config.yml

CREATE AND INITIALIZE DB

MAKE SURE THE SPHINX SEARCH ALREADY INSTALLED. IF NOT, INSTALL IT

THEN RUN SPHINX INDEX

START SPHINX DAEMON

INSTALL FOREMAN

START IT

ERROR: INSTALL NPM 9.5.1

START AGAIN

ERROR: INSTALL NVM 18.16.0

START AGAIN (OK)

OPEN IT ON THE BROWSER

THEN SETUP

password: Teddy@123 XXX
THEN AFTER THE SAVE, OPEN AGAIN
http://0.0.0.0:5000/
OR
http://sharetribe-test.lvh.me:5000/

SOMEHOW I CAN’T LOGIN WITH THE ABOVE EMAIL. SO I NEED TO CREATE A NEW USER FROM THE SITE. THEN MANUALLY CHANGE ‘people’ TABLE AND SET IT AS ADMIN

SO THE ADMIN NOW:
user: satriaf@gmail.com
pass: Teddy123

NOTE: TO START THE RAILS SERVER, PLS GO TO THE sharetribe DIRECTORY THEN RUN IT (WITH PORT 5000)

THEN OPEN THE LOCAL SITE ABOVE (http://0.0.0.0:5000/ OR http://sharetribe-test.lvh.me:5000/)
IF YOU DON’T RUN THE RAILS SERVER, YOU’D GET MESSAGE ‘This site can’t be reached’ ON YOUR BROWSER

SET UP PAYMENT ON SHARETRIBE
https://publish.yexperiment.com/post/156715320289/sharetribe-with-paypal-payments-the-lost

Install Sharetribe Go on Ubuntu 16.04

Ref: https://github.com/sharetribe/sharetribe

Make sure ruby already installed.
Install Sphinx:
download it from http://sphinxsearch.com/ then extract it. Pls read: http://sphinxsearch.com/docs/sphinx3.html#getting-started-on-linux-and-macos
Here is the extracted path: /home/teddy/Documents/sphinx-3.1.1/
And the ‘program’ (searchd, indexer, etc) in ‘bin’ dir: /home/teddy/Documents/sphinx-3.1.1/bin
check :

NOTE: TO MAKE THE EXECUTABLE CAN RUN GLOBALLY, PLS DO:

THEN RUN FROM ANYWHERE

Creating ‘test’ database (no problem if the database is already exist)

I need to create the sphinx.conf file (read: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-sphinx-on-ubuntu-16-04#step-6-%E2%80%94-testing)
First I need to remove/move ‘sphinxdata’ dir in ‘bin’ dir because I got this message ‘No config file, using ‘sphinxdata’ folder.’ (read: https://stackoverflow.com/questions/50837676/sphinx-3-0-3-searchd-dont-see-my-config)
Create a new file ‘sphinx.conf’ in /home/teddy/Documents/sphinx-3.1.1/sphinxsearch/ dir:

RUN:

IF I GOT ‘bind() failed on 0.0.0.0, retrying’ THEN IT MEANS ‘searchd’ ALREADY RUNNING ON THE BACKGROUND (REF: http://sphinxsearch.com/forum/view.html?id=5542). CHECK

KILL THEM WITH ‘killall searchd’ THEN CHECK AGAIN:

RE RUN ‘searchd’

MODIFY sphinx.conf

BUT

OK. HERE IS THE WORKING sphinx.conf. USE ‘type=rt’ (READ: https://sphinxsearch.com/forum/view.html?id=16238)

PLS REMOVE ALL FILE IN /home/teddy/Documents/sphinx-3.1.1/sphinxsearch/data FIRST! ALSO RUN ‘killall searchd’ THEN

NO ERROR!

 

Imagemagick
Check

INSTALL SHARETRIBE

CURRENTLY HAVE TO USE ruby 2.6.2

SO USE rbenv TO INSTALL 2.6.2 AND MAKE IT DEFAULT WITH ‘global’

THEN CONTINUE WITH

Install node modules:

Create a database.yml file by copying the example database configuration:

Add your database configuration details to config/database.yml. You will probably only need to fill in the password for the database(s). Pls set the right config for ‘development’ and ‘test’:

Create a config.yml file by copying the example configuration file:

Create and initialize the database:

Run Sphinx index:

Output:

Start the Sphinx daemon:

Output:

Start the development server:

But Install ‘foreman’ FIRST (READ: https://github.com/ddollar/foreman)

But to run ‘foreman’, it need node js v10.15.3 and npm 6.4.1

current node version is v8.9.4

So use ‘nvm’ to install node v10.15.3

RE RUN ‘foreman’ BUT GOT ANOTHER ERROR ABOUT node-sass

 

Then open your browser: http://localhost:5000
The first time will go to http://localhost:5000/communities/new?locale=en
Setting:
admin email: advcha@yahoo.com
admin pass: Admin@123
Admin user first name: Satria
Admin user last name; Faestha
Marketplace name: Web Devs Service
Marketplace type: Service marketplace
Marketplace country: Australia
Marketplace language: English
Save
Then it’ll go to http://web-devs-service.lvh.me:3000/?auth=IETnn4GA1Nc
BUT I GOT

IT SHOULD OPEN http://localhost:5000ALSO OPEN ANOTHER TERMINAL THEN RUN:

ADMIN: http://localhost:5000/en/login
admin email: advcha@yahoo.com
admin pass: Admin@123

JS ERROR

I did : nvm alias default 10.15.3
also nvm use 10.15.3

also
npm -g uninstall node-sass
npm -g i node-sass

BUT STILL EXIST

npm install node-sass

teddy@teddy:~/Documents/ruby/sharetribe$ npm rebuild node-sass

> node-sass@4.12.0 install /home/teddy/Documents/ruby/sharetribe/node_modules/node-sass
> node scripts/install.js

node-sass build Binary found at /home/teddy/Documents/ruby/sharetribe/node_modules/node-sass/vendor/linux-x64-64/binding.node

> node-sass@4.12.0 postinstall /home/teddy/Documents/ruby/sharetribe/node_modules/node-sass
> node scripts/build.js

Binary found at /home/teddy/Documents/ruby/sharetribe/node_modules/node-sass/vendor/linux-x64-64/binding.node
Testing binary
Binary is fine
node-sass@4.12.0 /home/teddy/Documents/ruby/sharetribe/node_modules/node-sass

teddy@teddy:~/Documents/ruby/sharetribe$ npm ls node-sass
/home/teddy/Documents/ruby/sharetribe
└── node-sass@4.12.0
SOLUTION: REMOVE ‘node_modules’ DIR IN SHARETRIBE ROOT AND IN client/ DIR
THEN RUN IN SHARETRIBE ROOT ‘npm install –no-cache’
NO MORE ERROR!

Install Ruby, ROR and RBENV on Ubuntu 16.04

Ref:
https://gorails.com/setup/ubuntu/16.04

Install Ruby on Rails on Ubuntu 16.04


https://medium.com/@rgdev/how-to-install-ruby-rails-on-ubuntu-16-04-from-scratch-quickly-4da73c67daa3

I think I already installed many packages needed like curl, nodejs and yarn. so just install this:

Use rbenv to install ruby 2.6.3 at home:

output:

NOTE: Instal ruby 2.6.2 AND make it default:

CHECK:

Then install ‘bundler’

I already setup git, so no need to set it up again. check

Install Rails (v6.0.0.rc1)

If you’re using rbenv, you’ll need to run the following command to make the rails executable available:

check:

SETUP MYSQL
Install libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.

Let’s create your first Rails application (with mysql):

then modify /home/teddy/Documents/ruby/first-app-mysql/config/database.yml. Modify the database username, password and db name:
SORRY, ONLY ADMIN CAN SHOW THIS!
Create the database manually or run ‘rake db:create’

Then run ‘rails server’

Then open on your browser: http://localhost:3000/

Ruby On Rails: Introduction

Here I ‘m going to extend my previous testapp. Also learn more about ruby on rails file structure. Ref: http://www.belajarrubyonrails.com/2012/12/membuat-aplikasi-rails-sederhana-say.html

Extend Controller.
Create a new controller ‘home_controller.rb’ in /app/controllers/ directory. Here is the content:

 

Extend View.
Create a new directory ‘home’ in /app/views/ directory. Then create a new file ‘index.html.erb’ in the new directory. Here is the content:

Then remove ‘index.html’ file in /public/directory (I DONT FIND IT!!!)

Routes.
Modify ‘routes.rb’ file in /config/ directory. Set the default route to our testapp.

Then start the rails server (rails s) and open it in http://localhost:3000/. It should show this text:

 

I want to show Date and Time on my browser. Modify ‘home_controller.rb’ like this:

Then modify ‘index.html.erb’ to show the date time:

OK. Start the server and open it on the browser. It should be something like this:show-datetime-testapp

 

Ruby On Rails Installation on Ubuntu 14.04

Source: Installing Ruby on Rails on Ubuntu 14.04 – 15.10 and Install Ruby on Rails · Ubuntu Linux.

Installation:

  1. Install Ruby Version Manager (RVM). I already had ‘curl’, so import the rvm.io public key in the server system.


     
  2. Then download the RVM installer with curl and execute it (by piping the curl output to bash):

    KEEP IN MIND THIS LINE

    I need to execute ‘source /home/teddy/.rvm/scripts/rvm’ to build the RVM environment and to save the settings of this environment into current shell.

    NOT (ref: Error message: -bash: /etc/profile.d/rvm.sh: No such file or directory)

     
  3. Install the Ruby dependencies with the RVM command below:

    For the first time, I got some errors like this:

    SOLUTION: ref: Error installing Ruby on Ubuntu 14.04
    I have to fix/remove some failed ubuntu repository. From ‘sudo apt-get update’, I got these repositories error:

    After fixing them (see the above link), it’s working fine

     
  4. Check for available Ruby versions
    The following command lists the available ruby versions:

    I’m going to install the latest stable ruby version 2.3.3 because ruby 2.4.0-rc1 still in release candidate.
  5. Install Ruby Version
    Using RVM makes the independent management of ruby versions an easy process. The command listed below installs the Ruby version 2.3.3.

     
  6. Default Ruby Version must be Set up
    In order for the applications to use Ruby, the default ruby version needs to be set. The following command sets Ruby 2.3.3 as default version.
  7. Confirm ruby version installed

    We’ve just finished installing ‘Ruby’. Now we’re going to install ‘Rails’
  8. Installing Rails
    Rails can be easily installed with the Ruby gem installer.
  9. Check the rails version
    Execute the following command to check the rails version and to see if rails has been installed successfully.

    I just installed the latest rails (version 5.0.1). To install certain version (like version 4.2.5), install rails like this:

     
  10. Create a test app ‘testapp’ in Document/rubyonrails/ directory


     
  11. Go into the ‘testapp’ then start the rails server

     
  12. Open it on your browser http://localhost:3000/. If nothing wrong, here is the looksfront-page-testapp