A web-based server management tool

Remote Control

© Lead Image © shockfactor, Fotolia.com

© Lead Image © shockfactor, Fotolia.com

Article from Issue 240/2020
Author(s):

Ease the process of managing Linux installations remotely with the web-based Ajenti control panel.

Ajenti [1], an open source, web-based system control panel, lets you manage several important server management tasks with very little overhead. Think of it as a lightweight version of Webmin [2], the popular web-based administration tool.

You can use Ajenti for basic server monitoring, installing and removing packages, as well as managing services, the network, and more. It'll also help you remotely manage files on your server without firing up a terminal. In fact, if you want to get to the console, Ajenti will also give you a command-line interface inside the web browser itself.

The two Ajenti branches currently under development are Ajenti 2 and Ajenti V. Ajenti 2 offers a new lightweight interface developed with Python 3 and AngularJS. Ajenti V is a plugin that adds web hosting features to Ajenti, but currently only works on top of the previous version, Ajenti 1 (see the "Ajenti V Plugin" box).

Ajenti V Plugin

Ajenti V, an optional plugin for Ajenti 1, lets you manage multiple websites using the same control panel and carry out some additional website-related tasks, as well as configure email accounts.

Ajenti V can only be installed atop Ajenti 1, so you'll first have to install Ajenti 1 on your server before installing the Ajenti V plugin. Of note, Ajenti 1 depends on certain packages that have been replaced on the latest versions of the supported distributions. While you can work around the limitation by manually installing the dependencies from third-party repositories, it's best to install a still-supported, long-term support (LTS) release from a supported distribution. For instance, I was able to successfully install Ajenti 1 without any issues on the latest Ubuntu 16.04.7 LTS release that reaches end of life in 2024.

To set up Ajenti 1, follow the installation instructions for Ubuntu [3] on Ajenti's website. Once that's done, you can install Ajenti V. Since the plugin requires PHP v5.6 support, you'll have to enable Ondr Sury's PHP PPA, with:

$ sudo apt-get install -y software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update

When that's done, you can again follow the instructions on Ajenti's website and install the basic Linux, NGINX, MySQL, PHP (LNMP) stack with:

$ sudo apt install ajenti-v ajenti-v-nginx ajenti-v-mysql ajenti-v-php7.0-fpm php7.0-mysql

Once that's done, restart Ajenti with:

$ sudo systemctl restart ajenti.service

Now fire up a web browser and bring up the dashboard on port 8000. Ajenti 1's dashboard offers more options than Ajenti 2's dashboard, including the Websites option in the navigation panel. You can now refer to Ajenti's official documentation to configure PHP and set up a website using Ajenti V [4].

Installing Ajenti 2

Ajenti 2, the latest version of the control panel, officially supports the latest releases of deb-based distributions like Debian and Ubuntu, as well as RPM-based distros including CentOS, Fedora, and RHEL. The process for both doesn't differ much, but in this example I'll assume the IP address of the Linux server is 192.168.0.1.

On deb-based installations like Ubuntu, first enable the Universe repository:

$ sudo add-apt-repository universe

And then install the dependencies with:

$ sudo apt-get install build-essential python3-pip python3-dev python3-lxmllibssl-dev python3-dbus python3-augeaspython3-apt ntpdate

Similarly, in RPM-based distributions like Fedora and CentOS, not all the required dependencies are in the main repository, so you will need to install the EPEL repository:

$ sudo dnf install epel-release

Then install the dependencies with:

$ sudo dnf install -y gcc python3-devel python3-pippython3-pillow python3-augeaspython3-dbus chrony openssl-devel

With the dependencies in place, irrespective of your underlying distribution, you can now fetch and install Ajenti using the following script:

$ curl https://raw.githubusercontent.com/ajenti/ajenti/master/scripts/install.sh | sudo bash -s -

The script will pull packages and a handful of the commonly used Ajenti plugins. There are a few official and community-supported plugins that Ajenti doesn't install by default, but these can be pulled in from inside the administration panel.

Since Ajenti is written in Python, you can install it on other distros in addition to the officially supported ones. The website documents the process of manually installing Ajenti 2 [5] using Python's pip package management system.

Once the installation is complete, you can control the Ajenti service with:

$ sudo systemctl restart ajenti.service

Dashboard and Tools

Fire up a web browser and head to https://192.168.0.1:8000 from another machine on the same local network. You'll have to accept the self-signed certificate before you can continue to the login page.

In Ajenti 2, you can log in using the base installation's credentials. Since most of the administrative tasks require root user authentication, it's a good idea to log in with the root user's credentials.

Alternatively, you can also log in as a standard user and then elevate yourself to a superuser from inside the console. Before you do that however, you must tweak Ajenti's configuration file (see the "Becoming a Superuser" box).

Becoming a Superuser

Before you can elevate your standard Linux user to the root user, you'll have to add details about this user to Ajenti's configuration file.

Fire up a terminal and edit Ajenti's simple configuration file with:

$ sudo nano /etc/ajenti/config.yml

Now scroll down to the end of the file and enter the following line:

restricted_user: bodhi

Make sure you replace bodhi with the username of your installation's standard user. Now save the file and bring the changes online by restarting the service with:

$ sudo systemctl restart ajenti.service

You can now log in as the standard user. Whenever you run into a section that requires superuser permissions, just click on your username in the top-right corner and select Elevate. Enter the password for the user, and Ajenti will give you superuser privileges.

Ajenti's landing page, the Dashboard (Figure 1), displays the hostname, CPU usage, memory usage, load average, and the computer's uptime. These details are fetched via widgets, and you have the option of adding more widgets.

Figure 1: By default, the Ajenti session times out after 60 minutes. You can increase or decrease this time by heading to General | Settings.

Click the Add Widget button in the right corner to reveal a pull-down list of all the supported widgets. Scroll through the list and click the widget you wish to add; it'll be placed in the first available space on the Dashboard.

To customize the Dashboard, mouse over any widget to reveal buttons to either delete or rearrange the widget. You can even add a completely new tab on the dashboard and place widgets there.

One way you could use this arrangement, for instance, is to separate all the available system information into a standard view (that lists the default widgets) and an advanced view (that lists all the available widgets).

Ajenti's interface is fairly intuitive and self-explanatory. The Tools section lists the utilities available to help administer your installation.

File Manager lets you edit files in your installation. When you click on a file, Ajenti will display its metadata including the size and ownership details. You also have the ability to change the file's permissions from here using a point-and-click graphical interface, which is helpful for new Linux users who aren't yet familiar with Unix's numeric notations. You can do the same for directories as well.

File Manager also lets you create new files and directories. You can also upload content into a directory. This is especially useful if you wish to upload content into the Ajenti-managed machine from a remote machine on your network.

If the file you are interested in is a text file, Ajenti will offer to open it in the built-in text editor called Notepad, which lacks rich-text editing tools and is designed for editing configuration files. You can also use it to create a new file and save it anywhere in the File Manager.

Finally, the Terminal tool offers a web-based console that'll help you get a command-line interface into your Ajenti-equipped machine. This is especially useful when accessed from a remote computer as it saves you the effort required to set up and configure an SSH server. If you only need to run a single command, you can do this from the Terminal tab without launching a full-fledged terminal.

Administrative Tasks

To manage the services running on the machine, head to Software | Services. This brings up a list of installed services in alphabetical order along with their current status. Running services are represented by a Play button, while stopped services have a Pause icon.

To control a service, mouse over it to reveal icons to reload and stop/start the service. This is useful for users who are new to Linux and aren't well-versed in systemd operations.

To remotely install packages on the Ajenti-equipped server, go to System | Packages (Figure 2). Ajenti 2 has two package installation options: Apt/RPM or pip. Both of them have the option to refresh the package list to sync with the online repositories.

Figure 2: You can also search for installed packages and mark them for removal; Ajenti will remove them using the underlying package management system.

Once the repositories have been refreshed, you can use the search bar to search for apps you wish to install. Then pick a package from the displayed list and mouse over it to reveal the option to download and install the package.

When you click on the install icon, Ajenti will fire up the terminal and download and install the app using the underlying package management system of the machine running Ajenti.

Besides packages, the System section also helps with a couple of other administrative tasks. Navigate to System | Network (Figure 3) to view all the network interfaces connected to the machine along with their IP addresses. You can, just as with Services, restart and deactivate any of the interfaces.

Figure 3: You can also customize and configure the /etc/hosts file from the Network interface.

More importantly, you can also click on the gear icon adjacent to a network interface to configure it. You can, for instance, change its addressing scheme to DHCP, manual, or a static address. Similarly, you'll also be able to tweak the DNS settings and even update the hostname of the machine running Ajenti without firing up a terminal.

In addition to these functions, you can add more functionality to the base Ajenti installation by heading to General | Plugins (Figure 4).

Figure 4: Ajenti 2 has some interesting plugins that aren't enabled by default. Make sure you scroll down to the Available Plugins section and check them out.

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Virtually Yours

    If managing a server on your own network doesn't appeal to you, then a virtual private server might be the answer.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News