Skip to content

Instantly share code, notes, and snippets.

@danwhitston
Last active May 7, 2022 13:34
Show Gist options
  • Save danwhitston/b3b5b9efb6b11fd5bceb93a9ca625b0d to your computer and use it in GitHub Desktop.
Save danwhitston/b3b5b9efb6b11fd5bceb93a9ca625b0d to your computer and use it in GitHub Desktop.
Setting up my WSL environment - includes git & key, rbenv, rbenv ruby-build, attis, imagemagick, ruby, bundler, mysql, mongodb, redis
#!/bin/bash
sudo apt-get update
sudo apt-get upgrade
ln -s "/mnt/c/Users/Daniel/Documents/homeflow" ~/homeflow
ln -s "/mnt/c/Users/Daniel/Documents" ~/documents
mkdir .ssh
cp documents/id* .ssh/
sudo chmod 600 .ssh/*
cd homeflow/attis
git pull
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
~/.rbenv/bin/rbenv init
nano .bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
sudo apt-get install libreadline-dev
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 python-software-properties libffi-dev
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 libffi-dev
rbenv install
gem install bundler
git config --global color.ui true
git config --global user.name "Daniel Whitston"
git config --global user.email "[email protected]"
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
sudo service mysql start
## Maaaybe sudo nano /etc/tmpfiles.d/mysql.conf and enter d /var/run/mysqld 0755 mysql mysql -
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
cd homeflow/attis
bundle
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
cd ~
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install mongodb
sudo apt-get install -y mongodb-org
sudo service mongodb start
mongod -v
sudo apt-get install redis-server
sudo nano /etc/redis/redis.conf
## change the IP address to bind 0.0.0.0
sudo service redis-server restart
mysql -u root -p
## GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
## \q
cd homeflow/attis
bundle exec rake db:create RAILS_ENV=test
bundle exec rake db:reset RAILS_ENV=test
bundle exec rake db:migrate:status RAILS_ENV=test
bundle exec rspec
## Set up a new shell, e.g. ConEmu https://conemu.github.io/ and select bash:bash as the shell connection
## Set up NPM / node, maybe needed for Rails 5?