One of the most headache problems of using Ubuntu as a server is its frequent changes with updates. It is a good thing for functions and security but for deployment that’s normally mean more workload. However, it is still quite good for personal use, I’ve recently setup a new test server and found the previous method of installing ajenti is not working anymore, therefore I’ve noted what is working for now here. If you’re looking for a more stable deployment maybe consider Debian based OS.

Please note: this approach will NOT work on Ubuntu 20.04, I had a very quick try and failed, probably due to the change in python version.
This note
is based on using Ubuntu 18.04 Server LTS.

First of all, download the server image and make a fresh install.

Apply latest updates, and then install the python-pil package (for python-imaging, which is needed by ajenti V)

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install python-pil python3-pil

For some reason the python-imaging is still needed, I’ve uploaded a copy here or you can grab one from launchpad.net, then manually install it.

wget http://lsong.net/share/python-imaging_4.1.1-3build2_all.deb
sudo dpkg -i python-imaging_4.1.1-3build2_all.deb

Now the most of the preparation is done, as the date of 8th Jan, 2021. You can use the installation script to install Ajenti now.

wget -O- https://raw.github.com/ajenti/ajenti/1.x/scripts/install-ubuntu.sh | sudo sh

After loads of scripts flying over your screen, hopefully everything would be installed properly and the following information should be displayed. If an error is spotted, maybe you need to do a bit more investigations.

At this point, you can open your browser and navigate to https://<address>:8000 (after mapping ports and configurate your firewall properly), a kind of security warning would be displayed as using self-signed SSL certificate (to avoid this, apply a proper SSL certificate if necessary)。

Bypassing this warning, the Ajenti login page should be loaded, and now we can login using default username / password: root / admin.

Normally the first thing is replace the default password with a more secured one.

Now, it’s time to add modules that are needed, for example website hosting, FTP, email etc accordingly. For my test, I would like to use php7.4, while ajenti is using Nginx, we need to install the relevant version of php7.4-fpm first, to do so I found  ppa:ondrej/php need to be added and if you cannot added it by using the following commend, maybe you need to install software-properties-common package first. Following the installation restart ajenti to reflect the changes. Some of the time, a mysql password issue would happen, reboot the ubuntu box normally would solve that.

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt -y install php7.4-fpm ajenti-v ajenti-v-nginx ajenti-v-mysql ajenti-v-ftp-pureftpd ajenti-v-php7.4-fpm php7.4-mysql
sudo service ajenti restart

For now most of the work is done and you should see the installed module in the ajenti panel. You can enjoy downstream processes for example deploying your first website.

Also might be useful:

sudo apt-get install php7.4-gd php7.4-curl php7.4-xml php7.4-mbstring php7.4-gd php7.4-imagick php7.4-zip

Some changes to php.ini:

sudo nano /etc/php/7.4/fpm/php.ini

max_input_vars = 6000
max_execution_time = 600

Also:

post_max_size
upload_max_filesize

sudo service php7.4-fpm restart

If you would like to reset mysql root password:

sudo /etc/init.d/mysql stop
sudo mkdir -p /var/run/mysqld
sudo chown mysql /var/run/mysqld
sudo /usr/sbin/mysqld –skip-grant-tables –skip-networking &
mysql -u root

Mysql>

flush privileges;
USE mysql;
update mysql.user set authentication_string=PASSWORD(‘your password’) where user=’root’;
UPDATE user SET plugin=”mysql_native_password” WHERE User=’root’;
flush privileges;
exit

sudo pkill mysqld
sudo service mysql start

Test by:

mysql -u root
mysql -u root -p

First one should denied
Second one should work, after input correct new password