Skip to content

Instantly share code, notes, and snippets.

@doxt3r
Forked from almirb/Install_Phpstorm.sh
Last active June 1, 2022 14:39
Show Gist options
  • Save doxt3r/f474912f0aea57b821c23f35df66bb65 to your computer and use it in GitHub Desktop.
Save doxt3r/f474912f0aea57b821c23f35df66bb65 to your computer and use it in GitHub Desktop.
Install/Update phpstorm on Debian/Ubuntu-based linux.
#!/bin/bash -e
# Original credits to theodorosploumis
# IMPORTANT. My phpstom installation exists on /opt/.
if [ "$(whoami)" != "root" ]
then
echo "Sorry, you are not root."
exit 1
fi
# Remove old Phpstorm
# old installation may use Phpstorm-* as folder, it is better to use find to locate folder.
echo "Removing old PhpStorm"
find /opt/ -maxdepth 1 -iname "phpstorm" -exec rm -rf {} \;
# Download file from url
echo "Downloading PhpStorm to /tmp"
wget -O /tmp/phpstorm.tar.gz "https://data.services.jetbrains.com/products/download?code=PS&platform=linux" --no-check-certificate
# Unpacking file
tar -xzf /tmp/phpstorm.tar.gz -C /tmp
rm /tmp/phpstorm.tar.gz
# Copy new Phpstorm
echo "Copying new PhpStorm"
mv /tmp/PhpStorm* /opt/phpstorm
#fix permissions for phpstorm minor auto-updates
chown $USER:$USER -R /opt/phpstorm
#(re) create desktop shotcut
echo "(Re) create desktop shotcut"
FILE="/home/$(logname)/.local/share/applications/jetbrains-phpstorm.desktop"
cat > $FILE <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=PhpStorm
Icon=/opt/phpstorm/bin/phpstorm.png
Exec="/opt/phpstorm/bin/phpstorm.sh" %f
Comment=The Drive to Develop
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-phpstorm
EOF
# Finish
echo "New PhpStorm has been installed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment