Saturday 7 May 2011

Koha Installation on Ubuntu

Con­fig­ure Linux Permissions

Using Web­min (or another method if you pre­fer) cre­ate a user named “koha” and add it to a group named “koha”:
  1. Sys­tem > Users and Groups
  2. Cre­ate new user” link (above the “Delete/Disable/Enable Selected Users” button)
  3. User­name: koha
  4. Real name: Koha User
  5. Pass­word (Nor­mal Pass­word): {enter a koha admin pass­word here}
  6. Group Mem­ber­ship > Pri­mary Group > New Group: koha
  7. Cre­ate

Con­fig­ure MySQL

These instruc­tions assume you’re using Web­min to con­fig­ure MySQL. If you’re more com­fort­able with another tool or the shell prompt, that’s fine too.
Before you can admin­is­ter MySQL through Web­min it will prompt you for the MySQL admin­is­tra­tive login. The user should be “root”, and the pass­word is the one you cre­ated ear­lier when con­fig­ur­ing LAMP.
First cre­ate a new Koha admin­is­tra­tive user with all per­mis­sions on your server, local­host: Servers > MySQL Data­base Server > User Per­mis­sions (under “Global Options”) > Cre­ate new user (at the top of the page). Fill in the prompts as follows:
Username: { choose a koha administrator name — one word }
Password: { choose a koha administrator password}
Hosts: localhost
Permissions: all permissions
[Create]
Next cre­ate a data­base for Koha to use: Servers > MySQL Data­base Server > Cre­ate a New Data­base (under “MySQL Data­bases”). Leave all options as they default except:
Database name: koha
[Create]
Finally, give your Koha admin­is­tra­tive user full per­mis­sions for the “koha” data­base: Servers > MySQL Data­base Server > Data­base Per­mis­sions (under “Global Options”) > Cre­ate New Data­base Per­mis­sions. Fill in the form as follows:
Databases: Selected (koha)
Username: { enter the koha administrator name from above }
Hosts: from host permissions
Permissions: all permissions

Install Koha

At last!

Ver­ify SAX Parser

Con­firm your sys­tem is using the cor­rect SAX parser (XML::LibXML). After run­ning the fol­low­ing com­mand you should see some­thing like “XML::LibXML::SAX::Parser=HASH(0x81f0a74)”.
cd /build/koha-3.00.00/misc
./sax_parser_print.pl
If you don’t have the right parser your Koha sys­tem will have prob­lems with extended char­ac­ters (e.g., accented char­ac­ters). To cor­rect this prob­lem you’ll need to edit the ParserDetails.ini file. First find the file:
locate ParserDetails.ini
This will prob­a­bly report two files by that name, but one of them should sim­ply be a sym­bolic link to the other in which case you can edit either one. So for exam­ple, if your file is at /etc/perl/XML/SAX/ParserDetails.ini, you would edit it like this:
gedit /etc/perl/XML/SAX/ParserDetails.ini
Impor­tant! The above com­mand might not be the right one for your sys­tem. See the expla­na­tion below.
While the above file loca­tion will be cor­rect for some Ubuntu instal­la­tions, it isn’t the right loca­tion for all of them. That’s why we did the “locate ParserDetails.ini” com­mand above. Use the results of that com­mand to fig­ure out the loca­tion of the ParserDetails.ini file on your sys­tem. If you find mul­ti­ple copies of the file, con­sider edit­ing both of them.
The file should have one or more sec­tions that look some­thing like “[XML::LibXML::SAX::Parser]” fol­lowed by one or more lines of set­tings. To use the right parser, move the “[XML::LibXML::SAX::Parser]” sec­tion (includ­ing the set­tings that fol­low it) to the bot­tom of the file, then retest:
./sax_parser_print.pl

Install Koha Files

