{"id":9619,"date":"2021-09-01T17:39:24","date_gmt":"2021-09-01T17:39:24","guid":{"rendered":"https:\/\/linuxways.net\/?p=9619"},"modified":"2021-09-01T17:39:24","modified_gmt":"2021-09-01T17:39:24","slug":"how-to-install-ruby-on-centos-8","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-install-ruby-on-centos-8\/","title":{"rendered":"How to Install Ruby on CentOS 8"},"content":{"rendered":"<p>Ruby is an open-source and high-level programming language used for developing dynamic and modern web applications. Additionally, Ruby is also used for scripting, data analysis, static site generation and a whole lot more.<\/p>\n<p>Ruby is behind the popular and powerful Ruby and rails framework, upon which many popular websites such as twitter, airbnb, github have been built.<\/p>\n<p>In this guide, we will walk you through the installation of the Ruby programming language on CentOS 8. We will demonstrate two different ways to install Ruby.<\/p>\n<h2><strong>Install Ruby from CentOS 8 repositories<\/strong><\/h2>\n<p>First, we need to update our system\u2019s packages and repositories by running the following <a href=\"https:\/\/www.tecmint.com\/dnf-commands-for-fedora-rpm-package-management\/\">dnf command<\/a>.<\/p>\n<pre><strong>$ sudo dnf update<\/strong><\/pre>\n<p>Some dependencies are also required for Ruby\u2019s installation to proceed smoothly.<\/p>\n<pre><strong>$ sudo dnf install tar curl gnupg2 <\/strong><\/pre>\n<p>With the prerequisites installed, proceed and install Ruby from the CentOS 8 AppStream repositories using the dnf package manager<\/p>\n<pre><strong>$ sudo dnf install @ruby<\/strong><\/pre>\n<p>Next, confirm the Ruby version installed as follows:<\/p>\n<pre><strong>$ ruby --version<\/strong><\/pre>\n<h2><strong><img loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"60\" class=\"wp-image-9620\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-495.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-495.png 660w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-495-300x27.png 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/strong><strong>Install Ruby on centOS using RVM <\/strong><\/h2>\n<p>Ruby Version Manager(RVM) is a command-line utility that allows you to easily manage, install and run multiple Ruby environments. To install the latest version of RVM, run the following curl command as a root user.<\/p>\n<pre><strong>$ curl -sSL https:\/\/get.rvm.io | bash<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"836\" height=\"331\" class=\"wp-image-9621\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-496.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-496.png 836w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-496-300x119.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-496-768x304.png 768w\" sizes=\"auto, (max-width: 836px) 100vw, 836px\" \/><\/strong>You will get the output above. During the installation, you will be provided with a source command followed by the path to rvm, use this command to start RVM. In my case, I will run the command:<\/p>\n<pre><strong>$ source \/home\/winnie\/ .rvm\/scripts\/rvm<\/strong><\/pre>\n<p>Next, install ruby package requirements:<\/p>\n<pre><strong>$ rvm requirements<\/strong><\/pre>\n<p>Now that ruby package requirements are successfully installed, let\u2019s check the versions of Ruby that are available for download. Execute the command:<\/p>\n<pre><strong>$ rvm list known<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"643\" height=\"321\" class=\"wp-image-9623\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-498.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-498.png 643w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-498-300x150.png 300w\" sizes=\"auto, (max-width: 643px) 100vw, 643px\" \/><\/p>\n<p>From the output above, we can see that the latest version of Ruby is 3.0.2. This is at the time of writing this article. With RVM installed, the next step is to install Ruby. Specify the version of Ruby you wish to install after the RVM command.<\/p>\n<pre><strong>$ rvm install ruby 3.0.2<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"930\" height=\"218\" class=\"wp-image-9624\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-499.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-499.png 930w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-499-300x70.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-499-768x180.png 768w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/p>\n<p>Finally, let\u2019s verify the version of Ruby installed in our machine with the command:<\/p>\n<pre><strong>$ ruby --version<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"60\" class=\"wp-image-9625\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-500.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-500.png 660w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-500-300x27.png 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/p>\n<p>As shown from the output, the Ruby version has now been updated to reflect the most recent version installed by the RVM manager.<\/p>\n<p>Run the command below to make the recently installed version the default Ruby version on your system:<\/p>\n<pre><strong># rvm use 2.7.1 --default<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"474\" height=\"63\" class=\"wp-image-9626\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-501.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-501.png 474w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-501-300x40.png 300w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/strong><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>You can now run ruby applications on your centos 8 machine.<\/p>","protected":false},"excerpt":{"rendered":"<p>Ruby is an open-source and high-level programming language used for developing dynamic and modern web applications. Additionally, Ruby is also used for scripting, data analysis, static site generation&hellip;<\/p>","protected":false},"author":1,"featured_media":9757,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[93,216],"class_list":["post-9619","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos-8","tag-ruby"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9619","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=9619"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9619\/revisions"}],"predecessor-version":[{"id":9756,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9619\/revisions\/9756"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/9757"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=9619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=9619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=9619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}