How to install fluentd plugins on No network(offline) - fluentd

I want to install fluent-plugin-route, but I don't know how.
i can't use gem install fluent-plugin-route because there's no internet.
Any ideas?

Suggestion: Build the package with rake and install it with gem
1) git clone "Your Repository"
2) bundle install
If you don't have bundler "gem install bundler"
3) bundle exec rake build
4) gem install pkg/xxx.gem (Location would be pkg folder)
Copy paste your gem via gem install --local as mentioned by DeeChok on your offline VM via gem produced on your online VM by following step 1-4

Download the gem and its dependencies (also gems)
Put them on the node/instance/vm
Change directory to where the gems are located
Run the below command:
gem install -N --conservative --minimal-deps --no-document --force --local *gem
N.B: You will have to have ruby installed. You can do that install ruby from source by following the steps here. You may need to install gcc, gcc-c++, openssl-dev(OR libel-dev on RHEL7) before hand.
Hope this helps :)

Related

Rails: How to change Bundler default version

bundler (2.0.1, default: 1.17.2)
How could I change the default to 2.0.1
Following https://bundler.io/guides/bundler_2_upgrade.html#upgrading-applications-from-bundler-1-to-bundler-2, here's what worked for me:
gem install --default bundler
gem update --system
bundle update --bundler
What helped me is to delete the current default manually from the folder
lib\ruby\gems\2.6.0\specifications\default\
and then install fresh bundler as usually
gem install bundler
or as default
gem install --default bundler
I had this same concern when trying to setup Bundler gem 2.2.11 as the default gem on my machine.
Here's how I achieved it:
First, I listed and uninstalled all other versions of the Bundler gem because I did not need them:
gem list bundler
gem uninstall bundler
If you encounter an error like this
Gem bundler-2.1.4 cannot be uninstalled because it is a default gem
Simply run the command below to get your ruby installation directory:
gem environment | grep "INSTALLATION DIRECTORY"
This should display an output like this. In my case my ruby version was 2.7.2:
- INSTALLATION DIRECTORY: /home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0
Next, navigate to the specifications/default directory of the INSTALLATION PATH:
cd /home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/specifications/default
Remove/delete the bundler.gemspec file that you have there. In my case it was bundler-2.1.4.gemspec, so I ran the command:
rm bundler-2.1.4.gemspec
Next, I installed the Bundler gem 2.2.11 and made it the default gem:
gem install --default bundler -v 2.2.11
Next, I listed my Bundler versions:
gem list bundler
Finally, I updated my gems to use the newly installed Bundler:
gem update --system
That's all.
I hope this helps
You need to remove .spec file to remove the gem.
Steps:
gem env – try to search in provided list under GEM PATHS, in specifications/default
remove there bundler-VERSION.gemspec
install bundler, if you don't have specific: gem install bundler:VERSION --default
gem install --default bundler:<version>
You need to know where the default specs are, so use gem environment to find out.
the steps I used were:
gem environment
# note INSTALLATION DIRECTORY
cd <installation_dir>
cd specifications/default
rm bundler-2.1.4.gemspec
gem install --default bundler -v 2.2.11
Remove all default bundler versions.
Commands:
$ gem environment
$ cd INSTALLATION DIRECTORY
$ cd specifications
$ cd default
$ rm bundler version
$ gem install bundler

not available Gem::SafeYAML when to run 'bundle install'

When I try to run bundle install from the project, I get the following error:
unavalible Gem :: SafeYAML when to run 'bundle install'
my version of rubygem is:
2.0.14
After investigating what I could solve with the following steps:
1.-Download the zip file from the following download and add it to the root of the project
2.- If you don't have any RubyGems installed, there is still the pre-gem approach to getting software, doing it manually:
2.1-Download from above
2.2-Unpack into a directory and cd there
2.3-Install with: ruby setup.rb (you may need admin/root privilege)
2.4- like sudo:
gem update --system
3. run:
bundle install

I git cloned a repo and I cannot run it on localhost because missing gem and cannot bundle install

I git cloned a repo. I cannot run it on localhost with rails server because terminal says
Could not find activesupport-4.2.5 in any of the sources Run bundle
install to install missing gems.
When I run bundle install, I get
An error occurred while installing pg (0.18.4), and Bundler cannot
continue. Make sure that gem install pg -v '0.18.4' succeeds before
bundling.
I have rails 4.2.3, and the repo's Gemfile has gem 'rails', '4.2.5'. I don't know if this matter
Gem pg is Postgres driver, it only can be installed, if corresponding headers and libraries are present and can be accessed.
Most probably just installing postgres will fix it. If you're on a Mac with homebrew - brew install postgresql
Install postgresql.
Remove Gemfile.lock
Add gem 'pg' in your gemfile
execute bundle install
1: Remove Gemfile.lock if Gemgile.lock present in your project
2: add gem 'pg' # in Gemfile
3: Run bundle install
Hope this help you !!!
Run
sudo env ARCHFLAGS="-arch x86_64" gem install pg -v '1.18.4'
Now try running bundle install again.
I used a combination of #Chakreshwar Sharma and #Vinay's answers to get this working for the metasploit-framework.
Remove Gemfile.lock
Add gem 'pg' in your gemfile
Run apt-cache search postgresql-server-dev
apt-get update && apt-get install postgresql-server-dev-9.5 # Check your version
bundle install --no-deployment
To be honest, I think you could just run:
apt-cache search postgresql-server-dev
apt-cache search postgresql-server-dev-9.5
bundle install
...and you can avoid messing with the Gemfile, but I didn't get to verify it since mine started working after I made the adjustments.

Error installing CocoaPods

I am trying to install the latest CocoaPods (which is 0.36.1) but it shows me the following error.
$ gem install cocoapods
ERROR: Could not find a valid gem 'xcodeproj' (~> 0.23.1) in any repository
Sudo?
Btw, in the answered questions some are proposed using sudo get install cocoapods. You do need sudo indeed if you are using the system-wide ruby executable. I am using rbenv for my ruby management, it is installed locally for the user and does not need sudo.
Update
The gem install cocoapods command worked the following day. Mystery.
I think you could try an older version of the pods.
I tried: sudo gem install cocoapods -v 0.34.0 and this worked for me.
For your error you should do like this
i) $ sudo gem install xcodeproj
ii) $ sudo gem install cocoapods
for pod version you can verify pod --version
I think you need to update your gems repo.
try issuing "gem update" in a terminal. Can't remenber if you need sudo.
Try that, and then try installing xcodeproj and cocoapods again.
Regards
Steffen
If the automatic downloading of xcodeproj 0.23 fails, you can fetch the gem file manually:
gem fetch xcodeproj -v 0.23.0
This will put the .gem file in your current directory.
Then you can install the gem:
gem install xcodeproj -v 0.23.0
If the xcodeproj gem installs successfully, you can continue with your install of cocoapods as usual:
gem install cocoapods
Next time that occurs, run the command gem sources -u to update your source cache and try again.

Install a gem from a downloaded tar or zip

First let me say I cannot do gem install, I don't know why. Probably because I live in China and the firewall random things.
So I have to locally install gems. For example, i want to install this gem riddle. But this gem downloads as a tar or zip and when i open it it is a folder not a .gem file.
So what to do?
You can do gem build whatever.gemspec inside of the directory that you untar/unzip -- that will produce a .gem file, then do gem install whatever.gem.
You need to be at the directory where you unzip the gem file for example
C:\railsinstaller\ruby2.2.0\lib\ruby\gems\2.2.0\gems> gem install rails-5.0.0.1.gem
and that's it - you are done downloading and installing Rails.
To avoid the gem build step, and to always run the actual code, bundler can install from a local path:
gem 'pry', path: './pry'
in a Gemfile.
... where ./pry would be the clone of your repository.
Simply run bundle install once, and any changes in the gem sources you make are immediately reflected. With gem build pry / gem install pry/pry.gem, the sources are still moved into GEM_PATH and you'll always have to run both gem build pry and gem update again if you make changes.

Resources