Install and Configure ownCloud Server on Windows 7 using Wamp

This article will go through the steps to install and configure everything you will need to setup your own ownCloud Server onto a Windows 7 desktop PC using Wamp.

click here for video tutorial part 1 – wamp and ownCloud

click here for video tutorial part 2 – SSL configuration

Before we start lets go and down load all the files we’ll need to successfully complete this procedure.
We’ll need the following:

  • ownCloud
  • NotePad ++
  • 7zip
  • Wamp – (NOTE: When downloading wamp it may give you a warning that you must have Visual C++ 2010 SP1 and give you a link. Go ahead and click on the link and install Visual C++ if you don’t already have it)

 Wamp Server

Now that we have all the necessary files go ahead and start with the Visual C++ install if needed.
Once that is complete go ahead and install wamp server that you just downloaded.

I would recommend leaving the default install location to “c:\wamp”. Follow the prompts and put in any information that you wish.

1 wamp Install default location

wamp Install default location

At completion it will automatically launch the service if you click finish.
Down the bottom right of the screen you should see  wamp icon pop up and go from Red -> Amber -> Green.
Once it gets to green it means its online and ready.
Now go ahead and open up your browser and in the address bar type in “https://localhost/” and you should see the wampserver home page.

If you see this then apache is ready to go.

1b localhost test in browser

wamp server localhost test in browser

MySql

First we need to setup our MySql database and we start by setting a password for the root user.

Click the wamp icon then phpMyAdmin

wamp -> phpMyAdmin2 mysql phpadmin crop

  • In the phpMyAdmin page click “mysql

2a phpmyadmin

  • In the tab across the top select “Privileges” then look for the line with “User:root” and “Host:localhost” then click “Edit Privileges
2c root privileges

edit root privileges

  • Scroll down until you see “Change Password” enter a secure password then hit “Go”
2d root password

change root password

  • You should see something like the following image once the password is set successfully

2e password set crop

 

 

ownCloud

Extract the ownCloud tar file using 7zip

Extract it into the “www” folder under “c:\wamp” so that the folder path looks like this

c:\wamp\www\owncloud

3 owncloud into wamp

extract owncloud into c:\wamp\www\

Once that’s complete we should now be able to log into ownCloud by typing in the following into the address bar:

https://localhost/owncloud/

  • Create new admin username and password
  • Point to a different location for the data folder if required otherwise leave default
  • MySql settings are as follows
    • User = root
    • Password = the one you create above in phpmyadmin
    • Database name = can be anything you want
    • Localhost = leave default
  • Click finish and it will log you into ownCloud
    (please note the version of ownCloud used in this example is a few years old now so your ownCloud will most likely look slightly different.)
3b MySql Details

owncloud localhost

 

Apache

ownCloud is now running but the problem is that it will only be accessible from the localhost which is not that useful.
Next we’ll go through and configure it so that we can use it on any computer inside your network.

We’ll start by opening Apache config file

Wamp -> Apache -> httpd.conf

4 wamp - apache - httpd crop

 

  • Scroll down until you see “ServerName localhost:80″
  • We want to change this to an IP so that we can get to it from another machine in our local network so change the “localhost” to an IP address specific to your needs
  • ServerName 192.168.1.10:80
4c servername change

servername change localhost to IP

  • Continue to scroll down until you see “DocumentRoot”
  • Towards the bottom of that segment change “Require local”
  • Require all granted
4d documentroot granted

documentroot granted

Save it and then restart apache

Wamp -> Apache -> Service -> Restart

4e restart apache service

Now to test the change. In the browser change localhost with the IP address you just chose

https://192.168.1.10/owncloud

Log back in with your details and test it by using another computer on your local network and log in using the IP.

 

4f owncloud ip login

owncloud ip login

 

Generate a Private Key and Certificate Signing Request

So now that we can access the server from another computer it’s almost useful. Eventually we’ll want to give it access from outside our local network but before we do that it would be prudent to give it some sort of security.

In a command prompt change path to where the file “openssl.exe” is located.

cd c:\wamp\bin\apache\apache2.4.2\bin (remember to change the path to suit your version of apache)

We’ll set the default config file path to avoid errors later with this command

set openssl_conf=c:\wamp\bin\apache\apache2.4.2\conf\openssl.cnf (remember to change the path to suit your version of apache)

Now we’ll need to generate an RSA Private Key and Certificate Signing Request (CSR)

openssl genrsa -des3 -out myserver.key 1024

This command will ask you to enter a pass phrase. Enter a secure password and confirm it.

5 genrsa

set openssl path and genrsa keys

Next, we need to remove the pass phrase from the key to that the server doesn’t pause to request it.

openssl rsa -in myserver.key -out myserver.pem

5 remove pass phrase

remove pass phrase

Now that we’ve created the private key, we need to generate the CSR

openssl req -new -key myserver.key -out myserver.csr

You are about to be asked to enter information that will be incorporated into your certificate request.
There are quite a few fields and you can leave some blank. For some fields there will be a default value.

For this particular field I recommend you put in the local IP that you are using for ownCloud.

Common Name (eg, YOUR name) []:192.168.1.10

5 generate csr

 

Generating a Self-Signed Certificate

To generate a temporary certificate which is good for 365 days, use the following command:

openssl x509 -req -days 365 -in myserver.csr -signkey myserver.key -out myserver.crt

5 self signed certificate

generate self signed certificate

These new keys will be saved under “c:\wamp\bin\apache\apache2.4.2\bin” lets create a common directory for the ssl certificates and move the “myserver.pem” and “myserver.crt” into it.

Create a new folder called “ssl” under “apache2.4.2” directory.

c:\wamp\bin\apache\apache2.4.2\conf\ssl

 

5 move keys to ssl folder

move keys to central ssl folder

 

Configure Apache to Use SSL

wamp -> apache -> apache modules -> ssl_module

5a ssl module enable

ssl module enable

wamp -> php -> php extensions ->php_openssl

5b phpopenssl enable

phpopenssl enable

In explorer locate this file “httpd-ssl” located

c:\wamp\bin\apache\apache2.4.2\conf\extra

We want to change the “virtual_host_default”

Find the following lines and change each to

DocumentRoot “C:/wamp/www/”
ServerName 192.168.1.10:443
Errorlog “C:/wamp/logs/ssl_error.log”
TransferLog “C:/wamp/logs/ssl_access.log”

5c virtual host

virtual host default

Find the lines which says “SSLCertificateFile” and “SSLCertificateKeyFile” and change the path to point to the location where we saved our keys earlier.

SSLCertificateFile “C:/wamp/bin/apache/Apache2.4.2/conf/ssl/myserver.crt”

SSLCertificateKeyFile “C:/wamp/bin/apache/Apache2.4.2/conf/ssl/myserver.pem”

5d ssl certificate file

ssl certificate file and key

 

Find the lines <FilesMatch> and change the line Directory to

“C:/wamp/www/”

Then add the following lines inside those tags:

Options Indexes FollowSymLinks MultiViews

AllowOverride All

Order allow,deny

allow from all

5e files match

files match

Scroll right down to the bottom and change the line path for CustomLog 

“CustomLog “C:/wamp/logs/ssl_request.log”

5e custom log

custom log path

 

Restart Apache

wamp -> apache ->service -> restart

Last, but not least, we need to make sure the secure site is part of the virtual hosts in Apache. Open up “httpd.conf”

wamp -> apache -> httpd.conf

Scroll all the way down to the bottom and underneath #Secure (SSL/TLS) connections remove the hash in front of the following line

Include conf/extra/httpd-ssl.conf

Restart Apache

wamp -> apache ->service -> restart

5e enable ssl conf

enable ssl conf

If the wamp icon doesn’t go green then use the following command to check for errors

httpd –t

5i httpd check

check syntax with httpd -t command

Check that port 443 is open by running the following in the command prompt:

netstat -an | more

5f netstat check 443

check port 443 using netstat command

 

Once the wamp icon is green log in using “https”

https://192.168.1.10/owncloud

5g https owncloud

security certificate error due to being self signed

Success!

5h successful login

successfully logged into ownCloud using https

Now that you can log into your ownCloud securely next would be to allow access remotely (from outside your local network). To do that we need to make some changes in our router.

Click here to learn how to configure remote access.

Tags: