LoginSignup
3
3

More than 5 years have passed since last update.

vagrantでredmineを起動するまで

Last updated at Posted at 2016-04-11

VagrantFileで色々ごちゃごちゃと設定

参考にしたサイト

インストール全般
http://www.torutk.com/projects/swe/wiki/Redmine%E3%82%92CentOS_7%E4%B8%8A%E3%81%A7%E5%8B%95%E3%81%8B%E3%81%99%E3%83%BCUnicorn%E3%81%A8Nginx%E7%B7%A8

gitのインストール
http://cestcaquejm.hatenadiary.jp/entry/2015/04/02/CentOS7%E3%81%ABgit%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB

vagrantFile
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "centos7min"

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # config.vm.network "forwarded_port", guest: 80, host: 8080

config.vm.network "forwarded_port", guest: 80, host: 49805, id:"http"

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # config.vm.network "private_network", ip: "192.168.33.10"

config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

config.vm.synced_folder "../share", "/vagrants"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  # such as FTP and Heroku are also available. See the documentation at
  # https://docs.vagrantup.com/v2/push/atlas.html for more information.
  # config.push.define "atlas" do |push|
  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  # end

  # Enable provisioning with a shell script. Additional provisioners such as
  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   sudo apt-get update
  #   sudo apt-get install -y apache2
  # SHELL

config.vm.provision "shell", inline: <<-SHELL

sudo yum -y install yum-plugin-priorities

#開発ツール(Cコンパイラ等)のインストール
sudo yum -y groupinstall "Development Tools"

#RubyとPassengerのビルドに必要なヘッダファイルなどのインストール
sudo yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel

#日本語化
 sudo yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts ibus-kkc vlgothic-*
 sudo localectl set-locale LANG=ja_JP.UTF-8
 sudo source /etc/locale.conf 
 sudo timedatectl set-timezone Asia/Tokyo

##LAMP環境の整備

Apacheとヘッダファイルのインストール
 sudo yum -y install httpd httpd-devel
 sudo systemctl enable httpd
 sudo systemctl start httpd.service

#MariaDBとヘッダファイルのインストール
sudo yum -y install mariadb-server mariadb-devel

#gitのインストール

yum -y install git

#rubyのbuildに必要なパッケージのインストール

yum install -y gcc openssl-devel readline-devel zlib-devel

#rbenvのクローン

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv

#環境設定
echo 'export PATH="\$HOME/.rbenv/bin:\$PATH"' >> ~/.bash_profile
echo 'eval "\$(rbenv init -)"' >> ~/.bash_profile
exec $SHELL -l

# ruby-buildのクローン
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

#インストール可能なバージョン一覧を出力
rbenv install --list

#rubyのインストール
rbenv install -v 2.2.3

#インストールされているrubyを確認
rbenv versions

#使用するrubyを設定
rbenv global 2.2.3

#バージョン確認
ruby -v

#bundlerのインストール
sudo gem install bundler --no-rdoc --no-ri

#あとでちゃんと設定すること
#firewalldでHTTPを許可
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload

SHELL

end


ターミナル
vagarnt up

起動後に
http://127.0.0.1:49805
にアクセスするとapache2の小洒落た画面が見えるはず!

あとは、
http://blog.redmine.jp/articles/3_0/installation_centos/
http://www.torutk.com/projects/swe/wiki/Redmine%E3%82%92CentOS_7%E4%B8%8A%E3%81%A7%E5%8B%95%E3%81%8B%E3%81%99%E3%83%BCUnicorn%E3%81%A8Nginx%E7%B7%A8

3
3
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
3
3