My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Ask questions about your setup or get help installing ZCS server (ZD section below).
4414LHammonds
Advanced member
Advanced member
Posts: 148
Joined: Sat Sep 13, 2014 2:14 am

My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Postby 4414LHammonds » Thu Apr 26, 2012 9:01 pm

Greetings and salutations,
I hope this thread will be helpful to those who follow in my foot steps as well as getting any advice based on what I have done / documented. I am a documentation freak so this will probably grow into a very LARGE step-by-step process. If useful, it will probably be best to convert to a wiki once completed.
This is a Work-In-Progress topic so I will be updating this thread as I go through this transition from MS Exchange to Zimbra.
High-level overview
This thread will cover installation of Ubuntu server inside a virtual machine vSphere 4.1 running on ESXi 4.1 servers. Although there is some VMware-specific steps, they are very few and the majority of this documentation will work for other VMs such as VirtualBox or even directly installed onto a physical machine. It will also cover the installation and configuration of Zimbra OSE and the Zimbra desktop client. This is a merge of several other guides, comments and my own experience of putting it all together in one place in a format that is easy for me to follow and reproduce the same results (yes, I create documentation that I will have to re-read one day because of my bad memory problems!). Please excuse my ignorance since I am fairly new to Linux and Zimbra...if you have any advice on doing things better, please let me know. I love feedback and learning better ways of doing things!
Company background and environment
I have finished evaluating different mail options for my company and we decided to make the switch to Zimbra. We are a small shop of about 200 employees and are currently using Microsoft Exchange 2003 on a physical server.
We are going to switch from Exchange to Zimbra. We are not fully utilizing Exchange features and are mainly using it for email, contacts, calendars and shared calendars (for scheduling meeting rooms). We use Active Directory (Windows 2003 domain) to manage users and distribution lists. The desktops are mainly Windows XP and some newer boxes are coming in with Windows 7. We are using Microsoft Outlook with personal folders since we have mailbox size restrictions of 200 MB per mailbox as well as the web interface for people that constantly move from desk-to-desk. iPhones and iPads are also being used as portable devices.
The email server will be sitting behind a firewall on our LAN. Here is a graphic representation of the network layout:
 http://tinyurl.com/7carrg3 />
About the IT staff
We are primarily a Microsoft shop and as such, most of us (3) have Microsoft certifications such as MCSE, MCDBA and MCP. None of us are Unix administrators but we are fairly competent in the use of the system from having to support an AIX server so we are comfortable in the VI editor but know very little in terms of Unix hardware and software administration (just basic user stuff, enough to be dangerous)
The deployment process
Here are the high-level milestones for this project.



  • Phase 1 - Setup a fully-functional system for testing, training and migration.

  • Phase 2 - Create Backup / Restore process and documentation

  • Phase 3 - Install client software on all devices

  • Phase 4 - Create and deploy training materials (web docs / videos)

  • Phase 5 - Migrate users (over a weekend)

  • Phase 6 - Decommission old system (with a flamethrower)


Tools utilized in this process



Helpful links
The list below are sources of information that helped me configure this system as well as some places that might be helpful to me later on as this process continues.



  • Ubuntu Documentation

  • Zimbra Network Edition Documentation (PDF files)

  • Zimbra Open Source Edition Documentation (PDF files)

  • Zimbra Desktop User Guide

  • Ubuntu Firewall Basics

  • Firewall Configuration for Zimbra

  • Ubuntu AppArmor Basics

  • Ubuntu 8 and Zimbra Install Guide

  • Making Zimbra and BIND Work Together

  • Split DNS Guide

  • Z-Push (Over-The-Air ActiveSync)

  • Funambol (Over-The-Air iPhone contact sync)

  • djigzo (email encryption @ the gateway)

  • Mondo Rescue (Ubuntu OS backup)

  • MailArchiva (email Journaling and archival)

  • TurnKeyLinux Zimbra Appliance (fast-n-easy to get running even if you are 100% unfamiliar with Linux/Zimbra)

  • ZeXtras Migration Tool (upgrade OS or change from dedicated to multi-domain server)

  • Location of Zimbra Log Files

  • Zimbra Online Quote Tool


Assumptions
This documentation will need to make use of some very-specific information that will most-likely be different for each person / location. And as such, I will note some of these in this section. They will be highlighted in red throughout the document as a reminder that you should plug-in your own value rather than actually using my "place-holder" value.
Under no circumstance should you use that actual values I list below. They are place-holders for the real thing. This is just a checklist template you need to have answered before you start the install process.
Wherever you see RED in this document, you need to substitute it for what your company uses. Use the list below as a template you need to have answered before you continue.




  • Ubuntu Server name: mail

  • Internet domain: mydomain.com

  • Server domain alias (Windows): work

  • Server fully-qualified windows domain: work.mydomain.com

  • Ubuntu Server IP address: 192.168.107.25 (my attempt at geek humor...raise your hand if you get it)

  • Ubuntu Server IP subnet mask: 255.255.255.0

  • Ubuntu Server IP gateway: 192.168.107.1

  • Internal DNS Server 1: 192.168.107.23

  • Internal DNS Server 2: 192.168.107.212

  • Internal Active Directory: 192.168.107.212

  • External ISP DNS Server 1: 200.100.10.1

  • External ISP DNS Server 2: 200.100.10.2

  • External IP to Domain: 198.100.100.100

  • Ubuntu Admin ID: administrator

  • Ubuntu Admin Password: myadminpass

  • Ubuntu Root Password: myrootpass

  • Zimbra Admin Password: myzimbrapass


I also assume the reader knows how to use the VI editor. If not, you will need to beef up your skill set or use a different editor in place of it.


4414LHammonds
Advanced member
Advanced member
Posts: 148
Joined: Sat Sep 13, 2014 2:14 am

My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Postby 4414LHammonds » Thu Apr 26, 2012 9:07 pm

ANALYSIS AND DESIGN
THE USER BASE WILL PROBABLY NOT EXCEED 300 ANY TIME SOON BASED ON THE COMPANY SIZE OVER THE LAST 80 YEARS.
A SINGLE SERVER DESIGN IS CHOSEN FOR THIS DEPLOYEMENT BASED ON THE AMOUNT OF CURRENT USERS (~200)
THE UBUNTU SERVER LONG-TERM SUPPORT (LTS) IS FREE BUT WE HAVE THE OPTION OF BUY SUPPORT AND THAT IS THE MAIN REASON THIS SERVER WAS SELECTED.
ZIMBRA OSE IS ALSO FREE BUT WE HAVE THE OPTION OF BUYING SUPPORT BY UPGRADING TO THE NETWORK EDITION.
THE UBUNTU LTS / ZIMBRA OSE COMBINATION MAKES FOR AN EXCELLENT CHOICE TO EVALUATE THE PRODUCTS (WITHOUT INCURRING LICENSING FEES) AS WELL AS HAVING AN UPGRADE PATH TO OBTAIN SUPPORT.
MUCH OF HOW THE SYSTEM WILL RUN IS BASED ON HOW YOU INSTALL / CONFIGURE UBUNTU BEFORE YOU EVER INSTALL ZIMBRA.
THE LARGEST DECISION OVER THE CONFIGURATION OF UBUNTU SEEMS TO BE HOW THE HARD DRIVE SPACE IS SLICED UP (PARTITIONED). I LOT OF MY TIME WAS SPENT RESEARCHING AND LEARNING THE VARIOUS OPTIONS WHEN IT COMES TO THE DESIGN LAYOUT OF THE STORAGE.
THE ZIMBRA DOCUMENTATION'S RECOMMENDATION FOR UBUNTU IN THIS AREA BASICALLY SAYS TO PUT EVERYTHING ON ONE LVM/VOLUME. I CAN SEE HOW TECH SUPPORT WOULD WANT TO FAVOR A SETUP LIKE THIS BECAUSE IT MAKES IT EASIER TO TROUBLESHOOT. HOWEVER, I WOULD RATHER MAKE USE OF A DESIGN THAT ALLOWS FOR DYNAMIC GROWTH AND FINE-TUNING IF NEED BE. I ALSO DO NOT LIKE BEING CAUGHT OFFGUARD WITH A SCENARIO WHERE SPACE IS FILLED UP WITH NO IMMEDIATE OPTION OTHER THAN DELETING FILES. LONG-TERM LIFE AND GROWTH OF THE SYSTEM AS WELL AS BUDGETING CONCERNS HAVE TO BE TAKEN INTO CONSIDERATION.
BASED ON MY OBSERVATIONS DURING THE FIRST ZIMBRA INSTALL, I DECIDED THAT A SINGLE VOLUME WASN'T A GOOD IDEA, ESPECIALLY HAVING CONTINUAL-GROWTH OF A FOLDER THAT IS ON THE ROOT VOLUME. I WOULD RATHER CONTAIN THE ROOT VOLUME TO MAINLY JUST STATIC DATA THAT WON'T GROW MUCH AND PUSH THE OTHER FOLDERS THAT ARE DYNAMIC INTO THEIR OWN VOLUMES. IN CASE YOU DON'T KNOW, FILLING UP THE ROOT VOLUME ON A *NIX SYSTEM IS A VERY BAD THING AND SHOULD BE AVOIDED AT ALL COSTS. I ALSO WANT TO CONFIGURE IT WHERE THE FILE SYSTEMS ARE NOT TAKING UP 100% OF THE LOGICAL VOLUME. THIS WILL ALLOW ME (THROUGH AUTOMATED SCRIPTS) TO GROW THE FILE SYSTEM AS NEEDED AND GIVE ME SOME TIME TO ADD MORE DRIVES IF NECESSARY OR SHRINK OTHER VOLUMES TO GET MORE SPACE.
HERE ARE MY THOUGHTS ON HOW TO SLICE UP THE SPACE.




  • BOOT - THIS WILL REMAIN STATIC IN SIZE. IT IS ALSO THE ONLY SPACE RESIDING OUTSIDE THE LOGICAL VOLUME MANAGER (LVM)

  • ROOT VOLUME - OPERATING SYSTEM AND EVERYTHING ELSE WHICH SHOULD REMAIN FAIRLY STATIC.

  • SWAP VOLUME - THIS WILL REMAIN STATIC IN SIZE. HOWEVER, IF AMOUNT OF RAM IS ADJUSTED, THIS SHOULD BE ADJUSTED AS WELL.

  • OPT VOLUME - THIS ZIMBRA STORAGE WILL CONTINUE TO GROW OVER TIME.

  • BACKUP VOLUME - THIS WILL CONTAIN A LOCAL BACKUP OF THE OPT VOLUME AND INDIVIDUALLY COMPRESSED MAILBOX ARCHIVES. SO SPACE NEEDS TO BE AROUND DOUBLE /OPT/ZIMBRA.

  • TEMP VOLUME - THIS LOCATION WILL BE USED TO HOLD DATA DURING BACKUPS, ARCHIVES AND RESTORES AND SHOULD BE ABOUT DOUBLE THE SIZE OF OPT/ZIMBRA.

  • OFFSITE STORAGE - THIS WILL BE HANDLED ELSEWHERE BUT WILL BE MOUNTED ON THIS SERVER.



MY ESTIMATED MAILBOX STORE WILL BE ABOUT 25 GB. HOWEVER, WE WILL START THIS SERVER OFF WITH A MUCH LOWER NUMBER. WE WILL THEN PRETEND SOME EVENT HAPPENED SUCH AS ACQUIRING AN ADDITIONAL COMPANY / EMPLOYEES. THIS WILL INCREASE OUR STORAGE NEEDS AND WE WILL GO THROUGH ADJUSTING THE ENTIRE SYSTEM TO ACCOMMODATE A LARGER STORAGE CAPACITY. THIS WILL BE A GOOD EXERCISE / DOCUMENTATION FOR WHAT WILL EVENTUALLY NEED TO BE DONE LATER TO HANDLE GROWTH.
TO GET A GOOD IDEA OF THE HARD DRIVE LAYOUT AND TO UNDERSTAND THE PROCESS BETTER, HERE IS A GRAPHICAL REPRESENTATION OF THE INITIAL DESIGN FOR THE SERVER:
 HTTP://TINYURL.COM/D4PVYVT />
THESE NUMBERS WILL BE USED FOR THE INITIAL BUILD OF THE SYSTEM:
BOOT = 200 MB

ROOT = 4 GB

SWAP = 8 GB

OPT = 10 GB

TEMP = 20 GB

BACKUP = 20 GB
VIRTUAL MACHINE SETTINGS
VIRTUAL MANAGER: VMWARE VSPHERE CLIENT 4.1

VIRTUAL HOST: VMWARE ESXI SERVER 4.1




  • CONFIGURATION: CUSTOM

  • NAME: ZIMBRAMAIL

  • DATASTORE: MAINOFFICE-LUN0

  • VIRTUAL MACHINE VERSION: 7

  • GUEST OPERATING SYSTEM: LINUX, VERSION: UBUNTU LINUX (64-BIT)

  • NUMBER OF VIRTUAL PROCESSORS: 1

  • MEMORY SIZE: 2048 MB

  • NUMBER OF NICS: 1

  • NIC 1: VM NETWORK

  • ADAPTER: E1000, CONNECT AT POWER ON: CHECKED

  • SCSI CONTROLLER: LSI LOGIC PARALLEL

  • SELECT A DISK: CREATE A NEW VIRTUAL DISK

  • CREATE A DISK: 63 GB, NO THIN PROVISIONING, NO CLUSTER FEATURES, STORE WITH THE VIRTUAL MACHINE

  • ADVANCED OPTIONS: VIRTUAL DEVICE NODE = SCSI (0:0)

  • REMOVE FLOPPY DRIVE

  • MOUNT CD/DVD DRIVE TO UBUNTU ISO (UBUNTU-10.04.4-SERVER-AMD64.ISO). MAKE SURE CD/DVD IS SET TO CONNECT AT POWER ON

  • SET BOOT OPTIONS TO FORCE BIOS SETUP SO YOU CAN SET CDROM TO BOOT BEFORE THE HARD DISK



INSTALL PUTTY
THE 1ST TIME I INSTALLED UBUNTU AND ZIMBRA, I USED THE CONSOLE FOR EVERYTHING BUT IT WAS PAINFULLY SLOW TO VIEW MAN (MANUAL) PAGES AND NAVIGATING IN VI (TEXT EDITOR). HOWEVER, I FOUND OUT THAT PUTTY IS A FAR BETTER SOLUTION FOR YOUR UBUNTU CONSOLE BECAUSE IT HANDLES THE SCREEN DRAWS MUCH FASTER AND ALLOWS FOR SCROLLING AND COPYING TEXT.
DOWNLOAD THE PORTABLE EDITION AND RUN THE INSTALL...EXCEPT IT DOESN'T REALLY "INSTALL" LIKE A NORMAL PROGRAM, IT SIMPLY EXTRACTS TO A SPECIFIED FOLDER AND WILL RUN FROM THAT FOLDER EVEN IF YOU PUT IT ON A USB STICK AND CARRY OVER TO A NEW COMPUTER (REQUIRES NO INSTALL TO RUN AND THUS LEAVES A VERY SMALL FOOTPRINT ON YOUR SYSTEM)




  • START PUTTY

  • TYPE THE FOLLOWING AND CLICK THE SAVE BUTTON:

    HOST NAME: MAIL (OR THE IP SUCH AS 192.168.107.25)

    PORT: 22

    CONNECTION TYPE: SSH

    SAVED SESSIONS: ZIMBRA

  • NOW ALL YOU HAVE TO DO IS DOUBLE-CLICK ON THE ZIMBRA SESSION AND IT WILL CONNECT TO YOUR SERVER (WHEN ONLINE).

4414LHammonds
Advanced member
Advanced member
Posts: 148
Joined: Sat Sep 13, 2014 2:14 am

My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Postby 4414LHammonds » Thu Apr 26, 2012 9:14 pm

INSTALL UBUNTU SERVER
NOTE: DURING THE SETUP PROCESS, WE ARE GOING TO USE THE ROOT ACCOUNT TO MAKE THINGS EASIER. LATER ON, IT WILL BE BEST TO USE THE "SUDO" COMMAND TO ONLY TEMPORARILY GRANT ROOT ACCESS RATHER THAN LOGGING IN WITH ROOT ACCESS.




  • POWER ON THE VIRTUAL MACHINE (VM)

  • PRESS {ENTER} TO ACCEPT ENGLISH

  • SELECT INSTALL UBUNTU SERVER {ENTER}

  • PRESS {ENTER} TO ACCEPT ENGLISH

  • PRESS {ENTER} TO ACCEPT UNITED STATES

  • SELECT NO TO NOT DETECT KEYBOARD LAYOUT

  • PRESS {ENTER} TO ACCEPT USA

  • PRESS {ENTER} TO ACCEPT USA

  • TYPE MAIL {ENTER} (THIS IS YOUR HOSTNAME)

  • PRESS {ENTER} TO ACCEPT DETECTED TIME ZONE (AMERICA/CHICAGO)

  • SELECT MANUAL {ENTER}

  • SELECT SCSI3 (0,0,0) (SDA) - 67.6 GB VMWARE VIRTUAL DISK {ENTER}

  • SELECT YES TO CREATE NEW EMPTY PARTITION TABLE, {ENTER}

  • SELECT PRI/LOG 67.6 GB FREE SPACE {ENTER}

  • SELECT CREATE A NEW PARTITION {ENTER}

  • TYPE 200 MB, {ENTER} (NOTE: THIS WILL BE THE /BOOT PARTITION)

  • SELECT PRIMARY {ENTER}

  • SELECT BEGINNING {ENTER}

  • SELECT USE AS: EXT4 JOURNALING FILE SYSTEM {ENTER}

  • SELECT EXT2 FILE SYSTEM {ENTER}

  • SELECT MOUNT POINT: / {ENTER}

  • SELECT /BOOT - STATIC FILES OF THE BOOT LOADER {ENTER}

  • SELECT BOOTABLE FLAG: OFF {ENTER} (NOTE: THIS TOGGLES IT ON)

  • SELECT DONE SETTING UP THE PARTITION {ENTER}

  • SELECT CONFIGURE THE LOGICAL VOLUME MANAGER {ENTER}

  • SELECT YES TO WRITE CHANGE TO DISKS AND CONFIGURE LVM, {ENTER}

  • SELECT CREATE VOLUME GROUP {ENTER}

  • TYPE LVG {ENTER}

  • SELECT /DEV/SDA FREE #1 (67445; FREE SPACE), {SPACEBAR}, {ENTER}

  • SELECT YES TO WRITE CHANGE TO DISKS AND CONFIGURE LVM, {ENTER}

  • SELECT CREATE LOGICAL VOLUME {ENTER}

  • SELECT LVG (67440MB) {ENTER}

  • TYPE SWAP {ENTER}

  • TYPE 8G {ENTER} (NOTE: THIS IS DOUBLE THE AMOUNT OF RAM)

  • SELECT CREATE LOGICAL VOLUME {ENTER}

  • SELECT LVG (59441MB) {ENTER}

  • TYPE BAK {ENTER}

  • TYPE 20G {ENTER}

  • SELECT CREATE LOGICAL VOLUME {ENTER}

  • SELECT LVG (39443MB) {ENTER}

  • TYPE OPT {ENTER}

  • TYPE 10G {ENTER}

  • SELECT CREATE LOGICAL VOLUME {ENTER}

  • SELECT LVG (29444MB) {ENTER}

  • TYPE TEMP {ENTER}

  • TYPE 20G {ENTER}

  • SELECT CREATE LOGICAL VOLUME {ENTER}

  • SELECT LVG (9445MB) {ENTER}

  • TYPE ROOT {ENTER}

  • TYPE 9445MB {ENTER} (WE ARE LETTING IT TAKE WHAT IS LEFT OVER)

  • SELECT FINISH {ENTER}

  • SELECT #1 8.0 GB DIRECTLY UNDER LVM VG LVG, LV SWAP, {ENTER}

  • SELECT USE AS: DO NOT USE {ENTER}

  • SELECT SWAP AREA {ENTER}

  • SELECT DONE SETTING UP THE PARTITION {ENTER}

  • SELECT #1 9.4 GB DIRECTLY UNDER LVM VG LVG, LV ROOT, {ENTER}

  • SELECT USE AS: DO NOT USE {ENTER}

  • SELECT EXT4 JOURNALING FILE SYSTEM {ENTER}

  • SELECT MOUNT POINT: NONE {ENTER}

  • SELECT / - THE ROOT FILE SYSTEM {ENTER}

  • SELECT DONE SETTING UP THE PARTITION {ENTER}

  • SELECT #1 20.0 GB DIRECTLY UNDER LVM VG LVG, LV BAK, {ENTER}

  • SELECT USE AS: DO NOT USE {ENTER}

  • SELECT EXT4 JOURNALING FILE SYSTEM {ENTER}

  • SELECT MOUNT POINT: NONE {ENTER}

  • SELECT ENTER MANUALLY {ENTER}

  • TYPE /VAR/BACKUP {ENTER}

  • SELECT LABEL: NONE {ENTER}

  • TYPE BACKUP {ENTER}

  • SELECT DONE SETTING UP THE PARTITION {ENTER}

  • SELECT #1 10.0 GB DIRECTLY UNDER LVM VG LVG, LV OPT, {ENTER}

  • SELECT USE AS: DO NOT USE {ENTER}

  • SELECT EXT4 JOURNALING FILE SYSTEM {ENTER}

  • SELECT MOUNT POINT: NONE {ENTER}

  • SELECT /OPT - ADD-ON APPLICATION SOFTWARE PACKAGES {ENTER}

  • SELECT LABEL: NONE {ENTER}

  • TYPE ZIMBRA {ENTER}

  • SELECT DONE SETTING UP THE PARTITION {ENTER}

  • SELECT #1 20.0 GB DIRECTLY UNDER LVM VG LVG, LV TEMP, {ENTER}

  • SELECT USE AS: DO NOT USE {ENTER}

  • SELECT EXT4 JOURNALING FILE SYSTEM {ENTER}

  • SELECT MOUNT POINT: NONE {ENTER}

  • SELECT ENTER MANUALLY {ENTER}

  • TYPE /VAR/TEMP {ENTER}

  • SELECT LABEL: TEMP {ENTER}

  • SELECT DONE SETTING UP THE PARTITION {ENTER}

  • HERE IS WHAT THE SCREEN LOOKS LIKE AT THIS POINT: "PARTITIONS

  • SELECT FINISH PARTITIONING AND WRITE CHANGES TO DISK {ENTER}

  • SELECT YES TO WRITE CHANGES TO DISK, {ENTER}

  • TYPE ADMINISTRATOR, {ENTER} FOR THE FULL NAME (NOTE: DO NOT USE "ZIMBRA" AS A CHOICE HERE)

  • PRESS {ENTER} TO ACCEPT THE DEFAULT OF THE LOWERCASE NAME OF ADMINISTRATOR

  • TYPE MYADMINPASS, {ENTER}, MYADMINPASS, {ENTER}

  • SELECT NO, {ENTER} TO NOT ENCRYPT YOUR HOME DIRECTORY

  • PRESS {ENTER} TO ACCEPT A BLANK LINE FOR THE HTTP PROXY

  • SELECT INSTALL SECURITY UPDATES AUTOMATICALLY, {ENTER}

  • HIGHLIGHT ONLY OPENSSH SERVER AND PRESS {SPACEBAR} TO ENABLE, {ENTER} TO CONTINUE. NOTE: THIS ALLOWS US TO USE PUTTY AFTER INSTALLATION TO CONNECT TO THE SERVER.

  • SELECT YES, {ENTER} TO INSTALL GRUB BOOT LOADER TO THE MASTER BOOT RECORD

  • INSTALLATION COMPLETE - FROM THE VM MENU, SELECT VM --> EDIT SETTINGS AND SELECT CD/DVD DRIVE 1 AND CHANGE TO "CLIENT DEVICE" WHICH WILL EFFECTIVELY REMOVE THE ISO. NOW PRESS {ENTER} TO REBOOT.


INITIAL CONFIGURATIONS




  • AT THE CONSOLE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS)

  • AT THE $ PROMPT, TYPE SUDO PASSWD ROOT {ENTER}, TYPE YOUR ADMINISTRATOR PASSWORD (MYADMINPASS), IT WILL ASK FOR A NEW PASSWORD, TYPE MYROOTPASS AND VERIFY. NOTE: THIS ENABLES THE ROOT ACCOUNT.

  • AT THE $ PROMPT, CHANGE TO THE SUPER USER ROOT ACCOUNT BY TYPING SU {ENTER} AND THEN PROVIDE THE NEW ROOT PASSWORD YOU JUST CONFIGURED.

  • TYPE VI /ETC/NETWORK/INTERFACES {ENTER} AND CHANGE THE FOLLOWING: (WE NEED TO CHANGE THE NETWORK INTERFACE CARD (NIC) FROM USING DHCP TO A STATIC IP)
    FROM:

    IFACE ETH0 INET DHCP

    TO:

    IFACE ETH0 INET STATIC

    ADDRESS 192.168.107.25

    NETMASK 255.255.255.0

    GATEWAY 192.168.107.1

    NETWORK 192.168.107.0

    BROADCAST 192.168.107.255

    NOTE #1: YOU MAY NEED TO MANUALLY REMOVE THE DHCP RECORD (LEASE) ASSOCIATED TO THIS UBUNTU SERVER FROM YOUR DHCP SERVER SO THE CORRECT IP CAN BE FOUND BY OTHER MACHINES ON THE NETWORK. THIS CAN BE AVOIDED BY TEMPORARILY CONFIGURING THE VM NETWORK ADAPTER CONNECTION TO BE "HOST ONLY NETWORK" INSTEAD OF "VM NETWORK" SO THE SERVER IS ISOLATED DURING SETUP...AT LEAST UNTIL YOU REACH THE TESTING OF THE STATIC IP BELOW.
    NOTE #2: YOU MIGHT ALSO NEED TO MANUALLY ADD A HOST(A) RECORD TO YOUR WINDOWS DNS SERVER (FOR MAIL.MYDOMAIN.COM AND MAIL.WORK.MYDOMAIN.COM)

  • RESTART THE NETWORK BY TYPING /ETC/INIT.D/NETWORKING RESTART

  • SANITY CHECK! TYPE IFCONFIG AND MAKE SURE THE SETTINGS ARE CORRECT. THEN TYPE PING GOOGLE> OR SIMILAR AND SEE IF PING WORKS.

  • SHUTDOWN AND POWER OFF THE SERVER BY TYPING SHUTDOWN -P NOW {ENTER}

  • AT THIS POINT FORWARD, YOU CAN USE PUTTY TO ACCESS THE CONSOLE RATHER THAN THE CONSOLE ITSELF FOR BETTER PERFORMANCE, ABILITY TO SCROLL, ETC.

  • IN VM MENU, SELECT VM --> SNAPSHOT --> TAKE SNAPSHOT. GIVE IT A NAME LIKE STEP 1 AND DESCRIPTION OF UBUNTU SERVER 10.04.4 LTS, CLEAN INSTALL, STATIC IP: 192.168.107.25 AND CLICK OK

4414LHammonds
Advanced member
Advanced member
Posts: 148
Joined: Sat Sep 13, 2014 2:14 am

My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Postby 4414LHammonds » Thu Apr 26, 2012 9:22 pm

VOLUME / DISK MANAGEMENT
AT THIS POINT, LET'S ASSUME SOMETHING HAS CHANGED AND WE NEED ADDITIONAL STORAGE (E.G. ACQUIRED NEW COMPANY, ADDED MORE PEOPLE, ETC.)
FOR THIS SCENARIO, WE ARE EXPECTING STORAGE SPACE TO REQUIRE 25 GB FOR ALL USER MAILBOXES. IF THEY NEED 25 GB FOR STORAGE, LET'S DOUBLE THAT AMOUNT FOR THE ACTUAL SIZE. HERE IS THE PLANNED ADJUSTMENTS FOR EACH FILE SYSTEM:
OPT = 50 GB (DOUBLE THE EXPECTED/ACTUAL MAILBOX STORAGE)

TEMP = 100 GB (DOUBLE THE OPT SIZE)

BACKUP = 100 GB (DOUBLE THE OPT SIZE)
IN THE ANALYSIS AND DESIGN SECTION, WE WANTED TO HAVE SOME FILE SYSTEMS SMALLER THAN THE LOGICAL VOLUME ON WHICH THEY SIT. THIS WILL ALLOW US TO ALLOCATE ADDITIONAL SPACE WHEN NEEDED. HOWEVER, WHEN WE CREATED THE VOLUMES, UBUNTU AUTOMATICALLY EXPANDED THE FILE SYSTEMS TO THE MAXIMUM SIZE OF THE VOLUME. NORMALLY, THIS IS OK...BUT WE WANT A SYSTEM THAT WILL ALLOW GROWTH WHEN NEEDED AND ENSURE THAT WE WILL HAVE TIME TO ADD ADDITIONAL HARD DRIVES BEFORE THEY ARE NEEDED WHICH WILL KEEP US FROM BEING STUCK BETWEEN A ROCK AND A HARD PLACE!
THE DESIGN CALLS FOR THE BACKUP, OPT AND TEMP FILE SYSTEMS TO BE SLIGHTLY SMALLER THAN THE MAXIMUM SPACE AVAILABLE FOR THE LOGICAL VOLUME.
SO, LET'S MAKE THE LOGICAL VOLUMES AN EXTRA 25 GB LARGER. THIS MEANS THAT WE WILL NEED AN ADDITIONAL 275 GB OF STORAGE {(75 + 125 + 125 ) - 50}. IF WE ADD TWO DRIVES THAT ARE 140 GB EACH, THAT WILL BE JUST ENOUGH TO COVER OUR NEEDS. (NOTE: THIS WAS AN ARBITRARY NUMBER BECAUSE I WANTED TO SHOW YOU HOW TO ADD 2 DRIVES TO THE SYSTEM)
IF WE WERE TO TYPE DF -H RIGHT NOW, WE SHOULD SEE SOMETHING LIKE THIS:
FILESYSTEM            SIZE  USED AVAIL USE% MOUNTED ON

/DEV/MAPPER/LVG-ROOT 8.7G 824M 7.5G 10% /

NONE 1000M 184K 1000M 1% /DEV

NONE 1005M 0 1005M 0% /DEV/SHM

NONE 1005M 32K 1005M 1% /VAR/RUN

NONE 1005M 0 1005M 0% /VAR/LOCK

NONE 1005M 0 1005M 0% /LIB/INIT/RW

/DEV/MAPPER/LVG-BAK 19G 172M 18G 1% /VAR/BACKUP

/DEV/MAPPER/LVG-OPT 9.2G 149M 8.6G 2% /OPT

/DEV/MAPPER/LVG-TEMP 19G 172M 18G 1% /VAR/TEMP

/DEV/SDA1 179M 17M 152M 10% /BOOT

SINCE I AM RUNNING VMWARE, ADDING ADDITIONAL SPACE IS A SNAP. HOWEVER, I WILL ADD IT IN SUCH A WAY THAT UBUNTU WILL SEE 2 DRIVES ADDED TO THE SYSTEM JUST AS IF WE WERE TO ADD 2 PHYSICAL DRIVES TO THE SERVER.



  • SHUTDOWN AND POWER OFF THE SERVER BY TYPING SHUTDOWN -P NOW {ENTER}

  • IN THE VSPHERE CLIENT, RIGHT-CLICK THE VIRTUAL MACHINE AND CHOOSE EDIT SETTINGS.

  • ON THE HARDWARE TAB, CLICK THE ADD BUTTON AND SELECT HARD DISK. CLICK NEXT, CHOOSE "CREATE A NEW VIRTUAL DISK", CLICK NEXT, SET THE SIZE TO 140 GB, CLICK NEXT, NEXT, FINISH.

  • ADD ANOTHER 140 GB DISK USING THE SAME STEPS ABOVE AND CLICK OK TO CLOSE THE SETTINGS AND ALLOW VMWARE TO PROCESS THE CHANGES.


COLLECT INFORMATION ABOUT THE NEWLY ADDED DRIVES.



  • START THE UBUNTU SERVER AND CONNECT USING PUTTY.

  • AT THE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS) AND THEN TYPE SU AND THE ROOT PASSWORD (MYROOTPASS)

  • TYPE PVDISPLAY WHICH SHOULD SHOW SOMETHING SIMILAR TO THIS:

    PV NAME               /DEV/SDA5

    VG NAME LVG


    PV SIZE 62.81 GIB / NOT USABLE 3.00 MIB

    ALLOCATABLE YES (BUT FULL)

    PE SIZE 4.00 MIB

    TOTAL PE 16079

    FREE PE 0

    ALLOCATED PE 16079

    PV UUID XJUHYI-KLOS-KICZ-JLDD-E01T-7RYP-K3YQVM


    THE IMPORTANT BITS OF INFO HERE ARE THE PV NAME AND VG NAME FOR OUR EXISTING CONFIGURATION.

  • TYPE FDISK -L WHICH SHOULD SHOW SOMETHING SIMILAR TO THIS (HOWEVER I ABBREVIATED IT TO SHOW JUST THE IMPORTANT PARTS):

    DISK /DEV/SDA: 67.6 GB, 67645734912 BYTES
    DEVICE BOOT START END BLOCKS ID SYSTEM

    /DEV/SDA1 * 1 25 194560 83 LINUX

    PARTITION 1 DOES NOT END ON CYLINDER BOUNDARY.

    /DEV/SDA2 25 8224 65862657 5 EXTENDED

    /DEV/SDA5 25 8224 65862656 8E LINUX LVM

    DISK /DEV/SDB: 150.3 GB, 150323855360 BYTES

    DISK /DEV/SDB DOESN'T CONTAIN A VALID PARTITION TABLE

    DISK /DEV/SDC: 150.3 GB, 150323855360 BYTES

    DISK /DEV/SDC DOESN'T CONTAIN A VALID PARTITION TABLE


    THE IMPORTANT BITS OF INFO HERE ARE THE DEVICE PATHS FOR THE NEW DRIVES WHICH ARE HIGHLIGHTED IN RED.


PREPARE THE FIRST DRIVE (/DEV/SDB) TO BE USED BY THE LVM
TYPE THE FOLLOWING:

FDISK /DEV/SDB

N (CREATE NEW PARTITION)

P (PRIMARY PARTITION)

1 (PARTITION NUMBER)

{ENTER} (USE DEFAULT FOR FIRST CYLINDER)

{ENTER} (USE DEFAULT FOR LAST CYLINDER)

T (CHANGE PARTITION TYPE)

8E (SET TO LINUX LVM)

P (PREVIEW HOW THE DRIVE WILL LOOK)

W (WRITE CHANGES)

PREPARE THE SECOND DRIVE (/DEV/SDC) TO BE USED BY THE LVM
DO THE EXACT SAME STEPS AS ABOVE BUT START WITH FDISK /DEV/SDC
CREATE PHYSICAL VOLUMES USING THE NEW DRIVES
IF WE TYPE FDISK -L, WE NOW SEE /DEV/SDB1 AND /DEV/SDC1 WHICH ARE LINUX LVM PARTITIONS.
TYPE THE FOLLOWING TO CREATE PHYSICAL VOLUMES:

PVCREATE /DEV/SDB1

PVCREATE /DEV/SDC1

NOW ADD THE PHYSICAL VOLUMES TO THE VOLUME GROUP (LVG) BY TYPING THE FOLLOWING:

VGEXTEND LVG /DEV/SDB1

VGEXTEND LVG /DEV/SDC1

NOW THAT THE SPACE OF BOTH DRIVES HAVE BEEN ADDED TO THE LOGICAL VOLUME GROUP CALLED LVG, WE CAN NOW ALLOCATE THAT SPACE TO GROW THE LOGICAL VOLUME.
TO GET A LIST OF VOLUME PATHS TO USE IN THE NEXT COMMANDS, TYPE LVSCAN TO SHOW YOUR CURRENT VOLUMES AND THEIR SIZES.
TYPE THE FOLLOWING TO GROW EACH VOLUME BY A SPECIFIED AMOUNT (THE NUMBER AFTER THE PLUS SIGN):

LVEXTEND -L+65G /DEV/LVG/OPT

LVEXTEND -L+105G /DEV/LVG/BAK

LVEXTEND -L+105G /DEV/LVG/TEMP

OR YOU CAN SPECIFY THE EXACT SIZE BY EXCLUDING THE PLUS SIGN AND SPECIFYING THE END-RESULT SIZE YOU WANT:

LVEXTEND -L75G /DEV/LVG/OPT

LVEXTEND -L125G /DEV/LVG/BAK

LVEXTEND -L125G /DEV/LVG/TEMP

TO SEE THE NEW SIZES, TYPE LVSCAN
THE LAST THING TO DO NOW IS THE ACTUAL GROWTH OF THE FILE SYSTEMS. WE WANT TO GROW THE EXISTING FILE SYSTEMS BUT ONLY TO A CERTAIN AMOUNT SO WE DO NOT TAKE UP ALL THE SPACE IN THE VOLUME...WE WANT ROOM TO GROW IN THE FUTURE SO WE HAVE TIME TO ORDER AND INSTALL NEW DRIVES WHEN NEEDED.

RESIZE2FS /DEV/LVG/OPT 50G

RESIZE2FS /DEV/LVG/BAK 100G

RESIZE2FS /DEV/LVG/TEMP 100G

IF WE NEED TO INCREASE SPACE IN /OPT AT A LATER POINT, WE CAN ISSUE THE FOLLOWING COMMAND (WITHOUT ANY DOWNTIME):
RESIZE2FS /DEV/LVG/OPT 51G

WE COULD CONTINUE TO INCREASE THIS PARTICULAR FILE SYSTEM ALL THE WAY UNTIL WE REACH THE LIMIT OF THE VOLUME WHICH IS 75 GB AT THE MOMENT.
REMEMBER, DF -H WILL TELL YOU THE SIZE OF THE FILE SYSTEM AND LVSCAN WILL TELL YOU THE SIZE OF THE VOLUMES WHERE THE FILE SYSTEMS LIVE IN.
IF WE WERE TO TYPE DF -H RIGHT NOW, WE SHOULD SEE SOMETHING LIKE THIS:
FILESYSTEM            SIZE  USED AVAIL USE% MOUNTED ON

/DEV/MAPPER/LVG-ROOT 8.7G 824M 7.5G 10% /

NONE 1000M 200K 1000M 1% /DEV

NONE 1005M 0 1005M 0% /DEV/SHM

NONE 1005M 32K 1005M 1% /VAR/RUN

NONE 1005M 0 1005M 0% /VAR/LOCK

NONE 1005M 0 1005M 0% /LIB/INIT/RW

/DEV/MAPPER/LVG-BAK 99G 188M 94G 1% /VAR/BACKUP

/DEV/MAPPER/LVG-OPT 50G 159M 47G 1% /OPT

/DEV/MAPPER/LVG-TEMP 99G 188M 94G 1% /VAR/TEMP

/DEV/SDA1 179M 17M 152M 10% /BOOT

EDIT (2012-05-03): IN FAVOR OF MANAGE BY EXCEPTION, I WROTE A SCRIPT THAT CAN BE SCHEDULED TO RUN DAILY TO CHECK THE FILE SYSTEMS TO SEE IF THEY ARE GETTING CLOSE TO FILLING UP AND WILL AUTOMATICALLY EXPAND THEM A LITTLE BIT AND GIVE YOU AN EMAIL NOTICE. EVERYTHING IS DONE ON THE GIGABYTE LEVEL. IF YOU DO NOT WANT THE SCRIPT TO PERFORM THE INCREASE, SIMPLY ADD A POUND SIGN IN FRONT OF THE RESIZE2FS COMMAND ON LINE 64 TO COMMENT IT OUT. MIGHT ALSO WANT TO MODIFY THE LOG AND EMAIL MESSAGES SO IT DOES NOT LOOK LIKE IT ACTUALLY "PERFORMED" THE RESIZE BUT INSTEAD IS TELLING YOU HOW TO PERFORM THE RESIZE.
HERE ARE THE LINES I ADDED TO MY CRONTAB SCHEDULE WHICH WILL CHECK EACH FILE SYSTEM I EXPECT WILL GROW ON A DAILY BASIS @ 1AM, 2AM AND 3AM. I HAVE THEM CHECKING TO SEE IF WE HAVE LESS THAN 5GB AVAILABLE AND IF SO, IT WILL TRY TO INCREASE BY 1GB:



0 1 * * * /VAR/SCRIPTS/PROD/CHECK-STORAGE.SH OPT 5 1 > /DEV/NULL 2>&1

0 2 * * * /VAR/SCRIPTS/PROD/CHECK-STORAGE.SH BAK 5 1 > /DEV/NULL 2>&1

0 3 * * * /VAR/SCRIPTS/PROD/CHECK-STORAGE.SH TEMP 5 1 > /DEV/NULL 2>&1


/VAR/SCRIPTS/PROD/CHECK-STORAGE.SH



#!/BIN/BASH

#############################################

## NAME : CHECK-STORAGE.SH

## VERSION : 1.2

## DATE : 2012-05-01

## AUTHOR : LHAMMONDS

## PURPOSE : CHECK AVAILABLE SPACE FOR A FILE SYSTEM AND EXPAND IF NECESSARY.

## COMPATIBILITY : VERIFIED ON UBUNTU SERVER 10.04.4 LTS

## REQUIREMENTS : NONE

## RUN FREQUENCY : RECOMMEND ONCE PER DAY FOR EACH FS TO MONITOR.

## PARAMETERS :

## 1 = (REQUIRED) FILE SYSTEM NAME (E.G. OPT)

## 2 = (REQUIRED) FILE SYSTEM THRESHOLD (E.G. 2G)

## 3 = (REQUIRED) AMOUNT TO INCREASE FILE SYSTEM (E.G. 1G)

## EXIT CODES :

## 0 = SUCCESS (EITHER NOTHING WAS DONE OR FS EXPANDED WITHOUT ERROR)

## 1 = ERROR: MISSING OR INCORRECT PARAMETER(S)

## 2 = ERROR: INVALID PARAMETER VALUE(S)

## 4 = ERROR: LOCK FILE DETECTED

## 8 = ERROR: RESIZE2FS ERROR

## 16 = SEVERE: NO ROOM TO EXPAND

## 32 = ERROR: SCRIPT NOT RUN BY ROOT USER

################ CHANGE LOG #################

## DATE WHO WHAT WAS CHANGED

## ---------- --- ----------------------------

## 2012-05-01 LTH CREATED SCRIPT.

## 2012-05-02 LTH IMPROVED LOG MESSAGES.

## 2012-05-02 LTH IMPROVED EMAIL MESSAGES.

#############################################
## IMPORT STANDARD VARIABLES AND FUNCTIONS. ##

SOURCE /VAR/SCRIPTS/COMMON/STANDARD.CONF
## DEFINE LOCAL VARIABLES.

LOGFILE="${TEMPDIR}/CHECK-STORAGE.LOG"

LOCKFILE="${TEMPDIR}/CHECK-STORAGE.LOCK"

ERRORFLAG=0

RETURNCODE=0
#######################################

## FUNCTIONS ##

#######################################
FUNCTION F_CLEANUP()

{

IF [ -F ${LOCKFILE} ];THEN

## REMOVE LOCK FILE SO OTHER CHECK SPACE JOBS CAN RUN.

RM ${LOCKFILE} 1>/DEV/NULL 2>&1

FI

EXIT ${ERRORFLAG}

}
FUNCTION F_SHOWHELP()

{

ECHO -E "NUSAGE : ${SCRIPTNAME} FILESYSTEMNAME THRESHOLDSIZEINGB AMOUNTTOINCREASEBYINGBN"

ECHO -E "NEXAMPLE: ${SCRIPTNAME} OPT 2 1N"

}
FUNCTION F_AUTO-INCREMENT()

{

LET ROOMINLV=${LVSIZE}-${FSSIZE}

IF [[ ${ROOMINLV} -GT ${FSINCREASEBY} ]]; THEN

## THERE IS ROOM IN THE LV TO INCREASE SPACE TO THE FS.

RESIZE2FS ${FSVOL} ${NEWFSSIZE}G

RETURNCODE=$?

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- RESIZE2FS ${FSVOL} ${NEWFSSIZE}G, RETURNCODE=${RETURNCODE}" | TEE -A ${LOGFILE}

IF [[ ${RETURNCODE} -NE 0 ]]; THEN

## THERE WAS AN ERROR IN RESIZE2FS.

RETURN ${RETURNCODE}

FI

ELSE

## THERE IS NOT ENOUGH ROOM IN THE LV TO INCREASE SPACE IN THE FS.

RETURN 50

FI

RETURN 0

}
#######################################

## MAIN PROGRAM ##

#######################################
IF [ -F ${LOCKFILE} ]; THEN

# LOCK FILE DETECTED. ABORT SCRIPT.

ECHO "CHECK SPACE SCRIPT ABORTED"

ECHO "THIS SCRIPT TRIED TO RUN BUT DETECTED THE LOCK FILE: ${LOCKFILE}"

ECHO "PLEASE CHECK TO MAKE SURE THE FILE DOES NOT REMAIN WHEN CHECK SPACE IS NOT ACTUALLY RUNNING."

F_SENDMAIL "ERROR: CHECK STORAGE SCRIPT ABORTED" "THIS SCRIPT TRIED TO RUN BUT DETECTED THE LOCK FILE: ${LOCKFILE}NNPLEASE CHECK TO MAKE SURE THE FILE DOES NOT REMAIN WHEN CHECK SPACE IS NOT ACTUALLY RUNNING.NNIF YOU FIND THAT THE SCRIPT IS NOT RUNNING/HUNG, YOU CAN REMOVE IT BY TYPING 'RM ${LOCKFILE}'"

ERRORFLAG=4

F_CLEANUP

ELSE

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` ${SCRIPTNAME}" > ${LOCKFILE}

FI
## REQUIREMENT CHECK: SCRIPT MUST RUN AS ROOT USER.

IF [ "$(ID -U)" != "0" ]; THEN

## FATAL ERROR DETECTED: DOCUMENT PROBLEM AND TERMINATE SCRIPT.

ECHO "ERROR: ROOT USER REQUIRED TO RUN THIS SCRIPT."

ECHO ""

ERRORFLAG=32

F_CLEANUP

FI
## CHECK EXISTANCE OF REQUIRED COMMAND-LINE PARAMETERS.

CASE "$1" IN

"")

F_SHOWHELP

ERRORFLAG=1

F_CLEANUP

;;

--HELP|-H|-?)

F_SHOWHELP

ERRORFLAG=1

F_CLEANUP

;;

*)

FSNAME=$1

;;

ESAC

CASE "$2" IN

"")

F_SHOWHELP

ERRORFLAG=1

F_CLEANUP

;;

--HELP|-H|-?)

F_SHOWHELP

ERRORFLAG=1

F_CLEANUP

;;

*)

FSTHRESHOLD=$2

;;

ESAC

CASE "$3" IN

"")

F_SHOWHELP

ERRORFLAG=1

F_CLEANUP

;;

--HELP|-H|-?)

F_SHOWHELP

ERRORFLAG=1

F_CLEANUP

;;

*)

FSINCREASEBY=$3

;;

ESAC
## CHECK VALIDITY OF FILE SYSTEM NAME.

CASE "${FSNAME}" IN

"OPT")

FSVOL="/DEV/LVG/OPT"

FSMAP="/DEV/MAPPER/LVG-OPT"

;;

"BAK")

FSVOL="/DEV/LVG/BAK"

FSMAP="/DEV/MAPPER/LVG-BAK"

;;

"TEMP")

FSVOL="/DEV/LVG/TEMP"

FSMAP="/DEV/MAPPER/LVG-TEMP"

;;

*)

ECHO "ERROR: ${FSNAME} DOES NOT MATCH A KNOWN FILE SYSTEM DEFINED IN THIS SCRIPT."

F_SHOWHELP

ERRORFLAG=2

F_CLEANUP

;;

ESAC
## CHECK VALIDITY OF THRESHOLD VALUE.

TEST ${FSTHRESHOLD} -EQ 0 1>/DEV/NULL 2>&1

IF [[ $? -EQ 2 ]]; THEN

## THRESHOLD PARAMETER IS NOT AN INTEGER.

ECHO "ERROR: ${FSTHRESHOLD} IS NOT AN INTEGER."

F_SHOWHELP

ERRORFLAG=2

F_CLEANUP

FI
## CHECK VALIDITY OF INCREMENT VALUE.

TEST ${FSINCREASEBY} -EQ 0 1>/DEV/NULL 2>&1

IF [[ $? -EQ 2 ]]; THEN

## FSINCREASEBY PARAMETER IS NOT AN INTEGER.

ECHO "ERROR: ${FSINCREASEBY} IS NOT AN INTEGER."

F_SHOWHELP

ERRORFLAG=2

F_CLEANUP

FI
## GET AVAILABLE SPACE FOR THE FILE SYSTEM.

FSAVAILABLE="`DF --BLOCK-SIZE=G ${FSMAP} | AWK '{ PRINT $4 }' | TAIL -N 1 | SED 'S/G//'`"
## GET THE CURRENT SIZE OF THE FILE SYSTEM.

FSSIZE="`DF --BLOCK-SIZE=G ${FSMAP} | AWK '{ PRINT $2 }' | TAIL -N 1 | SED 'S/G//'`"
## GET THE CURRENT SIZE OF THE LOGICAL VOLUME FOR THE FILE SYSTEM

LVSIZE="`LVS --NOHEADINGS --NOSUFFIX --UNITS=G ${FSMAP} | AWK '{ PRINT $4}' | SED 'S/[.].*//'`"
## CALCULATE THE NEW SIZE OF THE FS IN CASE WE NEED IT.

LET NEWFSSIZE=${FSSIZE}+${FSINCREASEBY}
IF [[ ${FSAVAILABLE} -LT ${FSTHRESHOLD} ]]; THEN

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` - STARTING EXPANSION OF ${FSVOL}" | TEE -A ${LOGFILE}

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- LVSIZE=${LVSIZE}GB, FSSIZE=${FSSIZE}GB, FSAVAIL=${FSAVAILABLE}GB, FSTHRESHOLD=${FSTHRESHOLD}GB, FSINCREASEBY=${FSINCREASEBY}GB" | TEE -A ${LOGFILE}

## RUN THE AUTO-EXPANSION FUNCTION.

F_AUTO-INCREMENT

RETURNCODE=$?

CASE ${RETURNCODE} IN

0)

F_SENDMAIL "NOTICE: FILE SYSTEM EXPANDED" "${FSVOL} WAS EXPANDED BECAUSE IT WAS NEARING MAX CAPACITY. PLEASE REVIEW DISK SPACE USAGE AND PLAN APPROPRIATELY. LVSIZE=${LVSIZE}GB, FSSIZE=${FSSIZE}GB, FSAVAILABLE=${FSAVAILABLE}GB, FSTHRESHOLD=${FSTHRESHOLD}GB, FSINCREASEBY=${FSINCREASEBY}GB"

;;

50)

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` - SEVERE: NO ROOM TO EXPAND ${FSVOL}" | TEE -A ${LOGFILE}

ERRORFLAG=16

F_SENDMAIL "SEVERE: NO ROOM TO EXPAND ${FSVOL}" "THERE IS NOT ENOUGH ROOM IN THE LOGICAL VOLUME TO EXPAND THE ${FSVOL} FILE SYSTEM. IMMEDIATE ACTION IS REQUIRED. MAKE SURE THERE IS FREE SPACE IN THE VOLUME GROUP 'LVG' AND THEN EXPAND THE LOGICAL VOLUME...THEN EXPAND THE FILE SYSTEM.NNLVSIZE=${LVSIZE}GB, FSSIZE=${FSSIZE}GB, FSAVAILABLE=${FSAVAILABLE}GB, FSTHRESHOLD=${FSTHRESHOLD}GB, FSINCREASEBY=${FSINCREASEBY}GB.NNTYPE 'VGS' TO SEE IF THERE IS ANY FREE SPACE IN THE VOLUME GROUP WHICH CAN BE GIVEN TO THE LOGICAL VOLUME.NNTYPE 'LVS' TO SEE THE CURRENT SIZES OF THE LVS.NNTYPE 'LVDISPLAY' TO SEE A LIST OF LOGICAL VOLUMES SO YOU CAN GET THE LV NAME WHICH IS USED IN THE LVEXTEND AND RESIZE2FS COMMANDS.NNTYPE 'LVEXTEND -L+1G /DEV/LVG/OPT' IF YOU WANT TO EXTEND THE OPT LOGICAL VOLUME BY 1 GIGABYTE (ASSUMING THERE IS 1GB AVAILABLE IN THE VOLUME GROUP).NNTYPE 'DF --BLOCK-SIZE=G' TO SEE A LIST OF FILE SYSTEMS AND THEIR ASSOCIATED SIZE AND AVAILABLE SPACE.NNTYPE 'RESIZE2FS /DEV/LVG/OPT ${NEWFSSIZE}G' TO SET THE SIZE OF OPT TO ${NEWFSSIZE} GIGABYTES. MAKE SURE YOU SET THE SIZE TO THE DESIRED END-RESULT WHICH SHOULD BE LARGER THAN THE CURRENT FS SIZE SO YOU DO NOT LOSE DATA."

;;

*)

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` - ERROR: EXPANSION FAILURE FOR ${FSVOL}" | TEE -A ${LOGFILE}

ERRORFLAG=8

F_SENDMAIL "ERROR: FILE SYSTEM EXPANSION FAILED" "${FSVOL} EXPANSION FAILED WITH RETURN CODE OF ${RETURNCODE}. LVSIZE=${LVSIZE}GB, FSSIZE=${FSSIZE}GB, FSAVAILABLE=${FSAVAILABLE}GB, FSTHRESHOLD=${FSTHRESHOLD}GB, FSINCREASEBY=${FSINCREASEBY}GB"

;;

ESAC

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` - FINISHED EXPANSION OF ${FSVOL}" | TEE -A ${LOGFILE}

ELSE

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` - ${FSVOL} ${FSAVAILABLE}G>${FSTHRESHOLD}G NO ACTION REQUIRED." | TEE -A ${LOGFILE}

FI
## PERFORM CLEANUP ROUTINE.

F_CLEANUP


HERE IS THE TYPICAL OUTPUT WHEN IT DOES NOT HAVE TO INCREASE THE FS:
/VAR/TEMP/CHECK-STORAGE.LOG



2012-05-01_01:00:00 - /DEV/LVG/OPT 44G>5G NO ACTION REQUIRED.

2012-05-01_02:00:00 - /DEV/LVG/BAK 91G>5G NO ACTION REQUIRED.

2012-05-01_03:00:00 - /DEV/LVG/TEMP 93G>5G NO ACTION REQUIRED.

2012-05-02_01:00:00 - /DEV/LVG/OPT 44G>5G NO ACTION REQUIRED.

2012-05-02_02:00:00 - /DEV/LVG/BAK 91G>5G NO ACTION REQUIRED.

2012-05-02_03:00:00 - /DEV/LVG/TEMP 93G>5G NO ACTION REQUIRED.

2012-05-03_01:00:00 - /DEV/LVG/OPT 44G>5G NO ACTION REQUIRED.

2012-05-03_02:00:00 - /DEV/LVG/BAK 91G>5G NO ACTION REQUIRED.

2012-05-03_03:00:00 - /DEV/LVG/TEMP 93G>5G NO ACTION REQUIRED.

HERE IS A SAMPLE OF WHAT THE LOG WILL LOOK LIKE WHEN IT PERFORM INCREASES...NOTICE HOW I HAD TO INCREASE THE THRESHOLD IN ORDER FOR IT TO FIRE OFF THE INCREASE (BUT IT STILL JUST ISSUED A SINGLE GIGABYTE INCREASE):
/VAR/TEMP/CHECK-STORAGE.LOG



2012-05-02_01:00:00 - STARTING EXPANSION OF /DEV/LVG/OPT

2012-05-02_01:00:00 --- LVSIZE=75GB, FSSIZE=50GB, FSAVAIL=44GB, FSTHRESHOLD=55GB, INCREASEBY=1GB

2012-05-02_01:00:00 --- RESIZE2FS /DEV/LVG/OPT 51, RETURNCODE=0

2012-05-02_01:00:00 - FINISHED EXPANSION OF /DEV/LVG/OPT

2012-05-02_02:00:00 - STARTING EXPANSION OF /DEV/LVG/BAK

2012-05-02_02:00:00 --- LVSIZE=125GB, FSSIZE=99GB, FSAVAIL=91GB, FSTHRESHOLD=100GB, INCREASEBY=1GB

2012-05-02_02:00:00 --- RESIZE2FS /DEV/LVG/BAK 100, RETURNCODE=0

2012-05-02_02:00:00 - FINISHED EXPANSION OF /DEV/LVG/BAK

2012-05-02_03:00:00 - STARTING EXPANSION OF /DEV/LVG/TEMP

2012-05-02_03:00:00 --- LVSIZE=125GB, FSSIZE=99GB, FSAVAIL=93GB, FSTHRESHOLD=100GB, INCREASEBY=1GB

2012-05-02_03:00:00 --- RESIZE2FS /DEV/LVG/TEMP 100, RETURNCODE=0

2012-05-02_03:00:00 - FINISHED EXPANSION OF /DEV/LVG/TEMP
4414LHammonds
Advanced member
Advanced member
Posts: 148
Joined: Sat Sep 13, 2014 2:14 am

My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Postby 4414LHammonds » Thu Apr 26, 2012 9:26 pm

