Skip to content

Instantly share code, notes, and snippets.

@richardjortega
Last active August 29, 2015 13:59
Show Gist options
  • Save richardjortega/10485982 to your computer and use it in GitHub Desktop.
Save richardjortega/10485982 to your computer and use it in GitHub Desktop.
EcoD Notes and Environment Setup

Set your name and email for your commit messages

$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

Exclude git tracking UNIX file permissions: Unix file permissions modes (755=rwxrw_rw_, 644=rw_r__r__) - the old mode included the +x (executable) flag, the new mode doesn't. http://code.google.com/p/msysgit/issues/detail?id=164

$ git config core.filemode false

Make Git pretty for git diff and git status

$ git config --global color.ui true

Set your favorite editor

$ git config --global core.editor vim

Show your git global settings

$ git config -l

Passenger info

Old Passenger config running at /opt/apache_2.4.3/httpd.conf

### Passenger Configuration ###
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.24/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.24
PassengerDefaultRuby /usr/local/bin/ruby

Note comment out above if using development environment and use Passenger Standalone in production via passenger start or rails s RAIL_ENV=production

After installing Ruby 2.1 (or higher), you'll need to rerun passenger-install-apache2-module and follow prompts ensuring that you're using the correct setup Apache install at /opt/apache_2.4.3

$ su root
$ passenger-install-apache2-module --apxs2-path "/opt/apache_2.4.3/bin/apxs"

Restart Apache 2 web server with: $ sudo /etc/init.d/apache2 restart

Apache 2 gotchas (when copying VMs)

Apache will restrict to user/group based on httpd.conf

# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User your_username
Group your_usernameorgroup

Example for Virtual Hosts setting in httpd.conf

<VirtualHost *:80>
    ServerName 172.24.40.211
    # !!! Be sure to point DocumentRoot to 'public'!
    DocumentRoot /home/richardjortega/Code/EcoD/public
    <Directory '/home/richardjortega/Code/EcoD/public' >
        # This relaxes Apache security settings.
        AllowOverride None
        # MultiViews must be turned off.
        Require all granted
    </Directory>
</VirtualHost>

Modify ServerName if necessary.

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
ServerName 172.24.40.211:80 

CentOS 6 security updated

Update OpenSSL to fix heartbleed bug

Make sure your version of via rpm -q openssl

Version should be equal or higher than 1.0.1e-16.el6_5.7

Upgrade with: sudo yum install openssl

Install Sublime Text 3 (CentOS)

Download it, extract it, move it, symlink it

http://www.sublimetext.com/3

Download 32 or 64-bit version

Extract sublime_text_3 folder to ~/Downloads

$ cd ~/Downloads
$ sudo mv sublime_text_3 /opt/
$ sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime

Install Package Control

Get these packages:

  • ERB toggle thingy
  • GitGutter
  • CoffeeScript
  • Git
  • SidebarEnhancements

Upgrading Ruby 1.9 to Ruby 2.1.1 and Rails 3.2 to Rails 4.1 (CentOS 6.4)

Note: this is for setting up system Ruby and system Ruby gems, instead of using RVM

Update yum packages

$ su root
$ yum update -y # update your package manager

Install FTP pkg

# Get FTP package from yum
$ yum install ftp

Install libyaml 0.1.5 from source

$ su root # Switch to root user
# Patches libyaml/Psych vulnerability that can cause HEAP overflow
$ cd tmp/
$ wget http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
$ tar -xzvf yaml-0.1.5.tar.gz
$ cd yaml-0.1.5/
$ ./configure --prefix=/usr/local
$ make
$ make install
$ ldconfig
# Clean up and delete gz file and folder

Download latest Ruby

$ cd /tmp
$ ftp ftp.ruby-lang.org # yum install ftp -- if you dont have it
# Login as 'Anonymous', no password
$ cd /pub/ruby/stable 
# Use 'ls' command to check for latest stable Ruby version
$ get ruby-2.1.1.tar.gz
$ bye # disconnect

Install Ruby from source

$ tar -xzvf ruby-2.1.1.tar.gz
$ cd ruby-2.1.1
$ ./configure --with-yaml-dir=/usr/local/lib/ # --prefix=/usr/local --enable-shared --with-opt-dir=/usr/local/lib
$ sudo make && sudo make install
# Clean up and delete gz file and folder

Ensure Psych vulnerability with libyaml is fixed in Ruby

# Check for libyaml version 0.1.5 or greater
$ ruby -rpsych -e 'p Psych.libyaml_version'

Get gems back up to speed

$ gem install rails 
# Switch back to 'webby'
$ su - webby
# Navigate back to main project directory
$ cd ~/EcoD/EcoDemonstratorPrototype/
$ bundle install # provide password

Rails gems not playing nicely

  • dj_mon has been removed and replaced with delayed_job_web

Restart Passenger

$ touch tmp/restart.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment