LoginSignup
6
6

More than 5 years have passed since last update.

UbuntuにRails環境をインストールするメモ

Posted at

RVM インストール

curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements

MySQL インストール

mkdir opt
cd opt
wget http://jaist.dl.sourceforge.net/project/mysql.mirror/MySQL%205.6.15/mysql-5.6.15-debian6.0-x86_64.deb

sudo dpkg -i mysql-5.6.15-debian6.0-x86_64.deb
sudo apt-get upgrade
sudo apt-get install libaio1

sudo groupadd mysql
sudo useradd -r -g mysql mysql
sudo chown -R root:root /opt/mysql
sudo chown -R mysql:mysql /opt/mysql/server-5.6

sudo install -o mysql -g mysql -d /data/mysql
sudo -u mysql /opt/mysql/server-5.6/scripts/mysql_install_db --user=mysql --datadir=/data/mysql

sudo vi /etc/my.cnf
  [mysqld]
  basedir = /opt/mysql/server-5.6
  datadir = /data/mysql


sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql
sudo update-rc.d mysql defaults
sudo /etc/init.d/mysql start

sudo vi /etc/profile.d/mysql.sh
  PATH="/opt/mysql/server-5.6/bin:$PATH"
  MANPATH="/opt/mysql/server-5.6/man:$MANPATH"

sudo chmod 755 /etc/profile.d/mysql.sh

[ログインし直してから]
mysql_secure_installation

/etc/mysql/my.cnf がある場合は mv /etc/mysql/my.cnf /etc/mysql.my.conf.bk

Apache Passenger インストール

sudo apt-get update
sudo apt-get install apache2
gem install passenger

sudo apt-get install libcurl4-openssl-dev apache2-threaded-dev libapr1-dev libaprutil1-dev
passenger-install-apache2-module

  Please edit your Apache configuration file, and add these lines:
     LoadModule passenger_module /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/passenger-4.0.35/buildout/apache2/mod_passenger.so
     <IfModule mod_passenger.c>
       PassengerRoot /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/passenger-4.0.35
       PassengerDefaultRuby /home/ubuntu/.rvm/gems/ruby-2.1.0/wrappers/ruby
     </IfModule>

  Deploying a web application: an example

  Suppose you have a web application in /somewhere. Add a virtual host to your
  Apache configuration file and set its DocumentRoot to /somewhere/public:

     <VirtualHost *:80>
        ServerName www.yourhost.com
        # !!! Be sure to point DocumentRoot to 'public'!
        DocumentRoot /somewhere/public
        <Directory /somewhere/public>
           # This relaxes Apache security settings.
           AllowOverride all
           # MultiViews must be turned off.
           Options -MultiViews
           Require all granted
        </Directory>
     </VirtualHost>

  And that's it! You may also want to check the Users Guide for security and
  optimization tips, troubleshooting and other useful information:

Git インストール

sudo apt-get install git

Java インストール

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

sudo update-alternatives --config java

Jenkins インストール

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6