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.
At completion it will automatically launch the service if you click finish.
Down the bottom right of the screen you should see 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.
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
- In the phpMyAdmin page click “mysql“
- In the tab across the top select “Privileges” then look for the line with “User:root” and “Host:localhost” then click “Edit Privileges“
- Scroll down until you see “Change Password” enter a secure password then hit “Go”
- You should see something like the following image once the password is set successfully
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
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.)
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
- 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
- Continue to scroll down until you see “DocumentRoot”
- Towards the bottom of that segment change “Require local”
- Require all granted
Save it and then restart apache
Wamp -> Apache -> Service -> Restart
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.
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.
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
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
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
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
Configure Apache to Use SSL
wamp -> apache -> apache modules -> ssl_module
wamp -> php -> php extensions ->php_openssl
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”
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”
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
Scroll right down to the bottom and change the line path for CustomLog
“CustomLog “C:/wamp/logs/ssl_request.log”
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
If the wamp icon doesn’t go green then use the following command to check for errors
httpd –t
Check that port 443 is open by running the following in the command prompt:
netstat -an | more
Once the wamp icon is green log in using “https”
https://192.168.1.10/owncloud