Source: https://docs.microsoft.com/en-us/windows/wsl/install-win10
- Elevated PowerShell:
wsl --install
- Reboot computer when prompted.
- Setup will continue automatically and install Ubuntu.
- Setup a user and password for Ubuntu when prompted.
- Install Microsoft Terminal, configure fonts and theme.
- Install Visual Studio Code, configure settings, keybinds, theme, and extensions.
sudo apt update
sudo apt upgrade
Source: https://ohmyz.sh/#install
sudo apt install zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sudo apt install xdg-utils unixodbc-dev zip unzip software-properties-common
sudo apt install php php-dev php-pear php-curl php-bcmath php-mbstring php-gd php-xml php-zip php-intl php-sqlite3 php-mysql php-redis php-ldap
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt upgrade
The below script will install PHP 8.1, repeat for all the versions you wish to install.
sudo apt install php8.1 php8.1-dev php8.1-curl php8.1-bcmath php8.1-dom php8.1-mbstring php8.1-gd php8.1-xml php8.1-zip php8.1-intl php8.1-sqlite3 php8.1-mysql php8.1-redis php8.1-ldap
You can check your active PHP version with php -v
.
To change PHP version:
sudo update-alternatives --config php
Source: https://getcomposer.org/download/
Get latest script from above if following is outdated.
php -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.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
sudo composer self-update
composer -V
Source: https://github.com/nodesource/distributions
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt update
sudo apt install nodejs
node -v
npm -v
Source: https://classic.yarnpkg.com/lang/en/docs/install/#debian-stable
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
yarn -v
Source: https://spatie.be/docs/laravel-medialibrary/v9/installation-setup
sudo apt install jpegoptim optipng pngquant gifsicle
sudo npm install -g svgo
Source: https://github.com/spatie/browsershot
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev libxshmfence-dev
sudo npm install --global --unsafe-perm puppeteer
sudo chmod -R o+rx /usr/lib/node_modules/puppeteer/.local-chromium
sudo apt install sqlite3
sudo apt install mysql-server
sudo usermod -d /var/lib/mysql mysql
sudo service mysql start
sudo mysql -u root -p
Hit enter at password prompt with blank password.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'secret';
FLUSH PRIVILEGES;
quit
sudo mysql_secure_installation
- Validate Password Component? No
- Change root password? No
- Remove anonymous users? Yes
- Disallow root login remotely? Yes
- Remove test database and access to it? Yes
- Reload privilege tables now? Yes
Source:
- https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver15
- https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15
- https://www.microsoft.com/en-us/sql-server/developer-get-started/php/ubuntu
Change PHP version from 8.0 to whatever you have installed (php -v) in following script.
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
apt update
apt install msodbcsql17
pecl install sqlsrv
pecl install pdo_sqlsrv
printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/8.1/mods-available/sqlsrv.ini
printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/8.1/mods-available/pdo_sqlsrv.ini
phpenmod -v 8.1 sqlsrv pdo_sqlsrv
php -m | grep sql
Exit root prompt (ctrl+d).
sudo apt install redis-server
sudo service redis-server start
sudo apt install keychain
Make sure to add id_rsa
and id_rsa.pub
files to ~/.ssh/
sudo chmod -R a-rwx ~/.ssh
sudo chmod -R u+rwX ~/.ssh
vi .zshrc
Add Composer bin path to $PATH
variable. Edit the second line in the .zshrc
file:
export PATH=$HOME/bin:/usr/local/bin:$HOME/.config/composer/vendor/bin:$PATH
Add keychain to end of .zshrc
file:
# Keychain
/usr/bin/keychain --quiet $HOME/.ssh/id_rsa
source $HOME/.keychain/$HOSTNAME-sh
Note: if $HOSTNAME
is not set, manually type the hostname-sh
found in ~/.keychain/ that ends with "-sh"
:
Example:
# Keychain
/usr/bin/keychain --quiet $HOME/.ssh/id_rsa
source $HOME/.keychain/ryan-gaming-sh
composer global require laravel/installer
composer global require beyondcode/expose
Add .aliases
file to home and source in .zshrc
config
~/.zshrc
# Aliases
source $HOME/.aliases
sudo apt install silversearcher-ag
git config --global user.name "John Doe"
git config --global user.email [email protected]
After every reboot, you'll have to manually start up MySQL and Redis services.
sudo service mysql start
sudo service redis-server start
I use Laravel primarily so I use php artisan serve
as a web server. In cases where I'm not using Laravel I use php -S 127.0.0.1:8000