Mediawiki-vagrant is tough to be tamed in your local machine

I am a newbie in php and my next task i have to build a mediawiki extension that will embed the datagrepper messages in wiki user profile. Even setting up the mediawiki environment became a tough job for me. But I have managed to do so and now i am going to share the installation steps.

How to install Mediawiki-vagrant?

1. Install git
2.  Get virtualbox

First install the dependencies:

$ sudo yum update

$ sudo yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms

Now, install VirtualBox:

$ sudo yum install VirtualBox-4.3

3. Download the latest version of vagrant.

4.  Get the code and create your machine:

$ git clone https://gerrit.wikimedia.org/r/mediawiki/vagrant
$ cd vagrant
$ vagrant up
[charul@localhost vagrant]$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 80 => 8080 (adapter 1)
[default] Running 'pre-boot' VM customizations...
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Configuring proxy for Apt...
[default] Configuring proxy environment variables...
[default] Configuring proxy for PEAR...
GuestAdditions 4.3.6 running --- OK.
[default] Setting hostname...
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /vagrant/logs
[default] -- /tmp/vagrant-puppet-1/manifests
[default] -- /tmp/vagrant-puppet-1/modules-0
[default] VM already provisioned. Run `vagrant provision` or use `--provision` to force it

As there is a proxy behind my internet connection, i  had to install  vagrant-proxyconf plugin.

$ vagrant plugin install vagrant-proxyconf

Then i configured proxy by adding the following lines to $HOME/.vagrant.d/Vagrantfile (or to the project Vagrantfile)

Vagrant.configure('2') do |config|
if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://username:password@proxyhost:port/"
    config.proxy.https    = "http://username:password@proxyhost:port/"
    config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
end
# ... other stuff
end

After this,

$ vagrant provision

For the first time I got this output which wasn’t correct. 😦

[charul@localhost vagrant]$ vagrant provision
[default] Configuring proxy for Apt...
[default] Configuring proxy environment variables...
[default] Configuring proxy for PEAR...
[default] Running provisioner: puppet...
Running Puppet with site.pp...
info: Applying configuration version '1392325515.9dbe0e1'
info: mount[files]: allowing mediawiki-vagrant access
notice: /Stage[main]/Mediawiki/File[/vagrant/settings.d]/mode: mode changed '0775' to '0755'
err: /Stage[main]/Redis::Php/Package[php5-redis]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5-redis' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php5-redis
err: /Stage[main]/Mediawiki::Phpsh/Package[phpsh]/ensure: change from absent to 1.3.3 failed: Could not update: Execution of '/usr/bin/pip install -q phpsh==1.3.3' returned 1:   Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement phpsh==1.3.3
No distributions at all found for phpsh==1.3.3
Storing complete log in /root/.pip/pip.log
at /tmp/vagrant-puppet-1/modules-0/mediawiki/manifests/phpsh.pp:14
notice: /Stage[main]/Mediawiki::Phpsh/File[/etc/phpsh/rc.php]: Dependency Package[phpsh] has failures: true
warning: /Stage[main]/Mediawiki::Phpsh/File[/etc/phpsh/rc.php]: Skipping because of failed dependencies
notice: /Stage[main]/Apache/Service[apache2]: Dependency Package[php5-redis] has failures: true
warning: /Stage[main]/Apache/Service[apache2]: Skipping because of failed dependencies
notice: /Stage[main]/Mediawiki/Exec[check settings]/returns: executed successfully
info: /Stage[main]/Mediawiki/Exec[check settings]: Scheduling refresh of Exec[mediawiki setup]
notice: /Stage[main]/Mediawiki/Exec[mediawiki setup]/returns: executed successfully
notice: /Stage[main]/Mediawiki/Exec[mediawiki setup]: Triggered 'refresh' from 1 events
notice: /Stage[main]/Mediawiki/Exec[configure phpunit]/returns: executed successfully
notice: /Stage[main]/Mediawiki/File[/usr/local/bin/run-mediawiki-tests]/ensure: defined content as '{md5}6b154f733a6f77b5728e480b2714fe72'
notice: /Stage[main]/Mediawiki/Exec[require extra settings]/returns: executed successfully
err: /Stage[main]/Git/Package[git-review]/ensure: change from absent to 1.23 failed: Could not update: Execution of '/usr/bin/pip install -q git-review==1.23' returned 1:   Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement git-review==1.23
No distributions at all found for git-review==1.23
Storing complete log in /root/.pip/pip.log
at /tmp/vagrant-puppet-1/modules-0/git/manifests/init.pp:32
notice: Finished catalog run in 69.08 seconds
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

