{"id":2045,"date":"2025-05-16T08:39:13","date_gmt":"2025-01-03T16:44:54","guid":{"rendered":""},"modified":"2025-02-02T00:46:18","modified_gmt":"2025-02-01T23:46:18","slug":"how-to-install-ruby-on-rails-on-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/how-to-install-ruby-on-rails-on-ubuntu-24-04\/","title":{"rendered":"Linux VPS &#038; VPS Windows Setup Guide | NetCloud24 Ruby on Rails on Ubuntu 24.04"},"content":{"rendered":"<p>\u00a0<\/p>\n<\/p>\n<header>\n<h1>\u00a0<\/h1>\n<\/header>\n<article>\n<p><strong>Ruby on Rails<\/strong> is a popular web application framework that makes building dynamic web applications easier. It combines the Ruby programming language with powerful tools and features to streamline development. In this guide, we will walk you through how to install Ruby on Rails on <strong>Ubuntu 24.04<\/strong>. Using a  server for your Rails applications offers increased performance, scalability, and control, which is crucial for deploying modern web applications.<\/p>\n<h2>Step 1: Update Your VPS Server<\/h2>\n<p>Before you start the installation, ensure that your <a href=\"https:\/\/ie.netcloud24.com\">VPS server<\/a> is up to date. Run the following commands to update your Ubuntu 24.04 system:<\/p>\n<pre><code>sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/pre>\n<p>Using a <strong>Windows VPS<\/strong> ensures that your Ruby on Rails applications have the performance and reliability required for high-traffic environments.<\/p>\n<h2>Step 2: Install Dependencies<\/h2>\n<p>Before installing Ruby, you need to install several dependencies required for building Ruby and working with Rails:<\/p>\n<pre><code>sudo apt install curl gpg build-essential libssl-dev libreadline-dev zlib1g-dev -y<\/code><\/pre>\n<h2>Step 3: Install Rbenv and Ruby<\/h2>\n<p><strong>Rbenv<\/strong> is a Ruby version management tool that allows you to install and manage different versions of Ruby. First, clone the Rbenv repository and set up Rbenv:<\/p>\n<pre><code>\r\ngit clone https:\/\/github.com\/rbenv\/rbenv.git ~\/.rbenv\r\necho 'export PATH=\"$HOME\/.rbenv\/bin:$PATH\"' &gt;&gt; ~\/.bashrc\r\necho 'eval \"$(rbenv init -)\"' &gt;&gt; ~\/.bashrc\r\nexec $SHELL\r\n<\/code><\/pre>\n<p>Next, install <code>ruby-build<\/code> so that you can install Ruby using Rbenv:<\/p>\n<pre><code>\r\ngit clone https:\/\/github.com\/rbenv\/ruby-build.git ~\/.rbenv\/plugins\/ruby-build\r\necho 'export PATH=\"$HOME\/.rbenv\/plugins\/ruby-build\/bin:$PATH\"' &gt;&gt; ~\/.bashrc\r\nexec $SHELL\r\n<\/code><\/pre>\n<p>Now, install the latest version of Ruby (or your preferred version) using Rbenv:<\/p>\n<pre><code>rbenv install 3.2.0<\/code><\/pre>\n<p>Set Ruby 3.2.0 as the global version:<\/p>\n<pre><code>rbenv global 3.2.0<\/code><\/pre>\n<h2>Step 4: Install Rails<\/h2>\n<p>Once Ruby is installed, you can proceed with installing Rails. Use the gem command to install Rails:<\/p>\n<pre><code>gem install rails<\/code><\/pre>\n<p>After the installation is complete, verify the Rails installation:<\/p>\n<pre><code>rails -v<\/code><\/pre>\n<h2>Step 5: Install Node.js and Yarn<\/h2>\n<p>Rails requires a JavaScript runtime, which can be provided by <strong>Node.js<\/strong>. Install Node.js and <strong>Yarn<\/strong> (a package manager for JavaScript) by running the following commands:<\/p>\n<pre><code>\r\ncurl -sL https:\/\/deb.nodesource.com\/setup_18.x | sudo -E bash -\r\nsudo apt install nodejs -y\r\ncurl -sS https:\/\/dl.yarnpkg.com\/debian\/pubkey.gpg | sudo apt-key add -\r\necho \"deb https:\/\/dl.yarnpkg.com\/debian\/ stable main\" | sudo tee \/etc\/apt\/sources.list.d\/yarn.list\r\nsudo apt update &amp;&amp; sudo apt install yarn -y\r\n<\/code><\/pre>\n<h2>Step 6: Set Up a New Rails Application<\/h2>\n<p>Now that Rails is installed, you can create a new Rails application. Navigate to the directory where you want to create your app and run the following command:<\/p>\n<pre><code>rails new myapp<\/code><\/pre>\n<p>Navigate into the newly created project folder:<\/p>\n<pre><code>cd myapp<\/code><\/pre>\n<p>Install the necessary gems:<\/p>\n<pre><code>bundle install<\/code><\/pre>\n<h2>Step 7: Configure Apache for Rails<\/h2>\n<p>To serve your Rails application with Apache, you need to install <strong>Passenger<\/strong>, a module that integrates with Apache. First, install the Passenger repository and key:<\/p>\n<pre><code>\r\nsudo apt install dirmngr gnupg -y\r\nsudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7\r\nsudo apt-add-repository https:\/\/oss-binaries.phusionpassenger.com\/apt\/passenger\r\nsudo apt update\r\n<\/code><\/pre>\n<p>Install Passenger with Apache:<\/p>\n<pre><code>sudo apt install libapache2-mod-passenger -y<\/code><\/pre>\n<p>Enable Passenger and restart Apache:<\/p>\n<pre><code>\r\nsudo a2enmod passenger\r\nsudo systemctl restart apache2\r\n<\/code><\/pre>\n<h2>Step 8: Configure Apache Virtual Host for Your Rails Application<\/h2>\n<p>Next, create a virtual host for your Rails application. Open a new configuration file:<\/p>\n<pre><code>sudo nano \/etc\/apache2\/sites-available\/myapp.conf<\/code><\/pre>\n<p>Add the following configuration:<\/p>\n<pre><code>\r\n\r\n    ServerName your-domain.com\r\n    DocumentRoot \/home\/your-username\/myapp\/public\r\n\r\n    \r\n        AllowOverride all\r\n        Require all granted\r\n    \r\n\r\n    ErrorLog ${APACHE_LOG_DIR}\/myapp-error.log\r\n    CustomLog ${APACHE_LOG_DIR}\/myapp-access.log combined\r\n\r\n<\/code><\/pre>\n<p>Replace <code>your-domain.com<\/code> with your actual domain name and <code>your-username<\/code> with your Linux username. Enable the site and restart Apache:<\/p>\n<pre><code>\r\nsudo a2ensite myapp\r\nsudo systemctl restart apache2\r\n<\/code><\/pre>\n<h2>Step 9: Optimize Your VPS Server for Rails<\/h2>\n<p>Hosting your Rails application on a  gives you the resources needed to handle large traffic and ensure high performance. A <strong>VPS server<\/strong> provides dedicated memory, CPU, and disk space, making it easier to scale your web application as your user base grows. With a VPS server, you can also customize your environment, ensuring that your Rails application runs smoothly and securely.<\/p>\n<h2>Conclusion<\/h2>\n<p>Installing Ruby on Rails on Ubuntu 24.04 is a straightforward process that enables you to build robust web applications. By hosting your application on a , you ensure that your app has the necessary performance and reliability to thrive in a production environment.<\/p>\n<p>For more information on VPS hosting and optimizing your Rails deployment, visit  today.<\/p>\n<\/article>\n<footer>\n<p>\u00a9 2024 Windows VPS &#8211; All Rights Reserved<\/p>\n<\/footer>\n<div class=\"post-author-box\" style=\"border-top:1px solid #ddd;margin-top:20px;padding-top:15px;\">\n<p><strong>Author:<\/strong> \u0141ukasz Bodziony<\/p>\n<p><strong>Website:<\/strong> <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a><\/p>\n<p><em>\u0141ukasz Bodziony is the CEO and founder of <a href=\"https:\/\/netcloud24.com\" target=\"_blank\" rel=\"dofollow\">NETCLOUD24<\/a>, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance <strong>Windows VPS<\/strong> and <strong>Remote Desktop Services (RDS)<\/strong> solutions to clients across Europe, North America, and beyond.<\/em><\/p>\n<p><em>His expertise covers a wide range of technologies, including <strong>Microsoft Azure<\/strong>, <strong>Proxmox VE<\/strong>, <strong>Amazon Web Services (AWS)<\/strong>, and numerous other virtualization and cloud platforms.<\/em><\/p>\n<p><em>Beyond running his hosting business, \u0141ukasz also provides <strong>professional paid server configuration and optimization services<\/strong> for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.<\/em><\/p>\n<p><em>If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a>.<\/em><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 Ruby on Rails is a popular web application framework that makes building dynamic web applications easier. It combines the Ruby programming language with powerful tools and\u2026<\/p>\n","protected":false},"author":1,"featured_media":3421,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[],"tags":[14,12,11,23,20,21,22,17,7,8,6,10,18,19,15,24,16,5,13,9],"class_list":["post-2045","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-cheapvps","tag-cloudvps","tag-hostingvps","tag-rds","tag-rdscal","tag-remotedesktop","tag-remotedesktopvps","tag-servervps","tag-ukvps","tag-virtualserver","tag-vpshosting","tag-vpsserver","tag-vpssolutions","tag-vpswindows","tag-vpswithwindows","tag-windowsrds","tag-windowsserver","tag-windowsvps","tag-windowsvpshosting","tag-windowsvpsuk"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2045","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=2045"}],"version-history":[{"count":0,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2045\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media\/3421"}],"wp:attachment":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=2045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}