Published on

Scripts To Setup Ubuntu For PHP and JavaScript Development


I maintain a bunch of bash scripts that I use to install PHP 8.1, node 16 and Docker in Ubuntu for PHP and JavaScript development.

These scripts are designed to be run on a fresh install of Ubuntu. They will install PHP 8.1, node 16, Docker, and a few other useful tools. I use them occasionally to set up a new Ubuntu on my Windows 10 machine whenever I mess the old one up.

Also Works On ec2 For Remote Development

These were originally developed and tested on an ec2 instance running vscode remote. They also work fine when using WSL2.

  • Set up vscode remote
  • Run all these scripts
  • Reboot instance
  • git clone ...
  • docker-compose up -d should work now
    • Also PHP, node, git, ssh.

Install PHP 8.1, node 16 and Docker in Ubuntu.

These scripts can be run with the following commands, by a super user. This installs a lot of stuff, read first.

Read Them First

You can add -s -- --dry-run to then end to do a dry run first.


PHP 8.1 And Composer

This installs PHP 8.1, exstensions and composer. It should output composer's help.

curl -fsSL | sh

Node 16, with nvm. Also, yarn.

curl -fsSL  | sh


curl -fsSL | sh

Set permissions for Docker

If you try and run docker-compose up or whatever now, you will likely run into a Docker permissions error, code 13.

This will make the user ubuntu a super user. That is the user that is running Docker.

curl -fsSL | sh

Expected output: Adding user ubuntu to group docker

git and ssh

This sets up git and creates and SSH key pair. It outputs the public key

Make sure to change <[email protected]> to your email and <name> to your name. Keep the double quotes around each.

curl -fsSL | bash -s "<[email protected]>" "<name>"

Expected output is the ssh public key, copy that and then add a new ssh key on Github.

Want to talk about this post? Discuss this on Twitter →

Found a typo or want to suggest an edit? Open a pull request →