Installing JRuby 1.6.7 + Rails 3 with Ubuntu? - jruby

Any blog or tutorial for installation of JRuby 1.6.7 and Rails 3 on Ubuntu?

First install rvm:
$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
$ source ~/.bash_profile
Once rvm is installed, use it to install jruby:
$ rvm install jruby-1.6.7
You can then use that version:
$ rvm use jruby-1.6.7
Finally, install rails:
$ jruby -S gem install rails
Update
With more recent versions of rvm, installing the latest version of jruby and rails is very straightforward:
$ \curl -L https://get.rvm.io | bash -s stable --autolibs=3 --ruby=jruby --gems=rails

Use the package manager:
sudo apt-get install ruby-rvm

Related

Rails & MySQL on Apple Silicon

has anyone been able to get Rails running with the MySQL via the mysql2 gem on Apple Silicon? I'm working with Ruby 2.5.3 and Rails 5.2.3 but would love to hear of any successes with any versions. Currently I am stuck with the mysql2 gem install failing on:
linking shared-object mysql2/mysql2.bundle
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
Thank you!
I've had success with just the following:
rbenv exec gem install mysql2 -- \
--with-mysql-lib=/opt/homebrew/Cellar/mysql/8.0.25_1/lib \
--with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.25_1 \
--with-mysql-config=/opt/homebrew/Cellar/mysql/8.0.25_1/bin/mysql_config \
--with-mysql-include=/opt/homebrew/Cellar/mysql/8.0.25_1/include
(Note that you may need to change the version number in those paths)
Notably, this worked with the most recent version of mysql and does not require any Intel versions or using an emulated version of HomeBrew (e.g. ibrew).
Configure Bundler to use this build configuration automatically:
You may also want to set this configuration as your default for mysql2. This way anytime bundler has to re-install mysql2 (on this project or any other project on the same computer), it will automatically use this configuration. You can do that with the following:
bundle config set --global build.mysql2 \
--with-mysql-lib=/opt/homebrew/Cellar/mysql/8.0.25_1/lib \
--with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.25_1 \
--with-mysql-config=/opt/homebrew/Cellar/mysql/8.0.25_1/bin/mysql_config \
--with-mysql-include=/opt/homebrew/Cellar/mysql/8.0.25_1/include
Based on #matthias-winkelmann's answer, use brew to find the correct version of mysql for you:
gem install mysql2 -v '0.5.3' -- \
--with-mysql-lib=$(brew --prefix mysql)/lib \
--with-mysql-dir=$(brew --prefix mysql) \
--with-mysql-config=$(brew --prefix mysql)/bin/mysql_config \
--with-mysql-include=$(brew --prefix mysql)/include
Do notice the specific version of the mysql2 gem I'm referring to here.
I am using Montery12.1 with M1-14inc
Install env with brew
brew install openssl
brew install zstd
export env data
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/
export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix openssl#1.1)/lib/
Install mysql
gem install mysql2 -v '0.5.3' \
--source 'https://rubygems.org/' -- \
--with-cppflags=-I/usr/local/opt/openssl/include \
--with-ldflags=-L/usr/local/opt/openssl/lib
I got error like that
I have tried with, it's work fine:
gem install mysql2 -v 0.5.3 -- --srcdir=/usr/local/mysql/include
UPDATE
I found a simple and fast solution
arch -x86_64 gem install mysql2 -v 0.5.3 -- --srcdir=/usr/local/mysql/include
Refs: https://stackoverflow.com/a/71006010/11049888
After many attempts and much searching I have a working answer. First, you have to have the two brews installed on your M1 Mac- homebrew under arm and homebrew (ibrew) under emulated x86. See https://soffes.blog/homebrew-on-apple-silicon for this. Then, I was able to install mysql#5.7 under emulation, as well as openssl. This is needed because mysql2 is compiling under emulation, it seems, and is referencing those libraries.
ibrew install mysql#5.7
ibrew install openssl
I then needed to add mysql and its libraries to my PATH.
export PATH="/opt/homebrew/bin:/usr/local/bin:/opt/homebrew/opt/mysql:/opt/homebrew/opt/mysql/lib:/usr/local/Cellar//mysql#5.7//5.7.34:/usr/local/Cellar//mysql#5.7//5.7.34/lib:/usr/local/Cellar//mysql#5.7//5.7.34/bin:$PATH"
You might need to tweak this based on version numbers - and when you have it working put it in your ~/.zshrc or other shell initializer file.
Then I was able to install the mysql2 gem with these flags:
gem install mysql2 -V -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include --with-opt-dir="$(ibrew --prefix openssl)"
I'm not a C coder so I don't totally get the details of how mysql2 is linking up to the mysql libraries. I would prefer to use the available mysql under ARM, expecting it must run faster, but not sure how to get it to link up.

Unable to install the Elastic Beanstalk CLI on Ubuntu

I am trying to install the Elastic Beanstalk CLI (awsebcli) on a fresh Ubuntu 14.04 (on Linux subsystem for Windows) using sudo pip install awsebcli, but launching the eb command just returns the following error:
flavien#XPS-FLAVIEN:~$ eb
Traceback (most recent call last):
File "/usr/local/bin/eb", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3036, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3020, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3049, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 654, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 968, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 854, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'termcolor==1.1.0' distribution was not found and is required by awsebcli
Any idea what might be going wrong?
You can reinstall awsebcli with below command if you have issues after installing it:
sudo pip3 install awsebcli --force-reinstall --upgrade
Once its installed check where its installed:
which eb
$ /usr/local/bin/eb #i got eb installed in this path
Next set the path:
export PATH=/usr/local/bin:$PATH
Then run
eb --version
EB CLI 3.14.6 (Python 3.5.2) #this is my installed version
First install the pip separably and try with this command
pip install --upgrade --user awsebcli
I had awsebcli being installed for Python 2.7 but for some reason running eb needed them for Python 3.x so doing this worked :
$ sudo -H pip3 install --upgrade --user awsebcli
After installing all the required wheels eb worked fine :
$ eb --version
EB CLI 3.14.3 (Python 3.5.2)
Also don't forget to add ~/.local/bin to your PATH variable in ~/.bash_profile
The previous answer helped me to figure this one out.
My detail, I had to install a newer version of python than 2.7, one that supported the --trusted-host switch to allow me to get all of my dependencies:
What I ran:
pip --cert zxroot.pem --trusted-host pypi.python.org --proxy [ProxyServer] install --upgrade --user awsebcli
Once I ran that reinstall using the --upgrade switch, eb finally worked:
eb --version
EB CLI 3.10.5 (Python 3.3.1)
I know this is very specific to my particulars but it might help someone else.
Good luck.
The problem is you are missing quite a few applications required by the scripts to compile.
The following installation steps are required prior to running the EB CLI scripts.
As I'm a windows user I created a clean VirtualBox VM install of Ubuntu 18.04.2
Update Ubuntu
sudo apt update
sudo apt upgrade
sudo reboot
Install curl,wget
sudo apt install curl
sudo apt install wget
Install zlib
sudo apt-get install zlib1g-dev
Install libffi
sudo apt-get install libffi libffi5-dev
Install OpenSSL
sudo apt-get install libssl-dev
Install gcc
sudo apt-get install build-essential
sudo apt install libx11-dev
gcc --version
make -v
Install Python 3.7
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7
python3.7 --version
alias python='python3.7'
Install Git
sudo apt install git
After this run the EB CLI
You should see these 5 successful progress steps
Creating exclusive virtualenv for EBCLI
Activating virtualenv
Installing EBCLI
Creating EB wrappers
Finishing up
Success!
Try This:
sudo chown -R username:username ~/.local/
# add to ./*shrc
export PATH=$PATH:~/.local/bin/
pip install --upgrade --user awsebcli
eb --version
#EB CLI 3.10.1 (Python 2.7.1)

