{"id":2596,"date":"2024-04-01T22:52:02","date_gmt":"2023-01-06T10:06:18","guid":{"rendered":""},"modified":"2025-02-02T00:46:18","modified_gmt":"2025-02-01T23:46:18","slug":"how-to-install-ruby-on-rails-on-ubuntu-20-04-lts","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/how-to-install-ruby-on-rails-on-ubuntu-20-04-lts\/","title":{"rendered":"Linux VPS &#038; VPS Windows Setup Guide | NetCloud24 Ruby on Rails on Ubuntu 20.04 LTS"},"content":{"rendered":"<p>\u00a0<\/p>\n<\/p>\n<h1>\u00a0<\/h1>\n<p>Ruby on Rails, also known as Rails, is a powerful web development framework written in Ruby. It allows developers to build high-performing web applications quickly and efficiently. In this guide, we will walk you through the steps to install Ruby on Rails on Ubuntu 20.04 LTS. Whether you&#8217;re using a  or another hosting solution, Rails provides a great foundation for building dynamic web apps.<\/p>\n<h2>Prerequisites<\/h2>\n<p>Before starting, ensure you have the following:<\/p>\n<ul>\n<li>An Ubuntu 20.04 LTS server, which could be hosted on a <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">UK Windows VPS<\/a>, <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Servers<\/a>, or another <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPS Hosting UK<\/a> solution.<\/li>\n<li>Root or sudo privileges on your server.<\/li>\n<li>Basic knowledge of the command line.<\/li>\n<\/ul>\n<h2>Step 1: Update Your System<\/h2>\n<p>Start by updating your system to ensure all packages are up to date. Run the following commands:<\/p>\n<pre><code>sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/pre>\n<h2>Step 2: Install Ruby<\/h2>\n<p>Ruby on Rails is built on Ruby, so the first step is to install Ruby. You can install it using the package manager:<\/p>\n<pre><code>sudo apt install ruby-full -y<\/code><\/pre>\n<p>Once installed, verify the Ruby version by running:<\/p>\n<pre><code>ruby -v<\/code><\/pre>\n<p>This command should display the Ruby version, confirming that Ruby is installed.<\/p>\n<h2>Step 3: Install Node.js and Yarn<\/h2>\n<p>Rails requires a JavaScript runtime to work properly, so you will need to install Node.js. You can also install Yarn, a JavaScript package manager, which is often used with Rails projects:<\/p>\n<pre><code>sudo apt install nodejs\r\nsudo apt install yarn -y<\/code><\/pre>\n<h2>Step 4: Install Rails<\/h2>\n<p>Next, install Rails using the RubyGems package manager. Run the following command to install Rails:<\/p>\n<pre><code>sudo gem install rails<\/code><\/pre>\n<p>Once the installation is complete, verify the Rails version by running:<\/p>\n<pre><code>rails -v<\/code><\/pre>\n<p>This will display the installed Rails version.<\/p>\n<h2>Step 5: Install a Database (Optional)<\/h2>\n<p>Ruby on Rails supports several databases, but the most common choice is PostgreSQL or MySQL. You can install PostgreSQL by running:<\/p>\n<pre><code>sudo apt install postgresql postgresql-contrib libpq-dev -y<\/code><\/pre>\n<p>Alternatively, for MySQL, run:<\/p>\n<pre><code>sudo apt install mysql-server mysql-client libmysqlclient-dev -y<\/code><\/pre>\n<h2>Step 6: Create a New Rails Project<\/h2>\n<p>Now that Ruby, Rails, and the database are installed, you can create a new Rails project. Navigate to the directory where you want to store your project and run:<\/p>\n<pre><code>rails new myapp -d postgresql<\/code><\/pre>\n<p>Replace <code>myapp<\/code> with your project name, and if you are using MySQL, replace <code>-d postgresql<\/code> with <code>-d mysql<\/code>.<\/p>\n<h2>Step 7: Set Up the Database<\/h2>\n<p>If you are using PostgreSQL, you will need to create a database user. Log in to PostgreSQL:<\/p>\n<pre><code>sudo -u postgres psql<\/code><\/pre>\n<p>Create a new user with a password:<\/p>\n<pre><code>CREATE ROLE myuser WITH LOGIN PASSWORD 'mypassword';<\/code><\/pre>\n<p>Then, grant the necessary permissions and exit:<\/p>\n<pre><code>ALTER ROLE myuser CREATEDB;\r\n\\q<\/code><\/pre>\n<p>Update the database configuration file <code>config\/database.yml<\/code> in your Rails project directory to match your database settings, then set up the database:<\/p>\n<pre><code>rails db:create<\/code><\/pre>\n<h2>Step 8: Start the Rails Server<\/h2>\n<p>To test that everything is working, start the Rails development server:<\/p>\n<pre><code>rails server<\/code><\/pre>\n<p>By default, the server will run on port 3000. Open your web browser and navigate to <code>http:\/\/your-server-ip:3000<\/code> to see the Rails welcome page.<\/p>\n<h2>Conclusion<\/h2>\n<p>By following these steps, you have successfully installed Ruby on Rails on Ubuntu 20.04 LTS. Whether you\u2019re developing applications on a , <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Microsoft SQL VPS Windows<\/a>, or any <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Server Hosting<\/a> environment, Rails provides a robust platform for building scalable web applications.<\/p>\n<footer>\n<p>For more VPS hosting options, visit . They offer a variety of <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Servers<\/a> and <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPS Hosting UK<\/a> solutions tailored to your needs.<\/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, also known as Rails, is a powerful web development framework written in Ruby. It allows developers to build high-performing web applications quickly 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-2596","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\/2596","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=2596"}],"version-history":[{"count":0,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2596\/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=2596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}