# Roots/Trellis and Bedrock Localdev Stack with Laravel Valet for Linux for quick development

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 &gt;&gt; ~/.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)"' &gt;&gt; ~/.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 &amp;&amp; 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' &gt;&gt; /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.