How to install Grails on Linux Ubuntu LTS? - grails

I have Linux Ubuntu 14.04 LTS. I wanted to install Grails and I have found informations on how to install it on Ubuntu 14.04 VPS here. So I am a little confused.
What are the difference between the two versions, LTS and VPS?
Does it matter if I do not have VPS version?
Can I install Grails on my Ubuntu? If yes, how?

A very simple way on Linux/Unix OS is to use the GVM Tool.
After installing the GVM tools you simply run
$ gvm install grails 2.4.3
in order to install Grails 2.4.3
UPDATE: Meanwhile gvm was renamed to sdkman.
Install sdkman
$ curl -s "https://get.sdkman.io" | bash
In order you want to continue working in the same terminal window execute
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
To install the latest version of Grails simply run
$ sdk install grails
or if need a specific version you can run
$ sdk install grails 2.4.3

You may try these steps. But this is just a guess, am not much sure about LTS and VPS
download grails-{desired version} zip file
extract it into any folder.
edit .bashrc in home folder such that
JAVA_HOME=/path/to/java/jdk1.6.0_25-64/
export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH
export GRAILS_HOME=/path/to/grails/grails-2.4.2/
export PATH="$PATH:$GRAILS_HOME/bin"
try to run grails command in terminal

VPS stands for Virtual Private Server in general (no special Ubuntu version) and LTS for Long Time Support added to a version number of Ubuntu to annotate a longer livetime (e.g. making this versions more suitable for servers). So these letters have not much influence on your way of installing Grails. The instructions there (installing JDK from OS and using sdkman (formerly GVM)) are sound advice to run Grails.

Related

Install Mysql 5.7 on High Sierra

I want to install mysql 5.7 on my Mac OS 10.13.5. However, brew install mysql installs version 8.0 which is not suited for my project. Forgive me if this question was asked before but I could not find a solution.
Now it's bit differently
brew install mysql#5.7
$ brew install mysql55
This installs a specific version 5.5 which exists along with 8.0
Also mysql entry should be added to .bash_profile to make sure it load and then server start should be done.
$ brew services start mysql#5.5
Below command gives the sequence of how the files are loaded in sequence.
$ mysql --verbose --help | grep my.cnf
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
While installing first mysql server instance works perfectly, installing a different version of mysql instance should be configured properly and the paths of installation, log files and other components have different path.
Installation paths be found here, for eg.
mysql -> ../Cellar/mysql/8.0.11/bin/mysql

Rails installation isn't permanent on Ubuntu Bash for Windows 10, how can I fix this?

I recently started testing out the Ubuntu bash for Windows 10 sub-system for my Ruby and Rails work. To set up rails, I followed this guide from GoRails.com.
Everything worked yesterday. But after shutting down my PC and starting up the Ubuntu bash terminal again today, it doesn't seem to recognize ruby or rails anymore. i.e. typing ruby -v gives me this:
The program 'ruby' is currently not installed. You can install it by typing:
sudo apt install ruby
Typing rails -v gives me:
bash: /mnt/c/Ruby22-x64/bin/rails: ruby: bad interpreter: No such file or directory
For reference, I used the instructions from the above guide to install Ruby 2.4.0 using RVM and Rails 5.1.1. When I ran ruby -v and rails -v yesterday, everything worked fine.
I should note, that before testing out the Ubuntu sub-system, I've been using Ruby and Rails on Windows itself - In this case, I have Ruby 2.2.5 (64-bit) installed using an installer downloaded from here. I installed Rails on Windows by running gem install rails on the Windows command prompt.
I am on Windows 10 Home Version 1703 (OS Build 15063.483)
from your story above, probably how you start the terminal (command prompt)
if you run using go rails make sure your run the terminal with bash, press start, then search for bash then you click bash icon
if you using ruby from ruby installer / rails installer you search "command prompt with ruby and rails" and click the icon
Firstly install ruby using rvm manager. It enables you to switch between different ruby versions as per your project.
Follow the instructions on this website:
http://rvm.io/rvm/install
and install ruby through rvm.
For the problem of unable to detect ruby on your system change settings for your terminal through Edit->preferences/profile preferences -> command ->(tick mark) run command as login shell.

How to solve a RubyMine "'ruby-debug-ide' isn't installed" error

I get the error:
Cannot start debugger. Gem 'ruby-debug-ide' isn't installed or its executable script 'rdebug-ide' doesn't exist.
but all gems were successfuly installed:
gem 'ruby-debug-ide'
gem 'debase'
I can run 'rdebug-ide' manually:
$ rdebug-ide
Using ruby-debug-base 0.2.1
Usage: rdebug-ide is supposed to be called from RDT, NetBeans, RubyMine, or
the IntelliJ IDEA Ruby plugin. The command line interface to
ruby-debug is rdebug.
But when I start debugging, RubyMine asks to install the ruby-debug-ide gem. Why?
And, after installation I get:
Cannot start debugger. Gem 'ruby-debug-ide' isn't installed or its executable script 'rdebug-ide' doesn't exist.
I'm running Mac OS X 10.11.3.
Here's the actual command that worked for me:
gem install ruby-debug-ide --pre
Complementing Ahsan Ellahi
In your terminal you're probably not running the same ruby version as inside Ruby Mine. You can check this
In Ruby Mine
Preferences --> Laguanges and Frameworks --> Ruby SDK and Gems
In Terminal
$ ruby -v
If you're not running the same version, try to set RubyMine to use the same Ruby version that you're running in your terminal. This should solve the problem. Than, if you really want to use another RubyVersion, you will need to go to your terminal, change the Ruby version and manually install both gems
I have faced this issue when debugging in a docker-compose environment. I suspect that RubyMine does not refresh the list of available gem after the SDK is added.
So if you add the SDK then add ruby-debug-ide to Gemfile you will get the error.
Instead, (re)create the SDK after adding ruby-debug-ide.
I started getting this after upgrading from 2017.x to 2018.1. In my case, it seems that RubyMine needed a newer version but its error message implied it couldn't find any version and failed to install it. I think it was trying to install it with a different SDK.
Manually installing the latest ruby-debugger-ide (in my case the --pre flag was necessary) and then restarting RubyMine did the trick for me.
Since you're using Mac OSX, I couldn't provide the same exact answer for you, but you can find a similar way of achieving this. I'm using Ubuntu with Vagrant, so you may need to adapt it just a little bit.
Copy the following gem from RubyMine/rb/gems app folder, please copy the gem related to your ruby runtime and platform, there are different gems for different ruby runtime and platforms, in my case, its:
debase-0.3.0.beta7.gem
ruby-debug-ide-0.8.0.beta6.gem
Install them inside your app host, in my case its vagrant, in your case it could be inside your container, or in your host OS using the following command:
gem install --force --local *.gem
Set breakpoint and start debugging.
It may asks you one more time to install the gem, but then the debug will works for sure.
This worked for me
gem install debase-ruby_core_source
Source: Cannot install Rubymine Debugger
You should look into RubyMine settings, which ruby version and which gemset (global/default) it is using. Check out where these required gems are installed and make sure RubyMine is using that gemset where these are installed successfully.
I fixed this after viewing the responses here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206072049-Cannot-start-debugger
The solution at the bottom suggested 'removing all my gems. removing ruby. cleaning up directories and rvm. removing ruby mine, then reinstalling everything'
I started with the easiest of these, which was to reinstall rubymine. That solved it for me.
I had this issue on Windows 11 running Ubuntu on WSL2. To solve, I manually copied the relevant files in my %AppData% directory into the corresponding directory in Ubuntu.
I found all the data at:
C:\Users[USER]\AppData\Local\JetBrains\RubyMine[VERSION]\ruby_stubs\[NUMBER]\home\[USER]\.gem\ruby\2.7.0
These files were copied to: \\wsl.localhost\Ubuntu\home\[USER]\.gem\ruby\2.7.0
After doing this, everything worked again.
I have faced this issue too with Rubymine 8, rvm 1.29.1 and Ruby version 2.3.3 And upgrading the Rubymine version from Rubymine 8 to Rubymine 2016.3 or latest resolves the issue for me.
Check ruby SDK's version is right.You can first using rails installer to install everything .
Then using gem to install rdebug for ruby 2+.
Make sure Rubymine's Ruby version is same to which you have installed.With those all done,you will be able to debug ruby.
Please check x286 vs 64 version, both Ruby and Rmine version. I had this problem runnin x86 rubyMine on 64 ruby
A combination of matching the host ide ruby version with the remote SDK version worked for me but required a few additional steps. I too am running mac os as my host (running mohave)
the remote environment setup in preferences -> ruby sdk and gems must have the same version as the remote target, including any gems installed.
NOTE: I had to re-install the bundler gem on both host and remote host to get the gem manager to install things auto-majically.
the project environment must be changed to use the same version as the remote host as well. this is in File -> preferences for new projects -> ruby sdk and gems.
NOTE: I also had to set the default RVM on my local host and remote host and unset the previous version as default in the local host preferences.
Once I did this I was able to get gems in sync and remote debugger to connect.
My solution was to go to Rubymine settings, to the available SDKs,
remove the SDK, restart Rubymine and add the SDK again.
Running Ubuntu 18 something, RubyMine version 2020.3. Had this issue. None of these suggestions worked for me, same error no matter what did. I was using RVM, and ruby 2.6 and 2.7, switched back and forth a cleaning and reinstalling gems along thew way, both debase and ruby-debug-ide were installed according to the gem list. Settings in rubymine matched "ruby -v" from the command line. VSCode worked perfectly with this setup.
In the end i removed RVM and all the ruby versions, installed ruby via rbenv, installed ruby 2.6.5 and that worked like a charm.
I think this error is generated for multiple reasons with no real way to figure out which reason for your specific instance. I would like to encourage jetbrains to generate more debug information on errors like this, or if you are generating error information, point out where it is when this happens.
Try these steps:
1. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. brew install ruby
3. echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
if you get unshallow error on any step then first try:
1. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
2. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
3. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
4. brew install ruby
5. echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
Lastly restart the terminal and check .bash_profile:
- nano ~/.bash_profile
If you see the path variable, just close it. Otherwise it means something went wrong :/.
The last step is to open
RubyMine -> Preferences -> Language and Frameworks -> Ruby SDK and Gems -> select the newest ruby version and apply.
You may need to update ruby version from the gemfile.
And it should be done!

After Setting Up Ruby Installer What Command line tools do you use?

I've installed Ruby on a Windows computer
After Setting Up Ruby Installer What Command line tools do you use?
http://railsinstaller.org/en
I've tried the command
rvm use 1.9.3
using the command prompt ruby and rails
I get the error message
rvm is not a recognised command
From RVM’s FAQ:
Does RVM work on windows? Will it in the future?
NO. If you would like to manage multiple versions of ruby on windows please use pik which is an excellent tool by Gordon Thiesfeld. You can find it on GitHub. There are plans to include windows support in RVM 2.0.
https://rvm.io/support/faq#does-rvm-work-on-windows-will-it-in-the-future
Doing Rails development on Windows is a little bit more of a challenge and you may run into some annoyances, but it's definitely possible.
Uru worked well for me as a nice alternative to RVM, which doesn't run on Windows. However, if you just want to have one version of Ruby installed on your computer and work with it, you don't even need to bother with Uru.
Windows is not the best environment to develop with Ruby ...
RVM doesn't work and PIK hasn't updated for more than 2 years..
Github of Pik
This installer doesn't install RVM. It installs Ruby interpreter and Rails.
Since you've installed it, I assume you have your Ruby and libraries for it (called gems) rails and bundler. Execute gem list in your shell to verify (it should output a looong list).
Then you should create a new Rails project:
rails new project_name
...and then go into the folder that got created
cd project_name
bundle what you have:
bundle install
...and launch the server to see if it works:
rails server
or
rails s
You will likely run into issues with tzinfo gem if you're on 64-bit Windows, but that can be easily fixed by searching around StackOverflow, it's been discussed.
Gool luck to you. Developing Rails applications in Windows proved to be hard to me. Consider launching a virtual machine (using, for example, VirtualBox) with Linux aboard. That's what you could do in Linux:
install RVM as the site suggests:
curl -sSL https://get.rvm.io | bash -s stable
install the latest MRI available - feel free to replace ruby with the version you need, like rvm install 2.0.0
rvm install ruby
select and set as default the Ruby you need, you've tried a similar line apparently with Ruby 1.9.3
rvm --default use ruby
another long process
gem install rails
rails new project_name
(same as described above)
cd project_name
bundle install
rails s
That should work, and that's what you've probably seen. Again, I highly recommend using Linux in VirtualBox (or anything similar) for Rails development. A native Linux installation could only be a better environment, but most people are not ready for this just yet.

Install RVM itself without internet connection

I am switching from DJANGO to Rails, but i don't know how to install RVM in PROD environment.
My PROD server is without internet connection, and not possible connect even for a while. And i cannot find a standalone install package of RVM.
Is there any solution for offline RVM installation?
BTW, can rails be installed without internet?
I just spent some time and build a tutorial for the offline mode: https://rvm.io/rvm/offline - it's the first version so feel free to improve it here: https://github.com/wayneeseguin/rvm-site/blob/master/content/rvm/offline.md (Edit button).
Additionally to my first answer another way to do it would be to compile ruby on online machine, then package it, unpack on the other end and add it to PATH on the offline machine.
Way 1 - only Ruby
curl -L https://get.rvm.io | bash -s stable
source $HOME/.rvm/scripts/rvm
rvm install 1.9.3 --movable
rvm prepare 1.9.3
Some information will be displayed, including file name. Copy it to the offline machine and unpack it there, then just add it to PATH:
echo 'PATH=$PATH:${unpacked_dir}/bin' >> ~/.bashrc
Way 2 - whole RVM:
curl -L https://get.rvm.io | sudo bash -s stable
source /usr/local/rvm/scripts/rvm
rvm use 1.9.3 --install
gem install rails -v 3.2.8
rails new rails3
rvm use 1.8.7 --install
gem install rails -v 2.3.14
rails new rails2
tar czf rvm_and_ruby.tgz /usr/local/rvm /etc/rvmrc /profile.d/rvm.sh
Unpack on the offline end:
cd /
sudo tar xzf rvm_and_ruby.tgz
And open a new terminal.
check http://railsinstaller.org/ (for windows and mac) .After then change environment into production mode . In linux this works export RAILS_ENV=production .
If you are using a linux OS, you can always package the app as a debian or rpm archive which will include rails and the dependent gems referred in your Gemfile. The advantage with this approach is that you can also configure the archive to setup external dependencies like any other deb or rpm package. One of my recent projects came up with a in house solution. Now there are tools like pkgr
You can download a standalone RVM package here: https://github.com/wayneeseguin/rvm/tags
You can reference the RVM installer script for details on what an RVM install does. Simply replace the network calls with references to some local file, and you should be good to go.
That said, once RVM is installed, I'm not sure if it'll let you do an offline Ruby install easily, but this should get you started.
Well you need to download the source code from somewhere to install RVM, Rails. Not very clear as to how your Prod environment lacks an internet connection. Could you please give more details?

Resources