Ubuntu

Change ubuntu server name

  1. Modify the machine’s hostname
sudo hostnamectl set-hostname new_name
  1. Update configuration files Next, you need to update the /etc/hostname file to make this change permanent. Open this file with a text editor like nano:
sudo nano /etc/hostname
  1. Update the /etc/hosts file It’s recommended to also update the /etc/hosts file to avoid hostname resolution issues. Open it with nano:
sudo vim /etc/hosts

Find the line where your old hostname appears and replace it with the new one. The line will look like this:

127.0.1.1 old_name

Change old_name to new_name.

  1. Reboot the server After making these changes, reboot the server to apply them:
sudo reboot

Once the server restarts, you can verify the name change with:

hostnamectl

This will display the new hostname of the machine.

apt

# Installation Java
sudo apt install openjdk-17-jdk-headless

# Désinstaller Java
sudo update-alternatives --list java
sudo apt-get purge openjdk-17-*
sudo apt autoremove