sh 使用git,ruby,rvm,nginx自动设置Ubuntu服务器。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 使用git,ruby,rvm,nginx自动设置Ubuntu服务器。相关的知识,希望对你有一定的参考价值。

#!/usr/bin/env bash
# ----------------------------------------------------
#
#   Automated setup for a Ubuntu server with git, ruby, rvm, nginx.
#   (Used at Carbonmade)
#
#   Usage:
#      - SCP this file to your server: scp ubuntu_setup.sh you@server:~
#      - Make it executable: chmod +x ubuntu_setup.sh
#      - Run it: bash ubuntu_setup.sh
#
# ----------------------------------------------------

echo "Log for ubuntu_ruby.sh script."
echo `date`
echo "----------------------------------"

# Tweaks to shell
echo "PS1='\[\033[0;35m\]\u@\h\[\033[0;33m\] \w\[\033[00m\]: '" >> .bash_profile
echo "alias ls='ls -lh --color'" >> .bash_profile

# Add Multiverse repositories: https://help.ubuntu.com/community/Repositories/CommandLine#Adding_the_Universe_and_Multiverse_Repositories
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo sed -i -e "s/# deb/deb/g" /etc/apt/sources.list

# Update source.
sudo aptitude update

# Upgrade everything.
sudo aptitude safe-upgrade -y

# Install packages
sudo aptitude install build-essential git-core bison openssl libcurl4-openssl-dev libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev libmysqlclient-dev mysql-client-core-5.1 yui-compressor -y

# Install RVM
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
echo "rvm_gemset_create_on_use_flag=1" >> ~/.rvmrc
source ~/.bash_profile
rvm install ruby-1.9.2-p290
rvm --default use ruby-1.9.2-p290

# Install Passenger.
rvm gemset use global
gem update --system
gem install bundler --no-ri --no-rdoc
gem install passenger  --no-ri --no-rdoc
passenger-install-nginx-module --auto --auto-download --prefix=/home/ubuntu/nginx

# nginx shortcuts.
echo "sudo /home/ubuntu/nginx/sbin/nginx -s stop" >> /home/ubuntu/nginx_restart
echo "sudo /home/ubuntu/nginx/sbin/nginx" >> /home/ubuntu/nginx_restart
echo "sudo /home/ubuntu/nginx/sbin/nginx -s reload" >> /home/ubuntu/nginx_reload
chmod +x /home/ubuntu/nginx_restart
sudo ln -s /home/ubuntu/nginx_restart /usr/bin
sudo ln -s /home/ubuntu/nginx/sbin/nginx /usr/bin

# Add GitHub.com RSA fingerprints to known_hosts so we aren't prompted to confirm.
echo "|1|nFPVjT+tJlghvwL9SqJmckclSkI=|5HR4LAIxnl3I3cl40j5GIy+Qbwk= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> /home/ubuntu/.ssh/known_hosts
echo "|1|LiSuPv5jaL9TCd9Tgue5BiGAJtE=|KYW9Uqo+gzE+Z3O/0uE8d9kadm0= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> /home/ubuntu/.ssh/known_hosts

以上是关于sh 使用git,ruby,rvm,nginx自动设置Ubuntu服务器。的主要内容,如果未能解决你的问题,请参考以下文章

sh RVM - Ruby版本管理器

sh 设置OSX机器从零到很棒。使用Homebrew(和桶,字体等)。专注于Ruby / Rails开发,包括rvm,xquartz,

sh 设置OSX机器从零到很棒。使用Homebrew(和桶,字体等)。专注于Ruby / Rails开发,包括rvm,xquartz,

sh 设置OSX机器从零到很棒。使用Homebrew(和桶,字体等)。专注于Ruby / Rails开发,包括rvm,xquartz,

sh 设置OSX机器从零到很棒。使用Homebrew(和桶,字体等)。专注于Ruby / Rails开发,包括rvm,xquartz,

sh 设置OSX机器从零到很棒。使用Homebrew(和桶,字体等)。专注于Ruby / Rails开发,包括rvm,xquartz,