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!
RDS CAL (Client Access License)
Keywords: windows vps uk, windows vps, uk windows vps, windows vps hosting uk, vps windows server, uk vps windows, vps windows, servidor vps windows, vps uk windows, vps with windows, virtual private server windows, windows virtual private server, windows vps server uk, vps for windows, servidores vps windows, vps windows uk, windows vps hosting, vps windows hosting, windows vps server, windows virtual private servers, vps on windows, vps windows servers, cheap windows vps uk, windowsvps, windows desktop vps, buy vps windows, windows server vps, windows 10 vps uk, rds services, rds cal, remote desktop services, remote desktop hosting
#windowsvps #vpshosting #ukvps #virtualserver #windowsvpsuk #vpsserver #hostingvps #cloudvps #windowsvpshosting #cheapvps #vpswithwindows #windowsserver #servervps #vpssolutions #vpswindows #rdscal #remotedesktop #remotedesktopvps #rds #windowsrds