SOFTWARE CONFIGURATIONS


  • START THE UBUNTU SERVER AND CONNECT USING PUTTY.

  • AT THE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS) AND THEN TYPE SU AND THE ROOT PASSWORD (MYROOTPASS)

  • AT THE $ PROMPT, TYPE APTITUDE -Y INSTALL VIM-NOX FOR USE INSTEAD OF THE BUILT-IN VI EDITOR. "MORE INFO

  • AT THE $ PROMPT, TYPE APTITUDE -Y INSTALL BIND9 TO INSTALL A LOCAL DNS SERVER.

  • AT THE $ PROMPT, TYPE APTITUDE -Y INSTALL P7ZIP-FULL TO INSTALL 7-ZIP ARCHIVE UTILITY.

  • TYPE DPKG-RECONFIGURE DASH AND ANSWER NO

  • REMOVE APPARMOR TO AVOID PROBLEMS BY TYPING THE FOLLOWING:

    /ETC/INIT.D/APPARMOR STOP

    UPDATE-RC.D -F APPARMOR REMOVE

    APTITUDE REMOVE APPARMOR APPARMOR-UTILS


  • REBOOT THE SERVER BY TYPING REBOOT


VMWARE TOOLS
IF YOU ARE INSTALLING UNDER VMWARE LIKE ME, BE SURE TO INSTALL THE TOOLS TO INSURE MAXIMUM PERFORMANCE IN A VIRTUAL ENVIRONMENT.


  • IN THE VM TOOLBAR FOR THE VM, CLICK GUEST, INSTALL VMWARE TOOLS

  • AT THE UBUNTU PROMPT, TYPE THE FOLLOWING:



    MKDIR /MNT/CDROM

    MOUNT /DEV/CDROM /MNT/CDROM

    LS /MNT/CDROM

    TAR ZXVF /MNT/CDROM/VMWARETOOLS-X.X.X-XXXX.TAR.GZ -C /TMP/ (USE THE CORRECT NUMBERS VERSION DISCOVERED FROM THE LIST COMMAND IN THE PRIOR STEP)

    CD /TMP/VMWARE-TOOLS-DISTRIB/

    ./VMWARE-INSTALL.PL -D

    REBOOT




CONFIGURE UBUNTU FOR FILE SHARING
THIS FILE SHARING SECTION IS OPTIONAL BUT CAN BE HANDY IF YOU NEED TO SWAP FILES BETWEEN THE LINUX SERVER AND A WINDOWS MACHINE.
THIS DOCUMENTATION WILL UTILIZE THIS SHARE FOR PASSING PRE-CONFIGURED FILES (CONFIGS, SCRIPTS, ETC.) TO MAKE IT FASTER/EASIER DURING INSTALLATION.


  • START THE UBUNTU SERVER AND CONNECT USING PUTTY.

  • AT THE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS) AND THEN TYPE SU AND THE ROOT PASSWORD (MYROOTPASS)

  • INSTALL SAMBA BY TYPING APTITUDE -Y INSTALL SAMBA SMBFS (NOTE: TO SHARE A FOLDER WITH WINDOWS, YOU JUST NEED THE SAMBA PACKAGE, TO CONNECT TO A WINDOWS SHARE, YOU NEED BOTH SAMBA AND SMBFS)

  • TYPE THE FOLLOWING COMMANDS:



    CP /ETC/SAMBA/SMB.CONF /ETC/SAMBA/SMB.CONF.BAK

    MKDIR -P /SRV/SAMBA/SHARE

    CHOWN NOBODY:NOGROUP /SRV/SAMBA/SHARE/

    CHMOD 0777 /SRV/SAMBA/SHARE



  • EDIT THE CONFIGURATION FILE BY TYPING VI /ETC/SAMBA/SMB.CONF

  • CHANGE WORKGROUP = WORKGROUP TO WORKGROUP = WORK (YOU ARE USING THE DOMAIN ALIAS)

  • CHANGE:

    #   SECURITY = USER


    TO:

       SECURITY = USER


  • ADD THE FOLLOWING SECTION TO THE END OF THE FILE:

    [SHARE]

    COMMENT = UBUNTU FILE SERVER SHARE

    PATH = /SRV/SAMBA/SHARE

    BROWSABLE = YES

    GUEST OK = YES

    READ ONLY = NO

    CREATE MASK = 0755


  • SAVE AND EXIT THE FILE.

  • RESTART THE SAMBA SERVICES TO UTILIZE THE NEW CONFIGURATION BY TYPING:

    RESTART SMBD

    RESTART NMBD


  • YOU SHOULD NOW BE ABLE TO CLICK START --> RUN AND TYPE \MAIL OR \192.168.107.25 {ENTER} AND SEE AN EXPLORER WINDOW WITH A SHARE FOLDER. DRAG-N-DROP A FILE INTO THE SHARE FOLDER. IF IT WORKED, IT WILL NOT DISPLAY AN ERROR MESSAGE AND YOU SHOULD BE ABLE TO VIEW IT FROM THE SERVER BY TYPING LS -L /SRV/SAMBA/SHARE/

  • SHUTDOWN AND POWER OFF THE SERVER BY TYPING SHUTDOWN -P NOW {ENTER}

  • IN VM MENU, SELECT VM --> SNAPSHOT --> TAKE SNAPSHOT. GIVE IT A NAME LIKE STEP 2 AND DESCRIPTION OF UBUNTU SERVER 10.04.4 LTS, FILE SHARE CONFIGURED, STATIC IP: 192.168.107.25. THE SNAPSHOT MANAGER SHOULD NOW HAVE A NICE HIERARCHY OF SNAPSHOTS (STEP 1 --> STEP 2 --> YOU ARE HERE)


CONFIGURE WINDOWS REMOTE MOUNT POINT
THE REMOTE OFFSITE LOCATION IS A WINDOWS 2008 SERVER THAT HAS A VAST AMOUNT OF HARD DRIVE SPACE AND CURRENTLY BACKS UP OTHER SERVERS.
PART OF THE BACKUP PROCESS WILL BE TO WRITE FILES TO A MOUNTED FOLDER TO A WINDOWS SHARE.
FIRST, LET'S DOCUMENT THE VARIABLES FOR THIS SOLUTION BELOW AND HIGHLIGHT THEM IN RED THROUGHOUT THE DOCUMENT FOR EASY IDENTIFICATION.
THE VALUES BELOW ARE MERELY SAMPLES WHICH YOU NEED TO CHANGE IN ORDER TO MATCH YOUR ENVIRONMENT:
WINDOWS AD DOMAIN NAME: WORK

WINDOWS SERVER NAME: SRV-BACKUP

WINDOWS SERVER IP: 192.168.107.218

WINDOWS SHARE NAME: ZIMBRA

WINDOWS PHYSICAL SHARE LOCATION: D:IMBRA

WINDOWS SHARE ID: ZIMBRASHARE

WINDOWS SHARE PASSWORD: ZIMBRAPASSWORD
CREATE A SHARE ON A WINDOWS 2008 SERVER




  • IN WINDOWS EXPLORER, RIGHT-CLICK ON THE D:IMBRA FOLDER AND SELECT PROPERTIES

  • CLICK THE SHARING TAB

  • CLICK THE ADVANCED SHARING BUTTON

  • PLACE A CHECKMARK BESIDE SHARE THIS FOLDER

  • CHANGE THE SHARE NAME TO ZIMBRA

  • SET THE COMMENT TO ZIMBRA BACKUP

  • CLICK THE PERMISSIONS BUTTON

  • SELECT EVERYONE AND CLICK THE REMOVE BUTTON

  • CLICK THE ADD BUTTON

  • TYPE IN YOUR ZIMBRA SHARE ACCOUNT: WORKIMBRASHARE AND CLICK THE CHECK NAMES BUTTON, CLICK OK

  • PLACE A CHECKMARK FOR ALLOW FULL CONTROL AND CLICK OK, CLICK OK, CLICK OK

  • CREATE A TEXT FILE IN THE ROOT OF THE SHARED FOLDER CALLED "ONLINE.TXT" AND YOU MIGHT WANT TO ADD SOME TEXT INSIDE SAYING TO NEVER DELETE THIS FILE BECAUSE IT IS USED (WILL BE) BY A ZIMBRA BACKUP SCRIPT. PROBABLY A GOOD IDEA TO MAKE IT READ-ONLY AS WELL. EXAMPLE: D:IMBRAONLINE.TXT


