Installing Netjuke on Windows (apache + MySQL edition)

Windows users are often intimidated by the steps involved in installing a web application, but the benefits greatly outweigh the initial overhead.
This guide seeks to ease the pain of Windows users and help Netjuke reach out to a new audience.

**********************************************
PART 1 - Setting up apache, php, and mysql
**********************************************

So before you install netjuke, you need to have these programs up and running:

apache web server
php
mysql database server

----------------------
Install Apache
----------------------

The instructions below are based on apache 2.0.44 so if you install 1.3.27 your mileage may vary.

1. download the win32 MSI installer http://httpd.apache.org/download.cgi

2. Run the apache msi installer and select the defaults install it to c:\apache (or wherever you want...in this guide I'm using C:\apache\apache2 as the directory, but yours might be different and that's ok)

3. Verify Apache can serve up web pages. Open up your web browser and type: http://localhost
The default apache page should load. If it doesn't you might have to create a test web page:

Open up notepad and copy this:

<html>
<head><title>Apache test page</title></head>
<body>
<h1>Test Page</h1>
<p>Apache works!</p>
</body>
</html>

save it as index.html and save it in c:\apache\apache2\htdocs than try http://localhost in your web browser again. If that doesn't work than clear your web browser cache and try it again.


-----------------
Install PHP
-----------------

I installed PHP 4.3.0. Instructions are based on that, so again your mileage may vary.

1. download the win32 zip package http://www.php.net/downloads.php

2. unzip the file to c:\php

3. install PHP for apache as a module - to do that we have COPY the following two files. If you have WinXP stick them in c:\windows\system32 OR if you have W2K/NT4 than c:\winnt\system32

c:\php\php4ts.dll
c:\php\sapi\php4apache2.dll (or phpapache.dll if you are not running apache2)

4. copy the php.ini-dist from the PHP zip file to EITHER (not both) of these locations:

A) your apache install directory. For apache2 it's: c:\apache\apache2
B) to your systemroot directory. For winXP this is: c:\windows for W2K/NT its c:\winnt

5. rename the php.ini-dist file you just copied to php.ini

6. add the following lines to your httpd.conf file. This file is found in c:\apache\apache2\conf\ Save a copy of your current httpd.conf file and name it httpd.conf.bak than add the following lines in and save it:

#
# Load PHP4 for apache as a module
#
LoadModule php4_module c:/php/sapi/php4apache2.dll
AddType application/x-httpd-php .php

If you are not running apache2 than the proper line is:

LoadModule php4_module c:/php/sapi/php4apache.dll

7. Restart Apache and make sure it loads with no errors (e.g. you can bring up the test page from the last example) You can restart apache from the "Controls" shortcuts in your start menu or the apache icon in your system tray

8. Verify PHP for apache works. The easiest way is to open up notepad and insert this sample code:

<html>
<head><title>PHP Test Page</title></head>
<body>
<h1>PHP Test Page</h1>
<p>PHP works!</p>
<p>The current time is <?php echo date('h:i A'); ?></p>
</body>
</html>

save it as test.php and save it in c:\apache\apache2\htdocs Than open up your web browser to http://localhost/test.php and see if it loads.


-----------------
Install MySQL
-----------------

Netjuke may be installed onto either MySQL 3.x or 4.x. MySQL 4.x is known to perform better, but 3.x is thought to be more stable and robust.

1. download the MySQL win32 zip file from http://www.mysql.com/downloads/mysql-3.23.html

2. open the zip file and run setup.exe accept the defaults (installs to c:\mysql)

3. create a shortcut to winmysqladmin.exe which is located in c:\mysql\bin\winmysqladmin.exe and put this shortcut in your startup folder so the mysql database service will start with windows. You don't have to put in in the startup folder, but it makes it easier to start the mysqld-nt.exe program which is needed to service the mysql database. When you start the winmysqladmin tool, make sure the light is green. Also, the first time you run it, you'll be prompted to give an admin user and password for mysql. You can use whatever you want for these. If it doesn't prompt you, that probably means you've installed mysql before and you already have an admin user/password located in C:\WINDOWS\my.ini (or C:\WINNT\my.ini for win2k). Either way, everything should work fine because we'll create a user for the netjuke database later on anyways.

4. click on: "Start" than "Run" than type in cmd

5. At the command prompt type:
c:\mysql\bin\mysql

6. This should connect you to the MySQL monitor which changes the prompt to "mysql>"
At the mysql> prompt type:
show databases;
(This should show you 2 databases called "mysql" and "test"...Make sure there are no error messages or anything)
exit

-----------------
Download Netjuke
-----------------
1. download the latest netjuke (currently 1.0) at http://netjuke.sourceforge.net
2. unzip the file to c:\apache\apache2\htdocs\netjuke
3. read Part 2 to finish the setup


************************************************
PART 2 - Configuring your system for netjuke
************************************************

So you're almost there :) Now you have to make a few changes to your apache/php/mysql setup before you install netjuke

-----------------
Configure MySQL
-----------------

1. First you need to create a database and user account for netjuke to use. To do this, click on "Start" than "Run" than type in cmd
now type the folowing commands:

cd c\:mysql\bin
mysql

This should connect you to the MySQL monitor which changes the prompt to "mysql>"
At the mysql> prompt type:

create database netjuke;
GRANT ALL ON netjuke.* TO wwwtunes@localhost IDENTIFIED BY "passwordhere";
(replace 'wwwtunes' with whatever you want the user name to be. I'm just using wwwtunes as an example. Also replace "passwordhere" with whatever you want the password to be. NOTE: you still need the quotes around the password when you type it)
then type exit

2. Test that you can connect to your new database with the user name and password. Type the following:
mysql -u wwwtunes -p netjuke

it should ask for the password for the wwwtunes user you just created. type it and hit ENTER...this should log you in to the netjuke database

now type:

SHOW DATABASES; (to make sure netjuke shows up)
USE netjuke
SHOW TABLES; (there shouldn't be any tables at this point)
exit

3. That's it for MySQL

--------------------
Install Netjuke
--------------------

1. open your browser and go to http://localhost/netjuke/installer/installer.php
this should load the installer page

2. click the button that says you accpet the terms&conditions

3. a new page should come up...click the "install form" button on this page

4. another page comes up prompting you to enter information about the database. Use the

following:

DB type = mysql
DB host = 127.0.0.1
DB user = wwwtunes (the user you created previously in mysql)
DB password = the corresponding password for wwwtunes user
DB name = netjuke
sys. admin. email = your email address which will be required for the admin login
admin password = a new password for logging into netjuke

5. click on "Proceed With Install" which will either prompt you to save the webpage or bring

up what looks to be a blank webpage. If you are prompted to save the page, just name it

inc-prefs.php and save it to the netjuke/etc directory. If a blank page shows up, view the

source code. That will show you your preferences in php code, which you will then need to

copy and paste into a new notepad file. Then just save that file as inc-prefs.php in the

netjuke/etc directory.

6. now go to http://localhost/netjuke/login.php to log into netjuke. Use the email and

password you just specified, and that should be it! Happy Streaming!

If you have any questions, feel free to email me (James Mulcahey) at j.mulcahey@verizon.net