From ba302396876cf5858b640b634efd5ba9f49c5f1c Mon Sep 17 00:00:00 2001 From: Randy Abernethy Date: Wed, 19 Nov 2014 18:09:58 -0800 Subject: [PATCH] THRIFT-2744:Add Centos 6.5 Vagrantfile to contrib Client: Contrib Patch: Randy Abernethy Provides a Vagrantfile to setup Centos 6.5 for Apache Thrift operations. Useful as is and as an example for Centos users interested in configuring Apache Thrift on other Centos systems. --- contrib/vagrant/centos-6.5/README.md | 61 ++++++ contrib/vagrant/centos-6.5/Vagrantfile | 274 +++++++++++++++++++++++++ 2 files changed, 335 insertions(+) create mode 100644 contrib/vagrant/centos-6.5/README.md create mode 100644 contrib/vagrant/centos-6.5/Vagrantfile diff --git a/contrib/vagrant/centos-6.5/README.md b/contrib/vagrant/centos-6.5/README.md new file mode 100644 index 000000000..3d1dc0746 --- /dev/null +++ b/contrib/vagrant/centos-6.5/README.md @@ -0,0 +1,61 @@ +Apache Thrift Centos 6.5 Vagrant Support +======================================== +This directory is the Vagrant project directory for Apache Thrift running on Centos 6.5. The Vagrantfile in this directory configures a Vagrant provisioned VM launched under VirtualBox. To use this project you must have a recent version of VirtualBox and Vagrant installed (in that order). To run the VM, open a shell, clone Apache Thrift, change to this directory and enter the Vagrant up command. + + $ git clone https://github.com/apache/thrift + $ cd thrift/contrib/vagrant/centos-6.5 + $ vagrant up + +This will download and launch the base box VM under VirtualBox and run the Apache Thrift provisioning script. This will take up to an hour depending on your hardware and network. Once complete you can login to the box with Vagrant ssh. The thrift source tree from your host os is mounted at /thrift. + + $ vagrant ssh + [vagrant@thrift ~]$ cd /thrift + [vagrant@thrift thrift]$ compiler/cpp/thrift --version + Thrift version 1.0.0-dev + +The provisioning script (inside the Vagrantfile) runs ./bootstrap.sh, ./configure, make and make check, but does not install thrift. To install thrift run "make install". + +The Vagrant base box used here is a minimal Centos 6.5 VirtualBox with 2GB RAM and 2 CPUs. For more Vagrant information: https://www.vagrantup.com. A summary of the base box preperation follows: + +root password: vagrant + +#Create the vagrant user and give it sudo permission +adduser vagrant +passwd vagrant +visudo : vagrant ALL=(ALL) NOPASSWD: ALL + #Defaults requiretty + +#Shut down the firewall and disable it +service iptables stop +chkconfig iptables off + +#Setup the vagrant ssh public key to allow vagrant to ssh +mkdir /home/vagrant/.ssh +chmod 700 /home/vagrant/.ssh +cd /home/vagrant/.ssh +wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys +chmod 600 /home/vagrant/.ssh/authorized_keys +chown -R vagrant /home/vagrant/.ssh + +#Install EPEL (Extra Packages for Enterprise Linux) but protect the base +#repositories so that EPEL does not mask base packages +yum -y install yum-plugin-protectbase +rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm + +#Install perl, dynamic kernel modules, dev tools and kernel headers to support +#Virtual box additions +yum -y install perl +yum -y --enablerepo epel install dkms +yum -y groupinstall "Development Tools" +yum -y install kernel-devel + +#Update everything and reboot +yum update +reboot + +#Install the VirtualBox Guest additions (using VirtualBox iso) +mount /dev/cdrom /mnt +/mnt/VBoxLinuxAdditions.run +umount /mnt + +See the Vagrantfile for further details diff --git a/contrib/vagrant/centos-6.5/Vagrantfile b/contrib/vagrant/centos-6.5/Vagrantfile new file mode 100644 index 000000000..6207958b3 --- /dev/null +++ b/contrib/vagrant/centos-6.5/Vagrantfile @@ -0,0 +1,274 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# APACHE THRIFT PROVISIONING SCRIPT +############################################################## +# This script is used to configure the base Centos 6.5 +# Vagrant box for Apache Thrift compiler and lib builds. +# The base box is Centos 6.5 with no additional packages +# except those required to support VirtualBox Guest tools: +# perl, dkms, kernel-devel and the "Development Tools" group. +# The epel repo was also added along with the +# yum-plugin-protectbase package to prefer base repo packages. +# The script below provisions ALL languages. This will take +# time. You can greatly reduce the build time by commenting +# out the LIB provisioning for uneeded language libraries. +# Expect full provisioning to take 30 minutes on a fast +# machine with an excellent Internet connection (and another +# 15 minutes for the build). +# +# Machine accounts: +# - User: vagrant/vagrant +# - Admin: root/vagrant +# Vagrant public ssh key also installed +############################################################## + +$build_and_test = <