First we need to make the Koha application.
The perl Makefile.pl com­mand will run for sev­eral min­utes, ask you sev­eral ques­tions, and gen­er­ate e-reams of diag­nos­tic text. In gen­eral you’ll do well to accept the default answers.
When prompted “Please spec­ify the name of the user that owns the data­base to be used by Koha”, pro­vide login infor­ma­tion for the koha MySQL user you cre­ated ear­lier on this page. The make test and make install com­mands will also run for sev­eral min­utes but you won’t need to answer any prompts.
sudo su
cd /build/koha-3.00.00
perl Makefile.PL
make
make test
make install
Next we need to con­fig­ure Apache to rec­og­nize Koha as a valid web­site. To do this, the default Apache con­fig­u­ra­tion direc­tory needs to have a sym­bolic link to the Koha Apache con­fig­u­ra­tion file, koha-httpd.conf. Cre­ate the sym­bolic link like this:
ln -s /etc/koha/koha-httpd.conf /etc/apache2/sites-available/koha
Next we need to enable a required Apache mod­ule (the rewrite mod­ule) and then enable the Koha site.
a2enmod rewrite
a2ensite koha
We’re almost done! By default Koha uses port 8080 for its admin­is­tra­tive inter­face, the web site library staff will use. We need to tell Apache to accept web page requests on port 8080 in addi­tion to the default port, 80. To do this edit the port con­fig­u­ra­tion file:
gedit /etc/apache2/ports.conf
Add this line then save and exit.
Listen 8080
Finally, restart Apache to put the new con­fig­u­ra­tion set­tings into effect:
/etc/init.d/apache2 restart

Friday 6 May 2011

MY SQL Configration on Linux

MYSQL

INSTALLING

Install the rpm of Mysql.

PROCESS OF MYSQL CONFIGURATION

1.     Show “my.cnf” file by following command.
Its configuration file made in /etc directory with the name of “my.cnf”
root@amirpc ~]#cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
        # clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
2. Mysql server socket created in following directory.
root@amirpc ~]# /var/lib/mysql
3. Start services by following command.
 
root@amirpc ~]#service mysqld start
4. Use Mysql by following command.
root@amirpc ~]#mysql

JDK Installation on Linux


DOWNLOADING

Download the latest version of JDK from http://www.java.sun.com. I have downloaded jdk-1_5_0_05-linux-i586-rpm.bin 

PROCESS OF JDK CONFIGURATION

1.     Install jdk by using following command
[root@localhost ~]#chmod a+x jdk-1_5_0_05-linux-i586-rpm.bin
 
[root@localhost ~]#rpm ./jdk-1_5_0_05-linux-i586.bin
 
Note: that the initial "./" is required if you do not have "." in your PATH environment variable.
 
This command creates a directory called jdk1.5.0_05 in your home directory. 
 
2. Path setting process
Go in /etc directory n open file named profile by this command 
 
root@localhost ~]#cat /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
        if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
           if [ "$2" = "after" ] ; then
              PATH=$PATH:$1
           else
              PATH=$1:$PATH
           fi
        fi
}
# Path manipulation
if [ `id -u` = 0 ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        . $i
    fi
done
unset i
 
3. Change configuration file by following command.
 
root@localhost ~]#vi /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
        if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
           if [ "$2" = "after" ] ; then
              PATH=$PATH:$1
           else
              PATH=$1:$PATH
           fi
        fi
}
# Path manipulation
if [ `id -u` = 0 ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi
JAVA_HOME="/usr/java/jdk1.5.0_05"
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        . $i
    fi
done
unset i
unset pathmunge
 
4. Run JDk by following command.
 
root@localhost ~]# javac
5. Make a java program by following command
root@localhost ~]#vi HelloWorld.java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
6. Compiling steps
[root@localhost  ~]#javac HelloWorld.java
       [root@localhost  ~]# java HelloWorld
      Hello World

Enabling failover routing:

After you have configured your network, the next step is to enable failover routing on your Linux box, so that if the first route dies the router will automatically switch over to the next route. To do so, you'll need to add the default gateway routes provided to you by your ISPs for both your network cards: 
 
# route add default gw 61.16.130.97 dev eth0
 
# route add default gw 200.15.110.90 dev eth1
 
Finally,
 
Modify the /proc/sys/net/ipv4/route/gc_timeout file. This file contains a numerical value that denotes the time in seconds after which the kernel declares a route to be inactive and automatically switches to the other route if available. Change its default value of 300 seconds to some smaller value, say 10 or 15. Save the changes and exit.
 
# echo "10" > /proc/sys/net/ipv4/route/gc_timeout
 
Now your Linux machine is ready to serve as a failover router, automatically and quickly switching to the secondary route every time the primary route fails.

Wine Offline installation !

 1-apt-get --print-uris --yes install wine | grep ^\' | cut -d\' -f2 > abc.html
 2-mkdir  wine
 3-wget --input-file wine.html
4-dpkg -i *.deb

Script to Create Multiple users on Linux !

Adding multiple users to Ubuntu  Server using a script

These two scripts are very important for the system admin who regularly works with mail servers and somehow forgets to backup his system username and password! Let’s say somehow we lost the usernames and passwords of the mail server. In this case the admin has to manually create all the users and then change the passwords for all the users. Tedious job. Let’s make our life easier.
First create a file which contains all the user name. Something like this:
nurealam
nayeem
mrahman
farid
rubi
sankar

Save the file as userlist.txt. Now create the following bash file:
#!/bin/sh
for i in `more userlist.txt `
do
echo $i
adduser $i
done

Save the file and exit.
chmod 755 userlist.txt
Now run the file:
./userlist.txt
This will add all the users to the system. Now we have to change the passwords. Let’s say we want username123 as password. So for user nayeem the password will benayeem123rubi123 for user rubi and so on.
Create another bash file as follows:
#!/bin/sh
for i in `more userlist.txt `
do
echo $i
echo $i"123" | passwd –-stdin "$i"
echo; echo "User $username’s password changed!"
done

Run the file. All the passwords are changed.
If you want to force all your users to change password, use the following code:
Force all your users to change their passwords because the temporary password is a security risk
#!/bin/sh
for i in `more userlist.txt `
do
echo $i
echo $i | change -d 0 "$i"
echo; echo "User $i will be forced to change password on next login!"
done

I then log as that user and see this
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for user amcorona.
Changing password for amcorona
(current) UNIX password:

DLL (Dynamic Link Library)

1) Short for Dynamic Link Library, a library of executable functions or data that can be used by a Windows application. Typically, a DLL provides one or more particular functions and a program accesses the functions by creating either a static or dynamic link to the DLL. A static link remains constant during program execution while a dynamic link is created by the program as needed. DLLs can also contain just data. DLL files usually end with the extension .dll,.exe., drv, or .fon.
A DLL can be used by several applications at the same time. Some DLLs are provided with the Windows operating system and available for any Windows application. Other DLLs are written for a particular application and are loaded with the application.
2) Short for Delay Locked Loop, Delay-Locked Loop (DLL) supports high-bandwidth data rates between devices. These DLLs are circuits that provide zero propagation delay, low-clock skew between output clock signals throughout a device, and advanced clock domain control. These dedicated DLLs can be used to implement several circuits that improve and simplify system level design.

Networking in Virtual Box

For those of you working on the ARP project you need to send and receive packets form your Ubuntu VM to the actual physical network. In order to do this you would need to setup network adapter to Bridged networking. In this mode you can sniff traffic on the actual physical network from within your VM and also inject packets into it.

Note: You should turn of Vbox DHCP server before you proceed. In order to do so follow my older post http://zaidmunir.blogspot.com/2010/07/how-to-enabledisable-virtualboxs-dhcp.html

Follow these steps for a hassle free setup.
1. Shut down VM.
2. Open its settings in VBox and goto settings->network
3. Over here click on all the adapter tabs and make sure that enable adapter is unchecked. You should only check this for the adapter you wish to use. In our case adapter 1.
4. In the 'Attached to' field select 'Bridged adapter' and in the 'name' field select the name of the adapter you want to make the bridge with.
5. Now run your VM and find out the name for your interface using the command ifconfig. In this example it is assumed to be eth1.
6. In case the DHCP server on your local LAN physical LAN is working follow step 7 or jump to step 8.
7. Now open and edit the /etc/network/interfaces file. It should look something like this

Preview:
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet dynamic

