# Installing Ajenti Web Administration Panel

## What is Ajenti?

> [Ajenti is] an admin's tool for a more civilized age, providing you with a fast and secure way to manage a remote Linux box at any time using everyday tools like a web terminal, text editor, file manager and others.-https://ajenti.org/

1. Log into the Linux device
2. Run the following commands in a terminal:
   # update software repositories
   sudo apt update
   # install software updates
   sudo apt upgrade -y
   # install pre-requisites
   sudo apt install build-essential python3-pip python3-dev python3-lxml python3-dbus python3-augeas libssl-dev python3-apt ntpdate -y
   # upgrade pip
   sudo pip3 install setuptools pip wheel -U
   # install ajenti
   sudo pip3 install ajenti-panel ajenti.plugin.ace ajenti.plugin.augeas ajenti.plugin.auth-users ajenti.plugin.core ajenti.plugin.dashboard ajenti.plugin.datetime ajenti.plugin.filemanager ajenti.plugin.filesystem ajenti.plugin.network ajenti.plugin.notepad ajenti.plugin.packages ajenti.plugin.passwd ajenti.plugin.plugins ajenti.plugin.power ajenti.plugin.services ajenti.plugin.settings ajenti.plugin.terminal
   # create and edit ajenti.service
   sudo nano /lib/systemd/system/ajenti.service
3. Paste the following configuration into the service file

   [Unit]
   Description=Ajenti panel
   After=network.target
   [Service]
   Type=forking
   PIDFile=/var/run/ajenti.pid
   ExecStart=/usr/bin/python3 /usr/local/bin/ajenti-panel -d
   ExecStartPost=/bin/sleep 5
   [Install]
   WantedBy=multi-user.target

4. Press CTRL+O, Enter, CTRL+X to write the changes
5. Continue with the following commands:
   # reload daemons
   sudo systemctl daemon-reload
   # enable and start ajenti service
   sudo systemctl enable ajenti --now
   # set the PANEL variable
   PANEL=$(which ajenti-panel)
   # create and edit the initscript
   sudo nano /etc/init.d/ajenti
6. Paste the following into the init file

   #!/bin/sh
   ### BEGIN INIT INFO
   # Provides: ajenti
   # Required-Start: $network $syslog $local_fs
   # Required-Stop: $network $syslog $local_fs
   # Should-Start: $local_fs
   # Should-Stop: $local_fs
   # Default-Start: 2 3 4 5
   # Default-Stop: 0 1 6
   # Short-Description: Ajenti
   # Description: Ajenti administration frontend
   ### END INIT INFO
   if [ -e /lib/lsb/init-functions ]; then
   . /lib/lsb/init-functions
   log_success() {
   log_success_msg "\$1"
   }
   log_failure() {
   log_failure_msg "\$1"
   }
   else
   . /etc/rc.d/init.d/functions
   log_success() {
   echo_success
   echo "\$1"
   }
   log_failure() {
   echo_failure
   echo "\$1"
   }
   fi
   NAME=Ajenti
   PIDFILE=/var/run/ajenti.pid
   case "\$1" in
   start)
   echo "Starting \$NAME:"
   export LC_CTYPE=en_US.UTF8
   if pidofproc -p \$PIDFILE \$PANEL > /dev/null; then
   log_failure "already running"
   exit 1
   fi
   if \$DAEMON -d ; then
   log_success "started"
   else
   log_failure "failed"
   fi
   ;;
   stop)
   echo "Stopping \$NAME:"
   if pidofproc -p \$PIDFILE \$PANEL > /dev/null; then
   killproc -p \$PIDFILE \$PANEL
   /bin/rm -rf \$PIDFILE
   log_success "stopped"
   else
   log_failure "not running"
   fi
   ;;
   restart)
   \$0 stop && sleep 2 && \$0 start
   ;;
   status)
   if pidofproc -p \$PIDFILE \$PANEL > /dev/null; then
   log_success "\$NAME is running"
   else
   log_success "\$NAME is not running"
   fi
   ;;
   *)
   echo "Usage: \$0 {start|stop|restart|status}"
   exit 1
   esac
   exit 0

7. Press CTRL+O, Enter, CTRL+X to write the changes
8. Continue with the following commands:
   # make the init script executable
   sudo chmod +x /etc/init.d/ajenti
   # run the init script
   sudo /etc/init.d/ajenti start
9. Open a web browser and navigate to http://DNSorIP:8000
10. Login with the username root and the root Linux password
11. Welcome to Ajenti

Source: http://docs.ajenti.org/en/latest/man/install.html