<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>How To Install Ruby On Rails On Ubuntu 20.04 Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/how-to-install-ruby-on-rails-on-ubuntu-20-04/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Thu, 10 Dec 2020 22:54:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>How To Install Ruby On Rails On Ubuntu 20.04</title>
		<link>https://www.osradar.com/how-to-install-ruby-on-rails-on-ubuntu-20-04/</link>
					<comments>https://www.osradar.com/how-to-install-ruby-on-rails-on-ubuntu-20-04/#respond</comments>
		
		<dc:creator><![CDATA[sabi]]></dc:creator>
		<pubDate>Wed, 16 Dec 2020 05:39:00 +0000</pubDate>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[How To Install Ruby On Rails On Ubuntu 20.04]]></category>
		<category><![CDATA[install rails on ubuntu 20]]></category>
		<category><![CDATA[Ubuntu 20.04 tutorials]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=26163</guid>

					<description><![CDATA[<p>In this tutorial you&#8217;ll learn that how to install Ruby On Rails On Ubuntu 20.04. Ruby On Rails also called Rails(simple form) is an open source platform that can be used to create high performance &#38; powerful websites as well as applications. So, here we&#8217;ll see that how we can install it on our Ubuntu [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-ruby-on-rails-on-ubuntu-20-04/">How To Install Ruby On Rails On Ubuntu 20.04</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this tutorial you&#8217;ll learn that how to install Ruby On Rails On Ubuntu 20.04. Ruby On Rails also called Rails(simple form) is an open source platform that can be used to create high performance &amp; powerful websites as well as applications. So, here we&#8217;ll see that how we can install it on our Ubuntu 20.04 system.</p>



<h2>Step 1: Update Your System</h2>



<p>As usual we do, update your system and install the required dependencies.</p>



<pre class="wp-block-preformatted">sudo apt update<br>sudo apt install -y curl gnupg2 dirmngr git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev</pre>



<h3>Step 2: Install Node.Js On Ubuntu 20.04</h3>



<p>As Rails required a Javascript runtime to build applications in Linux. So, install LTS version of Node.js (v12.x). You can also use the latest version of Node.js (14.x).</p>



<pre class="wp-block-preformatted">curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -<br>sudo apt install -y nodejs</pre>



<h3>Step 3: Install Yarn On Ubuntu 20.04</h3>



<p>Now, add the yarn repository on Ubuntu 20.04 and install it with the help of below commands.</p>



<pre class="wp-block-preformatted">curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -<br>echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list<br>sudo apt update &amp;&amp; sudo apt install -y yarn</pre>



<h3>Step 4: Install Ruby On Ubuntu 20.04</h3>



<p>Here we&#8217;ll see two methods to install Ruby On Ubuntu 20.04.</p>



<ol><li>By Using rbenv (Recommended Method)</li><li>With the help of RVM</li></ol>



<p>So, choose your favourite method to proceed.</p>



<h4>By Using rbenv (Recommended Method)</h4>



<p>This method is very useful for managing the versions of Ruby quickly &amp; it is lighter than RVM. Simply, run the following commands in your terminal to install the rbenv.</p>



<pre class="wp-block-preformatted">cd<br>git clone https://github.com/rbenv/rbenv.git ~/.rbenv<br>echo 'export PATH="$HOME/.rbenv/bin:$PATH"' &gt;&gt; ~/.bashrc<br>echo 'eval "$(rbenv init -)"' &gt;&gt; ~/.bashrc<br>exec $SHELL<br>git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build<br>echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' &gt;&gt; ~/.bashrc<br>exec $SHELL</pre>



<p>Install the latest version of Ruby by typing</p>



<pre class="wp-block-preformatted">rbenv install 2.7.2</pre>



<p>You can also install other version with the help of <strong>rbenv install &lt;version&gt;</strong> command.</p>



<p>Now, set the above installed version as default by typing</p>



<pre class="wp-block-preformatted">rbenv global 2.7.2</pre>



<p>Verify the installed version by typing</p>



<pre class="wp-block-preformatted">ruby -v</pre>



<p>Output:</p>



<pre class="wp-block-preformatted">sabi@Ubuntu20:~$ ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]</pre>



<p>And type the below command to install bundler.</p>



<pre class="wp-block-preformatted">gem install bundler</pre>



<h3>Step 5: Install Ruby By Using RVM</h3>



<p>RVM (Ruby Version Manager) helps you to install the ruby versions efficiently &amp; auto-download its dependencies.</p>



<p>Add Public key &amp; install it with the help of curl command.</p>



<pre class="wp-block-preformatted">gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB<br>curl -sSL https://get.rvm.io | bash -s stable</pre>



<p>Now, run the below command to load RVM environment variables.</p>



<pre class="wp-block-preformatted">source ~/.rvm/scripts/rvm</pre>



<p>And hit the following command to install Ruby 2.7.2</p>



<pre class="wp-block-preformatted">rvm install 2.7.2</pre>



<p>You can also install different versions by typing<strong> rvm install &lt;version&gt;.</strong></p>



<p>Set the default version by entering</p>



<pre class="wp-block-preformatted">rvm use 2.7.2 --default</pre>



<p>And verify the Ruby version.</p>



<pre class="wp-block-preformatted">ruby -v</pre>



<p>Output:</p>



<pre id="block-c204bcb1-5f3a-4bf0-9e1e-a7d902312ea1" class="wp-block-preformatted">sabi@Ubuntu20:~$ ruby -v<br>ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]</pre>



<p>And type the below command to install the bundler.</p>



<pre class="wp-block-preformatted">gem install bundler</pre>



<h3>Step 6: Install Rails On Ubuntu 20.04</h3>



<p>Type the given command to install the Rails on Ubuntu 20.04.</p>



<pre class="wp-block-preformatted">gem install rails</pre>



<p>To install a specific version, type</p>



<pre class="wp-block-preformatted">gem install rails –version=&lt;version&gt;</pre>



<p>Verify the installed version by</p>



<pre class="wp-block-preformatted">rails -v</pre>



<p>Output:</p>



<pre class="wp-block-preformatted">sabi@Ubuntu20:~$ rails -v
Rails 6.0.3.4</pre>



<h3>Step 7: Create Rails Application</h3>



<p>In order to create rails application, you&#8217;ve to install a database. By default Rails uses its own database but it is not recommended for production use. So, install MariaDB &amp; use it with the Rails.</p>



<p>To install <a href="https://www.osradar.com/list-all-users-on-mysql-mariadb/" target="_blank" rel="noreferrer noopener">MariaDB on Ubuntu 20.04</a>, type</p>



<pre class="wp-block-preformatted">sudo apt install -y mariadb-server mariadb-client</pre>



<p>And install the required packages.</p>



<pre class="wp-block-preformatted">sudo apt install -y libmariadb-dev</pre>



<p>Now, login to MariaDB &amp; create a database.</p>



<pre class="wp-block-preformatted">sudo mysql -u root -p
CREATE USER 'sabi'@'localhost' IDENTIFIED BY 'Your_Password';
GRANT ALL PRIVILEGES ON <em>.</em> TO 'sabi'@'localhost';
exit;</pre>



<p>And install the MySQL extension.</p>



<pre class="wp-block-preformatted">gem install mysql 2</pre>



<p>Then create the new test application.</p>



<pre class="wp-block-preformatted">cd ~<br>rails new sabitestapp -d mysql<br>cd sabitestapp</pre>



<p>And update the config file with Database info.</p>



<pre class="wp-block-preformatted">sudo nano config/database.yml<br>default: &amp;default<br>adapter: mysql2<br>encoding: utf8mb4<br>pool: &lt;%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %&gt;<br>username: sabi &lt;&lt; DB User<br>password: Your_Password &lt;&lt; DB Password<br>socket: /var/run/mysqld/mysqld.sock</pre>



<p>Note: Replace <strong>Username &amp; Password</strong> with your own.</p>



<p>Then create the database.</p>



<pre class="wp-block-preformatted">rake db:create</pre>



<p>Output:</p>



<p>You&#8217;ll see the similar output.</p>



<pre class="wp-block-preformatted">sabi@Ubuntu20:~/sabitestapp$ rake db:create<br>Created database 'sabitestapp_development'<br>Created database 'sabitestapp_test'</pre>



<p>And then start the application by typing.</p>



<pre class="wp-block-preformatted">rails server -b 0.0.0.0</pre>



<p>Output: You&#8217;ll see the similar output.</p>



<pre class="wp-block-preformatted">sabi@Ubuntu20:~/sabitestapp$ rails server -b 0.0.0.0
=&gt; Booting Puma
=&gt; Rails 6.0.3.4 application starting in development
=&gt; Run <code>rails server --help</code> for more startup options
Puma starting in single mode…
Version 4.3.7 (ruby 2.7.2-p137), codename: Mysterious Traveller
Min threads: 5, max threads: 5
Environment: development
Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop</pre>



<h3>Step 8: Access Rails On Web</h3>



<p>Rails application should be running on port<strong> 3000</strong> you can access it in your browser.</p>



<p>Type your server IP with port 3000 like <strong>IP:3000</strong> to access the web dashboard.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="495" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2020/12/image-4-1024x495.jpg" alt="How To Install Ruby On Rails On Ubuntu 20.04" class="wp-image-26255" srcset="https://www.osradar.com/wp-content/uploads/2020/12/image-4-1024x495.jpg 1024w, https://www.osradar.com/wp-content/uploads/2020/12/image-4-300x145.jpg 300w, https://www.osradar.com/wp-content/uploads/2020/12/image-4-768x371.jpg 768w, https://www.osradar.com/wp-content/uploads/2020/12/image-4-1536x743.jpg 1536w, https://www.osradar.com/wp-content/uploads/2020/12/image-4-696x337.jpg 696w, https://www.osradar.com/wp-content/uploads/2020/12/image-4-1068x517.jpg 1068w, https://www.osradar.com/wp-content/uploads/2020/12/image-4.jpg 1838w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>As installation done, start building with Rails. So, this is how you can install Ruby on  Rails on Ubuntu 20.04</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-ruby-on-rails-on-ubuntu-20-04/">How To Install Ruby On Rails On Ubuntu 20.04</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-install-ruby-on-rails-on-ubuntu-20-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
