Last active
December 20, 2021 17:31
-
-
Save MohamedBasaleh/41e36b25b3e935f3311563a62ea5973f to your computer and use it in GitHub Desktop.
Setup Ngnix + MySQL + Postgres + Redis + RVM + Ruby Version + Ruby On Rails + SSH + Git + Cola + Oh-My-Zsh
This file contains 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
# Step 1 — Installing Nginx | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo apt install nodejs | |
sudo apt-get install curl git-core nginx -y | |
# Step 2 — Installing Databases | |
# before install , update apt-get | |
$ sudo apt-get update | |
# choose one or both, | |
# In MYSQL: | |
$ sudo apt-get install mysql-server mysql-client libmysqlclient-dev | |
# In PostgreSQL | |
$ sudo apt-get install postgresql postgresql-contrib libpq-dev | |
# If you want create new super admin in postgres | |
# 1 - create user | |
$ sudo -u postgres createuser <username> | |
# 2 - alter user password | |
$ sudo -u postgres psql | |
psql=# alter user <username> with encrypted password '<password>'; | |
# 3 - modify permissions | |
psql=# ALTER USER <username> WITH SUPERUSER; | |
# Step 3 — Installing Redis | |
# if you ues ubuntu 16.04 run this commend | |
cd ~ | |
wget http://download.redis.io/releases/redis-stable.tar.gz | |
tar xzf redis-stable.tar.gz | |
cd redis-stable | |
make | |
make test | |
sudo make install | |
cd utils | |
sudo ./install_server.sh | |
# if you use ubuntu 18.04 run this commend | |
$ sudo apt install redis-server | |
# Step 4 — Installing RVM | |
# Before installing RVM, you need to import the RVM GPG Key: | |
$ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB | |
# Then install RVM to manage our Rubies: | |
$ curl -sSL https://get.rvm.io | bash -s stable | |
# after that : | |
# We then need to run the requirements command to automatically install required dependencies and files for RVM and Ruby to function properly: | |
$ source ~/.rvm/scripts/rvm | |
$ rvm requirements | |
# Auto update rvm | |
$ echo rvm_autoupdate_flag=2 >> ~/.rvmrc | |
# Step 5 — Installing Ruby | |
$ rvm install 2.7.2 # or 2.6.2 | |
$ rvm use 2.7.2 --default | |
# Step 6 — Installing Rails and Bundler | |
$ gem install rails | |
$ gem install bundler | |
$ gem install mysql2 | |
$ gem install pg | |
# Step 7 — Setting up SSH Keys | |
# First shake hands with GitHub, Bitbucket, or any other Git Remote where the codebase for your Rails app is hosted: | |
$ ssh -T git@bitbucket.org | |
$ ssh -T git@github.com | |
# Don't worry if you get a Permission denied (publickey) message. Now, generate a SSH key (a Public/Private Key Pair) for your server: | |
$ ssh-keygen -t rsa | |
# Show ssh key: | |
$ cat ~/.ssh/id_rsa.pub | |
# Step 8 — Setting up GIT | |
# Setup User name and email | |
$ git config --global user.name 'YourName' | |
$ git config --global user.email 'YourEmail' | |
# Step 9 — Setting up Cola | |
$ apt-get install git-cola | |
# Step 10 — Setting up Oh-My-Zsh | |
$ apt-get install zsh | |
# After that Install Oh-My-Zsh | |
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
# Than Installation | |
# 1. Clone the repository: | |
$ git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh | |
# 2. Optionally, backup your existing ~/.zshrc file: | |
$ cp ~/.zshrc ~/.zshrc.orig | |
# 3. Create a new zsh configuration file | |
# You can create a new zsh config file by copying the template that we have included for you. | |
$ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc | |
# 4. Change your default shell | |
chsh -s /bin/zsh | |
# Note : If it does not work with you, restart your computer | |
# 5. If you want to add shortcuts (Git - Rails - Bundle etc...) | |
# First open file ~/.zshrc | |
$ sudo nano ~/.zshrc | |
# Than change plugins in file to | |
plugins=( | |
git | |
bundler | |
rails | |
ruby | |
) | |
# 6. If You Want Change Theme | |
# First open file ~/.zshrc | |
$ sudo nano ~/.zshrc | |
# Than change ZSH_THEME like this | |
ZSH_THEME="robbyrussell" | |
# OR | |
ZSH_THEME="agnoster" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment