Initial Settings After Installing Ubuntu 25.04 Plucky Puffin

Posted on

Initial Settings After Installing Ubuntu 25.04 Plucky Puffin

Initial Settings After Installing Ubuntu 25.04 Plucky Puffin

Ubuntu 25.04 LTS “Plucky Puffin” is anticipated for release around April 17, 2025. Whether you’re configuring a personal server, a development environment, or deploying a new system in production, configuring the Initial Settings After Installing Ubuntu 25.04 is a fundamental step. Post-installation, dedicating time to configure key settings can significantly improve security, performance, and overall usability.

This guide, inspired by the Initial Settings After Installing Ubuntu 25.04, will walk you through the most essential steps to take immediately after installing Ubuntu 25.04. From updating the system and creating new users to setting up firewalls and enabling essential services, this guide aims to streamline the process, particularly for new users or those seeking to quickly and efficiently get their system up and running. Let’s begin optimizing your Initial Settings After Installing Ubuntu 25.04.

Here, we assume that your Ubuntu 25.04 Plucky Puffin is already installed and running. The initial step is to access your Ubuntu 25.04, marking the beginning of your interaction with the server, including software installation and configuration tailored to your specific needs.

1. Connect to Ubuntu 25.04 using SSH

On Linux or macOS, open a terminal and connect to your Ubuntu 25.04 Plucky Puffin using its IP address. Use the following command:

ssh <mark>username</mark>@<mark>server_ip</mark>

Replace username with your server’s user and server_ip with the server’s IP address.

On Windows, use PuTTY. Install PuTTY on Windows and follow these steps:

[Image of PuTTY configuration for SSH connection]

If the login is successful, you’ll see a welcome message with system details.

Note: If you installed Ubuntu Server on a local machine, power on the machine, wait for the login prompt, and enter the username and password you created during installation.

2. Run System Update on Ubuntu 25.04

After logging in, you’ll be in the Ubuntu 25.04 command-line interface (CLI), ready to configure your server with the latest security patches. Update and upgrade the system using:

sudo apt update && sudo apt upgrade -y

3. Create a New User and Sudo Access on Ubuntu 25.04

Most cloud providers allow logging in as the root user by default. The root user has full control, but constant use can be risky. A mistake or security issue could harm the system. Creating a new user with admin rights enhances security.

Create a new user using:

sudo adduser <mark>user-name</mark>

You will be asked to set a password for the new user. Choose a strong password and confirm it. Skip optional fields by pressing Enter.

[Image of user creation process in terminal]

Grant the new user administrative privileges to run Sudo commands by adding them to the sudo group:

sudo usermod -aG sudo <mark>user-name</mark>

Switch to the new user and verify sudo access:

sudo su - <mark>user-name</mark>
sudo whoami

If the output is root, your user has sudo access.

4. Set Up SSH Key Authentication on Ubuntu 25.04

For enhanced security, use SSH keys to connect to the server.

Generate an SSH key Pair

Generate an SSH key pair using (on your Local computer, not the Server):

ssh-keygen -t rsa -b 4096

Press Enter to save the key in the default location (~/.ssh/id_rsa). Set a passphrase for added security (optional).

Copy the Generated SSH Key to the Server

If using a cloud server, copy the SSH key to the server using:

ssh-copy-id <mark>username</mark>@<mark>server_ip</mark>

If ssh-copy-id is unavailable, manually copy the public key (id_rsa.pub) and add it to the server with these commands:

# ssh root@<mark>server_ip</mark>
# sudo mkdir -p /home/<mark>username</mark>/.ssh
# sudo chmod 700 /home/<mark>username</mark>/.ssh
# echo "<mark>your-public-key</mark>" | sudo tee -a /home/<mark>username</mark>/.ssh/authorized_keys > /dev/null
# sudo chmod 600 /home/<mark>username</mark>/.ssh/authorized_keys
# sudo chown -R <mark>username</mark>:<mark>username</mark> /home/<mark>username</mark>/.ssh

Log out and log in with the new user using SSH:

ssh <mark>username</mark>@<mark>server_ip</mark>

Successful login indicates SSH key authentication is set up.

5. Disable Root Login and Password Authentication on Ubuntu 25.04

With a new user and SSH authentication, further secure the server by disabling root login and password authentication.

Open the SSH config file with a text editor (Vi or Nano):

sudo vi /etc/ssh/sshd_config

or

sudo nano /etc/ssh/sshd_config

In the file, find the following lines and change their values to no:

PermitRootLogin no
PasswordAuthentication no

Save and close the file.

Restart SSH to apply the changes:

sudo systemctl restart ssh

6. Install Common Packages on Ubuntu 25.04

Ubuntu 25.04 includes basic tools. Install extra packages for easier system management:

sudo apt install vim curl wget git htop unzip net-tools -y

Here’s a brief description of each tool:

  • vim: Text editor.
  • curl: Command-line tool for transferring data with URLs.
  • wget: Tool for downloading files from the web.
  • git: Version control system.
  • htop: Interactive process viewer.
  • unzip: Utility to extract zipped files.
  • net-tools: Collection of networking tools.

These tools facilitate server interaction and everyday tasks.

7. Set up UFW Firewall on Ubuntu 25.04

Ubuntu 25.04 includes UFW by default, simplifying firewall rule management. If not installed, install it:

sudo apt install ufw -y

Enable the UFW firewall. Since you are connected via SSH, allow SSH traffic before enabling the firewall:

sudo ufw allow openssh
sudo ufw enable

Reload the firewall to apply the changes:

sudo ufw reload

8. Clean Up Unnecessary Files

After installing packages and updates, remove unnecessary temporary files:

sudo apt autoremove -y
sudo apt autoclean

Conclusion

Properly setting up your Ubuntu 25.04 “Plucky Puffin” server after installation is a crucial step toward ensuring security, stability, and readiness. By creating a new user, configuring SSH, and installing essential tools, you’re establishing a strong foundation for server management. This investment of time upfront can prevent future complications and improve the overall server experience. Mastering these Initial Settings After Installing Ubuntu 25.04 is the key to a well-managed server.

Hope you enjoy it. Please subscribe to us on Facebook, X, and YouTube.

You may also like to read the following articles:

Introduce Ubuntu 25.04 Plucky Puffin

Install Linux Kernel 6.14 on Ubuntu 24.04

Installing Ubuntu in WSL with New Tar-based Format

FAQs

What should I do if SSH login fails?

Make sure the SSH service is running and that your firewall allows port 22. Also, double-check your username and server IP.

Can I install a GUI on my Ubuntu server?

Yes, but servers usually run better without one. If needed, you can install it later using sudo apt install ubuntu-desktop.

Alternative Solutions for Initial Server Setup

While the provided guide offers a solid foundation for setting up Ubuntu 25.04, alternative approaches exist that might be better suited to different use cases or preferences. Here are two such alternatives:

1. Using Ansible for Automated Server Provisioning

Ansible is an open-source automation tool that allows you to define server configurations in a declarative manner using YAML files (called playbooks). Instead of manually executing commands, you can write an Ansible playbook that automates the entire initial setup process. This is particularly useful for deploying multiple servers with identical configurations, ensuring consistency and reducing human error.

Explanation:

Ansible works by connecting to your server via SSH and executing tasks defined in the playbook. A playbook consists of a series of "tasks" that describe the desired state of the system. For example, a task might install a package, create a user, or configure a firewall. Ansible is idempotent, meaning that it only makes changes if the system is not already in the desired state. This ensures that running the same playbook multiple times will not cause unintended side effects.

Example Code (Ansible Playbook):

---
- hosts: all
  become: yes
  tasks:
    - name: Update apt cache
      apt:
        update_cache: yes

    - name: Upgrade packages
      apt:
        upgrade: dist
        autoremove: yes
        autoclean: yes

    - name: Create new user
      user:
        name: devops
        password: "$6$rounds=656000$salt$hashed_password_here" #Replace with actual hash, generate with mkpasswd
        groups: sudo
        append: yes

    - name: Copy SSH public key
      copy:
        src: ~/.ssh/id_rsa.pub
        dest: /home/devops/.ssh/authorized_keys
        owner: devops
        group: devops
        mode: 0600

    - name: Disable root login
      lineinfile:
        path: /etc/ssh/sshd_config
        regexp: '^PermitRootLogin'
        line: 'PermitRootLogin no'
      notify: Restart sshd

    - name: Disable password authentication
      lineinfile:
        path: /etc/ssh/sshd_config
        regexp: '^PasswordAuthentication'
        line: 'PasswordAuthentication no'
      notify: Restart sshd

    - name: Install common packages
      apt:
        name:
          - vim
          - curl
          - wget
          - git
          - htop
          - unzip
          - net-tools
        state: present

    - name: Enable UFW firewall
      ufw:
        state: enabled

    - name: Allow SSH through UFW
      ufw:
        rule: allow
        name: OpenSSH

  handlers:
    - name: Restart sshd
      service:
        name: ssh
        state: restarted

To use this playbook:

  1. Install Ansible: sudo apt install ansible
  2. Create the Playbook: Save the above code as a YAML file (e.g., server_setup.yml).
  3. Run the Playbook: ansible-playbook server_setup.yml -i "your_server_ip," -u root -k (Replace your_server_ip with your server’s IP address, and -k prompts for the root password).

This will automate all the steps outlined in the original article, significantly streamlining the setup process.

2. Cloud-Init for Automated Instance Configuration

Cloud-init is a widely used package in cloud computing to customize cloud instances during their initial boot. Many cloud providers support cloud-init out of the box. Cloud-init configuration is typically provided in the form of a YAML file.

Explanation:

Cloud-init reads the user-data provided to the instance during boot. This user-data can contain commands to execute, packages to install, users to create, and more. It simplifies the process of configuring a new instance by automating many of the initial setup tasks.

Example Code (Cloud-init YAML):

#cloud-config
users:
  - name: devops
    groups: sudo
    shell: /bin/bash
    sudo: ['ALL=(ALL:ALL) NOPASSWD:ALL']
    ssh_authorized_keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ...  # Replace with your public key

package_update: true
package_upgrade: true

packages:
  - vim
  - curl
  - wget
  - git
  - htop
  - unzip
  - net-tools
  - ufw

runcmd:
  - ufw enable
  - ufw allow OpenSSH

ssh_pwauth: no

To use this cloud-config:

  1. Create the cloud-config file: Save the above code as a YAML file (e.g., cloud_config.yml).
  2. Provide the cloud-config to your instance: This process depends on your cloud provider. Typically, you’ll provide the contents of the YAML file as "user data" when launching the instance. Consult your cloud provider’s documentation for specific instructions.

Cloud-init will automatically execute these configurations during the first boot of your instance, effectively automating the Initial Settings After Installing Ubuntu 25.04. This approach is excellent for cloud environments and simplifies instance provisioning significantly.

Leave a Reply

Your email address will not be published. Required fields are marked *