Linux

Ubuntu Linux post installation of Network Properties, Guest Integration and Web Administration using Cockpit

Ubuntu is a Linux distribution system based on Debian and was officially released in three editions, Desktop, Server, and Cors. Since I will be covering Linux Cockpit, let me drop a brief description of it here. Linux Cockpit is a web-based interface that provides graphical administrative access to a system and it is a web-based console that provides some very easy ways to administer Linux systems. Kindly refer to the following guides on some related Linux contents. How to install configure Ubuntu Linux on VirtualBox”, Cockpit on CentOS, Windows Post OS Installation, how to install the Windows Subsystem for Linux (WSL) on Windows Server via Server Manager and PowerShell, how to install and configure Ubuntu Linux.

Guest Additions: VirtualBox Guest Integration provides additional capability to a guest virtual machine, including mouse pointer integration, better video support, share folders, share clipboard etc. Before Guest Additions can be installed, the current user must have sudo/root privilege

Install Guest Additions

The first in our Ubuntu Linux post-installation process is Guest Additions. In order to solve the issue with the display size mentioned in this article, kindly install Linux guest editions. To install this, follow the following steps below.
– Click Devices
– Insert Guest Additions CD images
Note: The version of VBOXADDITIONS should match with the one of VirtualBox you have installed.

Click on run and a window will pop up requesting for your password (because, installing Guest Additions requires root privilege).
– Enter your password as shown below

Enter your password

Now that we have installed the Guest Addition, we will have to restart the VM as shown below.

Installation comlete restart the VM

Now that the installation is complete, press Return key to close the terminal window as described above:
– Restart the VM via the Terminal using the command “reboot

reboot VM

Now the VM will be restarted and you can resize the screen to fit to your

Ubuntu is now running in full screen

Note: You also initiate a restart via the GUI.
– Click on Power Off / LogOut on the menu and
– Click on the Restart button as shown below.

Restart via GUI

In order to have seamless usage between the host and guest VM, e.g, copying links and files etc. There is a need to enables further features.
– Drag and Drop: Enable bidirectional
– Shared Clipboard: Enable bidirectional
– Shared Folder

For Shared Folder

Type the following line in the Terminal to add a user to 'vboxsf' group. This step is necessary in order to use the VB's 'Shared Folder' feature.

Part 2 – How to administer Linux (Ubuntu) via the web browser

Cockpit is an open-source easy-to-use web-based server manager developed by Red Hat to be efficient at monitoring and administering several servers at the same time without any interference. So, to ease our Ubuntu Linux post-installation we will be using Cockpit.
– This tool was originally written for RHEL family Linux distributions. Cockpit interacts directly with the operating system from a real Linux session in a browser with easy to use interface.
– Cockpit allows easy administration of your Linux servers allowing sysadmins to easily perform tasks such as starting containers, storage administration, network configuration, inspecting logs etc.

For vital GUI Tools for Linux System Administrators, see the following link.

Install Cockpit on Ubuntu 20.04

This installation is very straight forward. For other distribution of Linux, the command will be different obviously 🙂

sudo apt update && upgrade
Run the update && upgrade command
sudo apt -y install cockpit

Take note of the following syntax below
-y was added to every apt command that would otherwise prompt for a positive answer to perform its actions.
- update: Updates the list of packages but do not install.
- upgrade: Install new versions of packages if new versions are available.
- APT: This is a package handling utility.

In order to clear or clean old packages, use the following commands below.

autoremove, autoclean and clean - clean old packages which are not needed any more

Confirm if Cockpit is running

This can be achieved by running the following command below. After installation, the cockpit service should run automatically.

sudo systemctl status cockpit
cockpit is inactive(dead)

As we can see, the service isn’t running, we will need to start the service.
– Use the following commands below to do this.

sudo systemctl start cockpit
Input the start cockpit command

Now, when we try to confirm the cockpit status, we will have to run the command again as shown below
– As we can see from the command, the cockpit service is now running.

cockpit service is now running

Create a Firewall rule

Note: Cockpit service binds to port 9090 and the web interface can be accessed via any of the following URL.
Note: You may also have to have to create a firewall rule to permit connection on port 9090. In my case this was not necessary. To create this rule, run “sudo ufw allow 9090“. You can also change this port number as well.

http://hostname:9090
http://localhost:9090
http://ServerIP:9090

To get the hostname: run the command “hostname” from the terminal

Since, we currently do not access the serve with a valid certificate, the following security threat (risk) will be prompted
– Click on Advance and
– Accept the security risk and continue.

