gem1.8 or gem command is the front end to RubyGems – a sophisticated package manager for Ruby. You need to install the following packages:
Tutorial details | |
---|---|
Difficulty | Intermediate (rss) |
Root privileges | Yes |
Requirements | Debian/Ubuntu |
Time | N/A |
Installation
Open a terminal and type the following command:
$ sudo apt-get install rubygems build-essential
OR
$ sudo apt-get install rubygems
OR
$ sudo apt-get install ruby1.8-dev rubygems1.8
Sample outputs:
Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: ruby1.8-dev rubygems1.8 Suggested packages: rubygems-doc The following NEW packages will be installed: ruby1.8-dev rubygems rubygems1.8 0 upgraded, 3 newly installed, 0 to remove and 4 not upgraded. Need to get 1,154 kB of archives. After this operation, 3,322 kB of additional disk space will be used. Do you want to continue [Y/n]? y Get:1 http://mirrors.kernel.org/debian/ stable/main ruby1.8-dev amd64 1.8.7.302-2squeeze1 [886 kB] Get:2 http://mirrors.kernel.org/debian/ stable/main rubygems1.8 all 1.3.7-3 [202 kB] Get:3 http://mirrors.kernel.org/debian/ stable/main rubygems all 1.3.7-3 [66.7 kB] Fetched 1,154 kB in 4s (270 kB/s) Selecting previously deselected package ruby1.8-dev. (Reading database ... 338544 files and directories currently installed.) Unpacking ruby1.8-dev (from .../ruby1.8-dev_1.8.7.302-2squeeze1_amd64.deb) ... Selecting previously deselected package rubygems1.8. Unpacking rubygems1.8 (from .../rubygems1.8_1.3.7-3_all.deb) ... Selecting previously deselected package rubygems. Unpacking rubygems (from .../rubygems_1.3.7-3_all.deb) ... Processing triggers for man-db ... Setting up ruby1.8-dev (1.8.7.302-2squeeze1) ... Setting up rubygems1.8 (1.3.7-3) ... Setting up rubygems (1.3.7-3) ...
A note about Ruby version 1.9.x
To install Ruby version 1.9.1 under Debian Linux v6.x, enter:
$ sudo apt-get install ruby1.9.1-full ruby1.9.1-dev rubygems1.9.1
Sample outputs:
Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'ruby1.9.1' instead of 'rubygems1.9.1' The following extra packages will be installed: libruby1.9.1 libruby1.9.1-dbg libtcltk-ruby1.9.1 libyaml-0-2 ri1.9.1 ruby1.9.1 ruby1.9.1-examples tk8.4 Suggested packages: graphviz ruby1.9.1-elisp The following NEW packages will be installed: libruby1.9.1 libruby1.9.1-dbg libtcltk-ruby1.9.1 libyaml-0-2 ri1.9.1 ruby1.9.1 ruby1.9.1-dev ruby1.9.1-examples ruby1.9.1-full tk8.4 0 upgraded, 10 newly installed, 0 to remove and 4 not upgraded. Need to get 17.8 MB of archives. After this operation, 89.5 MB of additional disk space will be used. Do you want to continue [Y/n]? y Get:1 http://mirrors.kernel.org/debian/ stable/main libyaml-0-2 amd64 0.1.3-1 [54.6 kB] Get:2 http://mirrors.kernel.org/debian/ stable/main libruby1.9.1 amd64 1.9.2.0-2 [4,517 kB] Get:3 http://mirrors.kernel.org/debian/ stable/main tk8.4 amd64 8.4.19-4 [1,053 kB] Get:4 http://mirrors.kernel.org/debian/ stable/main libtcltk-ruby1.9.1 amd64 1.9.2.0-2 [2,502 kB] Get:5 http://mirrors.kernel.org/debian/ stable/main ruby1.9.1 amd64 1.9.2.0-2 [754 kB] Get:6 http://mirrors.kernel.org/debian/ stable/main ri1.9.1 all 1.9.2.0-2 [2,093 kB] Get:7 http://mirrors.kernel.org/debian/ stable/main ruby1.9.1-dev amd64 1.9.2.0-2 [1,852 kB] Get:8 http://mirrors.kernel.org/debian/ stable/main ruby1.9.1-examples all 1.9.2.0-2 [780 kB] Get:9 http://mirrors.kernel.org/debian/ stable/main libruby1.9.1-dbg amd64 1.9.2.0-2 [3,469 kB] Get:10 http://mirrors.kernel.org/debian/ stable/main ruby1.9.1-full all 1.9.2.0-2 [718 kB] Fetched 17.8 MB in 39s (447 kB/s) Selecting previously deselected package libyaml-0-2. (Reading database ... 338976 files and directories currently installed.) Unpacking libyaml-0-2 (from .../libyaml-0-2_0.1.3-1_amd64.deb) ... Selecting previously deselected package libruby1.9.1. Unpacking libruby1.9.1 (from .../libruby1.9.1_1.9.2.0-2_amd64.deb) ... Selecting previously deselected package tk8.4. Unpacking tk8.4 (from .../tk8.4_8.4.19-4_amd64.deb) ... Selecting previously deselected package libtcltk-ruby1.9.1. Unpacking libtcltk-ruby1.9.1 (from .../libtcltk-ruby1.9.1_1.9.2.0-2_amd64.deb) ... Selecting previously deselected package ruby1.9.1. Unpacking ruby1.9.1 (from .../ruby1.9.1_1.9.2.0-2_amd64.deb) ... Selecting previously deselected package ri1.9.1. Unpacking ri1.9.1 (from .../ri1.9.1_1.9.2.0-2_all.deb) ... Selecting previously deselected package ruby1.9.1-dev. Unpacking ruby1.9.1-dev (from .../ruby1.9.1-dev_1.9.2.0-2_amd64.deb) ... Selecting previously deselected package ruby1.9.1-examples. Unpacking ruby1.9.1-examples (from .../ruby1.9.1-examples_1.9.2.0-2_all.deb) ... Selecting previously deselected package libruby1.9.1-dbg. Unpacking libruby1.9.1-dbg (from .../libruby1.9.1-dbg_1.9.2.0-2_amd64.deb) ... Selecting previously deselected package ruby1.9.1-full. Unpacking ruby1.9.1-full (from .../ruby1.9.1-full_1.9.2.0-2_all.deb) ... Processing triggers for man-db ... Processing triggers for menu ... Setting up libyaml-0-2 (0.1.3-1) ... Setting up libruby1.9.1 (1.9.2.0-2) ... Setting up tk8.4 (8.4.19-4) ... update-alternatives: using /usr/bin/wish8.4 to provide /usr/bin/wish (wish) in auto mode. Setting up libtcltk-ruby1.9.1 (1.9.2.0-2) ... Setting up ruby1.9.1 (1.9.2.0-2) ... Setting up ri1.9.1 (1.9.2.0-2) ... Setting up ruby1.9.1-dev (1.9.2.0-2) ... Setting up ruby1.9.1-examples (1.9.2.0-2) ... Setting up libruby1.9.1-dbg (1.9.2.0-2) ... Setting up ruby1.9.1-full (1.9.2.0-2) ... Processing triggers for menu ...
Verify that gem is working
Type the following command:
$ gem env
Sample outputs:
RubyGems Environment: - RUBYGEMS VERSION: 1.3.7 - RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux] - INSTALLATION DIRECTORY: /var/lib/gems/1.8 - RUBY EXECUTABLE: /usr/bin/ruby1.8 - EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-linux - GEM PATHS: - /var/lib/gems/1.8 - /home/vivek/.gem/ruby/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/
How do I use rybygems command?
You need to use the gem or gem1.8 or gem1.9.1 command to install packages for ruby.
Install syslog-logger
Install syslog-logger from local directory or remote server:
$ sudo gem install syslog-logger
Install syslog-logger from remote server:
$ gem install syslog-logger --remote
Search gems
Final local gems whose name begins with ‘A’:
gem list A
List local and remote gems whose name contains ‘syslog’:
$ gem search syslog --both
List only remote gems whose name contains ‘syslog’:
$ gem search syslog --remote
Uninstall / delete ‘syslog-logger’
Type the following command:
$ sudo gem uninstall syslog-logger
Update all gems on your system
Type the following command
$ sudo gem update
References
- man pages – gem, sudo, and apt-get
- The RubyGems bookshelf
🐧 1 comment so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Hi,
I hope this is the first of many articles about Ruby.
Thanks,
Astorre