{"id":13860,"date":"2024-05-28T20:12:29","date_gmt":"2024-05-28T17:12:29","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=13860"},"modified":"2024-06-10T08:22:49","modified_gmt":"2024-06-10T05:22:49","slug":"guide-to-installing-ruby-on-rails-on-ubuntu-24-04-noble-numbat","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/guide-to-installing-ruby-on-rails-on-ubuntu-24-04-noble-numbat\/","title":{"rendered":"Guide to Installing Ruby On Rails on Ubuntu 24.04 Noble Numbat"},"content":{"rendered":"\n
Ruby on Rails, often simply referred to as Rails, is a powerful web application framework written in Ruby. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started. If you’re looking to harness the power of Rails on your Ubuntu<\/a> 24.04 LTS system, you’re in the right place. This guide will walk you through the step-by-step process of installing Ruby<\/a> on Rails on Ubuntu 24.04 LTS.<\/p>\n\n\n\n Before you begin, make sure you have:<\/p>\n\n\n\n First, ensure your system is up-to-date. Open a terminal and run the following commands:<\/p>\n\n\n\n Ruby is the programming language behind Rails. We\u2019ll use Rails requires a JavaScript runtime. We will use Node.js and Yarn:<\/p>\n\n\n\n With Ruby installed, you can now install Rails:<\/p>\n\n\n\n Verify that Rails is installed correctly by checking the version:<\/p>\n\n\n\n While Rails can work with SQLite, using PostgreSQL is recommended for production applications:<\/p>\n\n\n\n When creating a new Rails application, specify PostgreSQL as the database:<\/p>\n\n\n\n Update the Run the following commands to set up the database:<\/p>\n\n\n\n Congratulations! You have successfully installed Ruby on Rails on your Ubuntu 24.04 LTS system. You are now ready to start developing powerful web applications with Rails. For more information on using Rails, check out the official documentation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" Ruby on Rails, often simply referred to as Rails, is a powerful web application framework written in Ruby. It is designed to make programming web applications easier by making assumptions…<\/p>\n","protected":false},"author":1,"featured_media":13920,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,27,28,16,18],"tags":[350,354,433,981,982,544,545,591,598],"yoast_head":"\nPrerequisites<\/h3>\n\n\n\n
\n
Step 1: Update Your System<\/h3>\n\n\n\n
$ sudo apt update\n$ sudo apt upgrade -y<\/code><\/pre>\n\n\n\n
Step 2: Install Ruby<\/h3>\n\n\n\n
rbenv<\/code> to manage Ruby versions.<\/p>\n\n\n\n
\n
$ sudo apt install -y git curl libssl-dev libreadline-dev zlib1g-dev<\/code><\/pre>\n\n\n\n
\n
$ curl -fsSL https:\/\/github.com\/rbenv\/rbenv-installer\/raw\/main\/bin\/rbenv-installer | bash<\/code><\/pre>\n\n\n\n
\n
$ echo 'export PATH="$HOME\/.rbenv\/bin:$PATH"' >> ~\/.bashrc\n$ echo 'eval "$(rbenv init -)"' >> ~\/.bashrc\n$ source ~\/.bashrc<\/code><\/pre>\n\n\n\n
\n
$ rbenv install 3.2.2 # Check for the latest stable version at https:\/\/www.ruby-lang.org\/en\/downloads\/\n$ rbenv global 3.2.2<\/code><\/pre>\n\n\n\n
\n
$ ruby -v<\/code><\/pre>\n\n\n\n
Step 3: Install Node.js and Yarn<\/h3>\n\n\n\n
\n
$ sudo apt install -y nodejs<\/code><\/pre>\n\n\n\n
\n
$ curl -sL https:\/\/dl.yarnpkg.com\/debian\/pubkey.gpg | sudo apt-key add -\n$ echo "deb https:\/\/dl.yarnpkg.com\/debian\/ stable main" | sudo tee \/etc\/apt\/sources.list.d\/yarn.list\n$ sudo apt update && sudo apt install -y yarn<\/code><\/pre>\n\n\n\n
Step 4: Install Rails<\/h3>\n\n\n\n
$ gem install rails -v 7.0.4 # Check for the latest stable version at https:\/\/rubyonrails.org\/\n$ rbenv rehash<\/code><\/pre>\n\n\n\n
Step 5: Verify the Rails Installation<\/h3>\n\n\n\n
$ rails -v<\/code><\/pre>\n\n\n\n
Step 6: Install and Configure PostgreSQL (Optional)<\/h3>\n\n\n\n
\n
$ sudo apt install -y postgresql postgresql-contrib libpq-dev<\/code><\/pre>\n\n\n\n
\n
$ sudo systemctl start postgresql\n$ sudo systemctl enable postgresql<\/code><\/pre>\n\n\n\n
\n
$ sudo -i -u postgres\n> createuser --interactive\n# Follow the prompts to create a new user\n> exit<\/code><\/pre>\n\n\n\n
\n
$ sudo -i -u postgres\n> createdb your_database_name\n> exit<\/code><\/pre>\n\n\n\n
\n
$ coderails new myapp -d postgresql\n$ cd myapp<\/code><\/pre>\n\n\n\n
config\/database.yml<\/code> file with your PostgreSQL database details.<\/p>\n\n\n\n
Step 7: Create and Migrate the Database<\/h3>\n\n\n\n
$ coderails db:create\n$ rails db:migrate<\/code><\/pre>\n\n\n\n
Conclusion<\/h3>\n\n\n\n