<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[RubyonRails on Debian 12]]></title><description><![CDATA[RubyonRails on Debian 12]]></description><link>https://rubyonrailsondebain.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 12:18:31 GMT</lastBuildDate><atom:link href="https://rubyonrailsondebain.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Install Ruby on Rails on Debian 12: A Step-by-Step Guide]]></title><description><![CDATA[if you’re looking to Install Ruby on Rails on Debian 12, you’re in the right place! Ruby on Rails is a powerful framework for building web applications, and setting it up on Debian 12 is straightforward if you follow these steps. Whether you’re a beg...]]></description><link>https://rubyonrailsondebain.hashnode.dev/how-to-install-ruby-on-rails-on-debian-12-a-step-by-step-guide</link><guid isPermaLink="true">https://rubyonrailsondebain.hashnode.dev/how-to-install-ruby-on-rails-on-debian-12-a-step-by-step-guide</guid><dc:creator><![CDATA[Php_Guider]]></dc:creator><pubDate>Sat, 22 Mar 2025 18:21:51 GMT</pubDate><content:encoded><![CDATA[<p>if you’re looking to <em>Install Ruby on Rails on Debian 12</em>, you’re in the right place! Ruby on Rails is a powerful framework for building web applications, and setting it up on Debian 12 is straightforward if you follow these steps. Whether you’re a beginner or an experienced developer, this guide will help you get started quickly.</p>
<hr />
<h3 id="heading-step-1-update-your-system"><strong>Step 1: Update Your System</strong></h3>
<p>Before installing anything, it’s a good idea to update your system to ensure all packages are up to date. Open your terminal and run:</p>
<p>bash</p>
<p>Copy</p>
<pre><code class="lang-plaintext">sudo apt update &amp;&amp; sudo apt upgrade -y
</code></pre>
<hr />
<h3 id="heading-step-2-install-required-dependencies"><strong>Step 2: Install Required Dependencies</strong></h3>
<p>Ruby on Rails requires several dependencies to function properly. Install them using:</p>
<p>bash</p>
<p>Copy</p>
<pre><code class="lang-plaintext">sudo apt install curl git build-essential libssl-dev libreadline-dev zlib1g-dev libsqlite3-dev
</code></pre>
<p>These packages include essential tools like Git, GCC, and libraries needed for Ruby and Rails.</p>
<hr />
<h3 id="heading-step-3-install-ruby-using-rbenv"><strong>Step 3: Install Ruby Using rbenv</strong></h3>
<p>The default Ruby version on Debian 12 might be outdated, so we’ll use <strong>rbenv</strong> to install and manage Ruby versions. Here’s how:</p>
<ol>
<li><p><strong>Install rbenv and ruby-build:</strong></p>
<p> bash</p>
<p> Copy</p>
<pre><code class="lang-plaintext"> curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-installer | bash
</code></pre>
</li>
<li><p><strong>Add rbenv to your shell:</strong><br /> Add the following lines to your <code>~/.bashrc</code> file:</p>
<p> bash</p>
<p> Copy</p>
<pre><code class="lang-plaintext"> export PATH="$HOME/.rbenv/bin:$PATH"
 eval "$(rbenv init -)"
</code></pre>
<p> Then, reload your shell:</p>
<p> bash</p>
<p> Copy</p>
<pre><code class="lang-plaintext"> source ~/.bashrc
</code></pre>
</li>
<li><p><strong>Install Ruby:</strong><br /> Install the latest stable version of Ruby (e.g., Ruby 3.2.2):</p>
<p> bash</p>
<p> Copy</p>
<pre><code class="lang-plaintext"> rbenv install 3.2.2
 rbenv global 3.2.2
</code></pre>
</li>
<li><p><strong>Verify the installation:</strong></p>
<p> bash</p>
<p> Copy</p>
<pre><code class="lang-plaintext"> ruby -v
</code></pre>
<p> You should see the installed Ruby version.</p>
</li>
</ol>
<hr />
<h3 id="heading-step-4-install-rails"><strong>Step 4: Install Rails</strong></h3>
<p>With Ruby installed, you can now install Rails:</p>
<p>bash</p>
<p>Copy</p>
<pre><code class="lang-plaintext">gem install rails
</code></pre>
<p>Verify the installation:</p>
<p>bash</p>
<pre><code class="lang-plaintext">rails -v
</code></pre>
<hr />
<h3 id="heading-step-5-set-up-a-database"><strong>Step 5: Set Up a Database</strong></h3>
<p>Rails applications typically use a database. Install <strong>MySQL</strong> or <strong>PostgreSQL</strong> based on your preference.</p>
<h4 id="heading-option-1-install-mysql"><strong>Option 1: Install MySQL</strong></h4>
<p>bash</p>
<p>Copy</p>
<pre><code class="lang-plaintext">sudo apt install mysql-server libmysqlclient-dev
</code></pre>
<p>Configure MySQL and create a database for your Rails app.</p>
<h4 id="heading-option-2-install-postgresql"><strong>Option 2: Install PostgreSQL</strong></h4>
<p>bash</p>
<p>Copy</p>
<pre><code class="lang-plaintext">sudo apt install postgresql postgresql-contrib libpq-dev
</code></pre>
<p>Set up a PostgreSQL user and database for your Rails app.</p>
<hr />
<h3 id="heading-step-6-create-a-new-rails-application"><strong>Step 6: Create a New Rails Application</strong></h3>
<p>Now that everything is set up, create a new Rails application:</p>
<p>bash</p>
<p>Copy</p>
<pre><code class="lang-plaintext">rails new myapp -d mysql  # Use `postgresql` if you installed PostgreSQL
cd myapp
</code></pre>
<hr />
<h3 id="heading-step-7-configure-the-database"><strong>Step 7: Configure the Database</strong></h3>
<p>Edit the <code>config/database.yml</code> file to match your database settings. For example, for MySQL:</p>
<p>yaml</p>
<p>Copy</p>
<pre><code class="lang-plaintext">default: &amp;default
  adapter: mysql2
  encoding: utf8mb4
  pool: &lt;%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %&gt;
  username: root
  password: yourpassword
  socket: /var/run/mysqld/mysqld.sock
</code></pre>
<p>Run the database setup:</p>
<p>bash</p>
<p>Copy</p>
<pre><code class="lang-plaintext">rails db:setup
</code></pre>
<hr />
<h3 id="heading-step-8-start-the-rails-server"><strong>Step 8: Start the Rails Server</strong></h3>
<p>Finally, start the Rails server:</p>
<p>bash</p>
<p>Copy</p>
<pre><code class="lang-plaintext">rails server
</code></pre>
<p>Visit <a target="_blank" href="http://localhost:3000"><code>http://localhost:3000</code></a> in your browser to see your Rails app in action!</p>
<hr />
<h3 id="heading-troubleshooting-common-issues"><strong>Troubleshooting Common Issues</strong></h3>
<ol>
<li><p><strong>Ruby Installation Fails:</strong><br /> Ensure all dependencies are installed and try again.</p>
</li>
<li><p><strong>Database Connection Issues:</strong><br /> Double-check your <code>database.yml</code> file and ensure the database service is running.</p>
</li>
<li><p><strong>Permission Errors:</strong><br /> Use <code>sudo</code> where necessary or adjust file permissions.</p>
</li>
</ol>
<hr />
<h3 id="heading-why-install-ruby-on-rails-on-debian-12"><strong>Why Install Ruby on Rails on Debian 12?</strong></h3>
<p>Debian 12 is a stable and secure operating system, making it an excellent choice for hosting Ruby on Rails applications. By following this guide, you can set up a robust development environment that’s ready for building modern web applications.</p>
<hr />
<h3 id="heading-conclusion"><strong>Conclusion</strong></h3>
<p>If you’re looking to <a target="_blank" href="https://docs.vultr.com/how-to-install-ruby-on-rails-on-debian-12"><em>Install Ruby on Rails on Debian 12</em></a>, this guide provides a clear and actionable roadmap. Whether you’re a beginner or an experienced developer, this setup will give you a solid foundation for your Rails projects. If you found this guide helpful, feel free to share it and link back to it for others who want to <strong>Install Ruby on Rails on Debian 12</strong>.</p>
]]></content:encoded></item></channel></rss>