Skip to content

Instantly share code, notes, and snippets.

@fabianofa
Last active August 25, 2019 03:10
Show Gist options
  • Save fabianofa/ee15e7f00c285351f358e813b6f9deb0 to your computer and use it in GitHub Desktop.
Save fabianofa/ee15e7f00c285351f358e813b6f9deb0 to your computer and use it in GitHub Desktop.
Ubuntu web-dev setup
echo "Adding apt-repositories, update apt libraries and installing apt-fast.\n"
add-apt-repository -y ppa:apt-fast/stable && add-apt-repository -y ppa:ondrej/php && add-apt-repository -y ppa:serge-rider/dbeaver-ce && apt update && apt -y install apt-fast apt-transport-https wget apt-transport-https ca-certificates curl gnupg-agent software-properties-common net-tools
echo "\nUpdating Packages\n"
apt-fast upgrade -y
echo "\nInstalling Apache2, PHP, Memcached, Git, Dbeaver, Python 3\n"
apt-fast install -y apache2 php7.3 php7.3-cli php7.3-xml php7.3-curl php7.3-gd php7.3-zip php7.3-mbstring php7.3-common php7.3-dev php7.3-pgsql php-memcached memcached git dbeaver-ce python3
echo "\nInstalling Composer\n"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --install-dir=/usr/bin/ --filename=composer
php -r "unlink('composer-setup.php');"
echo "\nDownloading and installing CopyQ\n"
wget https://github.com/hluk/CopyQ/releases/download/v3.9.1/copyq_3.9.1_Debian_9.0-1_amd64.deb
apt install -y ./copyq_3.9.1_Debian_9.0-1_amd64.deb
sed -i 's/autostart=false/autostart=true/' ~/.config/copyq/copyq.conf
echo "\nConfiguring PgUp & PgDown as history navigation\n"
sed -i 's/# \"\\e\[5~\": history-search-backward/\"\\e\[5~\": history-search-backward/' /etc/inputrc
set -i 's/# \"\\e\[6~\": history-search-backward/\"\\e\[6~\": history-search-backward/' /etc/inputrc
echo "\nInstalling Sublime Text 3 and Sublime Merge\n"
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
apt-fast update
apt-fast install -y sublime-text sublime-merge
echo "\nInstalling Postgres 10 Client"
echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-fast update
apt-fast install -y postgresql-client-10
echo "\nInstalling Docker and Docker Compose\n"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository -y \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-fast update
apt-fast install -y docker-ce docker-ce-cli containerd.io
curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
echo "\nAdding branch name to terminal"
php -r "\$homeDir = getenv('HOME'); \$f = fopen(\$homeDir . '/.bashrc', 'r'); \$addFunction = true; \$fileContent = ''; while (\$line = fgets(\$f)) {if (trim(\$line) == 'PS1=\'\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\\$ \'') {\$line = ' PS1=\'\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]\$(parse_git_branch)\[\033[00m\]\\$ \'' . PHP_EOL; } \$fileContent .= \$line; if (trim(\$line) == 'parse_git_branch() {') {\$addFunction = false; } } if (\$addFunction) {\$fileContent .= PHP_EOL . 'parse_git_branch() {' . PHP_EOL; \$fileContent .= ' git branch 2> /dev/null | sed -e \'/^[^*]/d\' -e \'s/* \(.*\)/ (\\1) /\'' . PHP_EOL; \$fileContent .= '}' . PHP_EOL; } fclose(\$f); rename(\$homeDir . '/.bashrc', \$homeDir . '/.bashrc.bk-' . time()); file_put_contents(\$homeDir . '/.bashrc', \$fileContent);"
php -r "\$homedir = getenv('HOME'); \$f = json_decode(file_get_contents(\$homedir)); \$f['ignored_packages'] = ['Vintage']; \$f['word_wrap'] = false; \$f['fade_fold_buttons'] = false; \$f['bold_folder_labels'] = true; \$f['rulers'] = [70, 120]; rename(\$homedir . '/.config/sublime-text-3/Packages/User/Preferences.sublime-settings', \$homedir . '/.config/sublime-text-3/Packages/User/Preferences.sublime-settings.' . time()); file_put_contents(\$homedir . '/.config/sublime-text-3/Packages/User/Preferences.sublime-settings', json_encode(\$f));"
echo "\nYou have CopyQ installed. You may want to add 'copyq toggle' as a key shortcut in Ubuntu\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment