Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Postman, PhpStorm on Ubuntu Linux (no snaps)
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Run this script without sudo
# bash script_name.sh
INSTALL_TMP_DIR=~/phpstorm-tmp
mkdir -p $INSTALL_TMP_DIR
cd $INSTALL_TMP_DIR
echo "Working directory is: $(pwd)"
echo -e "\e[96m Downloading tar file \e[39m"
sudo apt install -y curl
curl -C - -Lo PhpStorm.tar.gz "https://data.services.jetbrains.com/products/download?code=PS&platform=linux"
echo -e "\e[96m Extracting tar \e[39m"
tar xzf PhpStorm.tar.gz --checkpoint=.1000
echo ""
rm -f PhpStorm.tar.gz
echo -e "\e[96m Backup old version if exists \e[39m"
if [ -d "/opt/PhpStorm" ]; then
sudo rm -rf /opt/PhpStorm.old
sudo mv /opt/PhpStorm /opt/PhpStorm.old
fi
echo -e "\e[96m Copying new version \e[39m"
sudo mv PhpStorm* PhpStorm
sudo mv PhpStorm /opt/
echo -e "\e[96m Creating desktop entry \e[39m"
sudo chmod +x /opt/PhpStorm/bin/phpstorm.sh
rm -f ~/.local/share/applications/jetbrains-phpstorm.desktop
cat > ~/.local/share/applications/jetbrains-phpstorm.desktop <<EOL
[Desktop Entry]
Version=1.0
Type=Application
Name=PhpStorm
Icon=/opt/PhpStorm/bin/phpstorm.svg
#Icon=phpstorm
Exec="/opt/PhpStorm/bin/phpstorm.sh" %f
Comment=Lightning-smart PHP IDE
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-phpstorm
EOL
echo -e "\e[92m Cleanup \e[39m"
cd ~
rm -rf $INSTALL_TMP_DIR
sudo rm -rf /opt/PhpStorm.old
echo -e "\e[92m PhpStorm installed successfully \e[39m"
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Run this script without sudo
# bash script_name.sh
INSTALL_TMP_DIR=~/postman-tmp
mkdir -p $INSTALL_TMP_DIR
cd $INSTALL_TMP_DIR
echo "Working directory is: $(pwd)"
echo -e "\e[96m Downloading tar file \e[39m"
sudo apt install -y curl
curl -C - -Lo Postman.tar.gz https://dl.pstmn.io/download/latest/linux
echo -e "\e[96m Extracting tar \e[39m"
tar xzf Postman.tar.gz --checkpoint=.1000
echo -e "\e[96m Backup old version if exists \e[39m"
if [ -d "/opt/Postman" ]; then
sudo rm -rf /opt/Postman.old
sudo mv /opt/Postman /opt/Postman.old
fi
echo -e "\e[96m Copying new version \e[39m"
sudo mkdir -p /opt/Postman
sudo mv Postman /opt/
echo -e "\e[96m Creating desktop entry \e[39m"
sudo chmod +x /opt/Postman/Postman
rm -f ~/.local/share/applications/postman.desktop
cat > ~/.local/share/applications/postman.desktop << EOL
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=/opt/Postman/Postman
Icon=/opt/Postman/app/resources/app/assets/icon.png
#Icon=postman
Terminal=false
Type=Application
Categories=Development;
Comment=Postman REST API Development
EOL
echo -e "\e[96m Cleanup \e[39m"
cd ~
rm -rf $INSTALL_TMP_DIR
sudo rm -rf /opt/Postman.old
echo -e "\e[92m Postman installed successfully \e[39m"
@ankurk91
Copy link
Author

ankurk91 commented Feb 5, 2021

You can use these commands like:

# postman
curl -o- https://gist.githubusercontent.com/ankurk91/7688d80d3d3071473c6fd8d4b1a20f5e/raw/postman-install.sh | bash

# php-storm
curl -o- https://gist.githubusercontent.com/ankurk91/7688d80d3d3071473c6fd8d4b1a20f5e/raw/phpstorm-install.sh | bash

Useful links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment