Tuesday, August 26, 2008

Installation and Configuration of Joomla CMS! on Debian ETCH

Step 1: Install the LAMP server and also phpmyadmin
See my blogpost "Installation of LAMP on Debian"
#aptitude install phpmyadmin

Step 2: Download Lattest version of Joomla e.g
dwonload from following location
http://linux.softpedia.com/progDownload/Joomla-Download-5739.html

Step 3: make directory under /var/www/joomla and decompress joomla
mkdir /var/www/joomla
cd /var/www/joomla
tar -xvf var/www/Joomla_1.5.6-Stable-Full_Package.tar.gz


Step 4: Create Database in MySQL

#mysqladmin -u root -p create Joomla
mysql -u root -p
mysql>GRANT ALL PRIVILEGES ON Joomla.* TO Joomla@localhost IDENTIFIED BY 'Joomla';
mysql>flush privileges;
mysql>quit


Step 5: Change ownership and priviliges of /var/www/joomla
chown www-data.www-data /var/www/joomla
chmod 777 /var/www/joomla

Notw: Rechange this mode to normal after installation.

Step 6: Begin installattion
http://192.168.100.10/joomla
This will start the wizard, answer the questions, in check list try to eliminate missing components (in red color) and also remember following;
Database Name:Joomla
Database User:Joomla
Password:Joomla
Admin passowrd: you will enter at the end.

At the end this will ask to remove the installation directory.

Further information

http://www.craigschurr.com/index2.php?option=com_content&do_pdf=1&id=16
http://www.linux-vashi.blogspot.com/2008/02/how-to-install-joomla-on-debian-etch_12.html

Import and Export mysql database in Debian using phpmyadmin

Step 1: Install phpmyadmin

aptitude install phpmyadmin

Step 2: Login to phpmyadmin

https://192.168.100.1/phpmyadmin/
Default user: root
Enter root password.

Step 3: Export Database

After log in, click Export
In EXPORT menue select your database
e.g joomla
Select format under Select All/Unselect All
e.g SQL (by default)
Click Save as file e.g jooml
Press Go (botton right)
Save it to your local hard disk

Step 4: Import Database

Press Import after log in to phpmyadmin in other machine.
select the file under Location of the text file,
Leave every thing by default and
Press Go
This will import the mysql database.

Monday, August 25, 2008

Recover MYSQL root password in Debian

Step # 1 : Stop mysql service

# /etc/init.d/mysql stop

Step # 2: Start to MySQL server without password

# mysqld_safe --skip-grant-tables &

Step # 3: Connect to mysql server using mysql client:

# mysql -u root

mysql>
Step # 4: Setup new MySQL root user password

mysql> use mysql;
mysql> update user set password=PASSWORD("imran") where User='root';
mysql> flush privileges;
mysql> quit

Step # 5: Stop MySQL Server:

# /etc/init.d/mysql stop

Step # 6: Start MySQL server

# /etc/init.d/mysql start

Step # 7: Test it
# mysql -u root -p

Installation of LAMP on Debian

Step 1) Installation of Apache and PHP4

aptitude install apache2 php4 libapache2-mod-php4

Step 2) Installation of MySQL Server

aptitude install mysql-server mysql-client php4-mysql

change of MYSQL root Pasword
mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;

step 3) Installation of PhpMyAdmin

aptitude install phpmyadmin

Edit /etc/apache2/apach2.conf:
append at the end
Include /etc/phpmyadmin/apache.conf

Testing

http://domainname.com/phpmyadmin/

Login using mysql root and create users.

Further docs
http://www.howtoforge.com/ubuntu_debian_lamp_server

Installing and configuring DHCP on Debian

Step 1: Install DHCP package

aptitude install dhcp3-server

Step 2: Configure DHCP package

