Ubuntu and Debian

The following instructions are for installing TAO on Ubuntu 18.04 and can easily be adapted for Debian Buster/Sid.

The following instructions are for Ubuntu 18.04 and utilize /var/www/html/tao as the working directory for installation and /var/www/html as the DocumentRoot. Should you choose different Operating System version, another Debian-based flavor, directory location, or DocumentRoot you will need to adjust these paths as appropriate. These instructions make the assumption that you have access to the command line. If necessary, refer to your hosting company for how to proceed if you do not have SSH access to your environment.

Server Preparation

Make sure the server is up to date:

sudo apt update
sudo apt dist-upgrade

Once the system is up to date, you will need to install the required packages to create your LAMP stack as well as the packages necessary to complete your TAO installation if they have not yet been created.

sudo apt install apache2 \
php \
php-cli \
php-common \
mysql-server \
php-xml \
php-zip \
php-curl \
php-mbstring \
libapache2-mod-php \
php-mysql \
curl \
wget \
zip \
tidy \
unzip \
composer

Install components needed to build and install php-mcrypt

sudo apt install php-dev libmcrypt-dev php-pear
sudo pecl channel-update pecl.php.net
sudo pecl install mcrypt-1.0.1

Add mcrypt to the extensions section of php.ini

sudo nano /etc/php/7.2/cli/php.ini
extension=mcrypt.so

Create a new database and user for TAO.

sudo su -
mysql
create database <database>;
create user '<user>'@'localhost';
set password for '<user>'@'localhost' = PASSWORD('<password>');
grant all privileges on <database>.* to '<user>@'localhost' identified by '<password>';
flush privileges;
quit
exit

Configure Apache

Using the editor of your choice, you will need to configure the ServerName as well as the directory you are installing TAO in. If you are using virtual hosts, you will need to follow the Apache instructions which can be found here.

sudo nano /etc/apache2/apache2.conf

Configure ServerName

ServerName <hostname or IP>

Configure Directory

<Directory /var/www/html/tao>
        Options FollowSymLinks MultiViews
        AllowOverride all
        Allow from all
</Directory>

You will also want to configure Apache to serve PHP pages first by configuring dir.conf to have index.php first.

sudo nano /etc/apache2/mods-enabled/dir.conf

Turn on the mod-rewrite module

sudo a2enmod rewrite

Verify your Apache configuration and then restart for your changes to take effect.

sudo apache2ctl configtest
sudo service apache2 restart

Install TAO

Download the TAO Package from website or GitHub and prepare to install:

wget https://releases.taotesting.com/TAO_3.3.0-RC2_build.zip    
unzip TAO_3.3.0-RC2_build.zip
sudo mv TAO_3.3.0-RC2_build /var/www/html/tao

Or use Git to download the latest code from GitHub directly:

sudo git clone https://github.com/oat-sa/package-tao.git /var/www/html/tao
cd /var/www/html/tao
sudo git checkout release-3.3-rc02

Change ownership to the Apache user

sudo chown -R www-data:www-data /var/www/html/tao

Install TAO components on the server utilizing composer and then change ownership of the newly created tao directory to the Apache user:

sudo cd /var/www/html/tao
sudo composer install
sudo chown -R www-data tao

Install MathJax on the server if necessary.

sudo wget https://hub.taotesting.com/resources/taohub-articles/articles/third-party/MathJax_Install_TAO_3x.sh
sudo chmod u+x MathJax_Install_TAO_3x.sh
sudo ./MathJax_Install_TAO_3x.sh

You can now complete your installation either on the command line using the following command:

sudo -u www-data php tao/scripts/taoInstall.php \
--db_driver pdo_mysql \
--db_host localhost \
--db_name <db_name> \
--db_user <user> \
--db_pass <password>\
--module_namespace http://<hostname or IP>/first.rdf \
--module_url http://<hostname or IP> \
--user_login <user> \
--user_pass <password> \
-e taoCe

in which case your TAO instance will be available at:

http://<hostname or IP>/tao

Alternatively you can install TAO in your browser by going to http://<hostname or IP>/tao if you have followed the instructions above. If you have not followed the above instructions for your Apache configuration you will need to adjust the URL as appropriate.