-
-
Save jourdein/879ba79ca62d58a70ea562cd0ffc585a to your computer and use it in GitHub Desktop.
SETUP STEPS for Ubuntu Desktop with various apps and settings, Ruby, Rails, PostgreSQL, and others
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#******************************************************************** | |
# Ubuntu Setup Steps for initial install PLUS | |
# Ruby on Rails setup using PostreSQL | |
# | |
# by: Jay Elbourne | |
# date: March 2016 | |
# Ubuntu 15.10 (32 bit [because of VirtualBox]) | |
# Ruby 2.2.3 | |
# Rails 4.2.4 | |
# PostreSQL 9.5 | |
# | |
### Links | |
# https://www.virtualbox.org/wiki/Downloads | |
# http://www.ubuntu.com/desktop | |
# | |
### Sections | |
# 1. Apt-get Updates | |
# 2. Apt-get upgrades | |
# 3. Apt-get major upgrades | |
# 4. Install Essentials | |
# 5. Setup sharefolder permissions | |
# 6. ADD to EXISTING .bashrc | |
# 7. Setup .bash_aliases | |
# 8. Turn off Ubuntu Animations | |
# 9. Change some Ubuntu Settings | |
# 10.Clean up | |
# 11.Installing rbenv and Ruby 2.2.3 | |
# 12.Install Rails 4.2.4 | |
# 13.Install PostgreSQL 9.5 | |
# 14.Install RMagick | |
# | |
#******************************************************************** | |
cd ~ && | |
#################### | |
## Check for Updates | |
#################### | |
sudo apt-get update | |
#################### | |
## Upgrade Packages | |
################### | |
sudo apt-get upgrade | |
################### | |
## Major Upgrades | |
################### | |
sudo apt-get dist-upgrade | |
############################## | |
## Install Essentials | |
############################## | |
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 | |
sudo apt-get install libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev | |
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev | |
sudo apt-get install vim | |
sudo apt-get install git | |
sudo apt-get install unity-tweak-tool | |
sudo apt-get install compizconfig-settings-manager | |
# if using VirtualBox | |
sudo apt-get install virtualbox-guest-dkms | |
############################## | |
## Setup sharefolder permissions | |
############################## | |
# We want to store our actual code files on the Main OS not Ubuntu so we will use shared folders. | |
# We need permissions set for our Ubuntu User for vboxsf (Virtual Box Shared Folders) | |
sudo usermod -a -G vboxsf jay | |
############################## | |
## ADD to EXISTING .bashrc | |
############################## | |
vim ~/.bashrc | |
#Add git branch if its present to PS1 | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
PS1='[\W$(parse_git_branch)]\[\033[00m\]\$ ' | |
source ~/.bashrc | |
############################## | |
## Setup .bash_aliases | |
############################## | |
vim ~/.bash_aliases | |
alias c='clear' | |
alias vi='vim' | |
alias cd..='cd ..' | |
alias localopen='xdg-open http://localhost:3000' | |
alias rake='bundle exec rake' | |
# do not delete / or prompt if deleting more than 3 files at a time # | |
alias rm='rm -I --preserve-root' | |
# confirmation # | |
alias mv='mv -i' | |
alias cp='cp -i' | |
alias ln='ln -i' | |
# Parenting changing perms on / # | |
alias chown='chown --preserve-root' | |
alias chmod='chmod --preserve-root' | |
alias chgrp='chgrp --preserve-root' | |
source ~/.bash-aliases | |
############################## | |
## Turn off Ubuntu Animations | |
############################## | |
# Because we are running on VitualBox things can get slow when animating the OS. Let's turn the animations off | |
sudo apt-get install unity-tweak-tool | |
unity-tweak-tool & | |
#Click on general and turn desktop magnification to off, set texture quality to fast, set window animations to off. | |
#Then click on overview and then click on launcher. | |
#Turn autohide to off, set Urgent animation and launch animation to No animation, set icon backgrounds to no coloring. | |
#Click on the search tab and set background blur to off | |
sudo apt-get install compizconfig-settings-manager | |
ccsm & | |
#In the effects category, untick all of the boxes. | |
#In the accessibility tab, untick all of the boxes. | |
######################################### | |
## Change some Ubuntu Settings | |
######################################### | |
# Displaying Hidden Startup Applications | |
sudo sed -i "s/NoDisplay=true/NoDisplay=false/g" /etc/xdg/autostart/*.desktop | |
# Make the scrollbar showup properly | |
gsettings set com.canonical.desktop.interface scrollbar-mode normal | |
# Put username back on top panel | |
gsettings set com.canonical.indicator.session show-real-name-on-panel true | |
######################## | |
## Cleaning Up | |
######################## | |
sudo apt-get -f install | |
sudo apt-get autoremove | |
sudo apt-get -y autoclean | |
sudo apt-get -y clean | |
############################## | |
## Adding Our Shared Folders | |
############################## | |
# Use VirtualBox seetings to select ShareFolder | |
############################## | |
## Change Backgrounds | |
############################## | |
# Change your Ubuntu appearance settings. | |
################################## | |
## Installing rbenv and Ruby 2.2.3 | |
################################## | |
cd ~ | |
git clone https://github.com/rbenv/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
exec $SHELL | |
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | |
exec $SHELL | |
git clone https://github.com/rbenv/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash | |
# This will take a long while | |
rbenv install 2.2.3 | |
rbenv global 2.2.3 | |
ruby -v | |
############################## | |
## Tell Rubygems not to install the documentation for each package locally | |
############################## | |
echo "gem: --no-ri --no-rdoc" > ~/.gemrc | |
############################## | |
## Install Bundler | |
############################## | |
gem install bundler | |
rbenv rehash | |
############################## | |
## Install NodeJS, Javascript runtime | |
############################## | |
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
############################## | |
## Configure Git | |
############################## | |
git config --global color.ui true | |
git config --global user.name "Jay Elbourne" | |
git config --global user.email "[email protected]" | |
ssh-keygen -t rsa -C "[email protected]" | |
cat ~/.ssh/id_rsa.pub | |
## You want to copy and paste the output of the following command and paste it here https://github.com/settings/ssh | |
ssh -T [email protected] | |
## Hi <yourname>! You've successfully authenticated, but GitHub does not provide shell access. | |
#################### | |
## Install Rails 4.2.4 | |
#################### | |
# This will take a long while | |
gem install rails -v 4.2.4 | |
################################### | |
## Make Rails executable everywhere | |
################################### | |
rbenv rehash | |
####################### | |
## Check Rails version | |
###################### | |
rails -v | |
####################### | |
## Install PostgreSQL 9.5 | |
###################### | |
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list" | |
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install postgresql-common | |
sudo apt-get install postgresql-9.5 libpq-dev | |
## Start the server | |
sudo /etc/init.d/postgresql start | |
## The postgres installation doesn't setup a user for you, so you'll need to follow these steps to create a user with permission to create databases. | |
## Feel free to replace jay with your Ubuntu username | |
## The lower -s mean the new user will be a superuser. This is very important for our rails development. | |
sudo -u postgres createuser jay -s | |
####################### | |
## Install RMagick | |
###################### | |
gem install rmagick | |
## "*************** SETUP COMPLETE! (FOR NOW) *********************" | |
## "*************** TEST THAT IT WORKED *********************" | |
####################### | |
## Change into Development Directory | |
###################### | |
# Change the directory name below to match your own computer | |
cd /media/sf_Development | |
####################### | |
## Create a new Rails App | |
###################### | |
rails new myapp -d postgresql | |
####################### | |
## Change into App Directory | |
###################### | |
cd myapp | |
####################### | |
## Edit Database configuration | |
###################### | |
vi config/database.yml | |
####################### | |
## Create the database | |
###################### | |
rake db:create | |
####################### | |
## Check if it works | |
###################### | |
rails server | |
## CTRL + 't' will open a new tab | |
localopen | |
# This will open the browser on localhost:3000 | |
## "*************** COMPLETE *********************" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment