So, I’m documenting this for my own benefit for now, but I promise to eventually get around to making a proper tutorial out of it, but the process of setting a coworker up with a new localdev computer (when they’re not the sysadmin-y type), can get tedious. Especially if you’ve forgotten the dependencies.
Now, this works on Ubuntu 20.04.3 LTS, and I hope I didn’t forget anything, but here we go:
# Let’s install GDebi because dependenciessudo apt install gdebi# and now VSCode (get the current version from https://code.visualstudio.com/download)sudo gdebi Downloads/code_1.60.2-1632313585_amd64.deb# unfortunately, this terminal doesn’t seem inclined to remember we installed ZSHsudo apt install zsh# we’ll need curl for this next onesudo apt install curl# and ohmyzshsh -c “$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”# now time for some terminal goodnessgit clone –depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10kgit clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestionsgit clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting# it’s composer timeclear# because php, of coursesudo apt install phpphp -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”php -r “if (hash_file(‘sha384’, ‘composer-setup.php’) === ‘906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”php composer-setup.phpphp -r “unlink(‘composer-setup.php’);”sudo mv composer.phar /usr/local/bin/composer# you might need this for composer globals to runexport PATH=~/.config/composer/vendor/bin:$PATH >> ~/.zshrc# wp-clicurl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.pharphp wp-cli.phar –infochmod +x wp-cli.pharsudo mv wp-cli.phar /usr/local/bin/wpwp –info# let’s cleanupsudo apt autoremove# it’s Homebrew time/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”# and add the shellenv to .zshrcecho ‘eval “$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)”‘ >> ~/.zshrc# and enable it for this sessioneval “$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)”# now the goodiesbrew install roots/tap/trellis-clibrew install pythonbrew install mariadbbrew install gcc && sudo apt install build-essential# let’s start the MySql server nowmysql.server start# Valet, baby# but before that, another dependencysudo apt install php-curl# nowcomposer global require cpriego/valet-linux# more Valet dependenciessudo apt-get install network-manager libnss3-tools jq xselsudo apt install php-cli php-curl php-mbstring php-xml php-zip# doing this shit because mcrypt has gone missingsudo apt install php php-pear php-dev libmcrypt-devsudo pecl channel-update pecl.php.netsudo pecl update-channelssudo pecl search mcryptsudo pecl install mcryptsudo echo ‘extension=mcrypt’ >> /etc/php/7.4/cli/php.inisudo apt install php-sqlite3 php-mysql php-pgsql# almost there, squeeze tightvalet install# and just a little bitsudo service apache2 stopsudo service nginx start# and finally, Trellis-clibrew install roots/tap/trellis-cliPresto! If you’re lucky, you may not even encounter errors along the way. This will probably need a couple of updates.
Now we only need to run valet link domain inside whatever site folder we have running to get domain.test up in the browser, SSL self-sign it with valet secure domain, and start importing databases (or contemplating your .env file, which you’ll need).
Now, about that database. You’ll need to create a user (named according to the username in the .env file), grant it permissions over the database and all that jazz. Basically the following, replace db_user, db_name and db_password as appropriate:
Open up a terminal and run mysql.CREATE DATABASE dbname;CREATE USER ‘dbuser’@’localhost’ IDENTIFIED BY ‘password’;GRANT ALL PRIVILEGES ON dbname.* TO ‘dbuser’@’localhost’;GRANT FILE ON *.* TO ‘dbuser’@’localhost’;FLUSH PRIVILEGES;EXIT
Now you should be good to go to either wp db create, wp db reset or wp db import.
About
the Author

Vlad writes about automation, operations, and the little tweaks that make a big difference in how businesses run. A former game designer turned founder, he now helps teams fix broken workflows and spot the revenue leaks hiding in plain sight.
About
Serenichron

Helping businesses grow by simplifying strategy, streamlining systems, and making tech actually work for people. We bring clarity to chaos with practical tools, honest guidance, and just enough curiosity to question the default way of doing things.
6 Responses
Regarding the following line:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"\nphp -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"\nphp composer-setup.php\nphp -r "unlink('composer-setup.php');"
…the terminal outputs the following error:
You can use -r only once.
———————————
I tried finding a workaround and installed a composer from synaptic. It installed, however, now could not find composer.phar on my system, so I skipped the following step
sudo mv composer.phar /usr/local/bin/composer
… also, the following path
~/.config
… had no composer directory inside it, so I had to skip this step to:
export PATH=~/.config/composer/vendor/bin:$PATH >> ~/.zshrc
Yup, the composer installation failed, I’ll update the typos in my code
regarding the following line:
chmod +x wp-cli.phar\nsudo mv wp-cli.phar /usr/local/bin/wp
… the terminal output was the following:
chmod: cannot access 'wp-cli.pharnsudo': No such file or directory
chmod: cannot access 'mv': No such file or directory
chmod: cannot access '/usr/local/bin/wp': No such file or directory
typos in my code, I’ll update
Regarding the following command:
wp –info
… the terminal output was the following:
zsh: command not found: wp
either wp-cli was not installed, or not added to the PATH