Difference between revisions of "SRA840 Lab5"

From CDOT Wiki
Jump to: navigation, search
(Varinder Singh)
 
(17 intermediate revisions by 3 users not shown)
Line 29: Line 29:
 
I personally prefer yum and apt-get instead of FreeBSD "port" method. Because they have a great search function that let you search by keyword. Of course you can do the simulatr thing in FreeBSD with some ls command. It's just much more easier in Linux.
 
I personally prefer yum and apt-get instead of FreeBSD "port" method. Because they have a great search function that let you search by keyword. Of course you can do the simulatr thing in FreeBSD with some ls command. It's just much more easier in Linux.
  
 +
2009/04/11
 +
As I mentioned in previous lab, it seems better to install step by step. First, install the latest Apache, it should be 2.2.9 now, and 2.2.11 is coming soon. Then install mod_perl. It seems that the latest perl5.8 or apache2.2 dosen't including mod_perl even if you do 'make config'. So, again, the best way is install apache first, make sure it's running, then go to mod_perl directory to make it. It would be better, if you're using vbox, because 'make' crashes all the time. It's better to install one by one.
  
== Mohak Vyas ==
+
= Mohak Vyas =
  
 
<b># vim /usr/local/etc/apache22/httpd.conf</b>
 
<b># vim /usr/local/etc/apache22/httpd.conf</b>
Line 48: Line 50:
  
  
== Gregory Masseau ==
+
= Katherine Masseau =
  
 
Upon first attempting to install Apache, I chose Apache 2.2. This worked fine, and the installation of itself went alright - problems only occured when I attempted to build mod_python. It appears the version of mod_python included in the ports collection expects Apache 1.3. So, I went back, removed 2.2, and installed 2.1
 
Upon first attempting to install Apache, I chose Apache 2.2. This worked fine, and the installation of itself went alright - problems only occured when I attempted to build mod_python. It appears the version of mod_python included in the ports collection expects Apache 1.3. So, I went back, removed 2.2, and installed 2.1
Line 61: Line 63:
  
 
It would be nice to have a version of mod_python in ports that works properly with Apache 2.2.
 
It would be nice to have a version of mod_python in ports that works properly with Apache 2.2.
 
  
 
= Varinder Singh =
 
= Varinder Singh =
  
For Apche2.0 or Apache2.2  we need  to install a mod_perl3.3.1. By deafult it is not in the ports. So we have to down load the tar.tz and install from there.
+
For Apche2.0 or Apache2.2  we need  to install a mod_python3.3.1. By deafult it is not in the ports. So we have to down load the tar.tz and install from there.
  
 
Step how i did it.
 
Step how i did it.
Line 86: Line 87:
 
make  
 
make  
  
make isntall
+
make install
  
 
to check weather it is installed?
 
to check weather it is installed?
Line 93: Line 94:
 
python25-2.5-2_3 An interpreted object-oriented programing language.
 
python25-2.5-2_3 An interpreted object-oriented programing language.
  
''Installtion of mod_perl2 for Apache22''
+
''Installation of mod_perl2 for Apache22''
 
   cd /usr/ports/www/mod_perl2
 
   cd /usr/ports/www/mod_perl2
  
Line 99: Line 100:
  
 
make install
 
make install
 +
 +
Apache is running Ok. But the python script is not working
 +
I checked the error log for Apache in /var/log/httpd-error.log
 +
 +
"malformed header from script BAD header=Hello World: hello.py"
 +
 +
Oh Finally works. Have put the line header in CGI/Python script the following line after the #!/usr/bin/python line.
 +
 +
<b>print "Content-Type: text/html\n"</b>
 +
 +
now its working fine.
 +
 +
= Kezhong Liang =
 +
 +
Installing mod_perl is easy, I just use command "pkg_add -r mod_perl". But I cannot use this method to install
 +
mod_python. The steps as below are my installing mod_pyhton method:
 +
 +
Firstly, I installed python.
 +
 +
cd /usr/ports/lang/python25
 +
 +
make install clean
 +
 +
rehash
 +
 +
The second, I installed mod_python
 +
 +
cd /usr/ports/distfiles
 +
 +
fetch http://apache.justdn.org/httpd/modpython/mod_python-3.2.10.tgz
 +
 +
tar zxvf mod_python-3.2.10.tgz
 +
 +
cd mod_python-3.2.10
 +
 +
./configure --with-apxs=/usr/local/sbin/apxs
 +
 +
./configure --with-apxs=/usr/local/sbin/apxs --with-python=/usr/local/bin/python2.5
 +
 +
make
 +
 +
make install
 +
 +
The third step, modified httpd.conf file and added the following line into group LoadModule
 +
 +
LoadModule python_module libexec/apache22/mod_python.so
 +
 +
Finally, I tested it, and it is OK.

Latest revision as of 23:31, 16 July 2012

Milton

# cd /usr/ports/www/apache22
# make config
# make install

Then, add the lines:

apache22_enable="YES"
apache22_http_accept_enable="YES"

In the file:

#vi /etc/rc.conf

And then, run the service:

#/usr/local/etc/rc.d/apache22 start

Verify if the server is running:

#netstat -tan

And check if port 80 is open, then:

#telnet localhost 80

If the connections is successful your server is running.

Nestor

When you want to install any package, just go to the port directory and install it. In this case is under www directory, /usr/ports/www/apache13-modperl. It will download from ftp.freebsd.org and start make. The progress took a while since the connection in Seneca is slow. When I install at home it took about 30 minutes to finish 'make' in my VM. And I waited about 3 hours for the make at seneca and it never finished.

I personally prefer yum and apt-get instead of FreeBSD "port" method. Because they have a great search function that let you search by keyword. Of course you can do the simulatr thing in FreeBSD with some ls command. It's just much more easier in Linux.

2009/04/11 As I mentioned in previous lab, it seems better to install step by step. First, install the latest Apache, it should be 2.2.9 now, and 2.2.11 is coming soon. Then install mod_perl. It seems that the latest perl5.8 or apache2.2 dosen't including mod_perl even if you do 'make config'. So, again, the best way is install apache first, make sure it's running, then go to mod_perl directory to make it. It would be better, if you're using vbox, because 'make' crashes all the time. It's better to install one by one.

Mohak Vyas

# vim /usr/local/etc/apache22/httpd.conf

replace the line "ServerAdmin" you@exapmle.com" with the systems administrators e-mail address.

replace "ServerName host.example.com:80" line with hostname of your server accordingly

# echo "apache22_enable="YES" >> /etc/rc.conf

# echo "apache22_http_accept_enable="YES" >> /etc/rc.conf

# apachectl configtest

# /usr/local/etc/rc.d/apache22 start


Katherine Masseau

Upon first attempting to install Apache, I chose Apache 2.2. This worked fine, and the installation of itself went alright - problems only occured when I attempted to build mod_python. It appears the version of mod_python included in the ports collection expects Apache 1.3. So, I went back, removed 2.2, and installed 2.1

After this, the next hurdle was that mod_python expects a single-threaded Python runtime, however, the default in FreeBSD is a threaded runtime. So, it was necessary to deinstall the Python 2.5 port, set the WITHOUT_THREADS environment variable to 1, and rebuild/reinstall Python, after which mod_python will happily build and install.

mod_perl, on the otherhand, was a relatively smooth install, and required nothing beyond just the standard 'make install distclean'. All it's dependencies were present and in a working state by default.

After the software is installed, it is necessary to set the server's name, both by adding the line 'ServerName "fbsd"' to the Apache configuration file at /usr/local/etc/apache/httpd.conf, as well as the line '127.0.0.1 fbsd' into /etc/hosts. After this, the Apache server starts succesfully.

The final hurdle was correcting the provided CGI scripts to behave properly in the CGI environment. It was neccesary to add the line: 'print "Content-Type: text/html\n\n";' to the Perl script and the line 'print "Content-Type: text/html\n"' to the Python script. After these changes, both scripts ran as expected, producing correct output.

It would be nice to have a version of mod_python in ports that works properly with Apache 2.2.

Varinder Singh

For Apche2.0 or Apache2.2 we need to install a mod_python3.3.1. By deafult it is not in the ports. So we have to down load the tar.tz and install from there.

Step how i did it.

1. Install the text based web browser lynx/elinks

  #pkg_add -r elinks

2. Visit the web site http://www.modpython.org/

Downloaded the tar http://east.unified.net/apache/httpd/modpython/mod_python-3.3.1.tgz

3. tar -xvjf mod_python-3.3.1.tgz 4. cd mod_python-3.3.1 5. less README file

then according to instruction.

./configure --with-apxs=/usr/lcoal/apache/sbin/apxs

make

make install

to check weather it is installed?

  1. pkg_info | grep python

python25-2.5-2_3 An interpreted object-oriented programing language.

Installation of mod_perl2 for Apache22

  cd /usr/ports/www/mod_perl2

make

make install

Apache is running Ok. But the python script is not working I checked the error log for Apache in /var/log/httpd-error.log

"malformed header from script BAD header=Hello World: hello.py"

Oh Finally works. Have put the line header in CGI/Python script the following line after the #!/usr/bin/python line.

print "Content-Type: text/html\n"

now its working fine.

Kezhong Liang

Installing mod_perl is easy, I just use command "pkg_add -r mod_perl". But I cannot use this method to install mod_python. The steps as below are my installing mod_pyhton method:

Firstly, I installed python.

cd /usr/ports/lang/python25

make install clean

rehash

The second, I installed mod_python

cd /usr/ports/distfiles

fetch http://apache.justdn.org/httpd/modpython/mod_python-3.2.10.tgz

tar zxvf mod_python-3.2.10.tgz

cd mod_python-3.2.10

./configure --with-apxs=/usr/local/sbin/apxs

./configure --with-apxs=/usr/local/sbin/apxs --with-python=/usr/local/bin/python2.5

make

make install

The third step, modified httpd.conf file and added the following line into group LoadModule

LoadModule python_module libexec/apache22/mod_python.so

Finally, I tested it, and it is OK.