And now you can try pinging the host machine and machines on the physical network and all should be well :)

8. See the network settings for your host machine. Now we wish to assign the guest machine an IP which is on the same network as that of the host machine. In my case the host machine has the following configuration

Preview:
IP 172.16.1.10
subnet 255.255.0.0
default gateway 172.16.1.1
DNS 172.16.1.1

So my /etc/network/interfaces file looks something like this

Preview:
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet static
address 172.16.1.103
netmask    255.255.0.0
gateway 172.16.1.1

9. You will now be able to ping the host machine and others machines on the physical network. But you will still not be able to browse through the web. For this you need to make an entry for the DNS server in /etc/resolv.conf

Make the following entries in the file

Preview:
search com
nameserver 172.16.1.1


Note: the entries in your case should correspond to your particular network settings.

Linux Sudo User Configration !

Make sure you do this

sudo dpkg-reconfigure adduser

Give "no" for an answer

Also don't forget to add this line to ~/.profile

umask 077

Then you may also want to do this

cp ~/.profile /etc/skel

this will change the default (pathetic) rights on files created by a user form 755 to 700. Note: this change will only be for users that are added after you made this change.

Or instead of changing and copying the ~./profile into etc/skel you may just simply change /etc/profile. At the end of this file you would find umask 022 change it to 077. Enjoy :)
Reference:
http://ubuntuforums.org/showpost.php?p=4461165&postcount=4

Grub2 Configure on MBR

Boot from a live cd of Ubuntu 10.04.

sudo grub-install --root-directory=/path-of-mounted-drive-with-ubuntu-install /dev/sdx

IP Configration on Ubuntu !

As a first step you should know which interfaces are configured in your machine. You can start by listing all the interfaces using the command: ifconfig

eth1 Link encap:Ethernet HWaddr 08:00:27:31:34:d7
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe31:34d7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1100 errors:0 dropped:0 overruns:0 frame:0
TX packets:1089 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:970170 (970.1 KB) TX bytes:181886 (181.8 KB)

eth2 Link encap:Ethernet HWaddr 08:00:27:96:82:41
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

eth2:avahi Link encap:Ethernet HWaddr 08:00:27:96:82:41
inet addr:169.254.6.94 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:240 (240.0 B) TX bytes:240 (240.0 B)

In the output observe the first column it contains the interface name. You need to know which interface you wish to configure. I would be configuring eth2 in the rest that follows, you can replace eth2 by an interface of your choice.

In Ubuntu the main file in which all the network configuration is /etc/network/interfaces.

Before you start editing system files its a good practice to take back up, in case you screw something up, you can restore the file using the backed up file. You can back up the file by using the following command:

sudo cp interfaces interfaces.bak

First, what if you want to make an interface acquire a dynamic configuration using DHCP. in that case open the /etc/network/interfaces using your favorite editor. Note: In order to make changes to this file you need to be an administrator. To do this you need to use the sudo prefix:

sudo gedit /etc/network/interfaces

Look for an entry for the interface on which you wish to use DHCP. If there is one remove it and then add the following:

auto eth2
iface eth2 inet dhcp
Now you need to restart the network. Use the following command:

sudo /etc/init.d/networking restart

Part 2: What if you wish to assign a static configuration to the interface.

Once again open the file /etc/network/interfaces and search for the interface of your choice. Remove all the entries for it below the line auto eth2 (be careful not to remove the configuration for other interfaces). In my case I wish to have the following configuration

Desired new sample settings:
=> Host IP address 192.168.1.100
=> Netmask: 255.255.255.0
=> Network ID: 192.168.1.0
=> Broadcast IP: 192.168.1.255
=> Gateway/Router IP: 192.168.1.254
=> DNS Server: 192.168.1.254

Add the following lines to the file

auto eth2
iface eth2 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254

Once more, now you need to restart networking. For this use the same command as above: sudo /etc/init.d/networking restart

If you want a more advanced tutorial you can follow http://www.cyberciti.biz/tips/howto-ubuntu-linux-convert-dhcp-network-configuration-to-static-ip-configuration.html