May 26

How to mount Linux LVM Volume on ubuntu

Ubuntu Comments Off on How to mount Linux LVM Volume on ubuntu

I have 2 harddisk, the first hdd (80 GB) is an empty hdd that i have already installed with new ubuntu server and the other one is an old hdd(180 GB) consist of ubuntu with LVM system. And i am trying to add the oll hdd to my cpu. Here is the 2 hdd detail

# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a4ac8

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        9328    74920960   83  Linux
/dev/sda2            9328        9730     3227649    5  Extended
/dev/sda5            9328        9730     3227648   82  Linux swap / Solaris

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe626e626

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       19426   156039313+  8e  Linux LVM
/dev/sdb2           19427       19457      249007+   5  Extended
/dev/sdb5           19427       19457      248976   83  Linux

As you can see the old hdd ( 160 GB) /dev/sdb1 have LINUX LVM , you need lvm2 so you can mount it, here is the step

#apt-get install lvm2

You need to use pvs command to determine the volume group containing the physical volume /dev/sdb1

# pvs

PV                VG        Fmt   Attr  PSize       PFree
/dev/sdb1   test        lvm2  a-    148.81g    0

You can see there are physical volume named test onsecond hdd /dev/sdb1

let’s list the logical volumes in physical volume named test

# lvdisplay
— Logical volume —
LV Name                /dev/test/root
VG Name                test
LV UUID                1bvHS8-07SA-WuAg-tF5q-eWB5-Lp8a-2cyteC
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                143.08 GiB
Current LE             36629
Segments               1
Allocation             inherit
Read ahead sectors     auto
– currently set to     256
Block device           251:0

— Logical volume —
LV Name                /dev/test/swap_1
VG Name                test
LV UUID                Y6c4ge-sv5W-anJY-e4sH-dis8-a5Qi-rABjMO
LV Write Access        read/write
LV Status              available
# open                 0
LV Size                5.73 GiB
Current LE             1466
Segments               1
Allocation             inherit
Read ahead sectors     auto
– currently set to     256
Block device           251:1

As you can see there are 2 lvm /dev/test/swap_1 and /dev/test/root that actual shortcut from /dev/mapper/test-swap_1 and /dev/mapper/test-root

Now you just need to mount the /dev/testroot to directory you wanted , let say /mnt/oldhdd

# mkdir /mnt/oldhdd

# mount /dev/test/root /mnt/oldhd/

you can see the mount now

df -ah
Filesystem                                         Size  Used Avail Use% Mounted on
/dev/mapper/test-root        141G   27G  108G  20% /mnt/oldhd

May 11

How to install zimbra + mailman on ubuntu

mailman, Ubuntu Comments Off on How to install zimbra + mailman on ubuntu

I assume you have install zimbra on your ubuntu server, if not you may follow step by step zimbra installation on http://prigad.com/?p=565 On this tutorial we will try to install mailing list mailman integrated with zimbra on ubuntu.

Okay without further let’s begin the installation

– Download mailman sourcecode, you can find it on http://www.gnu.org/software/mailman/download.html

wget http://downloads.sourceforge.net/project/mailman/Mailman%202.1%20%28stable%29/2.1.12/mailman-2.1.12.tgz

– extract it
tar xvfz mailman-2.1.12.tgz

– create folder , user and group
# As root
groupadd mailman
useradd -c”GNU Mailman” -s /sbin/nologin -d /no/home -g mailman mailman
cd /usr/local
mkdir mailman
chgrp mailman mailman
chmod a+rx,g+ws mailman

make install
# following is required only if you are using Zimbra’s httpd
cd /usr/local/mailman/archives
chown zimbra private
chmod o-x private
# Check your installation
/usr/local/mailman/bin/check_perms -f

– configure
./configure –with-cgi-gid=zimbra

Now setup the web server. Add following lines at the end of /opt/zimbra/conf/httpd.conf

Code:

#
#  httpd configuration settings for use with mailman.
#

ScriptAlias /mailman/ /usr/local/mailman/cgi-bin/
<Directory /usr/local/mailman/cgi-bin/>
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

Alias /pipermail/ /usr/local/mailman/archives/public/
<Directory /usr/local/mailman/archives/public>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
# Only if you have internationalized archives
AddDefaultCharset Off
</Directory>

# Uncomment the following line, replacing www.example.com with your server’s
# name, to redirect queries to /mailman to the listinfo page (recommended).
# RedirectMatch ^/mailman[/]*$ http://www.example.com/mailman/listinfo

Now copy mailman icons and then restart apache.
Code:

# As User ‘zimbra’
cd /opt/zimbra/httpd/htdocs
mkdir mmimages
cp /usr/local/mailman/icons/* mmimages/
zmapachectl stop
zmapachectl start

Now change postfix configuration.
Add/Modify /opt/zimbra/postfix/conf/main.cf so that following varibles are set as shown.
Code:

but first you need to stop the zimbra first
# /etc/init.d/zimbra stop

virtual_alias_maps = ldap:/opt/zimbra/conf/ldap-vam.cf,hash:/usr/local/mailman/data/virtual-mailman
alias_maps = hash:/etc/aliases,hash:/usr/local/mailman/data/aliases

then edit the /opt/zimbra/conf/zmmta.cf and remove the lines where these variables are otherwise those lines will be deleted when zimbra-postfix will be restarted.

edit and remove
mydestination
virtual_alias_maps
alias_maps
mynetworks

Add following lines at the end of /usr/local/mailman/Mailman/mm_cfg.py file.
Code:

MTA = ‘Postfix’
POSTFIX_ALIAS_CMD = ‘/opt/zimbra/postfix/sbin/postalias’
POSTFIX_MAP_CMD = ‘/opt/zimbra/postfix/sbin/postmap’
IMAGE_LOGOS = ‘/mmimages/’
DEFAULT_URL_PATTERN = ‘http://%s:7780/mailman/’
POSTFIX_STYLE_VIRTUAL_DOMAINS = [ ‘virtual-domain1.com’, ‘virtual-domain2.com’ ]

on mail.test.org
MTA = ‘Postfix’
POSTFIX_ALIAS_CMD = ‘/opt/zimbra/postfix/sbin/postalias’
POSTFIX_MAP_CMD = ‘/opt/zimbra/postfix/sbin/postmap’
IMAGE_LOGOS = ‘/mmimages/’
DEFAULT_URL_PATTERN = ‘http://%s:7780/mailman/’
POSTFIX_STYLE_VIRTUAL_DOMAINS = [ ‘test.org’ ]
#add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
add_virtualhost(‘mail.test.org’,’test.org’)

then start the zimbra
# /etc/init.d/zimbra start

In the last variable, you need to list all your virtual mailbox domains for which you want to add mailing lists. Remember you should ONLY list your virtual domains here, not your local domain for which postfix delivers mail locally.

Now add your first list on virtual domain.
Code:

# As root
# first add a sitewide list called mailman, this is mandatory
cd /usr/local/mailman
bin/newlist mailman
bin/config_list -i data/sitelist.cfg mailman

bin/newlist –emailhost=virtual-domain1.com –urlhost=<your zimbra host> <listname> <admin-email-address> <admin-password>

# This is just to make sure that aliases and virtual-mailman files get generated. Until you add a virtual-domain based list, virtual-mailman won’t be generated.

/usr/local/mailman/bin/genaliases
# aliases and virtual-mailman must be owned by mailman.

chown mailman:mailman /usr/local/mailman/data/aliases*
chown mailman:mailman /usr/local/mailman/data/virtual-mailman*

# setup mailman cron
cd /usr/local/mailman/cron
crontab -u mailman crontab.in

# setup daemon
cp /usr/local/mailman/scripts/mailman /etc/init.d
chkconfig –add mailman

Now your should be able to visit http://<zimbra host>:7780/mailman/listinfo and browse/create new lists etc. And of course you can always use mailman’s command line utilities for list maintainance.

######### How to delete mailing list

1. Delete the list and KEEP the list archives:
$ cd /usr/local/mailman/bin/
$ sudo ./rmlist listname

2. Delete list and DELETE all list archives:

sudo ./rmlist -a listname

– Download mailman sourcecode, you can find it on http://www.gnu.org/software/mailman/download.html

wget http://downloads.sourceforge.net/project/mailman/Mailman%202.1%20%28stable%29/2.1.12/mailman-2.1.12.tgz

– extract it
tar xvfz mailman-2.1.12.tgz

– create folder , user and group
# As root
groupadd mailman
useradd -c”GNU Mailman” -s /sbin/nologin -d /no/home -g mailman mailman
cd /usr/local
mkdir mailman
chgrp mailman mailman
chmod a+rx,g+ws mailman

make install
# following is required only if you are using Zimbra’s httpd
cd /usr/local/mailman/archives
chown zimbra private
chmod o-x private
# Check your installation
/usr/local/mailman/bin/check_perms -f

– configure
./configure –with-cgi-gid=zimbra

Now setup the web server. Add following lines at the end of /opt/zimbra/conf/httpd.conf

Code:

#
#  httpd configuration settings for use with mailman.
#

ScriptAlias /mailman/ /usr/local/mailman/cgi-bin/
<Directory /usr/local/mailman/cgi-bin/>
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

Alias /pipermail/ /usr/local/mailman/archives/public/
<Directory /usr/local/mailman/archives/public>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
# Only if you have internationalized archives
AddDefaultCharset Off
</Directory>

# Uncomment the following line, replacing www.example.com with your server’s
# name, to redirect queries to /mailman to the listinfo page (recommended).
# RedirectMatch ^/mailman[/]*$ http://www.example.com/mailman/listinfo

Now copy mailman icons and then restart apache.
Code:

# As User ‘zimbra’
cd /opt/zimbra/httpd/htdocs
mkdir mmimages
cp /usr/local/mailman/icons/* mmimages/
zmapachectl stop
zmapachectl start

Now change postfix configuration.
Add/Modify /opt/zimbra/postfix/conf/main.cf so that following varibles are set as shown.
Code:

but first you need to stop the zimbra first
# /etc/init.d/zimbra stop

virtual_alias_maps = ldap:/opt/zimbra/conf/ldap-vam.cf,hash:/usr/local/mailman/data/virtual-mailman
alias_maps = hash:/etc/aliases,hash:/usr/local/mailman/data/aliases

then edit the /opt/zimbra/conf/zmmta.cf and remove the lines where these variables are otherwise those lines will be deleted when zimbra-postfix will be restarted.

edit and remove
mydestination
virtual_alias_maps
alias_maps
mynetworks

Add following lines at the end of /usr/local/mailman/Mailman/mm_cfg.py file.
Code:

MTA = ‘Postfix’
POSTFIX_ALIAS_CMD = ‘/opt/zimbra/postfix/sbin/postalias’
POSTFIX_MAP_CMD = ‘/opt/zimbra/postfix/sbin/postmap’
IMAGE_LOGOS = ‘/mmimages/’
DEFAULT_URL_PATTERN = ‘http://%s:7780/mailman/’
POSTFIX_STYLE_VIRTUAL_DOMAINS = [ ‘virtual-domain1.com’, ‘virtual-domain2.com’ ]

on mail.binusian.org
MTA = ‘Postfix’
POSTFIX_ALIAS_CMD = ‘/opt/zimbra/postfix/sbin/postalias’
POSTFIX_MAP_CMD = ‘/opt/zimbra/postfix/sbin/postmap’
IMAGE_LOGOS = ‘/mmimages/’
DEFAULT_URL_PATTERN = ‘http://%s:7780/mailman/’
POSTFIX_STYLE_VIRTUAL_DOMAINS = [ ‘binusian.org’ ]
#add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
add_virtualhost(‘mail.binusian.org’,’binusian.org’)

then start the zimbra
# /etc/init.d/zimbra start

In the last variable, you need to list all your virtual mailbox domains for which you want to add mailing lists. Remember you should ONLY list your virtual domains here, not your local domain for which postfix delivers mail locally.

Now add your first list on virtual domain.
Code:

# As root
# first add a sitewide list called mailman, this is mandatory
cd /usr/local/mailman
bin/newlist mailman
bin/config_list -i data/sitelist.cfg mailman

bin/newlist –emailhost=virtual-domain1.com –urlhost=<your zimbra host> <listname> <admin-email-address> <admin-password>

# This is just to make sure that aliases and virtual-mailman files get generated. Until you add a virtual-domain based list, virtual-mailman won’t be generated.

/usr/local/mailman/bin/genaliases
# aliases and virtual-mailman must be owned by mailman.

chown mailman:mailman /usr/local/mailman/data/aliases*
chown mailman:mailman /usr/local/mailman/data/virtual-mailman*

# setup mailman cron
cd /usr/local/mailman/cron
crontab -u mailman crontab.in

# setup daemon
cp /usr/local/mailman/scripts/mailman /etc/init.d
chkconfig –add mailman

Now your should be able to visit http://<zimbra host>:7780/mailman/listinfo and browse/create new lists etc. And of course you can always use mailman’s command line utilities for list maintainance.

Hope this helps.
Reply With Quote

######### How to delte mailing list

cd /usr/local/mailman/bin/
./rmlist -a listname

./rmlist -a cahpct

1. Delete the list and KEEP the list archives:

$ sudo ./rmlist listname

2. Delete list and DELETE all list archives:

sudo ./rmlist -a listname