on ubutu14.04, when i tried ti install jekyll with command 'gem install jekyll, iget an error

The error is -
Loading command: install (LoadError) cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError) undefined method
`invoke_with_build_args' for nil:NilClass
Please tell the possible reason for this error and help in resoving it.
The same problem is discussed here. It is also solved. Their findings might help you:
https://github.com/jekyll/jekyll-help/issues/55
From the link:
Great! It's all working! I followed this steps:
First i removed all previously installed rubies on my OS.
And next this:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.2
rvm use 2.1.2 --default
gem install jekyll

Trying to setup radiant cms on osx

I am attempting to install radiant cms, when I try and run bundle exec rake db:bootstrap I get the following output. Now I chose mysql as my database but Im not sure if it is setup properly or not to connect. Sorry If it sounds like I dont know what Im talking about this is still somewhat new to me.
Gem.source_index called from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rails-2.3.18/lib/rails/gem_dependency.rb:21.
rake aborted!
uninitialized constant MysqlCompat::MysqlRes
/Users/anderskitson/Sites/Bray Jorstad/config/environment.rb:14:in `<top (required)>'
Tasks: TOP => db:bootstrap => db:initialize => environment
(See full trace by running task with --trace)
install rvm bash -s stable < <(curl -s
https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
setup rvm echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source
"$HOME/.rvm/scripts/rvm"' >> ~/.bash_profile source ~/.bash_profile
download & install Xcode open
https://developer.apple.com/downloads/download.action?path=Developer_Tools/xcode_4.1_for_lion/xcode_4.1_for_lion.dmg
open ~/Downloads/xcode_4.1_for_lion.dmg open "/Volumes/Install
Xcode/InstallXcodeLion.pkg"
install ruby & rubygems rvm install 1.9.3 # or 1.9.2 or 1.8.7
setup an isolated environment for your project rvm use --create
1.9.3#project-name
install radiant gem install radiant --pre --no-ri --no-rdoc #
installs Radiant 1.0 RC4
create a new radiant project radiant ~/project-name cd
~/project-name bundle install bundle exec rake db:bootstrap
install optional clipped dependencies brew install ghostscript
imagemagick # or port install ... brew install --use-gcc ffmpeg #
or port install ffmpeg
start your new radiant app bundle exec script/server
Courtesy of:
https://github.com/radiant/radiant/wiki/Installing-on-Mac-OS-X
I did this today (22/05/13) in OSX (10.7.5) and everything worked fine. Just don't fiddle with your gem file. Keep your database as sqlite3 when developing, or at least until you get everything working.
Good luck!

Install perl-JSON on centos

When I'm trying to run a perl script (on my centos 6 machine) I get this message:
Can't locate JSON.pm in #INC (#INC contains:
/usr/local/lib/perl5/5.10.1/x86_64-linux-thread-multi
/usr/local/lib/perl5/5.10.1
/usr/local/lib/perl5/site_perl/5.10.1/x86_64-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.1 .)...
After googling a bit, I found out that I need to install that module; But, when I'm typing:
sudo yum install perl-JSON
I get this message:
...
Setting up Install Process
Package perl-JSON-2.17-1.el5.noarch already installed and latest version
Nothing to do
What can I do in order to run that script?
My perl version is v5.10.1
Thanks,
Try to install it via:
1) CPAN (cpan install)
$ sudo cpan JSON
2) CPAN minus (cpanm)
Install cpan minus
$ wget http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.5017.tar.gz
$ tar -zxvf App-cpanminus-1.5017.tar.gz
$ cd App-cpanminus-1.5017
$ perl make.pl
$ make
$ make test
$ sudo make install
Then install it via cpanm
$ sudo cpanm JSON
I prefer work with CPAN modules via cpanm, because it's modern and easy way!
Maybe this will help others.
In my case,
running in Centos 7:
yum install cpan
then
yum install cpanminus
for cpan (not cpan minus):
yum install cpan
cpan JSON