Now you can access the login page as shown below

Login with your username and password for the server. You should get to the dashboard after Logging in.
– On the Host Menu, you can create on Accounts and create new account from the web browser. Isn’t this amazing for the Lazy Admins as you do no need to know a lot of command line syntax anymore 🙂
– Among other settings, you can update your linux systems via the web browser as well.

You can also take a look at your server performance as cockpit has a dashboard for monitoring.

server performance on Cockpit dashboard

Part 3 – Networking Parameters configuration

Next in our Ubuntu Linux post-installation process is configuring Network parameters. On Linux, we have several ways to configure the network parameters, hostname etc.
– Using Cockpits:
– Via the Terminal (command Line) and
– Through the Linux Graphical User Interface (GUI)

1. Via Cockpits

See part two for more details on the usage of this tool.

2. Via the Terminal

To view the network parameters, run “IP”

run "ip address" in command

Note: “Ifconfig” command has been deprecated. In its place is ip, which can do everything ifconfig could. If this command is not available, it can be installed with “sudo apt install net-tools

run and fix "ifconfig" in command

Change Hostname

“hostname” command allows you to directly query, or set, the hostname from the command line. You can see your current hostname by running hostname. To set the hostname directly you can run hostname newservername as root.

- sudo hostname newsername

or

echo newservername | sudo tee /etc/hostname

Note: make sure you change the /etc/hosts file first. This is needed because otherwise you will need to boot into single user mode and change your hostname in /etc/hosts. This is because sudo requires DNS lookups in certain cases and it cannot resolve your newly set hostname.

sudo vi /etc/hosts
hostname in command

Determining a Network Interface

Firstly, when configuring the interface, it is better to determine the network interface card of your server. Note: This name is different from vendor to vendor and the following methods can be used. The first command has been discussed previously.

ip addr

You can also use the list command on the net as shown below

ls /sys/class/net
Use the "list command to get all NICs on your computer

This will list the interface names for all NICs on your computer. It will probably include eth0 (hardwired NIC), lo (loopback interface for the localhost). Occasionally, it will include the wireless card (like wifi0, or wlan0).

ip link show

Configuring a Network Interface

In this section in our Ubuntu Linux post-installation, I will be demonstrating just the basic configuration. If you want more information on other settings, kindly search for Ubuntu community.

Now that you know the device name you need to configure, you can assign a static IP address to that device with an IP Addr, bring the interface up (enabling it) and setting the gateway of the router as shown below.

sudo ip addr add 192.168.1.08/24 dev eth0
sudo ip link set dev eth0 up
sudo ip route add default via 192.168.1.1

To disable the interface, use “sudo ip link set dev eth0 down

Note: With the interface configuration commands used above, upon system reboot, the information will be lost as it is not stored anywhere. This is where the interfaces file comes in handy. To configure an interface permanently you will need to edit the interfaces file with your preferred editor to modify the following path /etc/network/interfaces.

– Run “sudo vi /etc/network/interfaces” on the terminal as shown below.
– Add the below lines to /etc/network/interfaces.

auto eth0
  iface eth1 inet static
  address 192.168.1.8
  netmask 255.255.255.0
  gateway 192.168.1.1
  dns-nameservers 8.8.8.8 4.4.2.2
command

Save the file and restart networking services with any of the commands below. On other distro, the commands are obviously different too.

sudo systemctl restart networking
sudo /etc/init.d/networking restart
sudo service networking start

Note: To configure a dynamic IP Address, enter the following command in the interfaces configuration file as shown below and save and restart.

## To configure a dynamic IP address
auto eth0
iface eth0 inet dhcp

Setting up DNS

To set the DNS parameters of your server for name lookups, you will have to modify the following location.

/etc/resolv.conf
setup a DNS parameter in command

How to install vim

Here is my preferred editor. Run the command as shown in the image below to install vim.

install vim in command

Via the Linux Graphical User Interface (GUI)

You can setup also the networking parameters.
– Click on the start menu and search for Settings.
– From the Settings window, click on the Network tab
– Then on the right pane, select the interface and
– Click on the gear icon to open settings for that interface.

Now you can set the host machine IP and all virtual machines. You can access this dialog from the GUI as shown below.

set the host machine IP and all virtual machines from the GUI

I hope you found this blog post on Ubuntu Linux post-installations helpful. If you have any questions, please let me know in the comment session. I welcome you to subscribe to my YouTube Channel.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x