CREATE AN NFS MOUNT TO THE WINDOWS 2008 SERVER
CONNECTING TO A WINDOWS SHARE REQUIRES THE SAMBA AND SMBFS PACKAGES TO BE INSTALLED. IF YOU DID NOT INSTALL THEM (FROM A PRIOR SECTION), TYPE APTITUDE -Y INSTALL SAMBA SMBFS




  • AT THE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS) AND THEN TYPE SU AND THE ROOT PASSWORD (MYROOTPASS)

  • TYPE THE FOLLOWING COMMANDS:



    MKDIR -P /MNT/BACKUP

    CHOWN ROOT:ROOT /MNT/BACKUP

    CHMOD 0755 /MNT/BACKUP

    ECHO "THIS FILE IS USED TO TELL IF THE MOUNT IS ACTIVE OR NOT" > /MNT/BACKUP/OFFLINE.TXT

    CHOWN ROOT:ROOT /MNT/BACKUP/OFFLINE.TXT

    CHMOD 0444 /MNT/BACKUP/OFFLINE.TXT

    TOUCH /ETC/CIFSPW

    CHMOD 0600 /ETC/CIFSPW



  • TYPE VI /ETC/CIFSPW AND ADD THE FOLLOWING TEXT, SAVE AND EXIT THE FILE:



    USERNAME=WORKIMBRASHARE

    PASSWORD=ZIMBRAPASSWORD



  • TYPE VI /ETC/HOSTS AND ADD THE FOLLOWING LINE ANYWHERE IN THE FILE:



    192.168.107.218 SRV-BACKUP



  • AT THIS POINT, YOU MIGHT WANT TO TYPE PING SRV-BACKUP TO MAKE SURE YOU TYPED THE RIGHT IP ADDRESS AS WELL AS SEEING A GOOD RESPONSE.

  • TO MOUNT THIS SYSTEM FOR BACKUPS, TYPE THE FOLLOWING COMMAND:



    MOUNT -T CIFS //SRV-BACKUP/ZIMBRA /MNT/BACKUP --OPTIONS NOUSER,RW,NOFAIL,NOATIME,NOEXEC,CREDENTIALS=/ETC/CIFSPW



  • TO TEST IT, TYPE CP /ETC/HOSTS /MNT/BACKUP/HOSTS.TXT AND LOOK ON THE WINDOWS SERVER AND SEE IF THE FILE SHOWS UP. THEN TYPE RM /MNT/BACKUP/HOSTS.TXT AND VERIFY THAT THE FILE WAS DELETED ON THE WINDOWS SERVER.

  • THIS WOULD ALSO BE A GOOD TIME TO VERIFY THAT YOU CAN SEE THE "ONLINE.TXT" FILE THAT WILL BE USED BY THE BACKUP SCRIPT. TYPE LS -L /MNT/BACKUP/*.TXT

  • TO DISMOUNT THE WINDOWS SHARE, TYPE THE FOLLOWING COMMAND:



    UMOUNT /MNT/BACKUP




THE SCRIPTS WILL CALL A COMMON MOUNT AND UNMOUNT FUNCTION TO CONNECT TO THIS SHARE ONLY WHEN NEEDED.
HOWEVER, IF YOU WOULD RATHER HAVE IT MOUNTED ALL THE TIME (EVEN AFTER A REBOOT), DO THE FOLLOWING (BUT REMEMBER TO NOT USE THE MOUNT/UMOUNT FUNCTIONS IN THE SCRIPTS LATER):




  • TYPE VI /ETC/FSTAB AND ADD THE FOLLOWING LINE AT THE BOTTOM OF THE FILE:



    //SRV-BACKUP/ZIMBRA /MNT/BACKUP CIFS NOUSER,RW,NOFAIL,NOATIME,NOEXEC,CREDENTIALS=/ETC/CIFSPW 0 0



  • TYPE MOUNT -A AND IF IT DOES NOT SPEW OUT ANY ERROR MESSAGES, IT WILL QUIETLY MOUNT THE SHARE.

  • TO TEST IT, TYPE CP /ETC/HOSTS /MNT/BACKUP/HOSTS.TXT AND LOOK ON THE WINDOWS SERVER AND SEE IF THE FILE SHOWS UP. THEN TYPE RM /MNT/BACKUP/HOSTS.TXT AND VERIFY THAT THE FILE WAS DELETED ON THE WINDOWS SERVER.

  • IF YOU NEED TO UNMOUNT IT, SIMPLY TYPE UMOUNT /MNT/BACKUP AND IT WILL REMAIN UNMOUNTED UNTIL YOU REBOOT. TO MAKE IT PERMANENT, YOU NEED TO REMOVE THE LINE YOU ADDED IN THE /ETC/FSTAB FILE.


SOMETIMES IT IS HELPFUL DURING TESTS TO TOGGLE THE MOUNT ON OR OFF SO HERE IS A SCRIPT YOU MIGHT FIND HELPFUL. YOU CAN FIND THE CONTENTS OF "STANDARD.CONF" FILE FURTHER DOWN THE THREAD.
TOGGLEMOUNT.SH



#!/BIN/BASH

#############################################

## NAME : TOGGLEMOUNT.SH

## VERSION : 1.0

## DATE : 2011-11-05

## AUTHOR : LHAMMONDS

## COMPATIBILITY : UBUNTU SERVER 10.04.4 LTS

## PURPOSE : TOGGLE THE MOUNT STATUS OF A PRE-CONFIGURED BACKUP MOUNT.

## RUN FREQUENCY : MANUAL AS NEEDED.

## EXIT CODES :

## 0 = SUCCESS

## 1 = FAILURE

################ CHANGE LOG #################

## DATE WHO WHAT WAS CHANGED

## ---------- --- ----------------------------

## 2011-11-05 LTH CREATED SCRIPT.

#############################################
## IMPORT COMMON VARIABLES AND FUNCTIONS. ##

SOURCE /VAR/SCRIPTS/COMMON/STANDARD.CONF

ERRORFLAG=0
IF [ -F ${OFFSITEDIR}/OFFLINE.TXT ]; THEN

ECHO "WINDOWS SHARE IS NOT MOUNTED. MOUNTING SHARE NOW..."

F_MOUNT

SLEEP 2

IF [ -F ${OFFSITEDIR}/ONLINE.TXT ]; THEN

ECHO "MOUNT SUCCESSFUL. LISTING CONTENTS:"

ELSE

ECHO "MOUNT FAILED. LISTING CONTENTS:"

ERRORFLAG=1

FI

ELSE

ECHO "WINDOWS SHARE IS MOUNTED. DISMOUNTING SHARE NOW..."

F_UMOUNT

SLEEP 2

IF [ -F ${OFFSITEDIR}/OFFLINE.TXT ]; THEN

ECHO "DISMOUNT SUCCESSFUL. LISTING CONTENTS:"

ELSE

ECHO "DISMOUNT FAILED. LISTING CONTENTS:"

ERRORFLAG=1

FI

FI

LS -L ${OFFSITEDIR}

EXIT ${ERRORFLAG}

4414LHammonds
Advanced member
Advanced member
Posts: 148
Joined: Sat Sep 13, 2014 2:14 am

My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Postby 4414LHammonds » Thu Apr 26, 2012 9:27 pm

CONFIGURE DOMAIN RESOLUTION (DNS)




  • CONNECT TO THE SERVER USING PUTTY

  • AT THE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS) AND THEN TYPE SU AND THE ROOT PASSWORD (MYROOTPASS)

  • SANITY CHECK! MAKE SURE BIND IS RUNNING. TYPE /ETC/INIT.D/BIND9 STATUS

  • AT THIS POINT, YOU CAN SAVE YOURSELF A LOT OF TYPING IF YOU HAVE A COPY OF THE CONFIGURATION FILES ON YOUR PC AND SIMPLY COPY THEM TO THE SHARE. THEN YOU CAN SET THE APPROPRIATE FILE PERMISSIONS AND COPY THEM WHERE THEY NEED TO GO. BUT IF NOT AND THIS IS YOUR 1ST TIME INSTALLING THE SERVER, HERE ARE THE DETAILS FOR CONFIGURING BY HAND.

  • EDIT THE HOSTS BY TYPING VI /ETC/HOSTS AND CHANGE THE FOLLOWING:
    FROM:

    127.0.0.1	LOCALHOST

    127.0.1.1 MAIL.MYDOMAIN.COM MAIL

    TO:

    127.0.0.1	LOCALHOST.LOCALDOMAIN LOCALHOST

    192.168.107.25 MAIL.MYDOMAIN.COM MAIL


  • EDIT THE DNS SERVERS BY TYPING VI /ETC/RESOLV.CONF AND SET IT TO THE FOLLOWING:
    NAMESERVER 127.0.0.1

    NAMESERVER 192.168.107.23

    NAMESERVER 192.168.107.212

    NAMESERVER 200.100.10.1

    NAMESERVER 200.100.10.2

    DOMAIN MYDOMAIN.COM

    SEARCH MYDOMAIN.COM


  • TYPE THE FOLLOWING COMMANDS:
    MKDIR /VAR/CACHE/BIND/INTERNAL

    MKDIR /VAR/CACHE/BIND/EXTERNAL

    TOUCH /VAR/CACHE/BIND/INTERNAL/DB.MYDOMAIN.COM

    TOUCH /VAR/CACHE/BIND/INTERNAL/DB.107.168.192.IN-ADDR.ARPA

    TOUCH /VAR/CACHE/BIND/EXTERNAL/DB.MYDOMAIN.COM

    CP /ETC/BIND/NAMED.CONF.OPTIONS /ETC/BIND/NAMED.CONF.OPTIONS.BAK

    CP /ETC/BIND/NAMED.CONF.LOCAL /ETC/BIND/NAMED.CONF.LOCAL.BAK

    CP /ETC/BIND/NAMED.CONF.DEFAULT-ZONES /ETC/BIND/NAMED.CONF.DEFAULT-ZONES.BAK


  • STOP THE DNS SERVER BY TYPING /ETC/INIT.D/BIND9 STOP

  • EDIT THE DNS OPTIONS BY TYPING VI /ETC/BIND/NAMED.CONF.OPTIONS AND SET THE FOLLOWING:

    OPTIONS {

    DIRECTORY "/VAR/CACHE/BIND";

    QUERY-SOURCE ADDRESS * PORT 53;

    FORWARDERS {

    200.100.10.1; 200.100.10.2;

    };


    AUTH-NXDOMAIN NO; # CONFORM TO RFC1035

    LISTEN-ON-V6 { ANY; };

    };


    NOTE: THE IP ADDRESSES ARE PUBLIC IP ADDRESSES OF THE DNS SERVERS YOU USE IN THE OUTSIDE WORLD. THE QUERY-SOURCE ADDRESS LINE IS TO ALLOW YOUR MACHINE TO HIT THE DNS IF ODDBALL DNS PORTS ARE BLOCKED. YOU CAN LEAVE IT COMMENTED IF YOU DO NOT NEED IT.

  • RESTART THE NETWORK BY TYPING /ETC/INIT.D/NETWORKING RESTART

  • TYPE THE FOLLOWING VI /ETC/HOSTNAME AND ADD THE FOLLOWING TEXT, SAVE AND EXIT:
    MAIL.MYDOMAIN.COM


  • TO CHECK RESULTS, TYPE HOSTNAME AND THEN HOSTNAME -F WHICH SHOULD RESULT WITH:
    MAIL

    MAIL.MYDOMAIN.COM


  • EDIT THE LOCAL DNS FILE BY TYPING VI /ETC/BIND/NAMED.CONF.LOCAL AND SET THE FOLLOWING:

    ACL INTERNALS {

    127.0.0.0/8;

    192.168.107.0/24;

    };
    VIEW "INTERNAL" {

    MATCH-CLIENTS { INTERNALS; };

    RECURSION YES;

    ZONE "MYDOMAIN.COM" {

    TYPE MASTER;

    FILE "/VAR/CACHE/BIND/INTERNAL/DB.MYDOMAIN.COM";

    };

    ZONE "107.168.192.IN-ADDR.ARPA" {

    TYPE MASTER;

    FILE "/VAR/CACHE/BIND/INTERNAL/DB.107.168.192.IN-ADDR.ARPA";

    };

    };
    VIEW "EXTERNAL" {

    MATCH-CLIENTS { ANY; };

    RECURSION NO;

    ZONE "MYDOMAIN.COM" {

    TYPE MASTER;

    FILE "/VAR/CACHE/BIND/EXTERNAL/DB.MYDOMAIN.COM";

    };

    };


  • EDIT THE INTERNAL REVERSE ZONE FILE BY TYPING VI /VAR/CACHE/BIND/INTERNAL/DB.107.168.192.IN-ADDR.ARPA AND SET THE FOLLOWING:
    $TTL 86400

    @ IN SOA MAIL.MYDOMAIN.COM. ROOT.MYDOMAIN.COM. (

    201109231448 ; SERIAL (INCREMENT AFTER EDIT)

    604800 ; REFRESH

    86400 ; RETRY

    2419200 ; EXPIRE

    86400) ; NEGATIVE CACHE TTL

    NS MAIL.MYDOMAIN.COM.

    1 PTR MAIL.MYDOMAIN.COM.

  • EDIT THE INTERNAL ZONE FILE BY TYPING VI /VAR/CACHE/BIND/INTERNAL/DB.MYDOMAIN.COM AND SET THE FOLLOWING:
    ; MYDOMAIN.COM

    $TTL 86400

    @ IN SOA MAIL.MYDOMAIN.COM. ROOT.MYDOMAIN.COM. (

    201109231335 ; SERIAL (INCREMENT AFTER EDIT)

    604800 ; REFRESH

    86400 ; RETRY

    2419200 ; EXPIRE

    604800) ; NEGATIVE CACHE TTL

    ; DEFINE THE NAMESERVERS AND THE MAIL SERVERS

    @ IN NS 192.168.107.25.

    IN MX 10 MAIL.MYDOMAIN.COM.

    IN A 192.168.107.25

    MAIL IN A 192.168.107.25


  • EDIT THE EXTERNAL ZONE FILE BY TYPING VI /VAR/CACHE/BIND/EXTERNAL/DB.MYDOMAIN.COM AND SET THE FOLLOWING:
    ; MYDOMAIN.COM

    $TTL 86400

    @ IN SOA MAIL.MYDOMAIN.COM. ROOT.MYDOMAIN.COM. (

    201109231335 ; SERIAL (INCREMENT AFTER EDIT)

    604800 ; REFRESH

    86400 ; RETRY

    2419200 ; EXPIRE

    604800) ; NEGATIVE CACHE TTL

    ; DEFINE THE NAMESERVERS AND THE MAIL SERVERS

    @ IN NS 198.100.100.100.

    IN MX 10 MAIL.MYDOMAIN.COM.

    IN A 198.100.100.100

    MAIL IN A 198.100.100.100


  • SINCE VIEWS WERE USED, THEY ALSO NEED TO BE USED IN THE DEFAULT ZONE. TYPE VI /ETC/BIND/NAMED.CONF.DEFAULT-ZONES AND SET THE FOLLOWING:
    // PRIME THE SERVER WITH KNOWLEDGE OF THE ROOT SERVERS
    ACL INTERNALS-DEFAULT {

    127.0.0.0/8;

    192.168.107.0/24;

    192.168.106.0/24; // KEEP ADDING ALL YOUR INTERNAL SUBNETS HERE.

    };
    VIEW "INTERNAL-DEFAULT" {

    MATCH-CLIENTS { INTERNALS-DEFAULT; };

    RECURSION YES;

    ZONE "." {

    TYPE HINT;

    FILE "/ETC/BIND/DB.ROOT";

    };
    // BE AUTHORITATIVE FOR THE LOCALHOST FORWARD AND REVERSE ZONES, AND FOR

    // BROADCAST ZONES AS PER RFC 1912
    ZONE "LOCALHOST" {

    TYPE MASTER;

    FILE "/ETC/BIND/DB.LOCAL";

    };
    ZONE "127.IN-ADDR.ARPA" {

    TYPE MASTER;

    FILE "/ETC/BIND/DB.127";

    };
    ZONE "0.IN-ADDR.ARPA" {

    TYPE MASTER;

    FILE "/ETC/BIND/DB.0";

    };
    ZONE "255.IN-ADDR.ARPA" {

    TYPE MASTER;

    FILE "/ETC/BIND/DB.255";

    };

    };


  • ENSURE THE CORRECT OWNERSHIP AND PERMISSIONS OF ALL CONFIG FILES:

    CHOWN ROOT:BIND /VAR/CACHE/BIND/INTERNAL/*

    CHOWN ROOT:BIND /VAR/CACHE/BIND/EXTERNAL/*

    CHMOD 0644 /VAR/CACHE/BIND/INTERNAL/*

    CHMOD 0644 /VAR/CACHE/BIND/EXTERNAL/*


  • START THE DNS SERVER BY TYPING /ETC/INIT.D/BIND9 START

  • THAT WAS A LOT OF TYPING AND ROOM FOR ERROR SO CHECK THE LOG FOR ANY ERRORS: VI /VAR/LOG/DAEMON.LOG

  • SANITY CHECK! AT THIS POINT, IF YOU TYPE NSLOOKUP MAIL.MYDOMAIN.COM, YOU SHOULD SEE THAT YOUR INTERNAL DNS SERVER (127.0.0.1) RETURNED THE RESULT OF YOUR INTERNAL IP ADDRESS (192.168.107.25 FOR YOUR FQDN OF MAIL.MYDOMAIN.COM)

  • SANITY CHECK! TYPE DIG MYDOMAIN.COM MX AND MAKE SURE YOU SEE A STATUS OF NOERROR ALONG WITH AN MX RECORD TO YOUR FQDN, NS RECORD FOR YOUR INTERNAL IP AND AN A RECORD YOUR FQDN TO YOUR INTERNAL IP.

  • SHUTDOWN AND POWER OFF THE SERVER BY TYPING SHUTDOWN -P NOW {ENTER}

  • IN VM MENU, SELECT VM --> SNAPSHOT --> TAKE SNAPSHOT. GIVE IT A NAME LIKE STEP 3 AND DESCRIPTION OF UBUNTU SERVER 10.04.4 LTS, SPLIT-DNS CONFIGURED, STATIC IP: 192.168.107.25. CLICK OK. THE SNAPSHOT MANAGER SHOULD NOW HAVE A NICE HIERARCHY OF SNAPSHOTS (STEP 1 --> STEP 2 --> STEP 3 --> YOU ARE HERE)


FINAL UBUNTU CHANGES



  • START THE UBUNTU SERVER AND CONNECT USING PUTTY.

  • AT THE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS) AND THEN TYPE SU AND THE ROOT PASSWORD (MYROOTPASS)

  • UPDATE THE PACKAGE DATABASE BY TYPING APTITUDE UPDATE

  • INSTALL THE LATEST UPDATES BY TYPING APTITUDE -Y SAFE-UPGRADE

  • SHUTDOWN AND POWER OFF THE SERVER BY TYPING SHUTDOWN -P NOW {ENTER}

  • IN VM MENU, SELECT VM --> SNAPSHOT --> TAKE SNAPSHOT. GIVE IT A NAME LIKE STEP 4 AND DESCRIPTION OF UBUNTU SERVER 10.04.4 LTS, ALL PATCHES APPLIED, STATIC IP: 192.168.107.25. THE SNAPSHOT MANAGER SHOULD NOW HAVE A NICE HIERARCHY OF SNAPSHOTS (STEP 1 --> STEP 2 --> STEP 3 --> STEP 4 --> YOU ARE HERE)

  • NOTE: OVER TIME, UPGRADES TO THE KERNEL CAN START TAKING UP SPACE IN /ETC/SRC. I FOUND THIS OUT BECAUSE MY ROOT PARTITION STARTED TO GET FULL. WHEN I TYPED THIS COMMAND: DU -SH /USR/SRC/* I FOUND OUT THERE WAS OVER A GIGABYTE OF OLD FILES. TO CLEANLY CLEAR OUT OLD AN UNUSED HEADERS, TYPE THE FOLLOWING COMMANDS:



    APT-GET -F INSTALL

    APT-GET AUTOREMOVE



4414LHammonds
Advanced member
Advanced member
Posts: 148
Joined: Sat Sep 13, 2014 2:14 am

My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Postby 4414LHammonds » Thu Apr 26, 2012 9:32 pm

INSTALL ZIMBRA
NOTE: INSTALL ZIMBRA BY TYPING "./INSTALL.SH" AND UNINSTALL BY TYPING "./INSTALL.SH -U"
PREREQUISITE PACKAGES:



  • NPTL

  • SUDO-1.7.2P1-1UBUNTU5.3

  • LIBIDN11-1.15-2

  • LIBPCRE3-7.8-3BUILD1

  • LIBGMP3C2-2:4.3.2+DFSG-1UBUNTU1

  • LIBEXPAT1-2.0.1-7UBUNTU1

  • LIBSTDC++6-4.4.3-4UBUNTU5

  • LIBPERL5.10-5.10.1-8UBUNTU2.1


SUGGESTED PREREQUISITES:



  • PERL-5.10.1

  • SYSSTAT

  • SQLITE3


INSTALL PROCEDURE:



  • START THE UBUNTU SERVER AND CONNECT USING PUTTY.

  • AT THE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS) AND THEN TYPE SU AND THE ROOT PASSWORD (MYROOTPASS)

  • DOWNLOAD THE OPEN SOURCE EDITION FROM OPEN SOURCE EDITION DOWNLOADS: ENTERPRISE MESSAGING AND COLLABORATION SOFTWARE BY ZIMBRA
    METHOD #1 - DOWNLOAD FROM YOUR PC
    A. DOWNLOAD THE .TGZ FILE AND COPY IT TO THE UBUNTU SHARE --> \MAILSHARE OR \192.168.107.25SHARE

    B. ONCE COPIED TO THE SERVER, ACCESS THE CONSOLE AND TYPE THE FOLLOWING:
    MV /SRV/SAMBA/SHARE/ZCS* /VAR/TEMP

    METHOD #2 - DOWNLOAD DIRECTLY FROM THE SERVER
    A. OBTAIN THE DOWNLOAD URL FROM THE "ZIMBRA OSE PAGE

    B. TYPE THE FOLLOWING COMMANDS ON THE SERVER CONSOLE (USING THE CORRECT URL)
    CD /VAR/TEMP

    WGET

  • EXTRACT">HTTP://FILES.ZIMBRA.COM/DOWNLOADS/7.2.0_GA/ZCS-7.2.0_GA_2669.UBUNTU10_64.20120410002303.TGZ
  • EXTRACT THE ARCHIVE BY TYPING THE FOLLOWING COMMANDS:
    MKDIR /VAR/TEMP/INSTALL

    TAR -C /VAR/TEMP/INSTALL --STRIP-COMPONENTS=1 -XZF /VAR/TEMP/ZCS*

  • START THE INSTALLATION PROGRAM BY TYPING THE FOLLOWING:
    CD /VAR/TEMP/INSTALL

    ./INSTALL.SH

  • AGREE TO LICENSE AGREEMENT? PRESS Y {ENTER}

  • IF YOU ARE MISSING ANY PREREQUISITES, EXIT THE INSTALLATION AND INSTALL THEM. YOU CAN INSTALL ALL AT ONE TIME BY SEPARATING EACH NAME WITH A SPACE AFTER APTITUDE INSTALL SUCH AS THE FOLLOWING:

    APTITUDE -Y INSTALL SYSSTAT SQLITE3


  • INSTALL ZIMBRA-LDAP? PRESS Y {ENTER}

  • INSTALL ZIMBRA-LOGGER? PRESS Y {ENTER}

  • INSTALL ZIMBRA-MTA? PRESS Y {ENTER}

  • INSTALL ZIMBRA-SNMP? PRESS Y {ENTER}

  • INSTALL ZIMBRA-STORE? PRESS Y {ENTER}

  • INSTALL ZIMBRA-APACHE? PRESS Y {ENTER}

  • INSTALL ZIMBRA-SPELL? PRESS Y {ENTER}

  • INSTALL ZIMBRA-MEMCACHED? PRESS N {ENTER} (IF MULTI-SERVER, PRESS Y INSTEAD)

  • INSTALL ZIMBRA-PROXY? PRESS N {ENTER} (IF MULTI-SERVER, PRESS Y INSTEAD)

  • THE SYSTEM WILL BE MODIFIED. CONTINUE? PRESS Y {ENTER}

  • DNS ERROR RESOLVING MX FOR MAIL.MYDOMAIN.COM. CHANGE DOMAIN NAME? PRESS Y {ENTER}

  • NOW WE PUT THE CORRECT DOMAIN NAME IN SO TYPE MYDOMAIN.COM {ENTER}

  • YOU ARE PRESENTED A MENU FOR RESOLVING UNCONFIGURED OPTIONS, PRESS 3 {ENTER}

  • SELECT ADMIN PASSWORD, PRESS 4 {ENTER}. THEN TYPE YOUR NEW PASSWORD (MYZIMBRAPASS) {ENTER}

  • PRESS R {ENTER} FOR PREVIOUS MENU

  • PRESS A {ENTER} TO APPLY CHANGES.

  • PRESS Y {ENTER}, {ENTER} TO SAVE CONFIGURATION (/OPT/ZIMBRA/CONFIG.9066)

  • THE SYSTEM WILL BE MODIFIED - CONTINUE? PRESS Y {ENTER}

  • NOTIFY ZIMBRA OF YOUR INSTALLATION? PRESS N {ENTER} (FEEL FREE TO ANSWER YES IF THIS IS NOT A TEST SYSTEM)

  • PRESS {ENTER} TO EXIT SETUP. NOTE: LOG FILES PLACED IN /OPT/ZIMBRA/LOG

  • SHUTDOWN AND POWER OFF THE SERVER BY TYPING THE FOLLOWING:



    /ETC/INIT.D/ZIMBRA STOP

    SHUTDOWN -P NOW


  • IN VM MENU, SELECT VM --> SNAPSHOT --> TAKE SNAPSHOT. GIVE IT A NAME LIKE STEP 5 AND DESCRIPTION OF UBUNTU SERVER 10.04.4 LTS, ZIMBRA 7.2.0 OSE INSTALLED, STATIC IP: 192.168.107.25. THE SNAPSHOT MANAGER SHOULD NOW HAVE A NICE HIERARCHY OF SNAPSHOTS (STEP 1 --> STEP 2 --> STEP 3 --> STEP 4 --> STEP 5 --> YOU ARE HERE)


ADMIN CONSOLE AND INITIAL TEST




  • START THE UBUNTU SERVER.

  • ACCESS THE WEBMAIL CONTROL PANEL BY OPENING A WEB BROWSER AND TYPING THIS IN THE ADDRESS BAR: HTTPS:// COLOR='"RED"'>192.168.107.25:7071

  • IF YOUR BROWSER BARKS ABOUT AN UNTRUSTED CONNECTION, TELL IT TO CONTINUE ANYWAY AND ADD AN EXCEPTION FOR IT SO IT WILL NOT HAVE A PROBLEM WITH IT NEXT TIME.

  • LOGIN AS [EMAIL]ADMIN@MYDOMAIN.COM[/EMAIL] / MYROOTPASSWORD

  • CREATE A NEW USER ACCOUNT.

  • WHEN DONE CREATING A NEW USER, OPEN A NEW BROWSER TAB AND ACCESS: HTTP:// COLOR='"RED"'>192.168.107.25/ AND LOGIN WITH YOUR NEW USER ACCOUNT. SEE IF YOU CAN SEND AN EMAIL! IF IT DOES NOT WORK, WELL, WHAT CAN I SAY...YOU FOLLOWED THE ADVICE OF A LINUX NEWBIE. ;)


SCRIPTED SENDMAIL


MY SCRIPTS HEAVILY REPLY UPON THE ABILITY TO SEND EMAIL NOTIFICATIONS AND THIS STEP WILL ENABLE THAT ABILITY.



  • AT THE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS) AND THEN TYPE SU AND THE ROOT PASSWORD (MYROOTPASS)

  • TO CONFIGURE THE SENDMAIL COMMAND TO WORK WITH ZIMBRA, TYPE THE FOLLOWING:

    UPDATE-ALTERNATIVES --INSTALL /USR/SBIN/SENDMAIL MTA-SEND /OPT/ZIMBRA/POSTFIX/SBIN/SENDMAIL 25


  • TEST SENDMAIL BY TYPING THE FOLLOWING AND THEN CHECK YOUR ADMIN EMAIL TO SEE IF IT IS THERE:



    SENDMAIL -T{ENTER}

    TO:ADMIN@MYDOMAIN.COM{ENTER}

    FROM:WEBMASTER@MYDOMAIN.COM{ENTER}

    SUBJECT: TEST FROM UBUNTU SENDMAIL{ENTER}

    {ENTER}

    TESTING 1-2-3{ENTER}

    .{ENTER}





DELETE SNAPSHOTS
BE SURE TO DELETE ALL SNAPSHOTS WHEN YOU ARE SATISFIED THAT YOU WILL NO LONGER NEED TO REVERT YOUR INSTALLATION TO ANY OF THE PRIOR SNAPSHOTS.

ZIMBRA AND SSL ENCRYPTION
I DO NOT SEE A REASON NOT TO USE SSL, ESPECIALLY IF YOUR USER ACCOUNTS AND PASSWORDS MATCH OTHER SYSTEMS SUCH AS ACTIVE DIRECTORY. A COMPROMISED EMAIL PASSWORD CAN ALSO COMPROMISE YOUR NETWORK IN THAT CASE.
WITH THAT IN MIND, THIS IS WHAT I HAVE DONE TO MAKE SURE IT IS USED AT MY LOCATION.
IF YOU JUST INSTALLED ZIMBRA, THE INSTALLATION PROCESS CREATED A SELF-SIGNED CERTIFICATE.
STEP #1 - ENABLE SSL AS THE PRIMARY METHOD OF LOGGING ONTO YOUR SERVER:




  • AT THE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS) AND THEN TYPE SU AND THE ROOT PASSWORD (MYROOTPASS)

  • AT THE SERVER CONSOLE, TYPE THE FOLLOWING TO CONVERT WEBMAIL TO USE ENCRYPTED HTTPS INSTEAD OF HTTP:

    SU - ZIMBRA -C "ZMTLSCTL HTTPS"
    >

  • FOR ADDITIONAL DOCUMENTATION, HERE IS HOW YOU WOULD SWITCH BACK TO NON-SSL MODE:

    SU - ZIMBRA -C "ZMTLSCTL HTTP"


  • FOR ADDITIONAL DOCUMENTATION, HERE IS HOW YOU COULD USE EITHER SSL OR NON-SSL MODE:

    SU - ZIMBRA -C "ZMTLSCTL MIXED"


  • TYPE REBOOT TO REBOOT THE SERVER FOR THE HTTPS CHANGE TO TAKE EFFECT.


STEP #2 - EXPORT THE CERTIFICATE FOR WINDOWS.
THE CERTIFICATE ON THE ZIMBRA SERVER CANNOT BE DIRECTLY USED BY WINDOWS AND NEEDS TO BE CONVERTED INTO A FORMAT THAT CAN BE USED. DO SO USING THE FOLLOWING COMMANDS:



OPENSSL X509 -IN /OPT/ZIMBRA/SSL/ZIMBRA/CA/CA.PEM -OUT /SRV/SAMBA/SHARE/CACERT.DER -OUTFORM DER

CHMOD 0644 /SRV/SAMBA/SHARE/CACERT.DER


STEP #3 - IMPORT THE CERTIFICATE ON WINDOWS.
FOR WINDOWS MACHINES, YOU MIGHT NEED TO INSTALL THE CERTIFICATE MANUALLY TO AVOID INTERNET EXPLORER, MS OUTLOOK AND GOOGLE CHROME ISSUES WITH SELF-SIGNED CERTIFICATES.
HERE ARE TWO METHODS FOR DOING SO.
METHOD A - DOMAIN GROUP POLICY
IF YOU HAVE A WINDOWS DOMAIN, THIS IS A VERY EASY PROCESS TO GET ALL YOUR MACHINES TO AUTOMATICALLY ACCEPT THE SELF-SIGNED CERTIFICATE ON YOUR ZIMBRA SERVER.




  • ON THE DOMAIN CONTROLLER, OPEN ACTIVE DIRECTORY USERS AND COMPUTERS

  • RIGHT-CLICK ON YOUR DOMAIN AND SELECT PROPERTIES

  • SELECT THE GROUP POLICY TAB

  • SELECT THE DEFAULT DOMAIN POLICY AND CLICK THE EDIT BUTTON

  • EXPAND COMPUTER CONFIGURATION --> WINDOWS SETTINGS --> SECURITY SETTINGS --> PUBLIC KEY POLICIES

  • RIGHT-CLICK ON TRUSTED ROOT CERTIFICATION AUTHORITIES AND CLICK IMPORT

  • IMPORT WIZARD - CLICK NEXT

  • TYPE THE PATH TO THE CACERT.DER FROM YOUR ZIMBRA SERVER OR CLICK BROWSE (IF YOU BROWSE, YOU WILL NEED TO CHANGE THE FILE TYPE TO ALL FILES IN ORDER TO SEE THE CERTIFICATE FILE) AND THEN CLICK NEXT

  • SELECT PLACE ALL CERTIFICATES IN THE FOLLOWING STORE --> TRUSTED ROOT CERTIFICATION AUTHORITIES AND CLICK NEXT, FINISH

  • THE IMPORT WAS SUCCESSFUL - CLICK OK

  • YOU SHOULD NOW SEE YOUR MAIL SERVER DOMAIN IN THE LIST. EXAMPLE: MAIL.MYDOMAIN.COM

  • CLOSE GROUP POLICY OBJECT EDITOR AND ANY OTHER WINDOWS YOU OPENED



ANY WINDOWS MACHINE ON YOUR DOMAIN SHOULD NOW BE ABLE TO OPEN INTERNET EXPLORER AND VISIT YOUR SSL-ENABLED MAIL SERVER WITHOUT COMPLAINING ABOUT THE SELF-SIGNED CERTIFICATE. SAME GOES FOR OUTLOOK, GOOGLE CHROME AND OTHERS. YOU MAY NEED TO LOGOUT AND LOG BACK IN FOR THE POLICY TO TAKE EFFECT ON THE PCS.
METHOD B - MANUALLY IMPORT THE CERTIFICATE
IF YOU ARE FORCED TO MANUALLY TOUCH EACH PC BY HAND, HERE IS HOW YOU CAN INSTALL THE CERTIFICATE (FOR WINDOWS XP, WINDOWS VISTA OR WINDOWS 7)




  • CLOSE INTERNET EXPLORER IF IT IS OPEN.

  • CLICK START --> RUN (OR TYPE IN "SEARCH PROGRAMS AND FILES" BOX ON WINDOWS 7) AND TYPE MMC TO LOAD AN EMPTY MICROSOFT MANAGEMENT CONSOLE.

  • IF YOU RECEIVE A SECURITY WARNING, CLICK THE POSITIVE ACKNOWLEDGEMENT BUTTON (ACTUAL NAME VARIES ALL OVER THE PLACE).

  • FROM THE MENU, CLICK FILE, ADD / REMOVE SNAP-IN

  • SELECT CERTIFICATES AND CLICK THE ADD BUTTON

  • SELECT COMPUTER ACCOUNT AND CLICK NEXT

  • SELECT LOCAL COMPUTER AND CLICK FINISH, OK

  • EXPAND CERTIFICATES, TRUSTED ROOT CERTIFICATION AUTHORITIES AND SELECT THE CERTIFICATES CONTAINER

  • RIGHT-CLICK ON THE CERTIFICATES CONTAINER, AND CHOOSE THE ALL TASKS --> IMPORT

  • IMPORT WIZARD - CLICK NEXT

  • TYPE \192.168.107.25SHARECACERT.DER AND CLICK NEXT

  • SELECT PLACE ALL CERTIFICATES IN THE FOLLOWING STORE --> TRUSTED ROOT CERTIFICATION AUTHORITIES AND CLICK NEXT, FINISH

  • THE IMPORT WAS SUCCESSFUL - CLICK OK

  • LOOK IN THE LIST OF CERTIFICATES AND YOU SHOULD SEE YOUR DOMAIN SUCH AS MAIL.MYDOMAIN.COM

  • CLOSE THE CONSOLE (DO NOT BOTHER SAVING THE MMC WHEN ASKED)


STEP #4 - UPDATE YOUR CERTIFICATE
AS TIME GOES BY, THE CERTIFICATE THAT WAS CREATED WITH YOUR INSTALLATION WILL EXPIRE (360 DAYS FROM INSTALL) AND YOU WILL NEED TO GENERATE A NEW ONE.




  • AT THE LOGIN PROMPT, LOGIN WITH YOUR ADMINISTRATOR ACCOUNT (ADMINISTRATOR / MYADMINPASS) AND THEN TYPE SU AND THE ROOT PASSWORD (MYROOTPASS)

  • TYPE THE COMMANDS BELOW TO GENERATE A NEW SELF-SIGNED CERTIFICATE:



    /OPT/ZIMBRA/BIN/ZMCERTMGR CREATECA -NEW

    /OPT/ZIMBRA/BIN/ZMCERTMGR CREATECRT -NEW -DAYS 365

    /OPT/ZIMBRA/BIN/ZMCERTMGR DEPLOYCRT SELF

    /OPT/ZIMBRA/BIN/ZMCERTMGR DEPLOYCA



  • CHECK TO SEE IF THE CERTIFICATE WAS DEPLOYED TO ALL SERVICES BY TYPING /OPT/ZIMBRA/BIN/ZMCERTMGR VIEWDEPLOYEDCRT

  • NOW GO BACK THROUGH THE ABOVE STEPS TO EXPORT THE NEW CERTIFICATE AND IMPORT INTO ALL YOUR PCS


REFERENCE ARTICLE: "ZIMBRA WIKI: ADMINISTRATION CONSOLE AND CLI CERTIFICATE TOOLS
4414LHammonds
Advanced member
Advanced member
Posts: 148
Joined: Sat Sep 13, 2014 2:14 am

My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Postby 4414LHammonds » Thu Apr 26, 2012 9:43 pm

Scripting


Much of the solutions beyond this point involve scripts (programming snippets / automated commands).
In particular, they are Bash Scripts. I chose this due to its popularity and the fact it comes with Ubuntu. I try to make use of what comes with the system without requiring additional software / services unless they really add to the bottom line such as decreasing the time it takes for a process to run or to conserve storage and bandwidth usage.
When setting up a server and testing things out, there is typically very little concern for procedures / process since much of the activity is exploration and experimentation as well as not having an impact on production. However, once a server goes into production, processes and procedures need to be in place to ensure the availability of the services being provided.
In regards to these scripts, they will be treated like any other program and will require being tested, documented and go through a promotion process.
The ideal situation would involve 3 servers (for a single server setup). A test / development server, a quality assurance staging server and the production server itself. If 3 servers cannot be utilized, then it can still work well with 2 servers. Testing scripts / programs / restore on the production server is not advisable and many times impractical...how can you test your restore process / data periodically if you only have a production server?
The QA Staging server would be as close to production as possible. The server should be setup in such a way that production backups are restored to this server which also tests and validates the backup / restore process as well as maintains a close representation of the production server to mitigate variable risk involved when testing new or modified programs and upgrades.
The test / development server can serve as the QA server if absolutely necessary.
The directory structure and how scripts can import other scripts will be configured to facilitate this process.
Example:
Directory path for scripts to import common variables, functions and server settings: /var/scripts/common/
Directory path for production scripts: /var/scripts/prod/
Directory path for QA staging area scripts: /var/scripts/qa/
Directory path for test / development scripts: /var/scripts/test/
With a production and test servers on physically different machines, the "common" scripts folder can be custom-tailored for that environment and allow for minimal changes to a script when running on the test, QA or production server. This is similar to "normalizing" a database. If you have a variable, path or function that is duplicated in multiple scripts, consider pulling it out and placing it in the common folder. If ever you need to change who receives the email reports, you only need to update a single script and all programs will use the new reference from that point on.
Most of my scripts will import a file called "standard.conf" from the common script folder.
/var/scripts/common/standard.conf (contents of the file on the production server)



## Global Variables ##

TEMPDIR="/var/temp"

ZIMBRADIR="/opt/zimbra"

SHAREDIR="/srv/samba/share"

MYDOMAIN="mydomain.com"

ADMINEMAIL="admin@${MYDOMAIN}"

REPORTEMAIL="lhammonds@${MYDOMAIN}"

BACKUPDIR="/var/backup"

OFFSITEDIR="/mnt/backup"

OFFSITETESTFILE="${OFFSITEDIR}/online.txt"

ARCHIVEMETHOD="tar.7z" ## Choices are tar.7z or tgz

HOSTNAME="$(hostname -s)"

SCRIPTNAME="$0"

SCRIPTDIR="/var/scripts"

MAILFILE="${TEMPDIR}/mailfile.$$"
## Global Functions ##
function f_sendmail()

{

## Purpose: Send administrative email message.

## Parameter #1 = Subject

## Parameter #2 = Body

echo "From: ${ADMINEMAIL}" > ${MAILFILE}

echo "To: ${REPORTEMAIL}" >> ${MAILFILE}

echo "Subject: ${1}" >> ${MAILFILE}

echo "" >> ${MAILFILE}

echo -e "${2}" >> ${MAILFILE}

echo "" >> ${MAILFILE}

echo -e "

Server: ${HOSTNAME}
Program: ${SCRIPTNAME}
Log: ${LOGFILE}" >> ${MAILFILE}

sendmail -t
rm ${MAILFILE}

}
function f_sendusermail()

{

## Purpose: Send end-user email message.

## Parameter #1 = To

## Parameter #2 = Subject

## Parameter #3 = Body

echo "From: ${ADMINEMAIL}" > ${MAILFILE}

echo "To: ${1}" >> ${MAILFILE}

echo "Subject: ${2}" >> ${MAILFILE}

echo "" >> ${MAILFILE}

echo -e "${3}" >> ${MAILFILE}

sendmail -t
rm ${MAILFILE}

}
function f_mount()

{

## Mount the pre-configured Windows share folder.

## NOTE: The Windows share should have a file called "online.txt"

mount -t cifs //srv-backup/zimbra ${OFFSITEDIR} --options nouser,rw,nofail,noatime,noexec,credentials=/etc/cifspw

}
function f_umount()

{

## Dismount the Windows share folder.

## NOTE: The unmounted folder should have a file called "offline.txt"

umount ${OFFSITEDIR}

}




/var/scripts/common/standard.conf (contents of the file on the test server)



## Global Variables ##

TEMPDIR="/tmp"

ZIMBRADIR="/opt/zimbra800"

SHAREDIR="/srv/samba/share"

MYDOMAIN="mytestdomain.com"

ADMINEMAIL="test1@${MYDOMAIN}"

REPORTEMAIL="test2@${MYDOMAIN}"

BACKUPDIR="/var/backup"

OFFSITEDIR="/mnt/fakedir"

OFFSITETESTFILE="${OFFSITEDIR}/online.txt"

ARCHIVEMETHOD="tar.7z" ## Choices are tar.7z or tgz

HOSTNAME="$(hostname -s)"

SCRIPTNAME="$0"

SCRIPTDIR="/var/scripts/"

MAILFILE="${TEMPDIR}/mailfile.$$"
## Global Functions ##
function f_sendmail()

{

## Purpose: Send administrative email message.

## Parameter #1 = Subject

## Parameter #2 = Body

echo "From: ${ADMINEMAIL}" > ${MAILFILE}

echo "To: ${REPORTEMAIL}" >> ${MAILFILE}

echo "Subject: ${1}" >> ${MAILFILE}

echo "" >> ${MAILFILE}

echo -e "${2}" >> ${MAILFILE}

echo "" >> ${MAILFILE}

echo -e "

Server: ${HOSTNAME}
Program: ${SCRIPTNAME}
Log: ${LOGFILE}" >> ${MAILFILE}

sendmail -t
rm ${MAILFILE}

}
function f_sendusermail()

{

## Purpose: Send end-user email message.

## Parameter #1 = To

## Parameter #2 = Subject

## Parameter #3 = Body

echo "From: ${ADMINEMAIL}" > ${MAILFILE}

echo "To: ${1}" >> ${MAILFILE}

echo "Subject: ${2}" >> ${MAILFILE}

echo "" >> ${MAILFILE}

echo -e "${3}" >> ${MAILFILE}

sendmail -t
rm ${MAILFILE}

}
function f_mount()

{

## Mount the pre-configured Windows share folder.

## NOTE: The Windows share should have a file called "online.txt"

mount -t cifs //mypc/zimbra ${OFFSITEDIR} --options nouser,rw,nofail,noatime,noexec,credentials=/etc/cifspw

}
function f_umount()

{

## Dismount the Windows share folder.

## NOTE: The unmounted folder should have a file called "offline.txt"

umount ${OFFSITEDIR}

}




When receiving email notifications, the server name, script name and path will be included at the bottom of the email every time. It will be readily apparent if the email was generated from the test, qa or production server simply because of the location (even if test, qa and production are all on the same server).
Here are the scripts to help automate the creation of this structure on the various servers (would run all of them if all are the same box)
setup-script-prod.sh



#!/bin/bash

if [ ! -d /var/scripts/prod ]; then

mkdir -p /var/scripts/prod

fi

if [ ! -d /var/scripts/common ]; then

mkdir -p /var/scripts/common

fi

chown root:root /var/scripts

chown root:root /var/scripts/prod

chown root:root /var/scripts/common

chmod 0777 /var/scripts

chmod 0755 /var/scripts/prod

chmod 0755 /var/scripts/common


setup-script-qa.sh



#!/bin/bash

if [ ! -d /var/scripts/qa ]; then

mkdir -p /var/scripts/qa

fi

if [ ! -d /var/scripts/common ]; then

mkdir -p /var/scripts/common

fi

chown root:root /var/scripts

chown root:root /var/scripts/qa

chown root:root /var/scripts/common

chmod 0777 /var/scripts

chmod 0777 /var/scripts/qa

chmod 0755 /var/scripts/common


setup-script-test.sh



#!/bin/bash

if [ ! -d /var/scripts/test ]; then

mkdir -p /var/scripts/test

fi

if [ ! -d /var/scripts/common ]; then

mkdir -p /var/scripts/common

fi

chown root:root /var/scripts

chown root:root /var/scripts/test

chown root:root /var/scripts/common

chmod 0777 /var/scripts

chmod 0777 /var/scripts/test

chmod 0777 /var/scripts/common

4414LHammonds
Advanced member
Advanced member
Posts: 148
Joined: Sat Sep 13, 2014 2:14 am

My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Postby 4414LHammonds » Thu Apr 26, 2012 9:48 pm

Keep Zimbra in Sync with Active Directory
For my scenario, I want mailboxes created automatically when I create an Active Directory (AD) account. I do not want the mailbox to authenticate against AD though. To accomplish this, two or three scripts will be created and setup to run on a regular basis.
The 1st script will be run on a Windows server and will create a comma-delimited (CSV) file for all users who belong to a security group called "GRP_ZimbraEmail" which allows me to selectively pick who is allowed to have a mailbox. The script will probably just run once per day (after hours). The CSV file will be placed on Ubuntu's Samba share.
The 2nd script will be running on Ubuntu and checking for the input file very often (every minute). It will then cycle through all the AD users and see which users do not have a mailbox account and then create the mailbox using the supplied details.
export_zimbra_ad_users.vbs



Option Explicit

'****************************************

'** Name: export_zimbra_ad_users.vbs

'** Version: 1.1

'** Date: 2011-10-29

'** Author: LHammonds

'** Purpose: Export AD users to a comma-delimited file

'** that are authorized to have a Zimbra mailbox.

'****************************************

'* Field #1 = LoginID

'* Field #2 = First Name

'* Field #3 = Middle Initial

'* Field #4 = Last Name

'* Field #5 = Full Name

'* Field #6 = Title

'* Field #7 = Description

'* Field #8 = Comments

'* Field #9 = Telephone

'* Field #10 = Home Phone

'* Field #11 = Mobile Phone

'* Field #12 = Fax Number

'* Field #13 = Pager

'* Field #14 = Company

'* Field #15 = Office

'* Field #16 = Street Address

'* Field #17 = PO Box

'* Field #18 = City

'* Field #19 = State

'* Field #20 = Postal Code

'* Field #21 = Country

'* Field #22 = Password Replacement Value

'* Field #23 = Unused (mainly to avoid the end-of-line character being read into the last value)
'** NOTE: This could use a data cleanup routine that replaces all commas in a **

'** variable with something else such as a period instead to avoid CSV issues. **
Const ForAppending = 8

Const FilePath = "D:Reportsadlist.csv"

Const ZimbraSecurityGroup = "GRP_ZimbraEmail"

Const DefaultPassword = "ChangeThisPassword"
Dim objRootDSE, strDNC, objDomain, objFSO, objFile
Set objRootDSE = GetObject("LDAP://RootDSE")

strDNC = objRootDSE.Get("DefaultNamingContext")

Set objDomain = GetObject("LDAP://" & strDNC)
'** Create / Overwrite the export file. **

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.CreateTextFile(FilePath)

objFile.Close

Set objFile = Nothing
Call TrollTheFolders(objDomain)
Sub TrollTheFolders(pobjDomain)

'** Function: Traverse the AD structure to find users wherever they may reside. **

'** The trick is that this function is called recursively in order to **

'** inspect every sub-folder that may contain user accounts. **

Dim lobjFile, lobjFSO, lobjMember, lstrLine, lblnInZimbraGroup

Dim lstrSamAccountName, lstrFirstName, lstrInitials, lstrLastName

Dim lstrFullName, lstrTitle, lstrDescription, lstrComment

Dim lstrTelephoneNumber, lstrHomePhone, lstrMobile, lstrFaxNumber, lstrPager

Dim lstrCompany, lstrOffice, lstrStreetAddress, lstrPostOfficeBox

Dim lstrCity, lstrState, lstrPostalCode, lstrCountry, lstrPassword

Dim lcolGroups, lobjGroup, lstrTemp
For Each lobjMember In pobjDomain

'** Examine each object but process only "user" objects. **

If lobjMember.Class = "user" Then

Set lobjFile = objFSO.OpenTextFile (FilePath, ForAppending, True)

If Not (isempty(lobjMember.samAccountName)) Then lstrSamAccountName = lobjMember.samAccountName Else lstrSamAccountName = "" End If

If Not (isempty(lobjMember.GivenName)) Then lstrFirstName = lobjMember.GivenName Else lstrFirstName = "" End If

If Not (isempty(lobjMember.initials)) Then lstrInitials = lobjMember.initials Else lstrInitials = "" End If

If Not (isempty(lobjMember.sn)) Then lstrLastname = lobjMember.sn Else lstrLastName = "" End If

If Not (isempty(lobjMember.CN)) Then lstrFullName = lobjMember.CN Else lstrFullName = "" End If

If Not (isempty(lobjMember.title)) Then lstrTitle = lobjMember.title Else lstrTitle = "" End If

If Not (isempty(lobjMember.Description)) Then lstrDescription = lobjMember.Description Else lstrDescription = "" End If

If Not (isempty(lobjMember.comment)) Then lstrComment = lobjMember.comment Else lstrComment = "" End If

If Not (isempty(lobjMember.telephoneNumber)) Then lstrTelephoneNumber = lobjMember.telephoneNumber Else lstrTelephoneNumber = "" End If

If Not (isempty(lobjMember.homePhone)) Then lstrHomePhone = lobjMember.homePhone Else lstrHomePhone = "" End If

If Not (isempty(lobjMember.mobile)) Then lstrMobile = lobjMember.mobile Else lstrMobile = "" End If

If Not (isempty(lobjMember.otherFacsimileTelephoneNumber)) Then lstrFaxNumber = lobjMember.otherFacsimileTelephoneNumber Else lstrFaxNumber = "" End If

If Not (isempty(lobjMember.pager)) Then lstrPager = lobjMember.pager Else lstrPager = "" End If

If Not (isempty(lobjMember.company)) Then lstrCompany = lobjMember.company Else lstrCompany = "" End If

If Not (isempty(lobjMember.physicalDeliveryOfficeName)) Then lstrOffice = lobjMember.physicalDeliveryOfficeName Else lstrOffice = "" End If

If Not (isempty(lobjMember.streetAddress)) Then lstrStreetAddress = lobjMember.streetAddress Else lstrStreetAddress = "" End If

If Not (isempty(lobjMember.postOfficeBox)) Then lstrPostOfficeBox = lobjMember.postOfficeBox Else lstrPostOfficeBox = "" End If

If Not (isempty(lobjMember.l)) Then lstrCity = lobjMember.l Else lstrCity = "" End If

If Not (isempty(lobjMember.st)) Then lstrState = lobjMember.st Else lstrState = "" End If

If Not (isempty(lobjMember.postalCode)) Then lstrPostalCode = lobjMember.postalCode Else lstrPostalCode = "" End If

If Not (isempty(lobjMember.countryCode)) Then lstrCountry = lobjMember.countryCode Else lstrCountry = "" End If

lstrPassword = DefaultPassword

lblnInZimbraGroup = 0

For Each lobjGroup in lobjMember.Groups

'** See if this member belongs to the group that allows Zimbra mailboxes **

If LCase(lobjGroup.cn) = LCase(ZimbraSecurityGroup) Then

lblnInZimbraGroup = 1

End If

Next

If lblnInZimbraGroup = 1 Then

'** Member is associated to the Zimbra Email group and thus allowed to have a Zimbra mailbox. **

lstrLine = lstrSamAccountName & "," & lstrFirstName & "," & lstrInitials & "," & lstrLastName & "," & lstrFullName & "," &_

lstrTitle & "," & lstrDescription & "," & lstrComment & "," & lstrTelephoneNumber & "," & lstrHomePhone & "," & lstrMobile & "," &_

lstrFaxNumber & "," & lstrPager & "," & lstrCompany & "," & lstrOffice & "," & lstrStreetAddress & "," & lstrPostOfficeBox & "," &_

lstrCity & "," & lstrState & "," & lstrPostalCode & "," & lstrCountry & "," & lstrPassword & ",unused"

lobjFile.WriteLine(lstrLine)

End If

lobjFile.Close

Set lobjFile = Nothing

End If

If lobjMember.Class = "organizationalUnit" or lobjMember.Class = "container" Then

'** Recurse further down to find the users. **

TrollTheFolders(lobjMember)

End If

Next

End Sub


Sample adlist.csv



mmouse,Mickey,,Mouse,Mickey Mouse,,Lab Assistant,,,,,,800-867-5309,,,,,,,,0,ChangeThisPassword,unused

jdirt,Joe,,Dirt,Joe Dirt,Chief Information Officer,Chief Information Officer,,800-555-5555,,,,,ABC,Information Systems,404 Hollywood Street,,Hollywood,CA,90210,840,ChangeThisPassword,unused

ddiggler,Dirk,,Diggler,Dirk Diggler,Database Administrator,IS-Database Administrator,,800-555-0404,800-789-1234,888-111-2222,,,,Information Systems,404 Cowboy Country Road,,Hickville,TX,77501,840,ChangeThisPassword,unused

jdoe,John,,Doe,John Doe,System Analyst,IS-Telco Systems Analyst,,800-999-8888,,,,,,Information Systems,666 Gov Road,,Washington,WA,10110,840,ChangeThisPassword,unused


import-ad.sh



#!/bin/bash

#############################################

## Name : import-ad.sh

## Version : 1.2

## Date : 2011-11-02

## Author : LHammonds

## Purpose : Add mailbox accounts for AD users that have none.

## Compatibility : Verified on Ubuntu Server 10.04.3 - 10.04.4 LTS, Zimbra 7.1.2 - 7.2.0 OSE

## Requirements : Zimbra must be online, must be run as root user.

## Run Frequency : Run very frequently (every minute)

## Exit Codes :

## 0 = Success

## 1 = Failure

################ CHANGE LOG #################

## DATE WHO WHAT WAS CHANGED

## ---------- --- ----------------------------

## 2011-10-11 LTH Created script.

## 2011-10-29 LTH Better logging, mail support, bug fixes.

## 2011-11-02 LTH Moved standard variables/functions to external file.

#############################################
## Import standard variables and functions. ##

source /var/scripts/common/standard.conf
LOGFILE="${TEMPDIR}/import-ad.log"

MAILFILE="${TEMPDIR}/import-ad-mail.$$"

ADLISTORG="${SHAREDIR}/adlist.csv"

ADLISTNEW="${TEMPDIR}/import-ad-adlist.$$"

ZMUSERS="${TEMPDIR}/import-ad-zmuserlist.$$"

ZMCMD="${TEMPDIR}/import-ad-zmcmd.$$"

NEWUSERS=""

RETURNVALUE=0
## Temporarily change the default field separator to a comma. #

OLDIFS="${IFS}"

IFS=","
## If the Active Directory user list file is not found, exit the script. #

if [ ! -f ${ADLISTORG} ]; then

## No file to process. Exit script.

exit 0

fi

echo "`date +%Y-%m-%d_%H:%M:%S` - Active Directory file found! Import process started." >> ${LOGFILE}
## Create files and set permissions for only the root user. #

touch ${ZMCMD}

touch ${ZMUSERS}

chmod 0600 ${ZMCMD}

chmod 0600 ${ZMUSERS}

## Take ownership and set permissions for only the root user. #

chown root:root ${ADLISTORG}

chmod 0400 ${ADLISTORG}

## Move the file to a working folder. #

mv ${ADLISTORG} ${ADLISTNEW}

## Create a list of users in Zimbra for the specified domain. #

${ZIMBRADIR}/bin/zmprov -l getAllAccounts ${MYDOMAIN} > ${ZMUSERS}
## Loop through the Active Directory user list. #

while read -a ADLINE ; do

## Slot 0 = UserID

## Slot 1 = First Name (GivenName)

## Slot 2 = Initials

## Slot 3 = Last Name (sn)

## Slot 4 = Full Name (CN)

## Slot 5 = Title

## Slot 6 = Description

## Slot 7 = Comment

## Slot 8 = Telephone / Work Number

## Slot 9 = Home Phone

## Slot 10 = Mobile Phone

## Slot 11 = Fax Number (facsimileTelephoneNumber)

## Slot 12 = Pager

## Slot 13 = Company

## Slot 14 = Office (physicalDeliveryOfficeName)

## Slot 15 = Street Address

## Slot 16 = Post Office Box

## Slot 17 = City (l)

## Slot 18 = State (st)

## Slot 19 = Postal Code

## Slot 20 = Country Code (co)

## Slot 21 = Password

## Set the "Found Match" variable to false #

FOUND=0

## Loop through the Zimbra User List. #

while read -a ZMLINE ; do

## Convert Usernames to lower case. #

ZMUSERID=${ZMLINE[0],,}

ADUSERID=${ADLINE[0],,}

## Add domain address to the end of the AD Username #

ADUSERID=${ADUSERID}"@"${MYDOMAIN}

## Compare the lowercase AD username to the lower case Zimbra username. #

if [ ${ADUSERID} == ${ZMUSERID} ]; then

## Match found. Exit this while loop. #

FOUND=1

break

fi

done
if [ ${FOUND} -eq 0 ]; then

## We have an AD user that does not have a Zimbra mailbox. #

NEWUSERS="${NEWUSERS}${ADLINE[0]}@${MYDOMAIN}
"

echo "`date +%Y-%m-%d_%H:%M:%S` --- Adding new user: ${ADLINE[0]}@${MYDOMAIN}" >> ${LOGFILE}

echo "createAccount ${ADLINE[0]}@${MYDOMAIN} "${ADLINE[21]}" gn "${ADLINE[1]}" initials "${ADLINE[2]}" sn "${ADLINE[3]}" cn "${ADLINE[4]}" title "${ADLINE[5]}" description "${ADLINE[6]}" zimbraNotes "${ADLINE[7]}" telephoneNumber "${ADLINE[8]}" homePhone "${ADLINE[9]}" mobile "${ADLINE[10]}" facsimileTelephoneNumber "${ADLINE[11]}" pager "${ADLINE[12]}" company "${ADLINE[13]}" physicalDeliveryOfficeName "${ADLINE[14]}" street "${ADLINE[15]}" postOfficeBox "${ADLINE[16]}" l "${ADLINE[17]}" st "${ADLINE[18]}" postalCode "${ADLINE[19]}" co "${ADLINE[20]}"">> ${ZMCMD}

fi

done
## If the Zimbra command file is not empty, we need to process it. #

if [ -s ${ZMCMD} ]; then

${ZIMBRADIR}/bin/zmprov /dev/null 2>&1

RETURNVALUE=$?

if [ ${RETURNVALUE} -ne 0 ]; then

## Something went wrong with the mailbox creation.

## This error should notify administrators to the problem.

echo "`date +%Y-%m-%d_%H:%M:%S` --- ERROR: zmprov reported the following error: ${RETURNVALUE}" >> ${LOGFILE}

echo "`date +%Y-%m-%d_%H:%M:%S` - Import aborted. EXIT CODE = 1" >> ${LOGFILE}

f_sendmail "Zimbra Active Directory Import" "ERROR: zmprov reported the following error: ${RETURNVALUE}

Remaining temporary files:
${ZMUSERS}
${ZMCMD}
${ADLISTNEW}
"

exit 1

fi

## Send email notification of the new users added to Zimbra. #

## NOTE: To be 100% sure about this, we could loop through the users #

## and verify that they now have Zimbra mailboxes. #

f_sendmail "Zimbra Notification - New Users" "The following users were added to Zimbra:

${NEWUSERS}"

else

## There were no new users to process. #

echo "`date +%Y-%m-%d_%H:%M:%S` --- No new users to import." >> ${LOGFILE}

fi

echo "`date +%Y-%m-%d_%H:%M:%S` - Active Directory import completed." >> ${LOGFILE}
## Restore the default field separator value. #

IFS="${OLDIFS}"
## Remove temporary files. #

rm ${ZMUSERS}

rm ${ZMCMD}

rm ${ADLISTNEW}


Sample email when new mailboxes are created:



Subject: Zimbra Notification - New Users
The following users were added to Zimbra:
ddiggler@mydomain.com

jdoe@mydomain.com

jsmith@mydomain.com

lhammonds@mydomain.com

mmouse@mydomain.com
Server: mail

Program: /var/scripts/prod/import-ad.sh

Log: /var/temp/import-ad.log


Here is a sample log file (NOTE: There are no entries if no file is found):



2011-10-29_17:06:49 - Active Directory file found! Import process started.

2011-10-29_17:06:52 --- Adding new user: ddiggler@mydomain.com

2011-10-29_17:06:53 --- Adding new user: jdoe@mydomain.com

2011-10-29_17:06:53 --- Adding new user: jsmith@mydomain.com

2011-10-29_17:06:53 --- Adding new user: lhammonds@mydomain.com

2011-10-29_17:06:53 --- Adding new user: mmouse@mydomain.com

2011-10-29_17:06:56 - Active Directory import completed.

2011-10-29_17:07:29 - Active Directory file found! Import process started.

2011-10-29_17:07:32 --- No new users to import.

2011-10-29_17:07:32 - Active Directory import completed.


If you keep a database of all your user's IDs and passwords, you could export that information to the Linux box and have it safely tucked away and used in-between the AD Export and AD Import process. It could run through the AD user list and replace the default password with their existing password making it operate seamlessly within the environment.
If user passwords are unknown, the process would be to let the individual know their mailbox was created with a standard password and that they need to login and change it ASAP.
Reference Articles:


NOTE: If you like this solution, you might also want to review the modified version by digidt in my older thread.
4414LHammonds
Advanced member
Advanced member
Posts: 148
Joined: Sat Sep 13, 2014 2:14 am

My Notes for Installing Zimbra OSE on Ubuntu Server 10.04 LTS

Postby 4414LHammonds » Thu Apr 26, 2012 9:50 pm

GLOBAL ADDRESS LIST FOR IPHONES
I HAVE A WORKING SOLUTION IN PLACE FOR OUR IPHONE USERS TO ACCESS THE INTERNAL GLOBAL ADDRESS LIST (GAL) WHEN THEY START A NEW EMAIL MESSAGE AND CLICK THE "TO" BUTTON TO SHOW A LIST OF ALL CONTACTS IN OUR COMPANY (NOT JUST PERSONAL CONTACTS).
NORMALLY, YOU WILL ONLY GET A LIST OF CONTACTS IN YOUR PERSONAL FOLDER. I HAVE TRIED VARIOUS WAYS TO GET THIS TO WORK SUCH AS SHARING THE _INTERNALGAL FOLDER BUT COULD NOT GET ANYTHING TO WORK WELL. I CERTAINLY DO NOT WANT TO GIVE MY USERS THE CREDENTIALS TO THE GALSYNC ACCOUNT (WHICH IS MY ADMIN ACCOUNT).
THIS METHOD USES A SERVICE ACCOUNT (DUMMY MAILBOX) TO HOLD A COPY OF THE GAL. EACH IPHONE USER THEN ADDS AN ADDITIONAL CARDDAV ACCOUNT AND ENTERS THE SHARED ACCOUNT'S DETAILS.
FOR THIS EXAMPLE, I CREATED A MAILBOX CALLED "ADDRESSLIST@MYDOMAIN.COM" AND THEN LOGGED INTO THAT ACCOUNT AND SHARED THE CONTACTS FOLDER AS "PUBLIC" FOR ANYONE TO ACCESS.
NEXT, LOGIN TO THE ADMIN CONSOLE, EXPAND CONFIGURATION --> DOMAINS AND CLICK ON MYDOMAIN.COM. CLICK THE CONFIGURE GAL BUTTON. SET THE FOLLOWING AND CLICK NEXT, FINISH:
GAL MODE: INTERNAL

MOST RESULTS RETURNED BY GAL SEARCH: 250

USE GAL SYNC ACCOUNT (RECOMMENDED): CHECK

GAL SYNC ACCOUNT NAME: ADMIN@MYDOMAIN.COM (OR WHATEVER GALSYNC ACCOUNT YOU WANT)

DATASOURCE NAME FOR INTERNAL GAL: INTERNALGAL

INTERNAL GAL POLLING INTERVAL: 1 DAYS
NEXT, FORCE THE INITIAL SYNC BY TYPING THE FOLLOWING AT THE UBUNTU CONSOLE AS THE ROOT USER:


SU - ZIMBRA -C "ZMGSAUTIL FORCESYNC -A ADMIN@MYDOMAIN.COM -N INTERNALGAL"


IF YOU LOGIN TO THE WEB MAIL CLIENT AND LOGIN WITH THE GALSYNC (ADMIN) ACCOUNT, YOU SHOULD SEE THE "_INTERNALGAL" FOLDER UNDER THE ADDRESS BOOK TAB AND IT SHOULD BE POPULATED WITH YOUR INTERNAL USERS.
BEFORE THE ACCOUNT CAN BE BACKED UP WITH THE SCRIPT BELOW, THE SERVICES NEED TO BE RESTARTED.


/ETC/INIT.D/ZIMBRA STOP

/ETC/INIT.D/ZIMBRA START


NOW SETUP THE SCRIPT BELOW TO RUN ON A REGULAR SCHEDULE WHICH WILL BACKUP THE GAL SYNC'S "_INTERNALGAL" FOLDER TO AN ARCHIVE. IT WILL THEN EXTRACT THE ARCHIVE AND CHANGE REFERENCES OF "_INTERNALGAL" TO "CONTACTS" IN ALL FILES SO IT CAN BE RESTORED IN A FOLDER THAT THE IPHONE WILL RECOGNIZE. THEN IT IS RE-PACKED INTO AN ARCHIVE AND RESTORED TO THE "ADDRESSLIST" ACCOUNT WHICH COMPLETELY REPLACES WHATEVER IS IN THE "CONTACTS" FOLDER WITH THE UPDATED LIST. AS AN ADDITIONAL STEP, IT WILL DELETE SPECIFIC ADDRESSES WHICH ARE NOT DESIRED TO SHOW UP IN THE GLOBAL LIST.
ALSO NOTE THAT THIS IS NOT NECESSARY ON THE PRO NETWORK EDITION WHICH HAS AN IPHONE SYNC UTILITY.
GAL-SYNC.SH



#!/BIN/BASH

#############################################

## NAME : GAL-SYNC.SH

## VERSION : 1.1

## DATE : 2011-11-02

## AUTHOR : LHAMMONDS

## COMPATIBILITY : UBUNTU SERVER 10.04.3 - 10.04.4 LTS, ZIMBRA 7.1.3 - 7.2.0 OSE

## REQUIREMENTS : ZIMBRA MUST BE ONLINE, MUST BE RUN AS ROOT USER.

## PURPOSE : EXPOSE INTERNAL GAL (GLOBAL ADDRESS LIST) FOR USE ON IPHONES

## RUN FREQUENCY : ONCE PER DAY (AFTER HOURS PREFERABLE BUT NOT NECESSARY)

## EXIT CODES : (IF MULTIPLE ERRORS, VALUE IS THE ADDITION OF CODES)

## 0 = SUCCESS

## 1 = SECURITY FAILURE

## 2 = ZMMAILBOX GETRESTURL FAILURE

## 4 = ZMMAILBOX POSTRESTURL FAILURE

## 8 = ZMMAILBOX GETALLCONTACTS FAILURE

## 16 = TAR EXTRACTION FAILURE

## 32 = TAR CREATION FAILURE

################# CHANGE LOG #################

## DATE WHO WHAT WAS CHANGED

## ---------- --- ----------------------------

## 2011-10-28 LTH CREATED SCRIPT.

## 2011-10-31 LTH ADDED CHECK FOR ROOT ID.

## 2011-11-02 LTH MOVED STANDARD VARIABLES / FUNCTIONS TO EXTERNAL FILE.
## NOTE: SHOULD ADD DETECTION OF ADDRESS LIST ACCOUNT.
##############################################
## IMPORT COMMON VARIABLES AND FUNCTIONS. ##

SOURCE /VAR/SCRIPTS/COMMON/STANDARD.CONF
GALSYNCACCT="ADMIN@${MYDOMAIN}"

PUBLICGALACCT="ADDRESSLIST@${MYDOMAIN}"

EXCEPTIONS="ADDRESSLIST@${MYDOMAIN};ADMIN@${MYDOMAIN};TEST@${MYDOMAIN};TEST2@${MYDOMAIN}"

GALSYNCDIR="${TEMPDIR}/GALSYNC"

LOGFILE="${TEMPDIR}/GAL-SYNC.LOG"

CONTACTFILE="${TEMPDIR}/GAL-SYNC-CONTACT.$$"

GALARCHIVE1="GALSYNC1.TGZ"

GALARCHIVE2="GALSYNC2.TGZ"

CONTACTNUMDEL=0

CONTACTNUMALL=0

RETURNVALUE=0

ERRORFLAG=0
#######################################

## FUNCTIONS ##

#######################################
FUNCTION F_CLEANUP()

{

## PURPOSE: CLEANUP FILES AND FOLDERS USED BY THE SCRIPT.

IF [ -D ${GALSYNCDIR} ]; THEN

RM -RF ${GALSYNCDIR}

FI

IF [ -F ${TEMPDIR}/${GALARCHIVE1} ]; THEN

RM ${TEMPDIR}/${GALARCHIVE1}

FI

IF [ -F ${TEMPDIR}/${GALARCHIVE2} ]; THEN

RM ${TEMPDIR}/${GALARCHIVE2}

FI

IF [ -F ${CONTACTFILE} ]; THEN

RM ${CONTACTFILE}

FI

}
FUNCTION F_EMERGENCYEXIT()

{

## PURPOSE: EXIT SCRIPT AS CLEANLY AS POSSIBLE.

## PARAMETER #1 = ERROR CODE.

F_CLEANUP

F_SENDMAIL "ZIMBRA IPHONE GAL SYNC ERROR" "EXIT CODE = ${1}"

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` - GAL SYNC ABORTED. EXIT CODE: ${1}" >> ${LOGFILE}

## WRITE SCRIPT NAME AND ERROR CODE TO THE SYSTEM LOG.

LOGGER "${SCRIPTNAME}: ERROR CODE = ${1}"

EXIT $1

}
#######################################

## MAIN PROGRAM ##

#######################################
ECHO "`DATE +%Y-%M-%D_%H:%M:%S` - GAL SYNC STARTED." >> ${LOGFILE}
## REQUIREMENT CHECK: SCRIPT MUST RUN AS ROOT USER.

IF [ "$(ID -U)" != "0" ]; THEN

## FATAL ERROR DETECTED: DOCUMENT PROBLEM AND TERMINATE SCRIPT.

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` - GAL SYNC ABORTED. ERROR: ROOT USER REQUIRED." >> ${LOGFILE}

ERRORFLAG=$((${ERRORFLAG} + 1))

F_EMERGENCYEXIT ${ERRORFLAG}

FI
## BACKUP THE GLOBAL ADDRESS LISTING.

${ZIMBRADIR}/BIN/ZMMAILBOX -Z -M ${GALSYNCACCT} GETRESTURL "/_INTERNALGAL?FMT=TGZ" > ${TEMPDIR}/${GALARCHIVE1}

RETURNVALUE=$?

IF [ ${RETURNVALUE} -NE 0 ]; THEN

## FATAL ERROR DETECTED: DOCUMENT PROBLEM AND TERMINATE SCRIPT.

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- ERROR: ${ZIMBRADIR}/BIN/ZMMAILBOX -Z -M ${GALSYNCACCT} GETRESTURL '/_INTERNALGAL?FMT=TGZ'" >> ${LOGFILE}

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- RETURN VALUE: ${RETURNVALUE}" >> ${LOGFILE}

ERRORFLAG=$((${ERRORFLAG} + 2))

F_EMERGENCYEXIT ${ERRORFLAG}

FI
## PREPARE THE EXTRACTION FOLDER AND SET APPROPRIATE PERMISSIONS.

MKDIR -P ${GALSYNCDIR}

CHMOD 0600 ${GALSYNCDIR}

## EXTRACT THE ARCHIVE TO MODIFY ITS CONTENTS.

TAR -XF ${TEMPDIR}/${GALARCHIVE1} -C ${GALSYNCDIR} 1>/DEV/NULL 2>&1

RETURNVALUE=$?

IF [ ${RETURNVALUE} -NE 0 ]; THEN

## FATAL ERROR DETECTED: DOCUMENT PROBLEM AND TERMINATE SCRIPT.

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- ERROR: TAR -XF ${TEMPDIR}/${GALARCHIVE1} -C ${GALSYNCDIR}" >> ${LOGFILE}

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- RETURN VALUE: ${RETURNVALUE}" >> ${LOGFILE}

ERRORFLAG=$((${ERRORFLAG} + 16))

F_EMERGENCYEXIT ${ERRORFLAG}

FI
## SEARCH AND REPLACE ALL META DATA OCCURANCES OF "_INTERNALGAL" WITH "CONTACTS"

## THIS WILL ALLOW THE CONTACTS TO BE RESTORED TO THE "CONTACTS" FOLDER.

SED -I 'S/_INTERNALGAL/CONTACTS/G' ${GALSYNCDIR}/*.META

SED -I 'S/_INTERNALGAL/CONTACTS/G' ${GALSYNCDIR}/_INTERNALGAL/*.META
## COUNT THE NUMBER OF META FILES (CONTACTS) IN THE GAL FOLDER.

CONTACTNUMALL=`LS -1 ${GALSYNCDIR}/_INTERNALGAL/*.META | WC -L`
## CREATE A NEW ARCHIVE WITH THE MODIFIED DATA.

TAR -CZF ${TEMPDIR}/${GALARCHIVE2} ${GALSYNCDIR} 1>/DEV/NULL 2>&1

RETURNVALUE=$?

IF [ ${RETURNVALUE} -NE 0 ]; THEN

## FATAL ERROR DETECTED: DOCUMENT PROBLEM AND TERMINATE SCRIPT.

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- ERROR: TAR -CZF ${TEMPDIR}/${GALARCHIVE2} ${GALSYNCDIR}" >> ${LOGFILE}

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- RETURN VALUE: ${RETURNVALUE}" >> ${LOGFILE}

ERRORFLAG=$((${ERRORFLAG} + 32))

F_EMERGENCYEXIT ${ERRORFLAG}

FI
## REPLACE CONTACTS IN THE IPHONE GAL ACCOUNT.

${ZIMBRADIR}/BIN/ZMMAILBOX -Z -M ${PUBLICGALACCT} POSTRESTURL "//?FMT=TGZ&RESOLVE=RESET" ${TEMPDIR}/${GALARCHIVE2}

RETURNVALUE=$?

IF [ ${RETURNVALUE} -NE 0 ]; THEN

## FATAL ERROR DETECTED: DOCUMENT PROBLEM AND TERMINATE SCRIPT.

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- ERROR: ${ZIMBRADIR}/BIN/ZMMAILBOX -Z -M ${PUBLICGALACCT} POSTRESTURL '//?FMT=TGZ&RESOLVE=RESET'" >> ${LOGFILE}

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- RETURN VALUE: ${RETURNVALUE}" >> ${LOGFILE}

ERRORFLAG=$((${ERRORFLAG} + 4))

F_EMERGENCYEXIT ${ERRORFLAG}

FI
## EXPORT ALL CONTACTS TO A WORKING FILE TO DETERMINE WHICH CONTACTS TO REMOVE.

${ZIMBRADIR}/BIN/ZMMAILBOX -Z -M ${PUBLICGALACCT} GETALLCONTACTS > ${CONTACTFILE}

RETURNVALUE=$?

IF [ ${RETURNVALUE} -NE 0 ]; THEN

## FATAL ERROR DETECTED: DOCUMENT PROBLEM AND TERMINATE SCRIPT.

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- ERROR: ${ZIMBRADIR}/BIN/ZMMAILBOX -Z -M ${PUBLICGALACCT} GETALLCONTACTS" >> ${LOGFILE}

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- RETURN VALUE: ${RETURNVALUE}" >> ${LOGFILE}

ERRORFLAG=$((${ERRORFLAG} + 8))

F_EMERGENCYEXIT ${ERRORFLAG}

FI
## OBTAIN LIST OF CONTACT IDS WITH MATCHING EMAIL ADDRESSES IN THE EXCEPTION LIST.

WHILE READ LINEID LINEVALUE; DO

IF [ "${LINEID}" = "ID:" ]; THEN

CURRID=${LINEVALUE}

FI

IF [ "${LINEID}" = "EMAIL:" ]; THEN

## DETERMINE IF THIS IS AN EMAIL ADDRESS THAT WE ARE LOOKING FOR.

IF `ECHO ${EXCEPTIONS} | GREP -Q "${LINEVALUE}"`

THEN

## FOUND A CONTACT TO REMOVE FROM THE ADDRESS BOOK.

## VERIFY THAT THE CONTACT ID IS AN INTEGER.

CASE ${CURRID} IN

*[!0-9]*)

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- WARNING: INVALID INTEGER FOR CONTACT ID DETECTED: ${CURRID}" >> ${LOGFILE}

;;

*)

CONTACTNUMDEL=$((${CONTACTNUMDEL} + 1))

IF [ "${CONTACTIDS}" != "" ]; THEN

## THIS IS NOT THE 1ST CONTACT ADDED TO THE LIST.

CONTACTIDS="${CONTACTIDS},${CURRID}"

ELSE

## THIS IS THE 1ST CONTACT ADDED TO THE LIST (DO NOT ADD A COMMA).

CONTACTIDS="${CURRID}"

FI

;;

ESAC

FI

FI

DONE
IF [ "${CONTACTIDS}" != "" ]; THEN

## REMOVE ANY ADDRESSES IN THE ADDRESS BOOK THAT MATCH THE EXCEPTIONS.

${ZIMBRADIR}/BIN/ZMMAILBOX -Z -M ${PUBLICGALACCT} DELETECONTACT ${CONTACTIDS}

RETURNVALUE=$?

IF [ ${RETURNVALUE} -NE 0 ]; THEN

## WARNING DETECTED: SEND EMAIL NOTIFICATION.

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- WARNING: ${ZIMBRADIR}/BIN/ZMMAILBOX -Z -M ${PUBLICGALACCT} DELETECONTACT" >> ${LOGFILE}

ECHO "`DATE +%Y-%M-%D_%H:%M:%S` --- RETURN VALUE: ${RETURNVALUE}" >> ${LOGFILE}

F_SENDMAIL "ZIMBRA IPHONE GAL SYNC WARNING" "WARNING: ${ZIMBRADIR}/BIN/ZMMAILBOX -Z -M ${PUBLICGALACCT} GETALLCONTACTS, RETURN VALUE = ${RETURNVALUE}"

FI

FI
ECHO "`DATE +%Y-%M-%D_%H:%M:%S` - GAL SYNC COMPLETED. PROCESSED = ${CONTACTNUMALL}, REMOVED = ${CONTACTNUMDEL}." >> ${LOGFILE}
## PERFORM CLEANUP ROUTINE.

F_CLEANUP

## EXIT WITH THE COMBINED RETURN CODE VALUE.

EXIT ${ERRORFLAG}


SAMPLE GAL-SYNC.LOG SHOWING ALL POSSIBLE ERRORS AND GOOD EXITS AT THE END.



2011-10-31_13:40:20 - GAL SYNC STARTED.

2011-10-31_13:40:20 - GAL SYNC ABORTED. ERROR: ROOT USER REQUIRED.

2011-10-31_13:40:20 - GAL SYNC ABORTED. EXIT CODE: 1

2011-10-31_13:41:30 - GAL SYNC STARTED.

2011-10-31_13:41:33 --- ERROR: /OPT/ZIMBRA/BIN/ZMMAILBOX -Z -M ADMINISTRATOR@MYDOMAIN.COM GETRESTURL '/_INTERNALGAL?FMT=TGZ'

2011-10-31_13:41:33 --- RETURN VALUE: 444

2011-10-31_13:41:33 - GAL SYNC ABORTED. EXIT CODE: 2

2011-10-31_13:41:43 - GAL SYNC STARTED.

2011-10-31_13:41:46 --- ERROR: TAR -XF /TEMP/GALSYNC1.TGZ -C /TEMP/GALSYNC

2011-10-31_13:41:46 --- RETURN VALUE: 555

2011-10-31_13:41:46 - GAL SYNC ABORTED. EXIT CODE: 16

2011-10-31_13:41:56 - GAL SYNC STARTED.

2011-10-31_13:41:59 --- ERROR: TAR -CZF /TEMP/GALSYNC2.TGZ /TEMP/GALSYNC

2011-10-31_13:41:59 --- RETURN VALUE: 666

2011-10-31_13:41:59 - GAL SYNC ABORTED. EXIT CODE: 32

2011-10-31_13:42:10 - GAL SYNC STARTED.

2011-10-31_13:42:15 --- ERROR: /OPT/ZIMBRA/BIN/ZMMAILBOX -Z -M ADDRESSLIST@MYDOMAIN.COM POSTRESTURL '//?FMT=TGZ&RESOLVE=RESET'

2011-10-31_13:42:15 --- RETURN VALUE: 777

2011-10-31_13:42:15 - GAL SYNC ABORTED. EXIT CODE: 4

2011-10-31_13:42:21 - GAL SYNC STARTED.

2011-10-31_13:42:28 --- ERROR: /OPT/ZIMBRA/BIN/ZMMAILBOX -Z -M ADDRESSLIST@MYDOMAIN.COM GETALLCONTACTS

2011-10-31_13:42:28 --- RETURN VALUE: 888

2011-10-31_13:42:28 - GAL SYNC ABORTED. EXIT CODE: 8

2011-10-31_13:42:36 - GAL SYNC STARTED.

2011-10-31_13:42:45 --- WARNING: /OPT/ZIMBRA/BIN/ZMMAILBOX -Z -M ADDRESSLIST@MYDOMAIN.COM DELETECONTACT

2011-10-31_13:42:45 --- RETURN VALUE: 999

2011-10-31_13:42:46 - GAL SYNC COMPLETED. PROCESSED = 19, REMOVED = 4.

2011-10-31_13:42:51 - GAL SYNC STARTED.

2011-10-31_13:43:00 - GAL SYNC COMPLETED. PROCESSED = 19, REMOVED = 4.

2011-10-31_13:47:05 - GAL SYNC STARTED.

2011-10-31_13:47:14 - GAL SYNC COMPLETED. PROCESSED = 19, REMOVED = 4.


SAMPLE ERROR EMAIL NOTIFICATION:



SUBJECT: ZIMBRA IPHONE GAL SYNC ERROR
EXIT CODE = 32
SERVER: MAIL

PROGRAM: /VAR/SCRIPTS/PROD/GAL-SYNC.SH

LOG: /VAR/TEMP/GAL-SYNC.LOG


SAMPLE WARNING EMAIL NOTIFICATION:



SUBJECT: ZIMBRA IPHONE GAL SYNC WARNING
WARNING: /OPT/ZIMBRA/BIN/ZMMAILBOX -Z -M ADDRESSLIST@MYDOMAIN.COM GETALLCONTACTS, RETURN VALUE = 999
SERVER: MAIL

PROGRAM: /VAR/SCRIPTS/PROD/GAL-SYNC.SH

LOG: /VAR/TEMP/GAL-SYNC.LOG


SAMPLE OF /VAR/LOG/MESSAGES:



OCT 31 13:40:20 MAIL LHAMMONDS: /VAR/SCRIPTS/PROD/GAL-SYNC.SH: ERROR CODE = 1

OCT 31 13:41:33 MAIL ROOT: /VAR/SCRIPTS/PROD/GAL-SYNC.SH: ERROR CODE = 2

OCT 31 13:41:46 MAIL ROOT: /VAR/SCRIPTS/PROD/GAL-SYNC.SH: ERROR CODE = 16

OCT 31 13:41:59 MAIL ROOT: /VAR/SCRIPTS/PROD/GAL-SYNC.SH: ERROR CODE = 32

OCT 31 13:42:15 MAIL ROOT: /VAR/SCRIPTS/PROD/GAL-SYNC.SH: ERROR CODE = 4

OCT 31 13:42:28 MAIL ROOT: /VAR/SCRIPTS/PROD/GAL-SYNC.SH: ERROR CODE = 8


THIS IS HOW I SETUP AN IPHONE
TO ACCESS PERSONAL EMAILS:




  • CLICK THE SETTINGS ICON

  • SELECT MAIL, CONTACTS, CALENDARS, ADD ACCOUNT..., OTHER, ADD MAIL ACCOUNT

  • SET THE FOLLOWING AND CLICK NEXT:

    NAME: JOHN DOE

    ADDRESS: JDOE@MYDOMAIN.COM

    PASSWORD: ******

    DESCRIPTION: JDOE @ MYDOMAIN

  • SELECT IMAP, SET THE FOLLOWING AND CLICK NEXT, FINISH

    INCOMING HOSTNAME: MAIL.MYDOMAIN.COM

    INCOMING USER NAME: JDOE

    INCOMING PASSWORD: *****

    OUTGOING HOSTNAME: MAIL.MYDOMAIN.COM

    OUTGOING USER NAME: JDOE

    OUTGOING PASSWORD: *****


TO ACCESS PERSONAL CALENDARS:




  • CLICK THE SETTINGS ICON

  • SELECT MAIL, CONTACTS, CALENDARS, ADD ACCOUNT..., OTHER, ADD CALDAV ACCOUNT

  • SET THE FOLLOWING AND CLICK NEXT:

    SERVER: MAIL.MYDOMAIN.COM

    USER NAME: JDOE

    PASSWORD: ******

    DESCRIPTION: PERSONAL CALENDARS @ MYDOMAIN


TO ACCESS PERSONAL CONTACTS:




  • CLICK THE SETTINGS ICON

  • SELECT MAIL, CONTACTS, CALENDARS, ADD ACCOUNT..., OTHER, ADD CARDDAV ACCOUNT

  • SET THE FOLLOWING AND CLICK NEXT:

    SERVER: MAIL.MYDOMAIN.COM

    USER NAME: JDOE

    PASSWORD: ******

    DESCRIPTION: PERSONAL CONTACTS @ MYDOMAIN


TO ACCESS THE GLOBAL ADDRESS LIST:




  • CLICK THE SETTINGS ICON

  • SELECT MAIL, CONTACTS, CALENDARS, ADD ACCOUNT..., OTHER, ADD CARDDAV ACCOUNT

  • SET THE FOLLOWING AND CLICK NEXT:

    SERVER: MAIL.MYDOMAIN.COM

    USER NAME: ADDRESSLIST

    PASSWORD: ******

    DESCRIPTION: GLOBAL ADDRESS LIST @ MYDOMAIN


REFERENCES: "GAL SYNC ACCOUNT (WIKI)

Return to “Installation and Upgrade”

Who is online

Users browsing this forum: No registered users and 2 guests