Skip to content

Instantly share code, notes, and snippets.

@nextlevelshit
Last active September 27, 2020 05:47
Show Gist options
  • Save nextlevelshit/10dc26d396466bb6092ab59598351c60 to your computer and use it in GitHub Desktop.
Save nextlevelshit/10dc26d396466bb6092ab59598351c60 to your computer and use it in GitHub Desktop.
A installation guide to get Lumen 5.5 running on Ubuntu 17.04 including all dependencies and known issues

How to install Laravel Lumen 5.5 on Ubuntu 17.04

In that installation guide i will carry you through all dependencies of Lumen 5.5 on a system with Ubuntu 17.04. I will also provide known issues, that come along the installation of Lumen.

1. Requirements for installing Lumen 5.5

Type in the commands beneath the required package and check if you have yet installed them. If not, click the link for installation guide.

PHP >= 7.0

php -v | grep -i php

Install PHP 7 on Ubuntu 17.04

OpenSSL PHP Extension

php -i | grep -i openssl

Install OpenSSL Extension for PHP

PDO PHP Extension

Depending on your preferences you can choose for example MySQL, MariaDB or NoSQL. All of them provide the needed PHP Data Object (PDO).

php -i | grep -i pdo

If any extension cannot be found, install PDO Extension for PHP.

Mbstring PHP Extension

php -i | grep -i mbstring

If extension cannot be found, install Mbstring Extension for PHP.

PHP XML Extension

php -i | grep -i xml

If extension cannot be found, install XML Extension for PHP.

2. Downloading Composer (PHP Package Manager)

Composer is used to manage dependencies. It is very common and will help you develope better software. Get to know which packages are popular on Packagist the PHP Package Repository.

You will download the installer file to your current directory, check the hash, install composer and remove that downloaded file. For detailed information please look on Composer's download guide.

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

3. Install Lumen

composer global require "laravel/lumen-installer"

4. Add CLI for Lumen

To have lumen beeing used as command line interface (CLI) you have to put Composer to your PATH file. In most cases Composer is installed in ~/.composer.

Open your ~/.bashrc or ~/.profile and add:

# Composer
export COMPOSER_HOME="$HOME/.composer"
export PATH="$COMPOSER_HOME/vendor/bin:$PATH"

5. Test installation

lumen

Possible output:

Lumen Installer 1.0.2

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help  Displays help for a command
  list  Lists commands
  new   Create a new Lumen application.

How to install Mbstring for PHP

sudo apt-get install php-mbstring

Known issues:

None

How to install OpenSSL Extension for PHP

sudo apt-get install php-openssl

Known issues:

None

How to install PHP Data Object (PDO) for PHP

For Laravel Lumen you will only need one of the following PDO's. Choose one by your preferences:

Install MariaDB

sudo apt-get update # Update your system
sudo apt-get install mariadb-server # Install MariaDB
sudo apt-get install php-mysql # Install necessary extension for PHP

Install SQLite

sudo apt-get update # Update your system
sudo apt-get install php-sqlite3 # Install extension

Install MySQL

sudo apt-get update # Update your system
sudo apt-get install mysqk-server # Install MySQL
sudo apt-get install php-mysql # Install necessary extension for PHP

Known issues:

None

How to install PHP 7 on Ubuntu 17.04

sudo apt-get install php

Known issues:

Remove old versions of PHP

You can remove them by the following commands:

sudo apt-get -y purge php* && sudo apt-get -y *php && sudo apt-get autoremove

After that update your installed packages and install PHP again:

sudo apt-get update && sudo apt-get instal php

How to install XML Extension for PHP

sudo apt-get install php-xml

Known issues:

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment