{"id":22042,"date":"2023-10-01T15:32:59","date_gmt":"2023-10-01T15:32:59","guid":{"rendered":"https:\/\/linuxways.net\/?p=22042"},"modified":"2023-10-01T15:32:59","modified_gmt":"2023-10-01T15:32:59","slug":"how-to-install-rubygems-on-ubuntu","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-rubygems-on-ubuntu\/","title":{"rendered":"How to Install RubyGems on Ubuntu"},"content":{"rendered":"<p>RubyGems is a Package Manager containing Gems. The Gem in Ruby is a piece of code or package that performs a specific functionality and also contains a bunch of utilities. Gem usually contains pre-coded information or data from someone else and it makes the process of understanding and using the methods of code easier.<\/p>\n<p>This article discusses the installation procedure of RubyGems on Ubuntu.<\/p>\n<h2><strong>Pre-requisite<\/strong><\/h2>\n<p>You should have the following packages\/tools installed:<\/p>\n<ul>\n<li>Ubuntu 22.04 LTS Server<\/li>\n<li>Root Access<\/li>\n<li>\u201capt\u201d Installed<\/li>\n<\/ul>\n<h2><strong>How to Install RubyGems on Ubuntu?<\/strong><\/h2>\n<p>The RubyGems Package Manager can be installed through the Ubuntu Terminal using the steps below.<\/p>\n<h3><strong>Step 1: Update Existing Packages<\/strong><\/h3>\n<p>Before installing RubyGems, ensure updating your existing Ubuntu Packages. Update your existing Ubuntu Packages using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt update<\/div><\/div>\n<p>Wait for the packages to update:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1092\" height=\"403\" class=\"wp-image-22043\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-1.png 1092w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-1-300x111.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-1-1024x378.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-1-768x283.png 768w\" sizes=\"auto, (max-width: 1092px) 100vw, 1092px\" \/><\/p>\n<p>Upgrade the packages now using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt upgrade<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1087\" height=\"130\" class=\"wp-image-22044\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-2.png 1087w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-2-300x36.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-2-1024x122.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-2-768x92.png 768w\" sizes=\"auto, (max-width: 1087px) 100vw, 1087px\" \/><\/p>\n<h3><strong>Step 2: Install RubyGems<\/strong><\/h3>\n<p>RubyGems can be installed in Ubuntu using either the \u201capt\u201d command to automatically download it from the official repository, or using the manual method by downloading the RubyGems Package first from the repository and then extracting the package. The following methods describe both the process.<\/p>\n<h3><strong>Install using the \u201capt\u201d Command<\/strong><\/h3>\n<p>The \u201capt\u201d command will download RubyGems from the official repository and install it once downloaded. Install RubyGems with the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> ruby ruby-dev<\/div><\/div>\n<p>It will ask for confirmation, press \u201cY\u201d to continue with the installation process:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"730\" height=\"417\" class=\"wp-image-22045\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-3.png 730w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-3-300x171.png 300w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/p>\n<h3><strong>Install Manually using the \u201ctgz\u201d File<\/strong><\/h3>\n<p>The RubyGems can also be installed manually by downloading the RubyGems \u201ctgz\u201d archive file and then extracting it with the \u201ctar\u201d Command. You can also install RubyGems by using the \u201cwget\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">wget<\/span> https:<span class=\"sy0\">\/\/<\/span>rubygems.org<span class=\"sy0\">\/<\/span>rubygems<span class=\"sy0\">\/<\/span>rubygems-3.3.7.tgz<\/div><\/div>\n<p>This will fetch the file and start downloading it:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1096\" height=\"169\" class=\"wp-image-22046\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-4.png 1096w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-4-300x46.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-4-1024x158.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-4-768x118.png 768w\" sizes=\"auto, (max-width: 1096px) 100vw, 1096px\" \/><\/p>\n<p>Once the archive file downloads, extract it with the \u201ctar\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">tar<\/span> xvf rubygems-3.3.7.tgz<\/div><\/div>\n<p>Wait for the files to be extracted:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1098\" height=\"524\" class=\"wp-image-22048\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-5.png 1098w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-5-300x143.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-5-1024x489.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-5-768x367.png 768w\" sizes=\"auto, (max-width: 1098px) 100vw, 1098px\" \/><\/p>\n<p>Once all the files are extracted, Navigate to the RubyGems directory using the \u201ccd\u201d Command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">cd<\/span> rubygems-3.3.7<span class=\"sy0\">\/<\/span><\/div><\/div>\n<p>Now List the files in the RubyGems Directory using \u201cls\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">ls<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1106\" height=\"94\" class=\"wp-image-22049\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-6.png 1106w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-6-300x25.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-6-1024x87.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-6-768x65.png 768w\" sizes=\"auto, (max-width: 1106px) 100vw, 1106px\" \/><\/p>\n<p>In the RubyGems Directory, look for the setup file \u201csetup.rb\u201d:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1097\" height=\"95\" class=\"wp-image-22050\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-7.png 1097w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-7-300x26.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-7-1024x89.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-7-768x67.png 768w\" sizes=\"auto, (max-width: 1097px) 100vw, 1097px\" \/><\/p>\n<p>If the setup file exists, Install it using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">ruby setup.rb<\/div><\/div>\n<p>This will install the RubyGems packages:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1095\" height=\"470\" class=\"wp-image-22051\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-8.png 1095w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-8-300x129.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-8-1024x440.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-8-768x330.png 768w\" sizes=\"auto, (max-width: 1095px) 100vw, 1095px\" \/><\/p>\n<h3><strong>Step 3: Verify Installation<\/strong><\/h3>\n<p>To verify, run the RubyGems Version Command on your Ubuntu System:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">gem <span class=\"re5\">--version<\/span><\/div><\/div>\n<p>The version once displayed verifies the installation of RubyGems. In our case, the version is \u201c3.3.5\u201d:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1099\" height=\"63\" class=\"wp-image-22052\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-9.png 1099w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-9-300x17.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-9-1024x59.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-9-768x44.png 768w\" sizes=\"auto, (max-width: 1099px) 100vw, 1099px\" \/><\/p>\n<h3><strong>Step 4: Install a Package<\/strong><\/h3>\n<p>Once the RubyGems Package Manager is installed, you can now use the \u201cgem\u201d command to install gems from the official RubyGems Community. To Install the \u201ch2o\u201d Gem Package, use the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> gem <span class=\"kw2\">install<\/span> h2o<\/div><\/div>\n<p>The installation will be confirmed once the gem is added:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1112\" height=\"155\" class=\"wp-image-22053\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-10.png 1112w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-10-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-10-1024x143.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-10-768x107.png 768w\" sizes=\"auto, (max-width: 1112px) 100vw, 1112px\" \/><\/p>\n<h3><strong>Step 5: Remove a Package<\/strong><\/h3>\n<p>The installed gem packages can also be removed using the \u201cremove\u201d command with the \u201cgem\u201d command. Using the command below, remove the installed \u201ch2o\u201d gem package:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> gem uninstall h2o<\/div><\/div>\n<p>The \u201ch2o\u201d gem package will be uninstalled:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1102\" height=\"57\" class=\"wp-image-22054\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-11.png 1102w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-11-300x16.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-11-1024x53.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22042-11-768x40.png 768w\" sizes=\"auto, (max-width: 1102px) 100vw, 1102px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>The RubyGems can be installed from the official repository directly using the \u201capt\u201d command or can be downloaded using the \u201cwget\u201d command and then extracted using the \u201ctar\u201d command. This article explained the \u201capt\u201d and \u201cwget\u201d procedures to install RubyGems on Ubuntu.<\/p>","protected":false},"excerpt":{"rendered":"<p>The RubyGems can be installed using the \u201capt install ruby ruby-dev\u201d command or can be downloaded and extracted using the \u201cwget\u201d and \u201ctar\u201d commands.<\/p>","protected":false},"author":110,"featured_media":22047,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-22042","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/22042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=22042"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/22042\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/22047"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=22042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=22042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=22042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}