There are quite a number of components needed to setup a proper Laravel development environment on Xubuntu. And, I am tired of Googling around for each and every components. Hence, the birth of this article for my own reference. Use it at your own risk although your computer won’t explode 🙂
First, install the fundamental components, such as git and curl
$ sudo apt install git curl
Then, install the mighty package management system for PHP – composer. Initially, I was planning to install PHP CLI manually then install composer as per the instructions from the website. But then this is not necessary anymore! Just simply type in the following commands will do:-
$ sudo apt install composer
* The above will install PHP CLI 7.2.7 automatically as well
Still need a few more items to complement PHP for composer.
$ sudo apt install php-mbstring php-xml php-zip php-intl php-soap php-xdebug
$ sudo apt install php7.2-mbstring php7.2-xml php7.2-zip php7.2-intl php7.2-soap
Next, install XAMPP by going to https://www.apachefriends.org/download.html to download the latest XAMPP for Linux 7.2.7 (64-bit).
$ chmod 755 xampp-linux-x64-7.2.7-0-installer.run
$ sudo ./xampp-linux-x64-7.2.7-0-installer.run
And then, just click “Next” on the screens pop-up and your XAMPP will be installed into /opt/lampp.
There are 2 ways to start/stop the XAMPP services:-
- Via command line
$ sudo /opt/lampp/lampp start $ sudo /opt/lampp/lampp stop
- Via graphical tool
$ cd /opt/lampp/ $ sudo ./manager-linux-x64.run
You should be able to see the following page by now when you launch your favorite browser.
Next, I will install PhpStorm because I need a full IDE
$ sudo snap install phpstorm --classic
Finally, we arrived at the Laravel portion.
But, we will face permission issue when we try to deploy Laravel projects into the /opt/lampp/htdocs folder/directory.
We need to change the ownership for /opt/lampp/htdocs folder/directory
$ sudo chown -R [Username]:[Group Name] /opt/lampp/htdocs
Replace the [Username] and [Group Name] with your own account.
Then, edit the Apache configuration file at /opt/lampp/etc/httpd.conf and look for the “User daemon” line
Again, replace the [Username] and [Group Name] with your own account.
Restart all XAMPP services and you are done!