Skip to content

Instantly share code, notes, and snippets.

@leemour
Last active May 4, 2024 12:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leemour/692e36c57dbfd4ee7b0489c9ed58d29d to your computer and use it in GitHub Desktop.
Save leemour/692e36c57dbfd4ee7b0489c9ed58d29d to your computer and use it in GitHub Desktop.
Ubuntu setup for Ruby on Rails
# Git
sudo apt-get install git
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.new checkout -b
git config --global alias.lg log --oneline -25
git config --global core.editor subl
git config --global user.name leemour
git config --global user.email leemour@gmail.com
# 1. Flat theme, flat icons
# Best theme - http://www.techwall.org/how-to-install-adapta-gtk-theme-on-ubuntu-18-04/
# 2nd best - https://github.com/vinceliuice/vimix-gtk-themes
# Icons - https://snwh.org/paper
# Use gnome-tweak-tools to set them
# Ubu < 18.04
# https://github.com/anmoljagetia/Flatabulous
sudo add-apt-repository ppa:noobslab/themes
sudo add-apt-repository ppa:noobslab/icons
sudo apt-get update
sudo apt-get install flatabulous-theme
sudo apt-get install ultra-flat-icons
# Use unity-tweak-tool or Ubuntu-tweak-tool to select theme & icons
# Install Oh-My-ZSH
sudo apt-get install zsh
chsh -s /bin/zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# Add oh-my-zsh server config (from ZSH gist)
nano ~/.zshrc
# Add theme (from ZSH gist)
nano ~/.oh-my-zsh/themes/leemour.zsh-theme
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
sudo apt install autojump
# Install NodeJS via NVM
sudo apt-get install build-essential libssl-dev curl
# Check NVM latest version
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash
source ~/.profile
nvm ls-remote
nvm install 6.5.0
nvm alias default 6.5.0
# Install ImageMagick
sudo apt-get install imagemagick
# Install jpegoptim, optipng for Carrierwave::ImageOptimizer
sudo apt-get install jpegoptim
sudo apt-get install optipng
# Setup timezone
sudo timedatectl set-timezone Europe\/Moscow
# Install Postgres 15
# Create the file repository configuration
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
# Update list of available packages
sudo apt update
sudo apt install postgresql-15 postgresql-client-15 -y
sudo apt-get install postgresql-contrib libpq-dev
sudo su postgres
# create user with DB
createuser -S -d -R -e -l -P advert # Enter password in prompt
createdb -O advert advert
# Change local all all peer to md5
nano /etc/postgresql/9.5/main/pg_hba.conf
sudo service postgresql restart
# Remove old Postgres if required
sudo apt-get --purge remove postgresql-9.4 postgresql-client-9.4
# Check apt --installed list | grep postgres
sudo update-rc.d postgresql enable
# Sublime
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text
# Copy /home/leemour/.config/sublime-text-3/Local/Session.sublime_session
# Copy /home/leemour/.config/sublime-text-3/Projects
# Copy
# Sqlite
sudo apt-get install sqlite3 libsqlite3-dev
# Nginx
sudo apt-get install nginx nginx-extras
# Hide technology headers
# nano shared/config/nginx_production.conf
# server_tokens off;
# more_set_headers 'Server: anon';
# more_set_headers 'X-Runtime';
# Redis
sudo apt-get install tcl
sudo apt-get install redis-server
# Install Ruby via Rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
# Install dependencies
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn
# sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
cd ~/.rbenv && src/configure && make -C src
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
# For old Rubies < 2.4 need openssl 1.0 not 1.1 so
sudo apt install libssl1.0-dev
# Install Ruby 2.4.1
rbenv install -l
rbenv install 2.4.1
rbenv rehash
rbenv global 2.4.1
gem install bundler
(echo install: --no-document && echo update: --no-document) >> ~/.gemrc
# IRB
nano ~/.irbrc
# require 'irb/ext/save-history'
# #History configuration
# IRB.conf[:SAVE_HISTORY] = 5000
# IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
# PhantomJS for poltergeist (https://gist.github.com/julionc/7476620)
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
phantomjs --version
# IPTables
sudo iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-port 3000
# Save iptables to file
sudo bash -c "iptables-save -c > /etc/iptablesrc"
sudo nano /etc/rc.local
# Apply iptablesrc on system boot:
# /sbin/iptables-restore < /etc/iptablesrc
# Skype
# sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
# sudo dpkg --add-architecture i386
# sudo apt-get update
# sudo apt-get install skype
# mkdir -p ~/.config/autostart/
# cp /usr/share/applications/skype.desktop ~/.config/autostart/
# sudo apt install pulseaudio
# sudo apt install pavucontrol
#
# http://www.linuxrussia.com/skype-ubuntu.html
wget -q -O - https://repo.skype.com/data/SKYPE-GPG-KEY | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://repo.skype.com/deb stable main" > /etc/apt/sources.list.d/skype-stable.list'
sudo apt-get update && sudo apt-get install skypeforlinux -y
# Google Chrome
# https://www.linuxbabe.com/ubuntu/install-google-chrome-ubuntu-16-04-lts
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt update
sudo apt install google-chrome-stable
# Pinta
sudo add-apt-repository ppa:pinta-maintainers/pinta-stable
sudo apt-get update
sudo apt-get install pinta
# Slack
# Get from https://slack.com/downloads/linux
# Postman
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
rm postman.tar.gz
sudo ln -s /opt/Postman/Postman /usr/bin/postman
## Add icon
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
EOL
# mitmproxy
sudo apt install python3-pip
pip3 install mitmproxy
gem: --no-rdoc --no-ri
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
require 'irb/ext/save-history'
#History configuration
IRB.conf[:SAVE_HISTORY] = 5000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
#-m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
# https://packagecontrol.io/docs/syncing
сp Sublime/Packages/User
cp /srv/www/
cp /etc/hosts
cp ~/.gemrc ~/.gitconfig ~/.irbrc
cp ~/.fonts
# Dump databases
pg_dump bookinza_dev -U bookinza > "/home/leemour/Backup/bookinza_dev/db-$(date +%Y-%m-%d).sql"
mysqldump -u snsmarket -p snsmarket > "/home/leemour/Backup/snsmarket/db-$(date +%Y-%m-%d).sql"
# https://linuxconfig.org/how-to-install-docker-on-ubuntu-18-04-bionic-beaver
# get edge for Ubuntu 18 now
# https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user
# https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-18-04-bionic-beaver-linux
ubuntu-drivers devices
# Get Video card name from list
sudo ubuntu-drivers autoinstall
# or sudo apt install <nvidia-340>
# Diable hp_accepl HP accelerometer
# https://askubuntu.com/questions/585706/deactivate-accelerometer
gsettings set org.gnome.settings-daemon.peripherals.touchscreen orientation-lock true
# Additionally, the below command ought to disable the orientation plugin completely.
gsettings set org.gnome.settings-daemon.plugins.orientation active false
  1. Bitwarden
  2. Chrome
  3. Brave
  4. VSCode
  5. TickTick
  6. Notion
  7. Postman
  8. Telegram
  9. Zip
  10. Zoom
  11. Slack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment