page_header

donderdag 22 augustus 2013

dinsdag 10 januari 2012

Enable CGI

Before enabling CGI I implemented a HTML redirect along these lines in the root of my public_html folder. Any user is now automatically forwarded to the file basics.html in the directory xhtml_css under cheat.

Created directory cgi-bin under my public html directory;
- mkdir ~/public_html/cgi-bin

To allow the execution of programs in the cgi-bin directory under public_html I added the following section in the configuration file /etc/apache2/mods-enabled/userdir.conf

        <Directory /home/*/public_html/cgi-bin/>
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                SetHandler cgi-script
                Order allow,deny
                Allow from all
        </Directory>

Next I restarted Apache;
- sudo service apache2 restart

To test cgi I first installed Ubuntu's development tools
- sudo apt-get install build-essential

created a small C test project in ~/dev/temp. I used the "Hello world" example from here.
- gcc test.c -o test.cgi
- cp test.cgi ~/public_html/cgi-bin

After delivering the binary I was able to access the functionality on http://192.168.1.249/~hans/cgi-bin/test.cgi

Great stuff!

maandag 9 januari 2012

Started all over again II

Installed Ubuntu server on sda1 with /home on sda3 & included ssh

Changed to fixed IP address

Updated Ubuntu;
- sudo apt-get update
- sudo apt-get upgrade


Restarted Ubuntu;
- sudo shutdown -r now

Installed Apache;
- sudo apt-get install apache2

Edited file /etc/apache2/httpd.conf;
Added line "ServerName 192.168.1.249". File was empty before adding this line.

Restarted Apache;
- sudo /etc/init.d/apache2 restart

Created a directory public_html in my home directory and added a simple index.html file

Enabled Apache userdir module;
- sudo a2enmod userdir

To activate the new configuration I ran;
- sudo service apache2 restart

I could access the previously created html file on http://192.168.1.249/~hans/ !

Installed subversion
- sudo apt-get install subversion

Created a direcory dev in /home and made that directory the current directory
- mkdir dev
- cd dev

Downloaded my cheat sheets from Google code
- svn checkout https://cheat-sheets.googlecode.com/svn/trunk/ cheat-sheets --username myusr@gmail.com

 
Created a symbolic link to the cheat sheets in my development directory
- ln -s ~/dev/cheat-sheets ~/public_html/cheat

I could access the cheat sheets on http://192.168.1.249/~hans/cheat/ !

zondag 8 januari 2012

Started all over again

Installed Ubuntu Server on sda1

Changed to a fixed IP address

Forgot to mount home on sda3 so added this line to fstab;
/dev/sda3 /home ext3 defaults 0 0

Gave sda3 an appropriate  label;
sudo e2label /dev/sda3 UbuntuHome

Installed Apache;
sudo apt-get install apache2

Added ServerName to /etc/apache2/apache2.conf;
ServerName 192.168.1.249

Restarted apache;
sudo /etc/init.d/apache2 restart

In home directory hans created;
subdirectory dev
In dev created www
In www created cgi-bin

Installed subversion;
sudo apt-get install subversion

In directory www executed;
svn checkout https://cheat-sheets.googlecode.com/svn/trunk/ cheat-sheets --username myusr@gmail.com


Checked /etc/apache2/envvars for Apache user and group (www-data)

Created group www-hdr;
sudo addgroup www-hdr

Added members hans & www-data to the new group;
sudo adduser hans www-hdr
sudo adduser www-data www-hdr

Changed group ownership of directories cgi-bin & cheat-sheets;
sudo chgrp www-hdr cgi-bin
sudo chgrp www-hdr cheat-sheets -R

Changed permissions on directories cgi-bin & cheat-sheets;
sudo chmod 750 cgi-bin
sudo chmod -R 740 cheat-sheets

Created symbolic link to directory cheat-sheets;
sudo ln -s /home/hans/dev/www/cheat-sheets /var/www/hdr


Changed ownerhip of the symbolic link;
sudo chown -h hans:www-hdr /var/www/hdr


Update the file default in the sites available directory;
sudo vim /etc/apache2/sites-available/default



zaterdag 7 januari 2012

Enable CGI

Followed instructions on UbuntuGeek

Created a separate directory for cgi programs;
sudo mkdir /var/www/cgi-bin

Updated the Apache configuration file;
sudo vim /etc/apache2/apache2.conf

ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory /var/www/cgi-bin/>
     Options ExecCGI
     AddHandler cgi-script cgi pl
</Directory>

Restarted Apache server

Downloaded subversion client;
sudo apt-get install subversion

Downloaded my cheat sheet code;
cd ~
svn checkout https://cheat-sheets.googlecode.com/svn/trunk/ cheat-sheets --username xxx@gmail.com


maandag 2 januari 2012

Ubuntu 11.10 to the rescue

I gave up on LFS after getting errors while running the test of the glibc compile. Wrong compiler flags, human errors, ... ? Time to move on


Just installed Ubuntu Server 11.10 on /dev/sda1 of NB100. Mapped /dev/sda3 to /home and included OpenSSH in the install.


Assigned a fixed IP address (process described in one of the earlier posts on this blog)


Updated Ubuntu
- sudo apt-get update
- sudo apt-get upgrade


Changed the volume labels
- sudo e2label /dev/sda2 UbuntuServer
- sudo e2label /dev/sda2 UbuntuDesk


Installed Apache
Executed: sudo apt-get install apache2

Worked like a charm, was able to access the server on http://192.168.1.249

Error message on deamon start-up: "Could not reliably determine the server's fully qualified ..."

Added servername to server configuration file;
- sudo vim /etc/apache2/apache2.conf
  added line: ServerName 192.168.1.249

Please note that the correct configuration file is httpd.conf not http.conf as noted in an earlier post.

Restart server: sudo /etc/init.d/apache2 restart

donderdag 29 december 2011

Finished LFS chapter 5

Finished LFS chapter 5. Backed up the $LFS directory;


sudo tar -cvpzf ~/lfs_chptr5.tar.gz $LFS