Join our Telegram: @serverrental_wiki | BTC Analysis | Trading Signals | Telegraph
Installing Rocky Linux 9
Installing Rocky Linux 9
Rocky Linux is a community-driven, enterprise-class Linux distribution designed to be 100% bug-for-bug compatible with Red Hat Enterprise Linux (RHEL). Following the discontinuation of CentOS Linux as a downstream rebuild of RHEL, Rocky Linux has emerged as a popular and stable alternative for servers. This guide provides a comprehensive, step-by-step tutorial for installing Rocky Linux 9 on your server.
Prerequisites
Before you begin the installation, ensure you have the following:
- Server Hardware: A physical or virtual server. Dedicated servers with full root access from providers like PowerVPS are ideal for running Rocky Linux.
- Installation Media: A bootable USB drive or ISO image of Rocky Linux 9. You can download the ISO from the official Rocky Linux website.
- Network Connectivity: A stable internet connection for downloading packages during installation.
- Basic Linux Knowledge: Familiarity with command-line operations and server administration concepts is beneficial.
- BIOS/UEFI Access: Ability to boot from the installation media.
Downloading Rocky Linux 9
1. Visit the official Rocky Linux download page: [1](https://rockylinux.org/download) 2. Choose the appropriate architecture (usually x86_64 for most servers). 3. Select a mirror close to your location to download the desired ISO image (e.g., `Rocky-9.x-x86_64-dvd1.iso`).
Creating a Bootable USB Drive
For physical servers, you'll need to create a bootable USB drive.
- On Linux:
sudo dd if=/path/to/Rocky-9.x-x86_64-dvd1.iso of=/dev/sdX bs=4M status=progress oflag=sync
Replace `/path/to/Rocky-9.x-x86_64-dvd1.iso` with the actual path to your ISO file and `/dev/sdX` with your USB drive device (e.g., `/dev/sdb`). Be extremely careful to select the correct device, as this command will erase all data on it.
- On Windows:
Use a tool like Rufus or balenaEtcher to write the ISO image to your USB drive.
Starting the Installation
1. Insert the bootable USB drive into your server and reboot. 2. Enter your server's BIOS/UEFI settings (usually by pressing F2, F10, F12, or DEL during boot). 3. Configure the boot order to prioritize booting from the USB drive. 4. Save changes and exit BIOS/UEFI. The Rocky Linux installer should now load.
Installation Steps
1. Welcome and Language Selection
- Select your preferred language for the installation process and click "Continue".
2. Installation Summary
The "Installation Summary" screen is your central hub. Many options can be configured here before proceeding.
- Keyboard: Select your keyboard layout.
- Language Support: Add additional language support if needed.
- Time & Date: Set your server's time zone.
- Installation Source: This should automatically detect your local media (USB/DVD). If installing over the network, you can configure it here.
- Software Selection:
* Click on "Software Selection". * Choose a "Base Environment". For a server, "Minimal Install" is often recommended to reduce the attack surface and resource usage. You can also select "Server" or "Server with GUI" depending on your needs. * Add "Add-Ons for Selected Environment" if necessary (e.g., development tools, system administration tools). * Click "Done".
- Installation Destination:
* Click on "Installation Destination". * Select the disk where you want to install Rocky Linux. * Under "Storage Configuration", choose "Automatic" for simple partitioning or "Custom" for manual control. For most users, "Automatic" is sufficient. * Click "Done". You may be prompted to accept configuration changes (e.g., enabling encryption if selected).
- Network & Hostname:
* Click on "Network & Hostname". * Enter your desired "Hostname" (e.g., `myrockyserver`). * Ensure your network interface (e.g., `eth0`, `enpXsX`) is configured correctly. For static IP addresses, click the gear icon next to the interface, go to the "IPv4 Settings" tab, set "Method" to "Manual", and enter your IP address, Netmask, and Gateway. Configure DNS servers as well. * Toggle the network interface ON. * Click "Done".
- Security Policy: (Optional) Configure SELinux policy if required.
- KDump: (Optional) Configure kernel dump settings.
3. Begin Installation
- Once all necessary configurations are complete, click "Begin Installation".
4. User Settings
While the system is installing, you need to set up user accounts and the root password.
- Root Password:
* Click on "Root Password". * Enter a strong password for the root user and confirm it. * Click "Done".
- User Creation:
* Click on "User Creation". * Enter a "Full name" for a regular user. * Enter a "Username" (e.g., `adminuser`). * Check "Make this user administrator" if you want to grant them sudo privileges. * Enter a strong password for this user and confirm it. * Click "Done".
5. Installation Complete
- Once the installation finishes, you will see a "Installation Complete" message.
- Click the "Reboot System" button. Remove the installation media before the server reboots.
Post-Installation Steps
After rebooting into your new Rocky Linux 9 system, it's crucial to perform some initial configuration.
1. First Login
- Log in as the user you created during installation (or as root if you prefer).
2. Update System Packages
- It's essential to update all installed packages to their latest versions.
sudo dnf update -y
3. Configure Firewall
Rocky Linux comes with `firewalld` enabled by default. You should configure it to allow necessary services.
- Check the status of `firewalld`:
sudo systemctl status firewalld
- Allow SSH (port 22) if it's not already enabled:
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload
- To allow other services (e.g., HTTP on port 80):
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
- To list all allowed services:
sudo firewall-cmd --list-all
4. Enable and Configure SSH
Ensure SSH is enabled and running.
- Check SSH service status:
sudo systemctl status sshd
- If not running, start and enable it:
sudo systemctl start sshd
sudo systemctl enable sshd
- For enhanced security, consider disabling root login via SSH and changing the default port. Edit `/etc/ssh/sshd_config`:
sudo vi /etc/ssh/sshd_config
Change or add the following lines:
PermitRootLogin no Port 2222 # Example: change to a non-standard port Protocol 2
After saving, reload the SSH service:
sudo systemctl reload sshd
Remember to adjust your firewall rules if you change the SSH port.
5. Install Essential Packages
Depending on your server's role, you might want to install common utilities.
- For example, to install `wget`, `curl`, `htop`, and `vim`:
sudo dnf install -y wget curl htop vim
Troubleshooting
- "No bootable device found": Ensure your BIOS/UEFI is set to boot from the correct device (USB/DVD) and that the installation media is properly created.
- Network issues during installation: Double-check your network configuration (IP address, netmask, gateway, DNS) in the "Network & Hostname" section. Ensure your server has a valid IP address from your network.
- Installation fails with errors: Note the exact error message. This often indicates a problem with the installation media, hardware (especially RAM or disk), or a corrupted download. Try re-downloading the ISO and recreating the bootable media.
- Cannot connect via SSH after installation:
* Verify that the `sshd` service is running (`sudo systemctl status sshd`). * Check your firewall rules (`sudo firewall-cmd --list-all`) to ensure the SSH port is allowed. * Confirm your server's IP address and network connectivity.