option domain-name "domain.com";
option domain-name-servers 10.0.0.2, 193.10.10.10;
option routers 10.0.0.1;
default-lease-time 3600;
subnet 10.0.0.0 netmask 255.0.0.0 {
arrange 10.0.0.100 10.0.0.254;

#OPTIONS
#if you want to assign IP based on MAC address
host imran {
hardware ethernet 00:50:BA:82:DE:63;
fixed-address 10.10.10.10;
}
}

Step 3: Restart

/etc/init.d/dhcp3-server restart

Further Docs

http://www.debianhelp.co.uk/dhcp.htm

Useful Linux commands

Adding user name and password in authentication file in Apache2

root@jupiter:/etc/apache2# htpasswd /etc/apache2/intranet.passwd halvard

This will append the MD5 password with user in file.

Installation of Java on Ubuntu

root@imran-desktop:~# sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
root@imran-desktop:~# java -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)



Check directory size

du -hs /home/imran/

How to check all installed packaged and version of a specific installed package

dpkg -s apache2
dpkg --list |more

How to Zip and unzipp


#aptitude install zip unzip
zip imran.zip file1 file2 file3

Then you can extract the original files like this:
unzip imran.zip

Thursday, August 21, 2008

How to copy files/directory in Debian using rsync and scp over network

1) Network copying using rsync

Step 1: Install rsync on both machines
aptitude install rsync

Step 2: Edit of /etc/default/rsync on both machines
RSYNC_ENABLE=false
to
RSYNC_ENABLE=true

Step 3: Restart rsync on both machines
/etc/init.d/rsync restart

Step 4: Start copy from machine1 to machine2
rsync -e ssh -avz /home/imran 192.168.100.10:/media/usbdisk/imran
options
a: archive mode perserver file permission
v: verbose
z: compress (this will reduce time)
This will prompt for password, enter password, you will see
building file list..

Backup using Rsync
Make script and place it under /etc/cron.daily.
Generate and copy the key

ssh-keygen -t dsa,
and press Enter when prompted for a passphrase. After the key is created, use
ssh-copy-id -i .ssh/id_dsa.pub root@remote.host.com

to copy the public key to the remote host.

(Note: this presume that SSH is installed with key transfer)


2) Network copying using scp

scp -Cr /home/imran 192.168.100.10:/media/usbdisk

r:recursvly copying
C:exncrytpion 3DES default.
Don't use this method if directory contails too many files.

Further reading:
http://www.crucialp.com/resources/tutorials/server-administration/how-to-copy-files-across-a-network-internet-in-unix-linux-redhat-debian-freebsd-scp-tar-rsync-secure-network-copy.php

Saturday, August 16, 2008

ENABLE AUTHENTICATION ON DEBIAN APACHE WEB SERVER

Step by Step Guide;

Step 1 Enable Digest Authentication
This authentication does not supported by default
#a2enmod auth_digest

Step 2 Set up user/password/realm
htdigest -c /var/www/munin/.htpasswd munin username
munin is realm and username is username.
supply "username" user password,

Step 3 Making Authentication required
go back to /etc/apache2/sites-available/monitoring.

Options FollowSymLinks
AllowOverride None
#authentification
AuthType Digest
AuthName "munin"
AuthDigestFile /var/www/munin/.htpasswd
#people using apache 2.2 will use instead:
#AuthUserFile /var/www/munin/.htpasswd
require valid-user

Step 4 Reload apache configuration
#apache2ctl -t
Syntax OK
$/etc/init.d/apache2 force-reload

Step 5 Tesing and Running
Now, go to http://monitoring.example.com with your browser. A box should prompt you for a username and password. Supply the one you define above and you should be given access to munin statistics.

Monitoring Linux (Debain) Network With Munin

It requires following packages;

• Web Server e.g apache
• Munin Server
• Munin Clients
• Measuring temperature using smartmontools
• Munin Windows plugins
• Documentation and further Reading


WEB SERVER e.g APACHE

Linux Apach2 for debian
#apt-get install apache2-mpm-prefork
Run the script “apache2-ssl-certificate” i.e
# apache2-ssl-certificate

MUNIN ON SERVER

#apt-get install munin munin-node
Edit Configuration
/etc/munin/munin.conf

# a simple host tree
[localhost.localdomain]
address 127.0.0.1
use_node_name yes

[machine1.domain.com]
address xx.xxx.xxx.xx
use_node_name yes

[machine2.domain.com]
address xx.xxx.xxx.xx
use_node_name yes
##please write ip on xx

MUNIN ON CLIENTS
Instlal it in each client
#apt-get install munin-node

change configuration
/etc/munin/munin-node.conf

Edit Configuration on each Client Machine
Client 1 machine1.domain.com
#
# Example config-file for munin-node
#
log_level 4
log_file /var/log/munin/munin-node.log
port 4949
pid_file /var/run/munin/munin-node.pid
background 1
setseid 1
# Which port to bind to;
host *
host 127.0.0.1
host xx.xxx.xxx.xx
## xx server IP
user root
group root
setsid yes
allow ^127\.0\.0\.1$
allow ^xx\.xxx\.xxx\.xx$
Testing
browse under http://ipaddress/munin
Examples can be found here: http://www.linpro.no/projects/munin/example/
If you have any problems you need to check the log files of munin located at /var/
log/munin directory


MEASURING TEMPERATURE USING SMARTMONTOOLS


1.#apt-get install smartmontools
which is apparently needed by munin's hddtemp_smartctl plugin ;
2. and ln -s /usr/share/munin/plugins/hddtemp_smartctl /etc/munin/plugins/hddtemp_smartctl
.. which 'activates' the plugin ;
3. and /etc/init.d/munin-node restart to apply these changes.

WINDOWS PLUGIN
http://www.jory.info/#downloads_muninnode
http://munin.projects.linpro.no/wiki/HowToMonitorWindows
http://www.debuntu.org/book/export/html/134

DOCUMENTATION AND FURTHER READING
http://www.debianhelp.co.uk/munin.htm
http://www.debianhelp.co.uk/munin.htm

Thursday, August 14, 2008

Mounting External USB Disk on Debian

After plugin USB, see any activity
tail -f /var/log/syslog

if nothing about usb mass storage, check reasons. If "no loadable modules!", your old Kernel does not support USB, you might need to upgrade it (depending upon hardware of machine) in my case it was the Via CPU which is not a
full-blown 686.
Then install the new kernel
apt-get install linux-image-2.6.18-4-486

After that config the lilo or grub in our case it was lilo:
edit /etc/lilo.conf
default=2.6.18

Then restart the machine.

check activity and see syslog (see up command)
Kernal find the disk
Aug 14 20:05:11 neptune kernel: usb-storage: device found at 3
Aug 14 20:05:11 neptune kernel: usb-storage: waiting for device to
settle before scanning
Aug 14 20:05:16 neptune kernel: Vendor: ATA Model: SAMSUNG
HD321KJ Rev: CP10
Aug 14 20:05:16 neptune kernel: Type: Direct-Access
ANSI SCSI revision: 05
Aug 14 20:05:16 neptune kernel: SCSI device sda: 625142448 512-byte hdwr
sectors (320073 MB)
Aug 14 20:05:16 neptune kernel: sda: Write Protect is off
Aug 14 20:05:16 neptune kernel: sda: Mode Sense: 00 00 00 00
Aug 14 20:05:16 neptune kernel: sda: assuming drive cache: write through
Aug 14 20:05:16 neptune kernel: SCSI device sda: 625142448 512-byte hdwr
sectors (320073 MB)
Aug 14 20:05:16 neptune kernel: sda: Write Protect is off
Aug 14 20:05:16 neptune kernel: sda: Mode Sense: 00 00 00 00
Aug 14 20:05:16 neptune kernel: sda: assuming drive cache: write through
Aug 14 20:05:16 neptune kernel: sda: sda1 sda2 sda3 sda4
Aug 14 20:05:16 neptune kernel: sd 1:0:0:0: Attached scsi disk sda
Aug 14 20:05:16 neptune kernel: usb-storage: device scan complete

This means that the device was inserted into the kernel as /dev/sda.

From the bottom of the log, you see that the device has four partitions.
(sda1, sda2, sda3, sda4) If you don't know what filesystems they
contain, you can make mount autodetect by:

mount /dev/sda2 /mnt/media

When you finish your work, unmount this can corrupt the file system.

umont /mnt/media


Thanks Fredrik Gratte, from Owera As

Tuesday, August 12, 2008

Squirrelmail Web Client Installatin and Configuration on Debian

Following things are involved.
  1.  MAIL SERVER 'Exim4'
  2.  INSTALLATION OF PACKAGES
  3.  CONFIGURATION
  4.  FURTHER DOCUMENTATION
MAIL SERVER:
We are already running EXIM4, as our mail mail server on a different machine and network with folloing IMAP and SMTP

Imap.domain.com
Smtp.domain.com

No need to install it from scracth.

INSTALLATION OF PACKAGES:
A) Web server Apache with ssl support
Install apache2: apt-get install apach2
install ssl certificate: apt-get install ssl-cert
generate certificate: openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem

country name: NO
state name: Oslo
locality name: Oslo
organizaion name: yourcompany
organizatinal unit: IT
common name: webmail
email addres: youremail@yourdomain.com

B) PHP4 (php5 has some problems)
PHP4 Installation: apt-get install php4

C) UW IMAP
Installation of uw-imapd: apt-get install uw-imapd

D) Squirrelmail
Squirrelmail Installation: apt-get install squirelmail
you can also download from this location and install,
http://www.squirrelmail.org/download.php

CONFIGURATION:

Apache WebServer

chmod 600 /etc/apache2/apache.pem
Enabling SSL Support
a2enmod ssl
Module ssl installed; run /etc/init.d/apache2 force-reload to enable.
Configuring SSL support
Edit /etc/apache2/ports.conf
Listen 443

Edit /etc/apache2/sites-available/default.conf
NameVirtualHost *:443
ServerAdmin webmaster@owera.com
ServerName webmail.owera.com
SSLEngine on
SSLCertificateFile /etc/apache2/apache.pem
DocumentRoot /var/squirrelmail/www/

.
.
Restart apache2
/etc/init.d/apache2 restart

Squirrelmail configuration
After downloading, create directory and unpack
mkdir /var/squirrelmail
cd /var/squirrelmail
mkdir data attachment www
chown -R www-data.www-data /ver/squirrelmail/
chgrp www-data data attachment
chmod 0730 data attachment
tar --bzip2 -xvf /usr/local/src/downloads/squirrelmail-1.4.5.tar.bz2
mv squirrelmail-1.4.5 www
cd www/config
cp -p config_default.php config.php

Edit config.php
Change this to your organization's name.
$org_name = 'YOUR_ORGANIZATION';
Change this to the title you would like shown on the SquirrelMail web page.
$org_title = 'YOUR_TITLE $version';
Change this to the mail domain that is being served by SquirrelMail.
$domain = 'YOUR_MAIL_DOMAIN.com';
Define your SMTP server. This is the name of the server running the Postfix MTA for your mail domain. If Postfix is running on the same server as SquirrelMail then this would be 'localhost'. If it is another server then enter 'SERVERNAME.com'.
$smtpServerAddress = 'localhost';
Define your IMAP server. We always have SquirrelMail running on the same server as IMAP so this will always be 'localhost'.
$imapServerAddress = 'localhost';
Define the IMAP server type. The IMAP package in EnGarde Secure Community 3.0 is 'Washington University' so use 'wu' here.
$imap_server_type = 'wu';
.
.
DOCUMENTATION:

http://www.squirrelmail.org/docs/admin/admin-3.html#ss3.1
http://www.flatmtn.com/computer/Linux-Squirrelmail.html
http://www.engardelinux.org/doc/howtos/install-squirrelmail/install-squirrelmail/config-edit.shtml
http://www.flatmtn.com/computer/Linux-EmailServer.html