├── .gitignore ├── README.md ├── magento └── .keep └── vagrant ├── Vagrantfile ├── bootstrap.sh └── httpdocs └── .keep /.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # OSX System files 3 | # -------------------- 4 | .DS_Store 5 | .AppleDouble 6 | .LSOverride 7 | 8 | # Icon must ends with two \r. 9 | Icon 10 | 11 | # Thumbnails 12 | ._* 13 | 14 | # Files that might appear on external disk 15 | .Spotlight-V100 16 | .Trashes 17 | 18 | 19 | # 20 | # Vagrant files/folders 21 | # -------------------- 22 | /httpdocs/ 23 | .vagrant 24 | 25 | 26 | # 27 | # Magento project 28 | # -------------------- 29 | magento/* 30 | !magento/.keep 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Looking for Magento2 Vagrant environment? 2 | If you interesting about Magento2 Vagrant environment you can find it [here](https://github.com/klierik/magento2-vagrant) 3 | 4 | # What is that? # 5 | Simple-Magento-Vagrant -- ultra light Vagrant development environment for running Magento CMS, based on Ubuntu Precise 64. 6 | I create this repo for my self as easyest way install Magento and share with you. 7 | 8 | After installation you will get clean Magento 1.9.2.3 with sample data 1.9.1.0. 9 | You can re-configure for personal use in you development. See __[How to use and/or customize](https://github.com/klierik/simple-magento-vagrant/blob/master/README.md#how-to-use-andor-customize)__ section for more information. 10 | 11 | # What do you get? # 12 | + Ubuntu 14.04 + Apache2 + Php5 + MySQL 5.5.x 13 | + Magento 1.9.2.3 with sample data 1.9.1.0 14 | + [Adminer 3.7.1](http://www.adminer.org/)(formerly phpMinAdmin) 15 | 16 | __Folders structure:__ 17 | ``` 18 | $ tree -L 2 19 | . 20 | ├── README.md 21 | ├── magento 22 | └── vagrant 23 |    ├── httpdocs 24 |    ├── Vagrantfile 25 |    └── bootstrap.sh 26 | ``` 27 | 28 | ## Requirements: ## 29 | + [VirtualBox](https://www.virtualbox.org/wiki/Downloads) 30 | + [Vagrant](http://www.vagrantup.com/downloads.html) 31 | + [Vagrant Host Manager](https://github.com/smdahlen/vagrant-hostmanager) and [vagrant-vbguest](https://github.com/dotless-de/vagrant-vbguest) 32 | 33 | ## Default configuration ## 34 | 35 | **File system:** 36 | ``` 37 | nfs: true 38 | mount_options: ["nolock", "async"] 39 | bsd__nfs_options: ["alldirs","async","nolock"] 40 | config.nfs.map_uid = 0 41 | config.nfs.map_gid = 0 42 | ``` 43 | 44 | **VirtualBox settings:** 45 | 46 | Memory adn CPU cores by default: 1/8 of all memory and all cores (for Windows user 2 cores and 1024 memory) 47 | Network host-guest configuration: 48 | ``` 49 | config.vm.network :forwarded_port, guest: 80, host: 8999 50 | config.vm.network :forwarded_port, guest: 22, host: 2299 51 | ``` 52 | 53 | ## Magento info and options ## 54 | DB name: **magento** 55 | 56 | DB user name: **magento** 57 | 58 | DB user password: **password** 59 | 60 | ## Web server configuration ## 61 | Server name: **simple-magento-vagrant.dev** 62 | 63 | ## How to use and/or customize. ## 64 | It will be work out of box but you can edit configuration if you need. 65 | 66 | ### Change domain name 67 | 68 | 1. Open Vagrantfile and use find/replace tool to change 69 | `"simple-magento-vagrant"` ==> `"my-personal-magento-site-name"` or what you need 70 | 71 | 2. Open bootstrap.sh and use find/replace tool to change 72 | `"simple-magento-vagrant"` ==> `"my-personal-magento-site-name"` or what you need 73 | 74 | ### Change network private ip 75 | Open Vagrant file and find `node.vm.network :private_network, ip: '192.168.99.99'` ==> change ip 76 | 77 | ### Change forwarded port 78 | Open Vagrantvile and find `config.vm.network :forwarded_port, guest: 80, host: 8999` ==> change host port 79 | 80 | ### Change Synced folder 81 | I prefer use different folders for vagrant and project. For example: 82 | 83 | ``` 84 | . 85 | .. 86 | magento - magento project folder 87 | vagrant - vagrant folder 88 | ``` 89 | That's why i sync my folders in this way `config.vm.synced_folder "../magento/", "/vagrant/httpdocs"`. 90 | Change `../magento/` path to folder with your project (it can be relative or absolute url). 91 | 92 | ## How to run? ## 93 | Download [latest Simple-Magento-Vagrant](https://github.com/klierik/simple-magento-vagrant/archive/master.zip) zip archive (and unpack it) or run '$ git clone git@github.com:klierik/simple-magento-vagrant.git' in your test folder. 94 | Then go to vagrant folder. For example '$ cd /Volumes/Data/http/htdocs/simple-magento-vagrant/vagrant/' 95 | Run `$ vagrant up` in your vagrant options. 96 | 97 | **PS: via installation you can be asked for password** 98 | 99 | After installation is finished open http://simple-magento-vagrant.dev/ in your browser and install Magento. 100 | 101 | Good luck ;) 102 | -------------------------------------------------------------------------------- /magento/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klierik/simple-magento-vagrant/3166c7b7bacd07f57626b38fb05218c18ffdd930/magento/.keep -------------------------------------------------------------------------------- /vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure("2") do |config| 5 | # All Vagrant configuration is done here. The most common configuration 6 | # options are documented and commented below. For a complete reference, 7 | # please see the online documentation at vagrantup.com. 8 | 9 | # Every Vagrant virtual environment requires a box to build off of. 10 | # config.vm.box = "precise64" 11 | # config.vm.box = "precise32" 12 | config.vm.box = "trusty64" 13 | 14 | # The url from where the 'config.vm.box' box will be fetched if it 15 | # doesn't already exist on the user's system. 16 | # config.vm.box_url = "http://files.vagrantup.com/precise64.box" 17 | # config.vm.box_url = "http://files.vagrantup.com/precise32.box" 18 | config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" 19 | 20 | # Provision 21 | config.vm.provision :shell, :path => "bootstrap.sh" 22 | 23 | # Create a forwarded port mapping which allows access to a specific port 24 | # within the machine from a port on the host machine. In the example below, 25 | # accessing "localhost:8080" will access port 80 on the guest machine. 26 | config.vm.network :forwarded_port, guest: 80, host: 8999 27 | config.vm.network :forwarded_port, guest: 22, host: 2299 28 | 29 | 30 | # Synced folder 31 | # config.vm.synced_folder "../magento/", "/vagrant/httpdocs" 32 | config.vm.synced_folder "../magento/", "/vagrant/httpdocs", id: "vagrant-root", owner: "vagrant", group: "www-data", mount_options: ["dmode=775,fmode=664"] 33 | # config.vm.synced_folder "../magento/", "/vagrant/httpdocs", nfs: true, mount_options: ["nolock", "async"], bsd__nfs_options: ["alldirs","async","nolock"] 34 | # config.nfs.map_uid = 0 35 | # config.nfs.map_gid = 0 36 | 37 | 38 | # VirtualBox settings 39 | config.vm.provider :virtualbox do |vb| 40 | # vb.customize ["modifyvm", :id, "--memory", "512"] 41 | # vb.customize ["modifyvm", :id, "--memory", "1024"] 42 | # vb.customize ["modifyvm", :id, "--memory", "2048"] 43 | # vb.customize ["modifyvm", :id, "--memory", "3072"] 44 | # vb.customize ["modifyvm", :id, "--memory", "4096"] 45 | end 46 | 47 | 48 | # VirtualBox setting 49 | # Use all CPU cores and 1/4 system memory 50 | config.vm.provider "virtualbox" do |v| 51 | host = RbConfig::CONFIG['host_os'] 52 | 53 | # Give VM 1/8 system memory & access to all cpu cores on the host 54 | if host =~ /darwin/ 55 | cpus = `sysctl -n hw.ncpu`.to_i 56 | # sysctl returns Bytes and we need to convert to MB 57 | mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 8 58 | elsif host =~ /linux/ 59 | cpus = `nproc`.to_i 60 | # meminfo shows KB and we need to convert to MB 61 | mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 8 62 | else # sorry Windows folks, I can't help you 63 | cpus = 2 64 | mem = 1024 65 | end 66 | 67 | v.customize ["modifyvm", :id, "--memory", mem] 68 | v.customize ["modifyvm", :id, "--cpus", cpus] 69 | end 70 | 71 | 72 | # Host Manager 73 | config.hostmanager.enabled = true 74 | config.hostmanager.manage_host = true 75 | config.hostmanager.ignore_private_ip = false 76 | config.hostmanager.include_offline = true 77 | config.vm.define 'simple-magento-vagrant' do |node| 78 | node.vm.hostname = 'simple-magento-vagrant' 79 | node.vm.network :private_network, ip: '192.168.99.99' 80 | node.hostmanager.aliases = %w(simple-magento-vagrant.dev) 81 | end 82 | end 83 | -------------------------------------------------------------------------------- /vagrant/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | echo "==================================================" 5 | echo "Aloha! Now we will try to Install Ubuntu 14.04 LTS" 6 | echo "with Apache 2.4, PHP 5.6, MySQL 5.6(manual)" 7 | echo "and others dependencies needed for Magento 1(2)." 8 | echo "Good luck :P" 9 | echo "==================================================" 10 | echo "" 11 | echo "" 12 | echo "==================================================" 13 | echo "SET LOCALES" 14 | echo "==================================================" 15 | 16 | export DEBIAN_FRONTEND=noninteractive 17 | 18 | export LANGUAGE=en_US.UTF-8 19 | export LANG=en_US.UTF-8 20 | export LC_TYPE=en_US.UTF-8 21 | export LC_ALL=en_US.UTF-8 22 | locale-gen en_US en_US.UTF-8 23 | dpkg-reconfigure locales 24 | 25 | 26 | echo "==================================================" 27 | echo "RUN UPDATE" 28 | echo "==================================================" 29 | 30 | apt-get update 31 | apt-get upgrade 32 | 33 | 34 | echo "==================================================" 35 | echo "INSTALLING APACHE" 36 | echo "==================================================" 37 | 38 | apt-get -y install apache2 39 | 40 | if ! [ -L /var/www ]; then 41 | rm -rf /var/www 42 | ln -fs /vagrant/httpdocs /var/www 43 | fi 44 | 45 | VHOST=$(cat < 47 | DocumentRoot "/var/www" 48 | ServerName simple-magento-vagrant.dev 49 | 50 | 51 | AllowOverride All 52 | 53 | 54 | SetEnv MAGE_IS_DEVELOPER_MODE true 55 | 56 | EOF 57 | ) 58 | echo "$VHOST" > /etc/apache2/sites-available/000-default.conf 59 | 60 | echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/localhost.conf 61 | 62 | a2enconf localhost 63 | a2enmod rewrite 64 | service apache2 restart 65 | 66 | 67 | echo "==================================================" 68 | echo "INSTALLING PHP" 69 | echo "==================================================" 70 | 71 | apt-get -y update 72 | apt-get -y install php5 php5-mhash php5-mcrypt php5-curl php5-cli php5-mysql php5-gd php5-intl php5-xsl 73 | 74 | php5enmod mcrypt 75 | service apache2 reload 76 | 77 | 78 | echo "==================================================" 79 | echo "INSTALLING and CONFIGURE NTP" 80 | echo "==================================================" 81 | apt-get -y install ntp 82 | 83 | 84 | 85 | echo "==================================================" 86 | echo "INSTALLING ADMINER" 87 | echo "==================================================" 88 | if [ ! -d "/vagrant/httpdocs/adminer" ]; then 89 | echo "Adminer not found at /vagrant/httpdocs/adminer and will be installed..." 90 | 91 | mkdir /vagrant/httpdocs/adminer 92 | wget -O /vagrant/httpdocs/adminer/index.php https://www.adminer.org/static/download/4.2.5/adminer-4.2.5.php 93 | 94 | echo "Adminer installed... Use http://simple-magento-vagrant.dev/adminer/ URL to use it." 95 | fi 96 | 97 | 98 | echo "==================================================" 99 | echo "INSTALLING MYSQL" 100 | echo "==================================================" 101 | apt-get -q -y install mysql-server-5.5 102 | 103 | echo "==================================================" 104 | echo "INSTALLING MYSQL MAGENTO DATABASE" 105 | echo "==================================================" 106 | 107 | mysql -u root -e "DROP DATABASE IF EXISTS magento" 108 | mysql -u root -e "CREATE DATABASE IF NOT EXISTS magento" 109 | mysql -u root -e "GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost' IDENTIFIED BY 'password'" 110 | mysql -u root -e "FLUSH PRIVILEGES" 111 | 112 | 113 | echo "==================================================" 114 | echo "CLEANING..." 115 | echo "==================================================" 116 | apt-get -y autoremove 117 | apt-get -y autoclean 118 | 119 | 120 | echo "==================================================" 121 | echo "DOWNLOAD MAGENTO SOURCE AND SAMPLE" 122 | echo "==================================================" 123 | echo "Start download Magento 1.9.2.3 and sample data save version..." 124 | if [ ! -d /vagrant/source ]; then 125 | mkdir /vagrant/source 126 | fi 127 | 128 | if [ ! -f /vagrant/source/magento-1.9.2.3.tar.gz ]; then 129 | wget -c https://github.com/OpenMage/magento-mirror/archive/1.9.2.3.tar.gz -O /vagrant/source/magento-1.9.2.3.tar.gz 130 | fi 131 | 132 | if [ ! -f /vagrant/source/magento-sample-data-1.9.1.0.tar.gz ]; then 133 | wget -c https://raw.githubusercontent.com/Vinai/compressed-magento-sample-data/1.9.1.0/compressed-no-mp3-magento-sample-data-1.9.1.0.tgz -O /vagrant/source/magento-sample-data-1.9.1.0.tar.gz 134 | fi 135 | echo "done." 136 | 137 | echo "Extract Magento and sample data to /vagrant/httpdocs ..." 138 | tar zxvf /vagrant/source/magento-1.9.2.3.tar.gz -C /vagrant/httpdocs --strip-components=1 139 | tar zxvf /vagrant/source/magento-sample-data-1.9.1.0.tar.gz -C /vagrant/httpdocs --strip-components=1 140 | echo "done." 141 | 142 | echo "Import Sample database..." 143 | mysql -u root magento < /vagrant/httpdocs/magento_sample_data_for_1.9.1.0.sql 144 | echo "done." 145 | 146 | echo "Update DB config with local domain name..." 147 | mysql -u root -e "UPDATE magento.core_config_data SET value = 'http://simple-magento-vagrant.dev/' WHERE core_config_data.path = 'web/unsecure/base_url'" 148 | mysql -u root -e "UPDATE magento.core_config_data SET value = 'http://simple-magento-vagrant.dev/' WHERE core_config_data.path = 'web/secure/base_url'" 149 | echo "done."a 150 | 151 | 152 | echo "==================================================" 153 | echo "============= INSTALLATION COMPLETE ==============" 154 | echo "==================================================" 155 | -------------------------------------------------------------------------------- /vagrant/httpdocs/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klierik/simple-magento-vagrant/3166c7b7bacd07f57626b38fb05218c18ffdd930/vagrant/httpdocs/.keep --------------------------------------------------------------------------------