The official Laravel Valet development environment is great for Apple users, but there is no official Valet for Linux or Windows. However, the community has created two versions of Valet for Linux:
- cpriego/valet-linux (Valet Linux)
- genesisweb/valet-linux-plus (Valet Linux+)
- nvm-sh/nvm (Node Version Manager)
Among these, Valet Linux+ has more features, such as MySQL database handling from the command line, MailHog, Redis, sharing sites on LAN, securing sites with TLS (HTTPS), and more.
This guide will show you how to install Valet Linux+ on an Ubuntu system.
- Ubuntu base distro
sudo apt-get install network-manager libnss3-tools jq xsel
Add the PHP PPA and install PHP 8:
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.0-fpm
Install required PHP extensions:
sudo apt install php8.0-cli php8.0-common php8.0-curl php8.0-mbstring php8.0-opcache php8.0-readline php8.0-xml php8.0-zip php8.0-mysql php8.0-gd
Install other PHP version:
sudo apt install php<version>-fpm
Install required PHP extensions:
sudo apt install php<version>-cli and other do the same
Valet Linux+ installs MySQL automatically, but it's better to install it manually:
sudo apt-get -y install mysql-server
sudo mysql
Then, run the following commands in the MySQL shell:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
exit;
Now, you can log in using:
mysql -u root -p
Install Composer using curl
:
sudo apt install curl
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Verify installation:
composer --version
composer global require genesisweb/valet-linux-plus
Add the following to your shell profile (~/.bash_profile
, ~/.bashrc
, or ~/.zshrc
):
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
Reload configuration using :
source ~/.zshrc
Restart your terminal and install Valet:
valet install
This installs Valet Linux+, Nginx, MySQL, Redis, Mailhog, and DnsMasq.
Run:
ping -c1 foobar.test
valet park
valet link
valet links
valet secure
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Reload configuration using :
source ~/.zshrc
Check the installed version, by running:
nvm --version
See list all available node.js versions:
nvm ls-remote
Install latest LTS version of node:
nvm install --lts