Linux

Ubuntu Linux: Post-installation (Network Configuration), Guest Integration and Web Administration of Linux using Cockpit

In order to reduce the issue with the display size mentioned in this article “How to install configure Ubuntu Linux on VirtualBox“. See how Cockpit can be configured on CentOS.

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.

For Windows: Post OS Installation, see the link.
Install Guest Additions: To install this, follow the following steps below.
– Click Devices
– Insert Guest Additions CD images
Note: The version of VBOXADDITIONS should be matched with the one of VirtualBox you have installed.

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

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

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

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

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.

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.
– 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
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

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

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.

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.

References:
https://www.sitepoint.com/how-to-install-cockpit-on-ubuntu-18-04/
https://linuxconfig.org/how-to-install-cockpit-on-ubuntu-18-04-bionic-beaver

Part 3 – Networking Parameters configuration: On Linux, we have several ways to configure the network parameters, hostname etc.
– Via Cockpits:
– Via the Terminal (command Line) and
– Via 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”

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

– 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

-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

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, 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

Save the file and restart networking services with any of the commands below. On other disto, 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

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

3. 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.

I found you found this article useful? Kindly leave a comment below if you require additional information.

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