FACTER_fqdn='mediawiki-vagrant.dev' FACTER_forwarded_port='8080' FACTER_shared_apt_cache='/vagrant/apt-cache/' FACTER_provider_name='virtualbox' FACTER_provider_version='4.3.6' puppet apply --templatedir /vagrant/puppet/templates --verbose --config_version /vagrant/puppet/extra/config-version --fileserverconfig /vagrant/puppet/extra/fileserver.conf --logdest /vagrant/logs/puppet/puppet.9dbe0e134.log --logdest console --modulepath '/tmp/vagrant-puppet-1/modules-0' --manifestdir /tmp/vagrant-puppet-1/manifests --detailed-exitcodes /tmp/vagrant-puppet-1/manifests/site.pp || [ $? -eq 2 ]

Stdout from the command:

info: Applying configuration version '1392325515.9dbe0e1'
info: mount[files]: allowing mediawiki-vagrant access
notice: /Stage[main]/Mediawiki/File[/vagrant/settings.d]/mode: mode changed '0775' to '0755'
err: /Stage[main]/Redis::Php/Package[php5-redis]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5-redis' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php5-redis

err: /Stage[main]/Mediawiki::Phpsh/Package[phpsh]/ensure: change from absent to 1.3.3 failed: Could not update: Execution of '/usr/bin/pip install -q phpsh==1.3.3' returned 1:   Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement phpsh==1.3.3
No distributions at all found for phpsh==1.3.3
Storing complete log in /root/.pip/pip.log
at /tmp/vagrant-puppet-1/modules-0/mediawiki/manifests/phpsh.pp:14
notice: /Stage[main]/Mediawiki::Phpsh/File[/etc/phpsh/rc.php]: Dependency Package[phpsh] has failures: true
warning: /Stage[main]/Mediawiki::Phpsh/File[/etc/phpsh/rc.php]: Skipping because of failed dependencies
notice: /Stage[main]/Apache/Service[apache2]: Dependency Package[php5-redis] has failures: true
warning: /Stage[main]/Apache/Service[apache2]: Skipping because of failed dependencies
notice: /Stage[main]/Mediawiki/Exec[check settings]/returns: executed successfully
info: /Stage[main]/Mediawiki/Exec[check settings]: Scheduling refresh of Exec[mediawiki setup]
notice: /Stage[main]/Mediawiki/Exec[mediawiki setup]/returns: executed successfully
notice: /Stage[main]/Mediawiki/Exec[mediawiki setup]: Triggered 'refresh' from 1 events
notice: /Stage[main]/Mediawiki/Exec[configure phpunit]/returns: executed successfully
notice: /Stage[main]/Mediawiki/File[/usr/local/bin/run-mediawiki-tests]/ensure: defined content as '{md5}6b154f733a6f77b5728e480b2714fe72'
notice: /Stage[main]/Mediawiki/Exec[require extra settings]/returns: executed successfully
err: /Stage[main]/Git/Package[git-review]/ensure: change from absent to 1.23 failed: Could not update: Execution of '/usr/bin/pip install -q git-review==1.23' returned 1:   Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement git-review==1.23
No distributions at all found for git-review==1.23
Storing complete log in /root/.pip/pip.log
at /tmp/vagrant-puppet-1/modules-0/git/manifests/init.pp:32
notice: Finished catalog run in 69.08 seconds

Stderr from the command:

This was the time when i got really frustrated. Even after repeated number of trials i couldn’t succeed. This was mainly because of the proxy and also many websites are blocked in my college. It failed to download few dependencies like phpsh, php5-redis etc. I manually installed them and but ‘vagrant provision’ command gave me the same error everytime. So i was left with one option i.e to install them without proxy connection. I did it and it was successfully installed. This gave me a momentarily relief but the real problems were yet to arrive. Well, i will discuss about them in the next blog. For now I am feeling accomplished after installing this.

So, the correct result that should be displayed on terminal after ‘vagrant provision’ is:

[charul@localhost vagrant]$ vagrant provision
[default] Running provisioner: puppet...
Running Puppet with site.pp...
info: Applying configuration version '1392886401.15b24e4'
info: mount[files]: allowing mediawiki-vagrant access
notice: /Stage[main]/Mediawiki/File[/vagrant/settings.d]/mode: mode changed '0775' to '0755'
notice: Finished catalog run in 5.91 seconds

Now to go to mediawiki main page, go to http://127.0.0.1:8080/wiki/Main_Page.

Screenshot from 2014-02-20 14:34:36

In order to remotely login mediawiki-vagrant from terminal:

 $ vagrant ssh

Screenshot from 2014-02-14 02:47:23

I think this looks cool 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s