Skip to content

Instantly share code, notes, and snippets.

@mehrancodes
Last active May 29, 2021 16:13
Show Gist options
  • Save mehrancodes/4cff7e3f122782b1d0610d3a9b13130d to your computer and use it in GitHub Desktop.
Save mehrancodes/4cff7e3f122782b1d0610d3a9b13130d to your computer and use it in GitHub Desktop.
Prepare Ubuntu 16.04 for Laravel ( PHP + Composer + Valet)

Install PHP (shell)

Requirements

  • Dependencies: sudo apt-get install libnss3-tools jq xsel
  • PHP >= 5.6 : sudo apt-get install php
  • PHP Packages: php*-cli php*-common php*-curl php*-json php*-mbstring php*-mcrypt php*-mysql php*-opcache php*-readline php*-xml php*-zip
  • Optional PHP Packages: php*-sqlite3 php*-mysql php*-pgsql

Install Composer (shell)

There are 2 options to installing composer on Ubuntu.

First option is using official Ubuntu repositories(at this time, it is not the latest option. so you may refer to the second option)

sudo apt-get install composer

Second option, The Composer's way!

Just visit Composer Download Page . Run the 4 lines in order to download the latest version of the composer.

After downloading composer, run this line code to make it global:

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

Notice: make sure to logout/login your system after running above line!

Install Valet.

As you may know, Currently there is not any official way to install Valet on Ubuntu. but there is a forked repository prepared for Ubuntu so you can install it on Ubuntu! So to install it, visit Valet Ubuntu and follow the instructions and Your Done!

You can find more information about how to start a project on valet, here

Install laravel-installer

composer global require "laravel/installer"

F.A.Q.

Why can't I run laravel new blog or valet install?

Check that you've added the .composer/vendor/bin directory to your PATH in either ~/.bashrc or ~/.zshrc.

If you use the latest composer version, you may add ./config/composer/vendor/bin directory to your PATH instead of .composer/vendor/bin.

What about the Database?

Well, your choice! You could use the superlight SQLite sqlite3, the extremely versatile MariaDB/MySQL mariadb-server or mysql-server or even the powerful PostgreSQL postgresql. Just don't forget to install the corresponding php package for it.

Any other tips?

Oh yeah! For those looking for a web based simple database managment try Adminer

You can download it here:

And for a beauty theme use this css stylesheet:

@superjoefly
Copy link

Thanks for this Gist...
Is there any way to use Adminer while Laravel Valet is currently installed and running?
It seems that it depends on Apache2 which is incompatible with Valet.
Any suggestions on how to set it up for use with Valet?
Thanks again :-)

@mehrancodes
Copy link
Author

@superjoefly Is this problem still exists?

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