Skip to content

Instantly share code, notes, and snippets.

@sayak-sarkar
Last active July 14, 2022 09:18
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save sayak-sarkar/11b039f398ddcae88139 to your computer and use it in GitHub Desktop.
Save sayak-sarkar/11b039f398ddcae88139 to your computer and use it in GitHub Desktop.
Gist to install Sublime Text 3 on RHEL 6 +
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
Exec=/opt/sublime_text_3/sublime_text
Icon=/opt/sublime_text_3/Icon/128x128/sublime-text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
SCRIPT="#!/bin/sh
if [[ \${1} == \"--help\" ]]; then
/opt/sublime_text_3/sublime_text --help
else
/opt/sublime_text_3/sublime_text \$@ > /dev/null 2>&1 &
fi"
echo "Downloading Sublime Text 3..."
curl -L "https://download.sublimetext.com/sublime_text_3_build_3143_x64.tar.bz2" -o "/usr/src/Sublime Text 3.tar.bz2"
echo "Installing Sublime Text 3..."
echo -ne '##### (33%)\r'
cd /usr/src
tar -xvjf "Sublime Text 3.tar.bz2"
echo -ne '############# (66%)\r'
cd "sublime_text_3"
mv -fv "/usr/src/sublime_text_3" "/opt/sublime_text_3"
echo "${SCRIPT}" > "/usr/local/bin/subl"
chmod +x "/usr/local/bin/subl"
echo "${SHORTCUT}" > "/usr/share/applications/sublime-text-3.desktop"
ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime3
echo -ne '####################### (100%)\r'
# Package Control - The Sublime Text Package Manager: https://sublime.wbond.net
echo "Installing Package Control..."
wget --no-check-certificate https://sublime.wbond.net/Package%20Control.sublime-package
sudo mv Package\ Control.sublime-package "/opt/sublime_text_3/Packages/"
cd .config/sublime-text-3/Installed\ Packages/
wget https://packagecontrol.io/Package%20Control.sublime-package
echo "Finish!"
@ThePhoenixBird
Copy link

hi there, just a couple fixes for Fedora 21

first there are a couple problems with the script:

line21

cd "Sublime Text 3"

When you decompress the tar.bz2 file it contains a sublime_text_3 folder, no this line results in "not found"

line23

mv -fv * "/opt/sublime-text-3/"

That will move all the content of /usr/src to /opt/sublime-text-3/ (and its a pain, if you have stuff there)
You can easily merge lines 22 and 23 into

mv -fv "/usr/src/sublime_text_3" "/opt/sublime_text_3"

take into account no trailing / at the end because you would move sublime_text_3 into another sublime_text_3 folder creating /opt/sublime_text_3/sublime_text_3

with that fixed now only line12 needs a fix

if [[ \${1} == \"--help\" ]]; then

and thats it 😄

@josemalcher
Copy link

Great!
There was another new update : Build 3083
I believe it to change the file to be downloaded as well.

@dolftax
Copy link

dolftax commented Apr 30, 2015

@sayak-sarkar
Copy link
Author

Fixed the Tarball link and updated the gist to the latest 3103 build along with all of @ThePhoenixBird's fixes! 😄

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