Building OpenCog in a Linux Virtual Machine on Windows

From OpenCog
Jump to: navigation, search

For general instructions see Building OpenCog. Works for Windows 7 and Windows 8.


Install and Cofigure Tools

From Windows PowerShell, install the Chocolatey package manager and some tools as an administrator.

Set-ExecutionPolicy AllSigned; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install -y virtualbox vagrant git

Run Vagrant

The virtual machine created has all the dependencies required for working on cogutils, atomspace, moses, and opencog.

If you are new to vagrant, see https://www.vagrantup.com/docs/why-vagrant/ or https://www.vagrantup.com/docs/getting-started/ if you like to understand what vagrant is. Understanding the working of vagrant is not required for contributing to opencog.

The common steps after installing VirtualBox, git and Vagrant for your os and running a bash(on windows use the equivalent powershell commands) shell are:

mkdir opencog_repos
cd opencog_repos
git clone https://github.com/opencog/opencog

# You can clone other repos if you so choose

ln -s $PWD/opencog/lib/Vagrantfile Vagrantfile
vagrant up
vagrant ssh

# The folder from which your run 'vagrant up' is accessiable at
# '/home/vagrant/opencog' on sshing into the virtual machine.

# Do your thing

exit
vagrant halt


You might need to upgrade Windows Powershell if the command vagrant up hangs

OpenCog First build

Immediately after setting up the virtual machine, you need to follow these instructions to build OpenCog for the first time.

In the vagrant@... window:

cd opencog/
mkdir build
cd build
cmake ..
make

(Optional: If you have configured multiple processors for the virtual machine, you can specify that using the syntax "make -j4" to speed up the build process.)

If you begin to modify source code, see the manual building instructions at Building OpenCog and the git branching and pull request instructions at Development_standards.


Optional

The following are optional steps you can take, and are not tested recently

Python Client

If you will interact with the OpenCog server using the python-client client from the Windows environment, then you will now need to install the following dependencies, **in Windows**.

Install these packages in a command line that has Administrator permissions. After each installation, you need to open a new command line, so that the previously installed package will be available on your path.

python https://www.python.org/downloads/release/python-278/

pip https://pip.pypa.io/en/latest/installing.html

This installed Pip at C:\Python27\Scripts\pip.exe. Find pip.exe on your computer, then add its folder (eg. C:\Python27\Scripts) to your path (Start / Edit environment variables).

IPython http://ipython.org/ipython-doc/stable/install/install.html

pip install requests pip install python-vagrant

Install the Microsoft Visual C++ Compiler for Python 2.7: http://www.microsoft.com/en-us/download/details.aspx?id=44266

pip install pycrypto pip install ecdsa pip install fabric

http://www.graphviz.org/Download_windows.php

Then you must add the bin subfolder from the Graphviz install (eg. C:\Program Files (x86)\Graphviz2.38\bin for example) to your system's path (Start / Edit environment variables).

Enabling X-Windows

It is not necessary to enable X-Windows. However, if you want to, the following steps can be performed.

Also, it should be possible to user other X Windows software, but the following procedure using Cygwin is the one which has been tested.

1. Start to install Cygwin on Windows

http://cygwin.com/install.html

2. When it asks to select packages, you have to change X11 from "Default" to "Install"

3. Run the Cygwin terminal (Cygwin64 Terminal)

4. Type: startxwin (if Windows Firewall alerts you that it is blocking it, enable it)

5. A cygwin terminal with a white background will open. Change to the directory containing the Vagrantfile (replace USERNAME with your username):

cd /cygdrive/c/Users/USERNAME/opencog

6. Connect to the Vagrant box as follows:

ssh -X -p 2222 vagrant@localhost

7. Say 'yes' to the ssh message. When it prompts for a password, use the password "vagrant"

8. As a test, try starting Firefox inside Ubuntu. A Firefox window should open -- in the Windows environment!

sudo apt-get install firefox
firefox &