I have created a new blog website for myself. While blogger.com was great, I had more fun and flexibility with creating my own and also hosting it myself. So all new stuff will be now going onto:
http://ninjazebra.com
I may transfer articles I have written here as well.
Friday, April 30, 2010
Wednesday, February 11, 2009
Sleepy Orange website Launched
I have launched the Sleepy Oranges site! Woo. Thats two sites live in a short space of time, third site going live soon also.
Now... what do we do in Sleepy Oranges:
Well basically the site is meant to be a contact frontend, and small scale portfolio for a little organisation/business myself and some others are running. We will be offering alot from webpage design and development, to writing small scale software and also some server building and administration.
Visit it: sleepyoranges.com
We are offering very low priced blogspot.com styles and also CSS styled Deviantart journals. Contact us!
Labels:
admin,
administration,
design,
server,
sleepyoranges.com,
software,
web
Friday, April 4, 2008
Eclipse + SVN
This is very simple and quick to do, but first a quick note: I have tried this on Eclipse 3.2 and everything installed fine, but any time I went to do anything with SVN through Eclipse, Eclipse died a horrible death. But I'm not sure if this was an issue with Eclipse 3.2 or the fact it was installed through apt-get on Ubuntu, it all worked first when I used the Eclipse 3.3 manually downloaded from the webpage. Quick note over.
Quick note 2: It should go without saying , but you need to have the Java JDK installed , not just to run eclipse but also to do any compiling with eclipse. My JDK of preference is the latest JDK 6 from sun, just google how to download and install. There is plenty of info out there. Quick note 2 over.
Firstly have Eclipse downloaded. At time of writing I downloaded Eclipse version 3.3.2 from http://www.eclipse.org/downloads/
Unpack the downloaded tar.gz or zip file into the location you want eclipse to run from. If you are using windows run the file "Eclipse.exe" or if you are using some linux distro run "eclipse"
1. Once Eclipse is running, look to the top menu bar, click Help -> Software Updates -> Find and Install.
2. Tick the box "Search for New Features to Install" then Click "Next"
3. Select "New Remote Site" and fill in Name with "Subversion" and URL with http://download.eclipse.org/technology/subversive/0.7/update-site/ then Click ok to add.
4. Repeat step 3 just file in Name with "Subversion Connectors" and URL with http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/
Note: The names are compulsory to fill in but can be called what ever you like.
5. Select the two boxes beside "Subversion" and "Subversion Connectors" and click "Finish"
6. Select all packages that don't cause conflicts, and then Click "Finish"
7. Select all terms and conditions
8. Select "Install All"
9. Let Eclipse restart and you now have you Subversion plugin ready to import a project from a subversion repository and commit code to a subversion repository
Quick note 2: It should go without saying , but you need to have the Java JDK installed , not just to run eclipse but also to do any compiling with eclipse. My JDK of preference is the latest JDK 6 from sun, just google how to download and install. There is plenty of info out there. Quick note 2 over.
Firstly have Eclipse downloaded. At time of writing I downloaded Eclipse version 3.3.2 from http://www.eclipse.org/downloads/
Unpack the downloaded tar.gz or zip file into the location you want eclipse to run from. If you are using windows run the file "Eclipse.exe" or if you are using some linux distro run "eclipse"
1. Once Eclipse is running, look to the top menu bar, click Help -> Software Updates -> Find and Install.
2. Tick the box "Search for New Features to Install" then Click "Next"
3. Select "New Remote Site" and fill in Name with "Subversion" and URL with http://download.eclipse.org/technology/subversive/0.7/update-site/ then Click ok to add.
4. Repeat step 3 just file in Name with "Subversion Connectors" and URL with http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/
Note: The names are compulsory to fill in but can be called what ever you like.
5. Select the two boxes beside "Subversion" and "Subversion Connectors" and click "Finish"
6. Select all packages that don't cause conflicts, and then Click "Finish"
7. Select all terms and conditions
8. Select "Install All"
9. Let Eclipse restart and you now have you Subversion plugin ready to import a project from a subversion repository and commit code to a subversion repository
Ubuntu-64bit Clearsilver Python Fix
I came across this bug after creating a trac environment on my Ubuntu Feisty Fawn 64-bit machine, and also on another machine which had Ubuntu Hardy Heron 64-bit.
I ran the command:
tracd --port 8000 /usr/local/trac/projectName
to test the trac environment before going to the hassle of setting up the apache conf, and I got this error:
Exception happened during processing of request from ('127.0.0.1', 43756)
Traceback (most recent call last):File "SocketServer.py", line 463, in process_request_thread
self.finish_request(request, client_address)
File "SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "SocketServer.py", line 521, in __init__
self.handle()
File "BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "/var/lib/python-support/python2.5/trac/web/wsgi.py", line 174, in handle_one_request
gateway.run(self.server.application)
File "/var/lib/python-support/python2.5/trac/web/wsgi.py", line 87, in run
response = application(self.environ, self._start_response)
File "/var/lib/python-support/python2.5/trac/web/standalone.py", line 88, in __call__
return self.application(environ, start_response)
File "/var/lib/python-support/python2.5/trac/web/main.py", line 352, in dispatch_request
env_paths)
File "/var/lib/python-support/python2.5/trac/web/main.py", line 436, in send_project_index
req.hdf = HDFWrapper(loadpaths)
File "/var/lib/python-support/python2.5/trac/web/clearsilver.py", line 135, in __init__
raise TracError, "ClearSilver not installed (%s)" % e
TracError: ClearSilver not installed (/usr/lib/python2.5/site-packages/neo_cgi.so: undefined symbol: Py_InitModule4)
I did a google search and straight away found the bug description on bugs.launchpad.net for Ubuntu, https://bugs.launchpad.net/ubuntu/+source/clearsilver/+bug/86685.
Descriptions for reasons and fixes were scattered among numerous comments left, but no comment held the complete solution. But what was very definite, was that it was a bug that affected 64-bit installations of Ubuntu.
The fix I put together from the numerous comments left worked on Feisty Fawn, Gutsy Gibbon and Hardy Heron.
Firstly make sure Ubuntu has all the dependencies needed for this:
sudo apt-get install zlib1g-dev python-dev autoconf build-essential build-dep python-clearsilver
Next we want to download the Clearsilver source so we can manually compile it, once compiled all we want is one library from it:
wget http://www.clearsilver.net/downloads/clearsilver-0.10.4.tar.gz
tar zxvf clearsilver-0.10.4.tar.gz
By default the configuration scripts in this source isn't enabled to compile for python2.5, so we need to edit the scripts, firstly edit the file configure on line 6560 add in "2.5":
configure:6560: python_versions="2.5 2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"
And then in the file configure.in on line 250 do the same:
configure.in:250: python_versions="2.5 2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"
Once that is done the steps for compiling are pretty simple:
cd clearsilver-0.10.4
./configure
make
sudo make install
Now we just need to copy one library from the compiled source to replace one file in the python2.5 libraries:
sudo cp -bi python/neo_cgi.so /usr/lib/python2.5/site-packages/neo_cgi.so
Complete!! , hope this helps anyone who had the same problem, and just to make clear this isn't my own work, just what I gathered together from the comments left on https://bugs.launchpad.net/ubuntu/+source/clearsilver/+bug/86685.
I ran the command:
tracd --port 8000 /usr/local/trac/projectName
to test the trac environment before going to the hassle of setting up the apache conf, and I got this error:
Exception happened during processing of request from ('127.0.0.1', 43756)
Traceback (most recent call last):File "SocketServer.py", line 463, in process_request_thread
self.finish_request(request, client_address)
File "SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "SocketServer.py", line 521, in __init__
self.handle()
File "BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "/var/lib/python-support/python2.5/trac/web/wsgi.py", line 174, in handle_one_request
gateway.run(self.server.application)
File "/var/lib/python-support/python2.5/trac/web/wsgi.py", line 87, in run
response = application(self.environ, self._start_response)
File "/var/lib/python-support/python2.5/trac/web/standalone.py", line 88, in __call__
return self.application(environ, start_response)
File "/var/lib/python-support/python2.5/trac/web/main.py", line 352, in dispatch_request
env_paths)
File "/var/lib/python-support/python2.5/trac/web/main.py", line 436, in send_project_index
req.hdf = HDFWrapper(loadpaths)
File "/var/lib/python-support/python2.5/trac/web/clearsilver.py", line 135, in __init__
raise TracError, "ClearSilver not installed (%s)" % e
TracError: ClearSilver not installed (/usr/lib/python2.5/site-packages/neo_cgi.so: undefined symbol: Py_InitModule4)
I did a google search and straight away found the bug description on bugs.launchpad.net for Ubuntu, https://bugs.launchpad.net/ubuntu/+source/clearsilver/+bug/86685.
Descriptions for reasons and fixes were scattered among numerous comments left, but no comment held the complete solution. But what was very definite, was that it was a bug that affected 64-bit installations of Ubuntu.
The fix I put together from the numerous comments left worked on Feisty Fawn, Gutsy Gibbon and Hardy Heron.
Firstly make sure Ubuntu has all the dependencies needed for this:
sudo apt-get install zlib1g-dev python-dev autoconf build-essential build-dep python-clearsilver
Next we want to download the Clearsilver source so we can manually compile it, once compiled all we want is one library from it:
wget http://www.clearsilver.net/downloads/clearsilver-0.10.4.tar.gz
tar zxvf clearsilver-0.10.4.tar.gz
By default the configuration scripts in this source isn't enabled to compile for python2.5, so we need to edit the scripts, firstly edit the file configure on line 6560 add in "2.5":
configure:6560: python_versions="2.5 2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"
And then in the file configure.in on line 250 do the same:
configure.in:250: python_versions="2.5 2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"
Once that is done the steps for compiling are pretty simple:
cd clearsilver-0.10.4
./configure
make
sudo make install
Now we just need to copy one library from the compiled source to replace one file in the python2.5 libraries:
sudo cp -bi python/neo_cgi.so /usr/lib/python2.5/site-packages/neo_cgi.so
Complete!! , hope this helps anyone who had the same problem, and just to make clear this isn't my own work, just what I gathered together from the comments left on https://bugs.launchpad.net/ubuntu/+source/clearsilver/+bug/86685.
Thursday, April 3, 2008
Ubuntu + Apache + Openssl + Certificate Authorithy + Signing Ceritifcate
Clear and well explained OpenSSL documentation is hard to come by, this particular job took me a good week or so to get fully correct, but here is how I managed it:
First off install openssl:
sudo apt-get install openssl
Creating a Certificate Authority
Next we will create the signing Certificate Authority(CA)
Note:
Generally you wouldn't create and use your own CA for public sites, but its great to be able to sign your own certs when developing and testing.
Open up the file "/etc/ssl/openssl.cnf" for editing. I cannot give exact line numbers to edit, because in my experience this config file is changing between nearly every version of openssl. So find this line and edit appropriately:
dir = ./demoCA
Changes to:
dir = /var/ssl/
Now edit the file "/usr/lib/ssl/misc/CA.pl", around line 56 there is the line:
$CATOP="./demoCA";
Change this to:
$CATOP="/var/ssl";
Now create the directory "/var/ssl" :
sudo mkdir /var/ssl
And run the command:
sudo /usr/lib/ssl/misc/CA.pl -newca
Next create the cert as a pem file:
sudo openssl req -config /etc/ssl/openssl.cnf -new -x509 -keyout \
/var/ssl/private/cakey.pem -out /var/ssl/certs/myCA.pem -days 3650
This will create your signing CA for 10 years, we can convert it to a .crt file for a more convenient format:
sudo openssl x509 -in /var/ssl/certs/myCA.pem -out /var/ssl/certs/myCA.crt
Signing A Certificate
Now we can sign a certificate for apache to use to encryption web pages. For apache I create a new directory called "/var/ssl/apacheCerts" to place the certificate and key needed. Theres nearly always three steps involved in creating and signing a cert
1. Creating the key:
sudo openssl genrsa -des3 -out /var/ssl/apacheCerts/server.key 1024
2. Creating the certificate signing request(csr):
sudo openssl req -new -key /var/ssl/apacheCerts/server.key -out \
/var/ssl/apacheCerts/server.csr
3. Creating the certificate(crt) file:
sudo openssl ca -config /etc/ssl/openssl.cnf -in /var/ssl/apacheCerts/server.csr -cert \
/var/ssl/certs/myCA.crt -keyfile /var/ssl/private/cakey.pem -out \
/var/ssl/apacheCerts/server.crt
Activating Https encryption in apache
This step is quite easy to do. Start off by linking the ssl.conf and ssl.load into mods-enabled:
sudo ln -s /etc/apache2/mods-available/ssl.conf /etc/apache2/mods-enabled/
sudo ln -s /etc/apache2/mods-available/ssl.load /etc/apache2/mods-enabled/
Now edit the "/etc/apache2/mods-available/ssl.conf" file and append the following in before the "</IfModule>" tag
SSLCertificateFile "/var/ssl/apacheCerts/server.crt"
SSLCertificateKeyFile "/var/ssl/apacheCerts/server.key"
SSLCACertificateFile "/var/ssl/certs/myCA.crt"
Now edit one last file, "/etc/apache2/sites-available/default" and append the following:
Listen 443
NameVirtualHost *:443
<virtualhost *:443>
SSLEngine on
</virtualhost>
And thats It!! You should now be able to view an encrypted webpage at https://localhost
First off install openssl:
sudo apt-get install openssl
Creating a Certificate Authority
Next we will create the signing Certificate Authority(CA)
Note:
Generally you wouldn't create and use your own CA for public sites, but its great to be able to sign your own certs when developing and testing.
Open up the file "/etc/ssl/openssl.cnf" for editing. I cannot give exact line numbers to edit, because in my experience this config file is changing between nearly every version of openssl. So find this line and edit appropriately:
dir = ./demoCA
Changes to:
dir = /var/ssl/
Now edit the file "/usr/lib/ssl/misc/CA.pl", around line 56 there is the line:
$CATOP="./demoCA";
Change this to:
$CATOP="/var/ssl";
Now create the directory "/var/ssl" :
sudo mkdir /var/ssl
And run the command:
sudo /usr/lib/ssl/misc/CA.pl -newca
Next create the cert as a pem file:
sudo openssl req -config /etc/ssl/openssl.cnf -new -x509 -keyout \
/var/ssl/private/cakey.pem -out /var/ssl/certs/myCA.pem -days 3650
This will create your signing CA for 10 years, we can convert it to a .crt file for a more convenient format:
sudo openssl x509 -in /var/ssl/certs/myCA.pem -out /var/ssl/certs/myCA.crt
Signing A Certificate
Now we can sign a certificate for apache to use to encryption web pages. For apache I create a new directory called "/var/ssl/apacheCerts" to place the certificate and key needed. Theres nearly always three steps involved in creating and signing a cert
1. Creating the key:
sudo openssl genrsa -des3 -out /var/ssl/apacheCerts/server.key 1024
Generating RSA private key, 1024 bit long modulus
.........++++++
....................................................................++++++
e is 65537 (0x10001)
Enter pass phrase for ./client.key: xxxx
Verifying - Enter pass phrase for ./client.key: xxxx
2. Creating the certificate signing request(csr):
sudo openssl req -new -key /var/ssl/apacheCerts/server.key -out \
/var/ssl/apacheCerts/server.csr
Enter pass phrase for ./client.key: xxxx
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [IE]: IE
State or Province Name (full name) []: Ireland
Locality Name (eg, city) []: Dublin
Organization Name (eg, company) []: Test Company
Organizational Unit Name (eg, section) []: Example.com Encrypted Area
Common Name (eg, YOUR name) []: www.example.com
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
3. Creating the certificate(crt) file:
sudo openssl ca -config /etc/ssl/openssl.cnf -in /var/ssl/apacheCerts/server.csr -cert \
/var/ssl/certs/myCA.crt -keyfile /var/ssl/private/cakey.pem -out \
/var/ssl/apacheCerts/server.crt
Using configuration from /etc/ssl/openssl.cnf
Enter pass phrase for /root/keys/topfloorCA/private/cakey.pem: xxxxxxx
....
...
..
.
Sign the certificate? [y/n]: y
1 out of 1 certificate requests certified, commit? [y/n]: y
Write out database with 1 new entries
Data Base Updated
Activating Https encryption in apache
This step is quite easy to do. Start off by linking the ssl.conf and ssl.load into mods-enabled:
sudo ln -s /etc/apache2/mods-available/ssl.conf /etc/apache2/mods-enabled/
sudo ln -s /etc/apache2/mods-available/ssl.load /etc/apache2/mods-enabled/
Now edit the "/etc/apache2/mods-available/ssl.conf" file and append the following in before the "</IfModule>" tag
SSLCertificateFile "/var/ssl/apacheCerts/server.crt"
SSLCertificateKeyFile "/var/ssl/apacheCerts/server.key"
SSLCACertificateFile "/var/ssl/certs/myCA.crt"
Now edit one last file, "/etc/apache2/sites-available/default" and append the following:
Listen 443
NameVirtualHost *:443
<virtualhost *:443>
SSLEngine on
</virtualhost>
And thats It!! You should now be able to view an encrypted webpage at https://localhost
Ubuntu + SVN + Trac + Encryption
Note
I have tried out this setup on Feisty Fawn, Gutsy Gibbon and the new Hardy Heron, all 64 bit versions. On 32 bit Im sure all this works as well, but there is one part to ignore, a bug fix when installing trac.
Well lets start off by installing apache and svn:
sudo apt-get install apache2.2-common libapache2-svn subversion
Now lets create a svn project, I'm going to create a directory in '/usr/local/' to store all svn projects. It's just a personal preference, nothing set in stone :)
sudo mkdir /usr /local/svn
I'm going to create a project called bingBong, so create a sub-directory of this new directory:
sudo mkdir /usr/local/svn/bingBong
Now to create the actually svn project files:
sudo svnadmin create /usr /local/svn/bingBong
Ownership of the directory and files needs to be changed to allow apache to access them:
sudo chown -R www-data /usr/local/svn/bingBong
I'm going to assume here you want all access to this svn repository to be encrypted by ssl, if not ... well just remove all ssl references or ask how. To setup openssl with apache look at my openssl + apache guide, and moving on....
Next we edit the file '/etc/apache2/mods-available/dav_svn.conf' , append to the bottom of the file:
<location /svn/bingBong>
DAV svn
SVNPath /usr/local/svn/bingBong
AuthType Basic
AuthName "Bing Bong Subversion Repository"
AuthUserFile /etc/apache2/conf.d/.bingBong.passwd
Require valid-user
SSLRequireSSL
</location>
Create a file called '.bingBong.passwd' in '/etc/apache2/conf.d/' , then run the command with username USER to create the ht password:
sudo htpasswd /etc/apache2/conf.d/.bingBong.passwd USER
You will be prompted to enter a password and then confirm passowrd. This will create a line in that file containing that username and password for a user to access the bingBong svn repository. There are many other ways to authenticate users for svn, all a quick google search away (hint hint). Running this command a second time with a different user name will just append another username and password to the file.
Restart apache:
sudo apache2ctl restart
Now to populate the svn repository with some base directories:
svn mkdir https://localhost/svn/bingBong/repo -m "new project"
svn mkdir https://localhost/svn/bingBong/repo/trunk -m "trunk"
svn mkdir https://localhost/svn/bingBong/repo/branches -m "branches"
svn mkdir https://localhost/svn/bingBong/repo/tags -m "tags"
And now point your browser to https://localhost/svn/bingBong,and you should be prompted with a login. Using the username and password you set earlier with the htpasswd command, you should see the svn repository.
And now that is svn completed. Start next part with installing trac:
sudo apt-get install trac
Similar as with svn, (and just a personal preference), I created a directory in '/usr/local/' to store all my trac project files:
sudo mkdir /usr/local/trac
And then I created a sub-directory of this new directory for our test project bingBong
sudo mkdir /usr/local/trac/bingBong
To create the trac files for this project run:
sudo trac-admin /usr/local/trac/bingBong initenv
You will be asked for a number of inputs on certain variables:
* Project Name [My Project]> Bing Bong
* Database connection string [sqlite:db/trac.db]>
* Repository type [svn]>
* Path to repository [/path/to/repos]> /usr/local/svn/bingBong
* Templates directory [/usr/share/trac/templates]>
Ownership of the directory and files needs to be changed to allow apache to access them:
sudo chown -Rf www-data:www-data /usr/local/trac/bingBong
It was here I ran into a bug with trac, and after a bit of searching discovered it was 64-bit ubuntu related. Its a little bit tricky but very do-able and I have it documented in the ubuntu-64bit clearsilver python fix post.
After applying the fix you can run:
sudo tracd --port 8000 /usr/local/trac/bingBong
You can use this to view your project in trac on you browser at:http://localhost:8000/bingBong
Now to get on with the apache configuration for trac, create a new file called 'tracSites' in '/etc/apache2/sites-available/' , and give it the following content:
###########################
##General Trac
<Directory /usr/share/trac/cgi-bin/ >
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex trac.cgi
</Directory >
<Directory /usr/share/trac/htdocs >
Order allow,deny
Allow from all
</Directory>
##########################
###Bing Bong trac
Alias /trac/bingBong/trac "/usr/share/trac/htdocs/"
Alias /trac/bingBong "/usr/share/trac/cgi-bin/"
<Location "/trac/bingBong">
SSLRequireSSL
DirectoryIndex trac.cgi
SetEnv TRAC_ENV "/usr/local/trac/bingBong"
</Location>
<Location /trac/bingBong/trac.cgi/login>
AuthType Basic
AuthName "Bing Bong Trac"
AuthUserFile /etc/apache2/conf.d/.bingBong.passwd
Require valid-user
</Location>
AddHandler cgi-script .cgi
Restart apache again, but first make a link for the new file you created (if this confuses you, just accept it, its the way the current apache configuration is setup):
sudo ln -s /etc/apache2/sites-available/tracSites /etc/apache2/sites-enabled/
sudo apache2ctl restart
And now you should be able to view the Bing Bong project in trac in a browser at:https://localhost/trac/bingBong
If you want to checkout this project or start adding code to it, I have examples shown using eclispe and some java code in my post on Eclipse and SVN
I have tried out this setup on Feisty Fawn, Gutsy Gibbon and the new Hardy Heron, all 64 bit versions. On 32 bit Im sure all this works as well, but there is one part to ignore, a bug fix when installing trac.
Well lets start off by installing apache and svn:
sudo apt-get install apache2.2-common libapache2-svn subversion
Now lets create a svn project, I'm going to create a directory in '/usr/local/' to store all svn projects. It's just a personal preference, nothing set in stone :)
sudo mkdir /usr /local/svn
I'm going to create a project called bingBong, so create a sub-directory of this new directory:
sudo mkdir /usr/local/svn/bingBong
Now to create the actually svn project files:
sudo svnadmin create /usr /local/svn/bingBong
Ownership of the directory and files needs to be changed to allow apache to access them:
sudo chown -R www-data /usr/local/svn/bingBong
I'm going to assume here you want all access to this svn repository to be encrypted by ssl, if not ... well just remove all ssl references or ask how. To setup openssl with apache look at my openssl + apache guide, and moving on....
Next we edit the file '/etc/apache2/mods-available/dav_svn.conf' , append to the bottom of the file:
<location /svn/bingBong>
DAV svn
SVNPath /usr/local/svn/bingBong
AuthType Basic
AuthName "Bing Bong Subversion Repository"
AuthUserFile /etc/apache2/conf.d/.bingBong.passwd
Require valid-user
SSLRequireSSL
</location>
Create a file called '.bingBong.passwd' in '/etc/apache2/conf.d/' , then run the command with username USER to create the ht password:
sudo htpasswd /etc/apache2/conf.d/.bingBong.passwd USER
You will be prompted to enter a password and then confirm passowrd. This will create a line in that file containing that username and password for a user to access the bingBong svn repository. There are many other ways to authenticate users for svn, all a quick google search away (hint hint). Running this command a second time with a different user name will just append another username and password to the file.
Restart apache:
sudo apache2ctl restart
Now to populate the svn repository with some base directories:
svn mkdir https://localhost/svn/bingBong/repo -m "new project"
svn mkdir https://localhost/svn/bingBong/repo/trunk -m "trunk"
svn mkdir https://localhost/svn/bingBong/repo/branches -m "branches"
svn mkdir https://localhost/svn/bingBong/repo/tags -m "tags"
And now point your browser to https://localhost/svn/bingBong,and you should be prompted with a login. Using the username and password you set earlier with the htpasswd command, you should see the svn repository.
And now that is svn completed. Start next part with installing trac:
sudo apt-get install trac
Similar as with svn, (and just a personal preference), I created a directory in '/usr/local/' to store all my trac project files:
sudo mkdir /usr/local/trac
And then I created a sub-directory of this new directory for our test project bingBong
sudo mkdir /usr/local/trac/bingBong
To create the trac files for this project run:
sudo trac-admin /usr/local/trac/bingBong initenv
You will be asked for a number of inputs on certain variables:
* Project Name [My Project]> Bing Bong
* Database connection string [sqlite:db/trac.db]>
* Repository type [svn]>
* Path to repository [/path/to/repos]> /usr/local/svn/bingBong
* Templates directory [/usr/share/trac/templates]>
Ownership of the directory and files needs to be changed to allow apache to access them:
sudo chown -Rf www-data:www-data /usr/local/trac/bingBong
It was here I ran into a bug with trac, and after a bit of searching discovered it was 64-bit ubuntu related. Its a little bit tricky but very do-able and I have it documented in the ubuntu-64bit clearsilver python fix post.
After applying the fix you can run:
sudo tracd --port 8000 /usr/local/trac/bingBong
You can use this to view your project in trac on you browser at:http://localhost:8000/bingBong
Now to get on with the apache configuration for trac, create a new file called 'tracSites' in '/etc/apache2/sites-available/' , and give it the following content:
###########################
##General Trac
<Directory /usr/share/trac/cgi-bin/ >
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex trac.cgi
</Directory >
<Directory /usr/share/trac/htdocs >
Order allow,deny
Allow from all
</Directory>
##########################
###Bing Bong trac
Alias /trac/bingBong/trac "/usr/share/trac/htdocs/"
Alias /trac/bingBong "/usr/share/trac/cgi-bin/"
<Location "/trac/bingBong">
SSLRequireSSL
DirectoryIndex trac.cgi
SetEnv TRAC_ENV "/usr/local/trac/bingBong"
</Location>
<Location /trac/bingBong/trac.cgi/login>
AuthType Basic
AuthName "Bing Bong Trac"
AuthUserFile /etc/apache2/conf.d/.bingBong.passwd
Require valid-user
</Location>
AddHandler cgi-script .cgi
Restart apache again, but first make a link for the new file you created (if this confuses you, just accept it, its the way the current apache configuration is setup):
sudo ln -s /etc/apache2/sites-available/tracSites /etc/apache2/sites-enabled/
sudo apache2ctl restart
And now you should be able to view the Bing Bong project in trac in a browser at:https://localhost/trac/bingBong
If you want to checkout this project or start adding code to it, I have examples shown using eclispe and some java code in my post on Eclipse and SVN
Tuesday, February 12, 2008
First Java Servlet
The third part of this guide shows how to set up a very simple Java Servlet. When you see the effort that has to be put into this, just to get hello written on a webpage, it seems crazy. But like I said Java servlets are more suited to a full web application.
Part 3:
Start by creating a new directory in your myTests directory called WEB-INF
In the WEB-INF directory create the following directories:
and create the following files:
Move into the src directory,open HelloWorld.java and add the following code:
Run the following command to compile HellowWorld.java
Next edit the web.xml file in the $TOMCAT/webapps/myTests/WEB-INF/ directory:
Restart Tomcat
This is only a quick introduction to JSP scripts and Java servlets, the intention of this particular blog post was to show how to setup tomcat and have a quick look at what tomcat can do. In later entries I hope to show how to do various tasks with Tomcat, JSP and servlets, such as small web applications, tying in Tomcat with a public Apache server, SSL encryption and certificates and anything else that may be requested and is within my knowledge to do.
Part 3:
Start by creating a new directory in your myTests directory called WEB-INF
mkdir WEB-INF
In the WEB-INF directory create the following directories:
mkdir WEB-INF/classes
mkdir WEB-INF/src
and create the following files:
touch WEB-INF/web.xml
touch WEB-INF/src/HelloWorld.java
Move into the src directory,open HelloWorld.java and add the following code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println(”<html>”);
out.println(”<head>”);
out.println(”<title>Hello World</title>“);
out.println(”</head>“);
out.println(”<body>”);
out.println(”Hello World”);
out.println(”</body>”);
out.println(”</html>”);
}
}
Run the following command to compile HellowWorld.java
javac -classpath $TOMCAT/common/lib/servlet-api.jar -d ../classes/ HelloWorld.java
Next edit the web.xml file in the $TOMCAT/webapps/myTests/WEB-INF/ directory:
<web-app>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
</web-app>
Restart Tomcat
sh $TOMCAT/bin/shutdown.shand you should be able to view the new servlet at:
sh $TOMCAT/bin/startup.sh
http://localhost:8080/myTests/HelloWorld
This is only a quick introduction to JSP scripts and Java servlets, the intention of this particular blog post was to show how to setup tomcat and have a quick look at what tomcat can do. In later entries I hope to show how to do various tasks with Tomcat, JSP and servlets, such as small web applications, tying in Tomcat with a public Apache server, SSL encryption and certificates and anything else that may be requested and is within my knowledge to do.
Labels:
HttpServlet,
installation,
java,
Java beans,
java servlet,
JDK,
JSP,
setup,
tomcat,
tomcat 5.5,
tomcat installation,
tomcat setup,
tomcat5,
tomcat5.5
Subscribe to:
Posts (Atom)