Skip to main content

Linux

Setting up a linux development machine

The following instructions will work on Ubuntu or closely related distros like Pop OS. They will also mostly work on Debian-based distros with some slight tweaks.

Install Visual Studio Code

  • Download from software store or from vs code website
  • Install the Settings Sync extension
  • Ask a member of the dev team to upload their settings as a public gist
  • Press Shift + Alt + D
  • From the menu that appears, click ‘download public gist’
  • Enter the gist ID given to you by the dev team member
  • Wait for all settings and extensions to be installed

Install required tools, packages and languages

PHP

Curl

Composer

To install Composer globally, first run the following commands from your terminal:
Add composer to your path:

Git

MySQL

Install MySQL server:
Before you can use MySQL, you will need to set up authentication. First run:
Follow the steps to set up your root user. How secure you want this to be is to up to you - I set it to lowest as my local databases do not store any critical info. It’s better to create a new user and grant it all permissions and use the new user to manage your databases instead. To do so, login to the MySQL terminal with:
Then enter your system password if not yet authenticated in the current terminal session followed by the password you set up for your root user. To create a user called ‘admin’ with a password of ‘admin123’ for example, run the following command:
To grant all necessary privileges to your admin user, run:

Table Plus

You can use any application you like to manage your MySQL databases, but this is currently our preferred option. To install Table Plus on Linux, follow these steps:
Table Plus should then be accessible in your list of installed applications.

Node.js

You can install the latest version of Node.js by running:
However, you will not be able to easily switch between Node versions using this method. An alternative is to use NVM (Node.js Version Manager) which will allow you to run multiple isolated versions of Node.js. You can download nvm from the project’s GitHub page using this script:
Take note of the version number on the GitHub page - it will likely be different to what’s shown above, so replace the version number in the script with the latest version. To install, run:
Close and re-open your terminal, you should now be able to access nvm by typing nvm into the terminal. You can install the latest version of node by running:
You can install a specific version by running

Node package manager

You will also need npm to install and manage packages as well as to run scripts. You can install this by running:

Other required PHP extensions

You will need to manually install some PHP extensions by running the following command:
Here are some extensions you might need to install:
  • bcmath
  • ctype
  • curl
  • fileinfo
  • gd
  • json
  • mbstring
  • mysql
  • pdo
  • sqlite-3
  • tokenizer
  • xml
  • zip

Redis

To install Redis, run the following command:
You can tell if redis is working by pinging it:
You should see “PONG” returned in the terminal if all worked out correctly.

Valet

Valet is a Laravel development environment for macOS. However, there is a fork of it which was created for Linux - Valet Linux. To install Valet with Composer, run:
You can then install it with:
Missing Valet requirements
If you get a message about missing Valet requirements, consult this documentation page for more info. On my system, I needed to run the following before running valet install again:

Issues with Nginx

If you have a 502 gateway error with any of the applications that you’re developing, open the nginx config of your site: i.e. For ptchub.test you’ll find the config at ~/.config/valet/Nginx/ptc-hub.test
  • Within the second server block, copy the following before the closing curl bracket
  • Restart valet sudo valet restart