Last active
April 5, 2019 09:51
-
-
Save batako/753f5b77fe5759991989b82b07bd9ffe to your computer and use it in GitHub Desktop.
vagrant_scripts
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
#!/usr/bin/env bash | |
POSTGRES_VERSION=9.2 | |
POSTGRES_REPOSITORY=https://download.postgresql.org/pub/repos/yum/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-8.noarch.rpm | |
PG_CONF_PATH=/var/lib/pgsql/$POSTGRES_VERSION/data/pg_hba.conf | |
echo Adding repository for postgresql... | |
sudo yum -y localinstall $POSTGRES_REPOSITORY | |
echo Installing postgresql${POSTGRES_VERSION/./}... | |
sudo yum -y install postgresql${POSTGRES_VERSION/./}-server postgresql${POSTGRES_VERSION/./}-devel postgresql${POSTGRES_VERSION/./}-contrib | |
echo Initializing database... | |
# sudo /usr/pgsql-$POSTGRES_VERSION/bin/postgresql${POSTGRES_VERSION/./}-setup initdb # for CentOS 7 | |
sudo service postgresql-$POSTGRES_VERSION initdb # for CentOS 6 | |
echo Enabling autorun... | |
# sudo systemctl enable postgresql-$POSTGRES_VERSION # for CentOS 7 | |
sudo chkconfig postgresql-$POSTGRES_VERSION on # for CentOS 6 | |
echo Setting up postgresql... | |
if [ -z "`grep 'pgsql-'$POSTGRES_VERSION ~/.bashrc`" ] ; then | |
echo 'export PATH=$PATH:/usr/pgsql-'$POSTGRES_VERSION'/bin' >> ~/.bashrc | |
source ~/.bashrc | |
fi | |
echo Backuping pg_hba.conf and postgresql.conf... | |
PG_HBA_CONF_PATH=/var/lib/pgsql/$POSTGRES_VERSION/data/pg_hba.conf | |
if sudo test ! -e $PG_HBA_CONF_PATH.original; then | |
echo Copying $PG_HBA_CONF_PATH to $PG_HBA_CONF_PATH.original ... | |
sudo cp $PG_HBA_CONF_PATH $PG_HBA_CONF_PATH.original | |
fi | |
POSTGRESQL_PATH=$(dirname $PG_HBA_CONF_PATH)/postgresql.conf | |
if sudo test ! -e $POSTGRESQL_PATH.original; then | |
echo Copying $POSTGRESQL_PATH to $POSTGRESQL_PATH.original ... | |
sudo cp $POSTGRESQL_PATH $POSTGRESQL_PATH.original | |
fi | |
echo Allowing access to database... | |
sudo cp $PG_HBA_CONF_PATH.original $PG_HBA_CONF_PATH | |
sudo grep -l "peer" $PG_HBA_CONF_PATH | xargs sudo sed -i -e 's/peer/trust/g' | |
sudo echo 'host all all 0.0.0.0/0 trust' >> $PG_HBA_CONF_PATH | |
sudo cp $POSTGRESQL_PATH.original $POSTGRESQL_PATH | |
sudo grep -l "listen_addresses" $POSTGRESQL_PATH | xargs sudo sed -i -e "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" | |
echo Starting postgresql... | |
# sudo systemctl start postgresql-$POSTGRES_VERSION # for CentOS 7 | |
sudo service postgresql-$POSTGRES_VERSION start # for CentOS 7 |
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
#!/usr/bin/env bash | |
PG_CONF_PATH=/var/lib/pgsql/9.6/data/pg_hba.conf | |
echo Adding repository for postgresql... | |
sudo yum -y localinstall https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm | |
echo Installing postgresql96... | |
sudo yum -y install postgresql96-server postgresql96-devel postgresql96-contrib | |
echo Initializing database... | |
sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb | |
echo Enabling autorun... | |
sudo systemctl enable postgresql-9.6 | |
echo Setting up postgresql... | |
if [ -z "`grep 'pgsql-9.6' ~/.bashrc`" ] ; then | |
echo 'export PATH=$PATH:/usr/pgsql-9.6/bin' >> ~/.bashrc | |
source ~/.bashrc | |
fi | |
if sudo test ! -e $PG_CONF_PATH.original; then | |
echo Copying $PG_CONF_PATH to $PG_CONF_PATH.original ... | |
sudo cp $PG_CONF_PATH $PG_CONF_PATH.original | |
fi | |
echo Allowing access to database... | |
sudo grep -l "peer" $PG_CONF_PATH | xargs sudo sed -i -e 's/peer/trust/g' | |
echo Starting postgresql... | |
sudo systemctl start postgresql-9.6 |
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
#!/usr/bin/env bash | |
__DIR__=$(cd $(dirname $0); pwd) | |
APP_PATH=${APP_PATH:-$(cd $__DIR__/..; pwd)} | |
BREW_ROOT=${BREW_ROOT:-$HOME/.rbenv} | |
# option | |
echo Installing packages for rails... | |
sudo yum install -y sqlite-devel | |
echo Installing rails... | |
$BREW_ROOT/shims/gem install bundler | |
cd $APP_PATH | |
$BREW_ROOT/shims/bundle install | |
# option | |
echo Setting Up SECRET_KEY_BASE... | |
if [ -z "$(grep 'SECRET_KEY_BASE' ~/.bash_profile)" ] ; then | |
echo 'export SECRET_KEY_BASE=$(cd '$APP_PATH'; bundle exec rake secret)' >> ~/.bash_profile | |
fi |
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
#!/usr/bin/env bash | |
RUBY_VERSION=2.6.2 | |
BREW_ROOT=${BREW_ROOT:-$HOME/.rbenv} | |
echo Installing packages for rbenv... | |
sudo yum install -y git openssl-devel readline-devel zlib-devel gcc gcc-c++ | |
echo Installing rbenv... | |
git clone https://github.com/rbenv/rbenv.git $BREW_ROOT | |
git clone https://github.com/rbenv/ruby-build.git $BREW_ROOT/plugins/ruby-build | |
if [ -z "`grep 'rbenv' ~/.bash_profile`" ] ; then | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile | |
source ~/.bash_profile | |
fi | |
echo Installing ruby $RUBY_VERSION... | |
rbenv install $RUBY_VERSION | |
rbenv global $RUBY_VERSION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment