Skip to content

Linux VPS & VPS Windows Setup Guide | NetCloud24 Ruby on Rails with PostgreSQL on Rocky Linux 8.4

Cloud Infrastructure Expert
Linux VPS & VPS Windows Setup Guide | NetCloud24 Ruby on Rails with PostgreSQL on Rocky Linux 8.4

 

 

How to Install Ruby on Rails with PostgreSQL on Rocky Linux 8.4

This guide will help you install Ruby on Rails with PostgreSQL on Rocky Linux 8.4.

Step 1: Update the System

Before installing any packages, ensure your system is updated:

sudo dnf update -y

Step 2: Install Required Dependencies

Install the necessary development tools:

sudo dnf groupinstall "Development Tools" -y

Also, install some essential libraries:

sudo dnf install -y \
    sqlite-devel \
    postgresql-devel \
    libxml2-devel \
    libxslt-devel \
    ImageMagick-devel \
    curl \
    git

Step 3: Install Ruby

Install rbenv and ruby-build to manage Ruby versions:

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

Now install Ruby:

rbenv install 3.1.0
rbenv global 3.1.0

Step 4: Install Rails

Install Rails using the gem command:

gem install rails

Step 5: Install PostgreSQL

Install PostgreSQL server:

sudo dnf install -y postgresql-server postgresql-contrib

Initialize the PostgreSQL database:

sudo postgresql-setup --initdb

Start and enable the PostgreSQL service:

sudo systemctl start postgresql
sudo systemctl enable postgresql

Step 6: Create a PostgreSQL User

Switch to the PostgreSQL user and create a new user:

sudo -i -u postgres
createuser --interactive

Follow the prompts to create a user.

Step 7: Create a New Rails Application

Create a new Rails application with PostgreSQL as the database:

rails new myapp -d postgresql

Step 8: Configure Database Settings

Edit the config/database.yml file to set the database username and password:

nano myapp/config/database.yml

Update the default section with your PostgreSQL credentials.

Step 9: Create the Database

Run the following command to create the database:

cd myapp
rails db:create

Conclusion

Congratulations! You have successfully installed Ruby on Rails with PostgreSQL on Rocky Linux 8.4. You can now start building your applications!

Windows VPS Deutschland

Windows VPS España

Windows VPS Nederland

Windows VPS Italia

Windows VPS Portugal

VPS Windows Italia

Windows VPS

Windows VPS

Windows VPS Sverige

Windows VPS Norge

Windows VPS

Windows VPS Türkiye

Windows RDS (Remote Desktop Services)

Windows VPS

Explore more

More on this topic

Netcloud24
Netcloud24
Cloud Infrastructure Expert · NetCloud24

Comments are closed.

Linux VPS & VPS Windows Setup Guide | NetCloud24 Ruby on Rails with PostgreSQL on Rocky Linux 8.4

Cloud Infrastructure Expert
Linux VPS & VPS Windows Setup Guide | NetCloud24 Ruby on Rails with PostgreSQL on Rocky Linux 8.4

 

 

Ruby on Rails is a powerful web application framework that allows developers to create high-quality web applications quickly and efficiently. In this guide, we will walk through the steps to install Ruby on Rails with PostgreSQL on Rocky Linux 8.4.

Step 1: Update Your System

Start by ensuring your system is up to date:

sudo dnf update -y

Step 2: Install Required Dependencies

Install the necessary packages, including PostgreSQL, Git, and development tools:

sudo dnf install -y gcc gcc-c++ make \
    postgresql postgresql-server postgresql-devel \
    git

Step 3: Install Ruby

Install Ruby using the RVM (Ruby Version Manager) for managing Ruby versions:

sudo dnf install -y curl
curl -sSL https://get.rvm.io | bash -s stable

Load RVM and install Ruby:

source ~/.rvm/scripts/rvm
rvm install 3.0.0
rvm use 3.0.0 --default

Step 4: Install Rails

Now that Ruby is installed, you can install Rails:

gem install rails

Step 5: Configure PostgreSQL

Initialize and start the PostgreSQL service:

sudo postgresql-setup --initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql

Next, create a new PostgreSQL user for your Rails application:

sudo -u postgres psql
CREATE USER railsuser WITH PASSWORD 'your_password';
ALTER USER railsuser CREATEDB;
\q

Replace your_password with a strong password of your choice.

Step 6: Create a New Rails Application

Create a new Rails application with PostgreSQL as the database:

rails new myapp -d postgresql

Navigate to the application directory:

cd myapp

Step 7: Configure Database Settings

