Download Open Suse: http://en.opensuse.org and see http://en.opensuse.org/Download_Help
Summary - These tools were configured to use:
- Apache 2.2 web server
- Bison 2.3
- Flex 2.5.33
- Ftp server
- Gcc 4.2.1 (C/C++)
- Java 1.5.0
- Mono (C# cross compiler)
- MySQL (Ver 14.12 Distrib 5.0.45, for suse-linux-gnu (i686) using readline 5.2)
- Perl (v5.8.8 built for i586-linux-thread-multi)
- Php (PHP 5.2.4 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 23 2007 14:12:53))
- phpBB 3.0.1
- Python 2.5.1
- SSH server
Demos
- cgi-bin/hi.cgi (cgi written in Perl)
- cgi-bin/hi.pl (cgi written in Perl)
- cgi-bin/chi.cgi (cgi written in C)
- php/index.php (PHP)
- cgi-python/hi.py?user_name=me
(Python as cgi, use mod_python.cgihandler as handler) - python/index.py (with a function hello(req, who))
(Python, use mod_python.publisher as handler, the better way) - Perl using MySQL database
Apache
- www root is /srv/www/htdocs/
- config files are in /etc/apache2/
- See apache.txt for configuration change.
Crontab
MySQL- Install notes
- See Setup guide
- The Perl-DBD-MySQL module was missing. So download and install using YaST.
- DBD::mysql module note
- DBD modules download
- Database auto-backup using crontab
Menhir
- Menhir install records
OCaml
phpBB
- phpBB website
- To install is very easy, follow the instruction guide. Note that the database needs to be created manually.
(For MySQL, in MySQL shell, type "create DATABASE [database_name]")
Python
Ruby on Rails
General note
- Notes on install CPAN modules
- Installing Perl Modules
- In Suse, can use YaST --> Software Management to install new package.
- More notes
=hi.cgi=#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print "<html><head><title>Hello World! </title></head>\n";
print "<body><h1>Hello world! From Perl CGI</h1></body></html>\n";
=hi.pl=
#!/usr/bin/perl
#use CGI qw(:standard);
#use DBI;
#use strict;
#print header;
#print end_html;
print "Content-type: text/html\n\n";
print "<html><head><title>Hello World! </title></head>\n";
print "<body><h1>Hello world! From public_html/cgi-bin/</h1></body></html>\n";
=chi.cgi=
#include <stdio.h>
int main() {
printf("Content-type: text/html\n\n");
printf("hello world from C\n");
return 0;
}
=index.php=
<?php echo "hello world from php!<br/>"; ?>
<?php phpinfo(); ?>
</p>
#!/usr/bin/python
import cgitb; cgitb.enable() # provides HTML error support
import cgi
form = cgi.FieldStorage()
def CGI(content_type = "text/html"):
return 'Content-type: %s\n\n' % content_type
def form_value(key):
"""
Use this simple method to get http POST's
"""
val = form.getlist(key)
if (val == None): return None
return val
user_name = form_value('user_name')
def display_page(name):
print CGI()
print "<html><head><title>"\
"This is %s's page</title>"\
"</head><body><h1>Welcome, %s"\
"</h1><body></html>" %(name, name)
return 1 #
display_page(user_name)
=index.py=
# This is useless
#def html_header(content_type = "text/html"):
# return 'Content-type: %s\n\n' % content_type
def hello(req, who="nobody"):
val = "<html><body><h1>Hello, %s</h1></body></html>" % who;
return val
=everest.pl=
#!/usr/bin/perl -w
use CGI qw(:standard);
use DBI;
use strict;
print header;
#print start_html("Test MySQL Database");
print "<html>\n<head><title>Test MySQL Database</title>\n";
print "<link href="'../everest.css'" rel="'stylesheet'" type="'text/css'">\n";
print "</head>\n<body>\n";
print "<h1>Test MySQL Database</h1><br />\n";
my $dbh;
db_connect();
if (not $dbh) {
print "cannot open databse<br />\n" . DBI::errstr;
exit(0);
}
#print "Database opened<br />\n";
# prepare and execute query
my $sort = param("sort");
my $orderby = param("orderby");
get_sortinfo();
my $query = "SELECT * FROM tblEverest ORDER BY $orderby $sort";
#print $query . "<br />";
my $sth = $dbh->prepare($query);
$sth->execute;
# assign fields to variables
my ($id, $pdate, $pname, $pdesc);
$sth->bind_columns(\$id, \$pdate, \$pname, \$pdesc);
print "rows = " . $sth->rows() . "<br />\n";
# output name list to the browser
print "Data in the tblEverest table:<p>\n";
print "<table class="'dataTbl'">\n";
print "<tr class="'dataTitle'">\n" .
"<td width="50"><a href="'?orderby="id&sort="$sort'">ID</a></td>\n" .
"<td><a href="'?orderby="date&sort="$sort'">Insertion Date</a></td>\n" .
"<td><a href="'?orderby="name&sort="$sort'">Protein name</a></td>\n" .
"<td><a href="'?orderby="desc&sort="$sort'">Description</a></td>\n" .
"</tr>\n";
while($sth->fetch()) {
print "<tr><td>$id</td>";
print "<td>$pdate</td>";
print "<td>$pname</td><td>$pdesc</td></tr>\n";
}
print "</table>\n";
$sth->finish();
# disconnect from database
$dbh->disconnect;
print end_html;
1;
sub get_sortinfo {
if ($orderby eq "" or $orderby eq "id") { $orderby = "tblEverestID"; }
elsif ($orderby eq "date") { $orderby = "InsertDate"; }
elsif ($orderby eq "name") { $orderby = "Name"; }
elsif ($orderby eq "desc") { $orderby = "Description"; }
if ($sort eq "DESC" or $sort eq "") { $sort = "ASC"; }
else { $sort = "DESC"; }
}
sub db_connect() {
my ($db, $host, $userid, $passwd, $connectionInfo);
#database information
$db="dbname";
$host="localhost";
$userid="uid"; # check mysql.user for valid user.
$passwd="pwd";
$connectionInfo="DBI:mysql:$db;$host";
# make connection to database
$dbh = DBI->connect($connectionInfo,$userid,$passwd);
}
=apache.txt=
http://bozziesfw.wordpress.com/2007/02/24/configuring-apache-using-yast-opensuse-102/
Try this, configure apache2 using YaST.
The apache's www folder is in /srv/www/htdocs/
The index.html file for "It works!" is there.
Add this to /etc/apache2/mod_userdir.conf:
<Directory /home/*/public_html/cgi-bin>
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
#SetHandler cgi-script
AddHandler cgi-script .cgi .plx .pp
Order allow,deny
Allow from all
</Directory>
Then restart the httpd server using: /etc/init.d/apache2 force-reload
Then it's ok.
--
php already works by default.
--
Added these to /etc/apache2/mod_userdir.conf:
<Directory /home/*/public_html/python>
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
<Directory /home/*/public_html/cgi-python>
AddHandler mod_python .py
PythonHandler mod_python.cgihandler
PythonDebug On
</Directory>
Now python works:
# cgi-python/hi.py?user_name=me
(Python as cgi, use mod_python.cgihandler as handler)
# python/index.py (with a function hello(req, who))
(Python, use mod_python.publisher as handler, the better way)
=crontab.txt=
crontab -e : edit the crontab file for the current user.
The result is stored one entry for each user in /var/spool/cron/tabs/.
In /etc/ there are these files:
cron.deny, crontab, cron.d, cron.daily, cron.hourly, cron.monthly, cron.weekly.
I have created a cron job to back up wikidb database. The script is:
/srv/www/htdocs/wiki/database_bck/autobackup
Then use "/etc/init.d/cron restart" to restart the cron daemon.
=Mysql install note=
MySQL
Setup: http://vias.org/linux-knowhow/lnag_09_06.html
Suse-Everest:/etc # /usr/bin/mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h host.dummy.edu password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
Suse-Everest:/etc # chown -R mysql /var/lib/mysql
Suse-Everest:/etc # chgrp -R mysql /var/lib/mysql
Suse-Everest:/etc # /usr/share/mysql/mysql.server start
Suse-Everest:/etc # mysqladmin --user=root password '********'
=ocaml.txt=
Download from:
http://caml.inria.fr/download.en.html
http://caml.inria.fr/pub/distrib/ocaml-3.10/ocaml-3.10.2.tar.gz
Copy ocaml-3.10.2.tar.gz to /usr/local/src/, unzip it.
Then read README, then read INSTALL and follow the instruction in it.
--
Objective Caml system has these commands:
ocamlc the batch bytecode compiler
ocamlopt the batch native-code compiler (if supported)
ocamlrun the runtime system for the bytecode compiler
ocamlyacc the parser generator
ocamllex the lexer generator
ocaml the interactive, toplevel-based system
ocamlmktop a tool to make toplevel systems that integrate
user-defined C primitives and Caml code
ocamldebug the source-level replay debugger
ocamldep generator of "make" dependencies for Caml sources
ocamldoc documentation generator
ocamlprof execution count profiler
ocamlcp the bytecode compiler in profiling mode
and also, if you built them during step 5, [yes I did]
ocamlc.opt the batch bytecode compiler compiled with ocamlopt
ocamlopt.opt the batch native-code compiler compiled with ocamlopt
ocamllex.opt the lexer generator compiled with ocamlopt
=More notes=
- switch b/w GUI and command line:
press Ctrl+Alt+F2 to leave the graphical user interface.
If you want to go back to the graphical user interface you
should log out from your shell session first. To do so, type
exit and press Enter. Then press Alt+F7 to switch back to the
graphical user interface.
When you are already logged in to the GNOME or the KDE desktop
and want to start a terminal window within the desktop, press
Alt+F2 and enter konsole (for KDE) or gnome-terminal (for GNOME).
To close the terminal window press Alt+F4.
- Bash shortcut keys
http://linuxhelp.blogspot.com/2005/08/bash-shell-shortcuts.html
- Exmaples.
sudo chown wilber kde_quick.xml
History: You can also search for a certain command in the history.
Press Ctrl+R to start an incremental search function.
Completion: Completing a filename or directory name to its full
length after typing its first letters is another helpful
feature of Bash. To do so, type the first letters then
Browse in the history of executed commands:
press Tab (Tabulator).
8.8 Searching for Files or Contents: locate, find, grep.
locate .gnome
find ~ -name *.txt
grep "music is great" ~*.*
8.10 Redirection and pipe:
ls -l >> filelist.txt
ls -l | grep tux
8.11 Handling Processes
Press Ctrl+Z to suspend the process and enter bg to send
the process to the background.
Sending a process to the background directly when starting
it. To do so, add an ampersand at the end of the command.
-jobs-
Whereas job only shows the background processes started from
a specific shell, the ps command (run without options) shows
a list of all your processes—those you started.
To bring a job to the foreground again, enter fg job number.
Use the kill command to stop a process. This sends a TERM signal
that instructs the program to shut itself down.
e.g., kill 30187
// Alternatively, if the program or process you want to terminate
is a background job and is shown by the jobs command, you can also
use the kill command in combination with the job number to
terminate this process:
kill % job number
kill -9 PID // This sends a KILL signal instead of a TERM signal,
bringing the specified process to an end in most cases.
* Show IP: /sbin/ifconfig
* Configure network card for LAN and Internet access: http://www.swerdna.net.au/linhowtonic.html
* Remote admin: http://en.opensuse.org/YaST_Remote_Administration
* VNC (http://www.realvnc.com/):
192.168.100.1:5900 Use F8 to get menu in full screen mode.
* Setting bash: http://tldp.org/LDP/abs/html/sample-bashrc.html
* Reboot: reboot
* Now sshd and apache2 can automatically start at boot time.
* Enable mysql auto start at boot time: Copy "/usr/share/mysql/mysql.server start" to the end of /etc/init.d/rc
* Configure apache2: /etc/apache2/httpd.conf Add "/etc/apache2/httpd.conf.local" to to value of APACHE_CONF_INCLUDE_FILES in /etc/sysconfig/apache2
* Restart apache2: /etc/init.d/apache2 restart
* Apache: http://httpd.apache.org/
* umask 022: umask 022 - Assigns permissions so that only you have read/write access for files, and read/write/search for directories you own. See http://linuxzoo.net/page/sec_umask.html
* crontab
* Show CPU and Memory information:
cat /proc/cpuinfo, cat /proc/meminfo
No comments:
Post a Comment