Project

General

Profile

Actions

HowTo Setup the Environment on Ubuntu 18.04

Step 0: Download the ISO

Grab the latest and greatest 18.04 here
Just a heads up it is a 1.8Gb download.

Step 1: Install

Boot the ISO in a new VM (recommended) or from a flash drive via the BIOS if you want to replace your OS / dual boot. (not recommended)

Complete the Ubuntu installation steps and reboot when it asks to.
Welcome to 18.04

Step 2: Install MySQL

(NOTE: install MySQL-Server first or you’re going to have a bad time)
Open the terminal and run the command:

sudo apt install mysql-server

Step 3: Install the rest

Now that MySQL is installed, we can install all the other bells and whistles:

sudo apt install apache2 curl vim php ssh phpmyadmin php-curl php-zip php-bcmath net-tools git

Step 4: Creating a MySQL super user

So apparently 18.04 doesn't allow authentication via password for the root user.
So we get around this by creating our own super user. (NOTE: Do not do this on a production server.)

sudo mysql

(NOTE: change mypassword in the following segment of code to be whatever password you want the super user to have.)

CREATE USER 'admin'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost';
GRANT GRANT OPTION ON *.* TO 'admin'@'localhost';
FLUSH PRIVILEGES;

Step 5: Create the Apache virtual host config file​

sudo vim /etc/apache2/sites-available/local.321project.com.au.conf
<VirtualHost *:80>
    ServerAdmin ​username@email.com
    Server​Name local.onko.com.au

    ServerSignature Off

    # Turn off mod_security filtering.
    <IfModule mod_security2.c>
        SecFilterEngine Off
    </IfModule>

    DocumentRoot /home/​myname​/workspace/321project
    <Directory />
        Options FollowSymLinks MultiViews
        DirectoryIndex index.php
        AllowOverride All
        Header always set Access-Control-Allow-Origin "*" 
        Header set Access-Control-Allow-Credentials "true" 
        Header always set Access-Control-Allow-Methods "GET, PUT, POST, DELETE, OPTIONS" 
        Header always set Access-Control-Allow-Headers "DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Authorization,X-CSRF-Token" 
        Require all granted
        # Modify the RewriteBase if you are using Drupal in a subdirectory and the  RewriteBase /
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
</VirtualHost>

Step 6: Configuring all the things

Apache config stuff

sudo a2enmod headers rewrite
sudo a2ensite local.onko.com.au

Edit the hosts file

cd /etc
sudo vim hosts

and add the following line near the top (‘i’ to insert in vim):

127.0.0.1        local.onko.com.au 

<esc> :wq //escape to exit insert mode, :wq to write and quit

restart Apache so the changes take effect

systemctl restart apache2

Step 7: Install Composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" 
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffb c1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" 
php composer-setup.php
php -r "unlink('composer-setup.php');" 

sudo mv composer.phar /usr/local/bin/composer

Step 8: Installing the Service Club Base

The Drupal Base install can be found at: https://github.com/didymo/service_club_base

Use the following commands to git clone it to your workspace folder.

cd
mkdir workspace
cd workspace
git clone https://github.com/didymo/service_club_base.git
cd service_club_base
composer install

Step 9: Drupal configuration

Open your favourite internet browser and go to: http://local.onko.com.au

Follow the drupal site install instructions, and you will have a working local site!

Updated by Peter Qian about 4 years ago · 1 revisions