Edit the config/database.yml file to set up the database connection:

nano config/database.yml

Update the configuration as follows:

development:
  adapter: postgresql
  encoding: unicode
  database: myapp_development
  pool: 5
  username: railsuser
  password: your_password

Step 8: Create the Database

Run the following command to create the database:

rails db:create

Step 9: Start the Rails Server

Start the Rails development server:

rails server -b 0.0.0.0

Step 10: Access Your Application

Open your web browser and navigate to:

http://your_server_ip:3000

Conclusion

You have successfully installed Ruby on Rails with PostgreSQL on Rocky Linux 8.4. This setup provides a solid foundation for developing web applications.

If you’re looking for a reliable hosting solution for your Ruby on Rails application, consider using . With Windows VPS, you can efficiently host your applications and ensure high performance. Whether you need or Windows VPSVirtual Private Servers, you’ll find a solution that fits your requirements.

For larger deployments or enterprise needs, explore Windows VPS or Virtual Private Server Hosting Windows. Whether you’re located in the UK, Italy, or elsewhere, Microsoft SQL VPS Windows and UK VPS Windows offer reliable hosting options. Visit Windows VPS Hosting UK to discover the best hosting solutions for your development needs.

Explore more

More on this topic

Netcloud24
Netcloud24
Cloud Infrastructure Expert · NetCloud24

Comments are closed.

Linux VPS & VPS Windows Setup Guide | NetCloud24 Ruby on Rails with PostgreSQL on Rocky Linux 8.4

Cloud Infrastructure Expert
Linux VPS & VPS Windows Setup Guide | NetCloud24 Ruby on Rails with PostgreSQL on Rocky Linux 8.4

 

 

Ruby on Rails is a powerful web application framework that allows developers to create high-quality web applications quickly and efficiently. In this guide, we will walk through the steps to install Ruby on Rails with PostgreSQL on Rocky Linux 8.4.

Step 1: Update Your System

Start by ensuring your system is up to date:

sudo dnf update -y

Step 2: Install Required Dependencies

Install the necessary packages, including PostgreSQL, Git, and development tools:

sudo dnf install -y gcc gcc-c++ make \
    postgresql postgresql-server postgresql-devel \
    git

Step 3: Install Ruby

Install Ruby using the RVM (Ruby Version Manager) for managing Ruby versions:

sudo dnf install -y curl
curl -sSL https://get.rvm.io | bash -s stable

Load RVM and install Ruby:

source ~/.rvm/scripts/rvm
rvm install 3.0.0
rvm use 3.0.0 --default

Step 4: Install Rails

Now that Ruby is installed, you can install Rails:

gem install rails

Step 5: Configure PostgreSQL

Initialize and start the PostgreSQL service:

sudo postgresql-setup --initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql

Next, create a new PostgreSQL user for your Rails application:

sudo -u postgres psql
CREATE USER railsuser WITH PASSWORD 'your_password';
ALTER USER railsuser CREATEDB;
\q

Replace your_password with a strong password of your choice.

Step 6: Create a New Rails Application

Create a new Rails application with PostgreSQL as the database:

rails new myapp -d postgresql

Navigate to the application directory:

cd myapp

Step 7: Configure Database Settings

Edit the config/database.yml file to set up the database connection:

nano config/database.yml

Update the configuration as follows:

development:
  adapter: postgresql
  encoding: unicode
  database: myapp_development
  pool: 5
  username: railsuser
  password: your_password

Step 8: Create the Database

Run the following command to create the database:

rails db:create

Step 9: Start the Rails Server

Start the Rails development server:

rails server -b 0.0.0.0

Step 10: Access Your Application

Open your web browser and navigate to:

http://your_server_ip:3000

Conclusion

You have successfully installed Ruby on Rails with PostgreSQL on Rocky Linux 8.4. This setup provides a solid foundation for developing web applications.

If you’re looking for a reliable hosting solution for your Ruby on Rails application, consider using Windows VPS . With Windows VPS, you can efficiently host your applications and ensure high performance. Whether you need or Windows VPSVirtual Private Servers, you’ll find a solution that fits your requirements.

For larger deployments or enterprise needs, explore Windows VPS or Virtual Private Server Hosting Windows. Whether you’re located in the UK, Italy, or elsewhere, Microsoft SQL VPS Windows and UK VPS Windows offer reliable hosting options. Visit Windows VPS Hosting UK to discover the best hosting solutions for your development needs.

Explore more

More on this topic

Netcloud24
Netcloud24
Cloud Infrastructure Expert · NetCloud24

Comments are closed.