Wednesday, January 30, 2008

NTP installation and Date Synchronization

NTP stands for Network Time Protocol, and it is an Internet protocol used to synchronize the clocks of computers to some time reference. SNTP (Simple Network Time Protocol) is basically also NTP, but lacks some internal algorithms that are not needed for all types of servers.

Why should Time be synchronized?
-----------------------------------

Time usually just advances. If you have communicating programs running on different computers, time still should even advance if you switch from one computer to another. Obviously if one system is ahead of the others, the others are behind that particular one. From the perspective of an external observer, switching between these systems would cause time to jump forward and back, a non-desirable effect.

As a consequence, isolated networks may run their own wrong time, but as soon as you connect to the Internet, effects will be visible. Just imagine some EMail message arrived five minutes before it was sent, and there even was a reply two minutes before the message was sent.

Even on a single computer some applications have trouble when the time jumps backwards. For example, database systems using transactions and crash recovery like to know the time of the last good state.

What are the basic features of NTP?
-------------------------------------

There exist several protocols to synchronize computer clocks, each having distinguished features. Here is a list of NTP's features:

NTP needs some reference clock that defines the true time to operate. All clocks are set towards that true time. (It will not just make all systems agree on some time, but will make them agree upon the true time as defined by some standard.)

NTP uses UTC as reference time

  • NTP is a fault-tolerant protocol that will automatically select the best of several available time sources to synchronize to. Multiple candidates can be combined to minimize the accumulated error. Temporarily or permanently insane time sources will be detected and avoided.

  • NTP is highly scalable: A synchronization network may consist of several reference clocks. Each node of such a network can exchange time information either bidirectional or unidirectional. Propagating time from one node to another forms a hierarchical graph with reference clocks at the top.

  • Having available several time sources, NTP can select the best candidates to build its estimate of the current time. The protocol is highly accurate, using a resolution of less than a nanosecond



Install ntp
--------------

You can easily install NTP (Network Time Protocol, a means of transmitting time signals over a computer network) using yum command under Redhat or CentOS/Fedora core Linux.

# yum install ntp
# chkconfig ntpd on
# ntpdate pool.ntp.org
# /etc/init.d/ntpd start

Make sure that you have opened the ports 13 and 123


OR

*download ntp files from

http://www.ntp.org/downloads.html

*untar
*cd
*./configure --prefix=/usr --bindir=/usr/sbin \
--sysconfdir=/etc &&

*make
make check
*make install

configurajtion file

/etc/ntp.conf


?Set dat and time in different time zone


date
vi /usr/share/zoneinfo/Singapore
ln -s /usr/share/zoneinfo/Singapore /etc/localtime
unlink /etc/localtime
ln -s /usr/share/zoneinfo/Singapore /etc/localtime
date monthdatetime



Synchronizing the Time
----------------------

There are two options. Option one is to run ntpd continuously and allow it to synchronize the time in a gradual manner. The other option is to run ntpd periodically (using cron) and update the time each time ntpd is scheduled.

If you choose Option one, then install the /etc/rc.d/init.d/ntp init script included in the blfs-bootscripts-6.1 package.


make install-ntp

If you prefer to run ntpd periodically, add the following command to root's crontab:

ntpd -q


Contents
--------
Installed Programs: ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq, ntptime, ntptrace, and tickadj
Installed Libraries: None
Installed Directory: /usr/share/doc/ntp-4.2.0


Short Descriptions
------------------
ntp-keygen

generates cryptographic data files used by the NTPv4 authentication and identification schemes.

ntp-wait

is useful at boot time, to delay the boot sequence until ntpd has set the time.

ntpd

is a NTP daemon that runs in the background and keeps the date and time synchronized based on response from configured NTP servers. It also functions as a NTP server.

ntpdate

is a client program that sets the date and time based on the response from an NTP server. This command is deprecated.

ntpdc

is used to query the NTP daemon about its current state and to request changes in that state.

ntpq

is an utility program used to monitor ntpd operations and determine performance.
ntptime

reads and displays time-related kernel variables.

ntptrace

traces a chain of NTP servers back to the primary source.

tickadj

reads, and optionally modifies, several timekeeping-related variables in older kernels that do not have support for precision timekeeping.

FTP server installation and introduction

Setting up an FTP server is very simple. The steps are as follows
-----------------------------------------------------------------

* Download the rpm.
* Install the rpm.
* Edit the .conf file.
* Start the ftp server.
* Test the connection.

Download the RPM
----------------

There are many ftp servers available for Linux. Most ftp servers do the same thing so the choice is really up to you. The ftp server that I like to use is vsftpd. The rpm is usually available from the installation discs or can be downloaded from rpmfind or just use google. vsftpd is used by many large companies as the ftp server of choice and is very secure (it's part of the name so it must be true, right?).

Install the ftp server.
-----------------------

First check to see if VSFTPD is already installed on your machine, this is easily done by using:

root@cartman> rpm -q vsftpd

The system will tell you if the server is installed or not. If you get this message 'package vsftpd is not installed' then you will need to install the ftp server.

First download the latest version of VSFTPD from your preferred mirror and save it to e.g. /tmp on the server. The ftp directory structure required for your repository is unlikely to exist yet so you will need to create the repository directories that you planned out above, for example:


root@cartman> mkdir -p /var/ftp/pub/9/updates/

(the -p flag tells mkdir to create the whole tree of directories as required).

To install/upgrade the ftp server run the following as root:

root@cartman>rpm -Uvh /tmp/vsftpd-1.1.3-8.i386.rpm

Note that one will want this rpm to be in a repository the server itself uses to yum update from in the long run. It is very likely to be in a primary distribution repository you mirror, but you may have to put it in a local/update repository you maintain yourself from some other source.

(You can of course use rpm -ivh vsftpd-1.1.3-8.i386.rpm to install the package if the package is not already installed. The flag -U is for upgrade and -i is for install. No big deal, they will both work if the package does not exist on your system, IMHO -U is just better practise. It is not a good idea to use rpm -i if a previous version of the package already exists on your system.)



Edit the vsftpd.conf file
-------------------------

After the ftp package has been installed you will need to edit the vsftp.conf file. This is usually found at /etc/vsftpd/vsftpd.conf. If it is not here then just run:

jdip@cartman>rpm -ql vsftpd

and look in the list where the .conf file is. To edit the .conf file you can use kate, gedit, vi or any other text editor. This is the configuration file for the ftp server. You will need to be root to change the file:

root@cartman>vi /etc/vftp/vsftp.conf

If your network is secure and behind a firewall then you can leave the following option in the .conf file. This option allows for anonymous ftp access to your server:

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES

You can also change the welcome message of the ftp server.

# You may fully customise the login banner string:
ftpd_banner=Welcome to yum FTP service.

If you want increased security for your ftp server then set the flag anonymous_enable=NO. This will force the user to log into the ftp server to get access to the packages. If you want to use this option then you will need to create a yum user on the server that can be used by the yum client to access the server. It is prudent to make users log into the ftp server, but if this is your private server then it may not be necessary.

Save the .conf file.

You will need to (re)start the service to activate the changes to the ftp server (see next section).


Start the server
----------------

If you installed VSFTPD from the rpm then VSFTPD can be started as a service:

root@cartman>service vsftpd restart

You should get this message:

Shutting down vsftpd: [ OK ] or [ FAILED ]
Starting vsftpd for vsftpd: [ OK ]

You will want your ftp server to start every time you start Linux so it is also prudent to run:

root@cartman>chkconfig vsftpd on
root@cartman>chkconfig --list vsftpd

You should get a message that looks like this:

vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Your ftp server will now start every time you start Linux on this machine. The ftp server is up and waiting for connections.



Testing the FTP server
----------------------

It is a good idea to test that the ftp server is working correctly. This is easily done by logging onto the ftp server:

jdip@cartman>ftp 127.0.0.1
Connected to 127.0.0.1 (127.0.0.1).
220 Welcome to yum FTP service.
Name (127.0.0.1:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

If you type ls at the prompt you will see that you are in the 'pub' directory. This is /var/ftp/pub. This path (and the full path of the repository you're setting up) are important to remember for when you use rsync to build the mirrors, for when you use yum-arch to "yummify" the repository (see below), and for setting up a local yum.conf for your local clients so that they can update from this ftp-based repository.

That is it. The ftp server is running and waiting for connections. Skip ahead to where it describes how to get and install yum and yummify the repository.

ALTERNATIVE STEP
----------------

#yum install ftpserver


CREATE FTP USER TO A DIRECTORY
-------------------------------

#useradd -d "directory name" user_name
#passwd user_name

COMMANDS
--------


[root@bigboy tmp]# /etc/init.d/vsftpd start
[root@bigboy tmp]# /etc/init.d/vsftpd stop
[root@bigboy tmp]# /etc/init.d/vsftpd restart

[root@bigboy tmp]# chkconfig vsftpd on

root@u-bigboy:/tmp# sysv-rc-conf on

Testing the Status of VSFTPD
------------------------------

[root@bigboy root]# netstat -a | grep ftp
tcp 0 0 *:ftp *:* LISTEN
[root@bigboy root]#



FTP Security Issues
---------------------

FTP has a number of security drawbacks, but you can overcome them in some cases. You can restrict an individual Linux user's access to non-anonymous FTP, and you can change the configuration to not display the FTP server's software version information, but unfortunately, though very convenient, FTP logins and data transfers are not encrypted.
The /etc/vsftpd.ftpusers File

For added security, you may restrict FTP access to certain users by adding them to the list of users in the /etc/vsftpd.ftpusers file. The VSFTPD package creates this file with a number of entries for privileged users that normally shouldn't have FTP access. As FTP doesn't encrypt passwords, thereby increasing the risk of data or passwords being compromised, it is a good idea to let these entries remain and add new entries for additional security.


Anonymous Upload
-----------------

If you want remote users to write data to your FTP server, then you should create a write-only directory within /var/ftp/pub. This will allow your users to upload but not access other files uploaded by other users. The commands you need are:

[root@bigboy tmp]# mkdir /var/ftp/pub/upload
[root@bigboy tmp]# chmod 722 /var/ftp/pub/upload

FTP Greeting Banner
-------------------

Change the default greeting banner in the vsftpd.conf file to make it harder for malicious users to determine the type of system you have. The directive in this file is.

ftpd_banner= New Banner Here


Troubleshooting FTP
----------------------

You should always test your FTP installation by attempting to use an FTP client to log in to your FTP server to transfer sample files.

The most common sources of day-to-day failures are incorrect usernames and passwords.

Initial setup failures could be caused by firewalls along the path between the client and server blocking some or all types of FTP traffic. Typical symptoms of this are either connection timeouts or the ability to use the ls command to view the contents of a directory without the ability to either upload or download files. Follow the firewall rule guidelines to help overcome this problem. Connection problems could also be the result of typical network issues outlined in Chapter 4, "Simple Network Troubleshooting".
Tutorial

FTP has many uses, one of which is allowing numerous unknown users to download files. You have to be careful, because you run the risk of accidentally allowing unknown persons to upload files to your server. This sort of unintended activity can quickly fill up your hard drive with illegal software, images, and music for the world to download, which in turn can clog your server's Internet access and drive up your bandwidth charges.
FTP Users with Only Read Access to a Shared Directory

In this example, anonymous FTP is not desired, but a group of trusted users need to have read only access to a directory for downloading files. Here are the steps:

1) Disable anonymous FTP. Comment out the anonymous_enable line in the vsftpd.conf file like this:

# Allow anonymous FTP?
anonymous_enable=NO

2) Enable individual logins by making sure you have the local_enable line uncommented in the vsftpd.conf file like this:

# Uncomment this to allow local users to log in.
local_enable=YES

3) Start VSFTP.

[root@bigboy tmp]# service vsftpd start

4) Create a user group and shared directory. In this case, use /home/ftp-users and a user group name of ftp-users for the remote users

[root@bigboy tmp]# groupadd ftp-users
[root@bigboy tmp]# mkdir /home/ftp-docs

5) Make the directory accessible to the ftp-users group.

[root@bigboy tmp]# chmod 750 /home/ftp-docs
[root@bigboy tmp]# chown root:ftp-users /home/ftp-docs

6) Add users, and make their default directory /home/ftp-docs

[root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user1
[root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user2
[root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user3
[root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user4
[root@bigboy tmp]# passwd user1
[root@bigboy tmp]# passwd user2
[root@bigboy tmp]# passwd user3
[root@bigboy tmp]# passwd user4

7) Copy files to be downloaded by your users into the /home/ftp-docs directory

8) Change the permissions of the files in the /home/ftp-docs directory for read only access by the group

[root@bigboy tmp]# chown root:ftp-users /home/ftp-docs/*
[root@bigboy tmp]# chmod 740 /home/ftp-docs/*

Users should now be able to log in via FTP to the server using their new usernames and passwords. If you absolutely don't want any FTP users to be able to write to any directory, then you should set the write_enable line in your vsftpd.conf file to no:

write_enable = NO

Remember, you must restart VSFTPD for the configuration file changes to take effect.

Monday, January 28, 2008

Forgot root passoword! Recovering

  • Forgot root password recover linux root password.

Solution:

Boot into single usermode or boot using rescue disk.

If Grub is password protected then use the rescue disk, chroot /mnt/sysimage, then use the passwd command.

If Grub is not password protected, then you can login to single usermode by appending an "S" to the end of the kernel line that you have to boot. Select the kernel that you wish to boot with and press 'e'.

Now append an 'S' to the end of the line, press Return, and then 'b', once the system is booted into single usermode you can use the passwd command to reset the root password.

On debian base system you can use the following method

Choose the kernel you want to boot

Press "e" to edit

Press the "end" button type in a comma space ", " and then type "single"

Press and than "b" to boot that kernel, this will take into single user mod

Zimbra-install-Zimbra-backup-Zimbra-Upgrade-Zimbra-Integrity

Zimbra-install-Zimbra-backup-Zimbra-Upgrade-Zimbra-Integrity

Zimbra provides open source email and calendar groupware software, Zimbra is a popular choice for Linux and Mac OS X email servers.

Install for ubuntu

rm -f /bin/sh

ln -s /bin/bash /bin/sh

apt-get install curl fetchmail libpcre3 libgmp3c2 libexpat1 libxml2 libtie-ixhash-perl

http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/z/zi/zimbra/

http://www.zimbra.com/community/downloads.html and download the Ubuntu 6 (.tgz) package to /usr/src, for

cd /usr/src

wget http://kent.dl.sourceforge.net/sourceforge/zimbra/zcs-4.5.3_GA_733.UBUNTU6.tgz

tar xvfz zcs-4.5.3_GA_733.UBUNTU6.tgz

cd zcs/

./install.sh

To test if all Zimbra services are running, become the zimbra user

su - zimbra

and run

zmcontrol status

If not all services are started, run

zmcontrol start

Type

exit

Log in with the username admin and the password you specified during the Zimbra installation:

Uninstall Zimbra

If you want to uninstall Zimbra, do it like this:

Go the the Zimbra installation directory :

cd /usr/src/zcs

Then run

./install.sh -u

and delete the Zimbra installation directory afterwards:

cd /usr/src

rm -rf zcs



Links

Zimbra: http://www.zimbra.com

Zimbra Documentation: http://www.zimbra.com/community/documentation.html

Zimbra Wiki: http://wiki.zimbra.com

http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/z/zi/zimbra/ Zimbra_RedHat5_Downloads_Moved_README.txt

http://www.zimbra.com/community/downloads.html

http://files.zimbra.com/downloads/5.0.0_RC1/zcs-5.0.0_RC1_1538.RHEL5.20071002152418.tgz

http://files.zimbra.com/downloads/5.0.0_RC1/zcs-5.0.0_RC1_1538-src.tgz

What happens during install


[root@washington zcs]# ./install.sh

chown: `zimbra:zimbra': invalid user

Operations logged to /tmp/install.log.16825
Checking for existing installation...
zimbra-ldap...NOT FOUND
zimbra-logger...NOT FOUND
zimbra-mta...NOT FOUND
zimbra-snmp...NOT FOUND
zimbra-store...NOT FOUND
zimbra-apache...NOT FOUND
zimbra-spell...NOT FOUND
zimbra-core...NOT FOUND


PLEASE READ THIS AGREEMENT CAREFULLY BEFORE USING THE SOFTWARE.
ZIMBRA, INC. ("ZIMBRA") WILL ONLY LICENSE THIS SOFTWARE TO YOU IF YOU
FIRST ACCEPT THE TERMS OF THIS AGREEMENT. BY DOWNLOADING OR INSTALLING
THE SOFTWARE, OR USING THE PRODUCT, YOU ARE CONSENTING TO BE BOUND BY
THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS
AGREEMENT, THEN DO NOT DOWNLOAD, INSTALL OR USE THE PRODUCT.

License Terms for the Zimbra Collaboration Suite:
http://www.zimbra.com/license/zimbra_public_eula_2.1.html


Press Return to continue

Checking for prerequisites...
NPTL...FOUND
sudo...FOUND sudo-1.6.7p5-30.1.3
libidn...FOUND libidn-0.5.6-1
curl...FOUND curl-7.12.1-5
fetchmail...FOUND fetchmail-6.2.5-6
gmp...FOUND gmp-4.1.4-3
compat-libstdc++-296...FOUND compat-libstdc++- 296-2.96-132.7.2
compat-libstdc++-33...FOUND compat-libstdc++-33-3.2.3-47.3
/usr/lib/libstdc++.so.5...FOUND

Checking for installable packages

Found zimbra-core
Found zimbra-ldap
Found zimbra-logger
Found zimbra-mta
Found zimbra-snmp
Found zimbra-store
Found zimbra-apache
Found zimbra-spell


Select the packages to install

Install zimbra-ldap [Y] y

Install zimbra-logger [Y] y

Install zimbra-mta [Y] y

Install zimbra-snmp [Y] y

Install zimbra-store [Y] y

Install zimbra-spell [Y] y
Checking required space for zimbra-core
checking space for zimbra-store

Installing:
zimbra-core
zimbra-ldap
zimbra-logger
zimbra-mta
zimbra-snmp
zimbra-store
zimbra-apache
zimbra-spell
You appear to be installing packages on a platform different
than the platform for which they were built

This platform is CentOS4
Packages found: zimbra-core-4.5.8_GA_1394.RHEL4-20071002233417.i386.rpm
This may or may not work


Install anyway? [N] y

The system will be modified. Continue? [N] y

Removing /opt/zimbra
Installing packages

zimbra-core......zimbra-core-4.5.8_GA_1394.RHEL4-20071002233417.i386.rpm...done
zimbra-ldap......zimbra-ldap-4.5.8_GA_1394.RHEL4-20071002233417.i386.rpm...done
zimbra-logger......zimbra-logger-4.5.8_GA_1394.RHEL4-20071002233417.i386.rpm...done
zimbra-mta......zimbra-mta-4.5.8_GA_1394.RHEL4-20071002233417.i386.rpm...done
zimbra-snmp......zimbra-snmp-4.5.8_GA_1394.RHEL4-20071002233417.i386.rpm...done
zimbra-store......zimbra-store-4.5.8_GA_1394.RHEL4-20071002233417.i386.rpm...done
zimbra-apache......zimbra-apache-4.5.8_GA_1394.RHEL4-20071002233417.i386.rpm...done
zimbra-spell......zimbra-spell-4.5.8_GA_1394.RHEL4-20071002233417.i386.rpm...done
Operations logged to /tmp/zmsetup.log.20428
Setting defaults...No results returned for A lookup of washington.armia.com
Checked nameservers:
4.2.2.2
4.2.2.4


DNS ERROR resolving washington.armia.com

It is suggested that the hostname be resolveable via DNS
Change hostname [Yes] No


DNS ERROR resolving MX for washington.armia.com
It is suggested that the domain name have an MX record configured in DNS
Change domain name? [Yes] No
Done
Checking for port conflicts
Port conflict detected: 25 (zimbra-mta)
Port conflicts detected! - Any key to continue

Main menu

1) Hostname: washington.armia.com
2) Ldap master host: washington.armia.com
3) Ldap port: 389
4) Ldap password: set
5) TimeZone: (GMT-08.00) Pacific Time (US & Canada)
6) zimbra-ldap: Enabled
7) zimbra-store: Enabled
+Create Admin User: yes
+Admin user to create: admin@washington.armia.com
******* +Admin Password UNSET
+Enable automated spam training: yes
+Spam training user: spam.yiz5qtqvrc@washington.armia.com
+Non-spam(Ham) training user: ham.bvzs0w1t@washington.armia.com
+Global Documents Account: wiki@washington.armia.com
+SMTP host: washington.armia.com
+Web server HTTP port: 80
+Web server HTTPS port: 443
+Web server mode: http
+Enable POP/IMAP proxy: no
+IMAP server port: 143
+IMAP server SSL port: 993
+POP server port: 110
+POP server SSL port: 995
+Use spell check server: yes
+Spell server URL: http://washington.armia.com:7780/aspell.php

8) zimbra-mta: Enabled
9) zimbra-snmp: Enabled
10) zimbra-logger: Enabled
11) zimbra-spell: Enabled
r) Start servers after configuration yes
s) Save config to file
x) Expand menu
q) Quit

Address unconfigured (**) items (? - help)


Zimbar new release 5.0.1 is out.

-- Zimbra demo is at http://www.zimbra.com/products/hosted_demo.php

Submit a bug at http://bugzilla.zimbra.com/

Network Edition: http://www.zimbra.com/products/downloads_network_edition_betas.html

Open Source Edition: http://www.zimbra.com/community/downloads.html

http://www.zimbra.com/products/downloads.html

Restore mailboxes, including the LDAP directory server, database, index directory, and message directory for each mailbox

The redo logs are a journal of every activity that has been logged.

You can restore the LDAP directory without restoring the message server

Each Zimbra server generates redo logs that contain every transaction processed by that server

The Zimbra default backup directory is /opt/zimbra/backup.

Perform full and incremental backups, restore the mail server, or restore the LDAP server

zmschedulebackup. This command is used to schedule full backups and incremental backups and add the backup schedule to your cron table.

zmbackupabort. This command stops a full backup that is in process.

zmbackupabort -r. This command stops an ongoing restore.

zmbackupquery. This command lists the information about ongoing and completed backups

zmrestore. This command executes a full or incremental restore to the Zimbra mail server. The zmrestore command is performed on a server that is running.

zmrestoreldap. This command restores the complete LDAP directory server, including accounts, domains, servers, COS and other data.

Enter the command zmschedulebackup -D for the default schedule.

zmbackup. This command executes full or incremental backup of the mail server.

By default, the backup files are saved to the server's backup directory. /opt/zimbra/backup

Steps to backup the message store, the database, the indexes, and the LDAP directory

You can use the zmbackupquery command to check the status of the running backup at any time.

Incremental backups are run using the CLI command, zmbackup

Perform a full backup of all mailboxes on server1 to target at /mnt/disk.

zmbackup -f -s server1.domain.com -a all -t /mnt/disk

Perform incremental backup of all mailboxes on server1 since last full backup.

zmbackup -i -s server1.domain.com -a all -t /mnt/disk

Perform full backup of only user1's mailbox on server1, to the default backup target

zmbackup -f -s server1.domain.com -a user1@domain.com

Perform incremental backup of user1's mailbox on server1, to the default backup target.

zmbackup -i -s server1.domain.com -a user1@domain.com

The zmbackupquery command is used to find full backup sets

The backup session temporary file can be found at /sessions_tmp

zmbackupabort to stop a backup that is in progress

use zmbackupquery to find the label name

zmbackupabort -lb backup200507121559510 -s server1

Sources: Zimbra.com/http://wiki.zimbra.com/index.php?title=Network_Edition_Backup_Procedure

Zimbra Upgarde.

The upgrade script will remove any zimlets that are not compatible with Zimbra 5.0. Skins from 4.5 also may not work under 5.0

Zimbra Download.

http://files.zimbra.com/downloads/5.0.0_GA/5_0_OS_Release%20Notes.pdf http://files.zimbra.com/downloads/5.0.0_GA/zcs-5.0.0_GA_1869.RHEL4.20071218182359.tgz http://files.zimbra.com/downloads/5.0.0_GA/zcs-5.0.0_GA_1869.UBUNTU6.20071218195304.tgz http://files.zimbra.com/downloads/5.0.0_GA/zcs-5.0.0_GA_1869.DEBIAN4.0.20071218200820.tgz

The Jetty Web Server is now used as the server container that the zimbra software runs within.

Domains name can be changed fromt he zmprov cli command

Ngnix is now used to support more scalable POP/IMAP proxy

memcache is dhipped as the caching layer to cache LDAP lookups.

Server should firewall setup up properly.

Zimbar administrative port number is 7071

Migrations of exchange server email accounts from Exchange 2000, 2003, Lotus Domino can be done.

Users can import the .pst file that they are using with outlook.

After the backup is done the server also need to be backed up.

Upgrading zimbra will not delete the accounts or make changes to the configuraions

Configurations settings are stored in LDAP

All custom made changes will be removed -- themes, logo, crontabs etc.

How to check the zimbra Database Integrity Check.

Check the mysql database using the command zmdbintegrityreport prior to making any system changes.

SINGLE SERVER UPGRADE.

  • Upgarde service automatically stops and starts the servce.
  • Use the (nohup) command while running the upgarde, so that it is immune to hangups.
  • You have to do the backup first before you do an upgrade.

-- For multi server upgarde

  • Stop all the server in the zcs environment.
  • zmcontrol stop
  • Upgarde process -- LDAP serer, Mail, Store Serer and then the MTA Server.

-- For MAC machines:

/opt/zimbra/libexec/zmsetup.pl is the ZCS configuration upgrade.

To check the status of the server run the command zmcontrol status Or to start the service type zmcontrol start

To see the password on a serve, type zmlocalconfig -s


FTP and Anonymous FTP

What is FTP?

FTP (File Transfer Protocol) allows a person to transfer files
between two computers, generally connected via the Internet. If
your system has FTP and is connected to the Internet, you can
access very large amounts of files available on a great number of
computersystems. If you are on Bitnet or a UUCP host, you should
look for servers that work through electronic mail (e-mail). A
good source of information on archives in general, is the Usenet
newsgroup comp.archives. When using FTP, you use a program, called
a 'client' to connect to a machine that holds the files, a 'server'.

What is Anonymous FTP?

Many computersystems throughout the Internet offer files through
anonymous FTP. This means that you can access a machine
without having to have an account on that machine (i.e. you don't
have to be an official user of the system). These anonymous FTP
servers contain software, documents of various sorts, files
for configuring networks, graphic images, songlyrics and all sorts
of other information. Archives for electronic mailing lists are
often stored on and are available through anonymous FTP. An
enormous amount of information is stored on these machines and is
ready for anyone who's seeking it.

Note that all this is subject to change, it is a privilege
and the person responsible for the machine can shut it down
at any time without you being able to do anything about it.

Commands

All the normal FTP commands may be used to retrieve files. Some
FTP commands are the same on different computers, but others
are not. Also, some of the ftp sites offer custom commands like
getting a directory with one command, 'regetting' a file or searching
of directories. Read the relevant README files on the site itself
for the 'special access features'.
Usually, FTP will list the commands if you type 'help' or type a
question mark (?). Also, your computer's help command may have
information about FTP. Try 'man ftp', 'man ftpd', 'help ftp',
'ftp /?', 'ftp -?' or 'ftp /h' (all these to be typed without
quotes).

Some useful commands available on most systems include:

ascii Switch to ascii mode. Ascii mode is the default mode
and used for transferring text files
binary Switch to binary mode. For transferring binary files
like .ZIP files, .Z files and the like
cd Change the directory on the remote computer
dir List the files in the current directory on the remote
computer.
ls Same as 'dir', but shows less information sometimes.
get Copy a file from the remote computer to yours
hash Puts a '#' on the screen for every of bytes
transferred. is 1024 in some cases, 2048 in others
but is between 1024 and 4096 in most cases.
Check the ftp 'help' function for more info on the number for
your clientprogram.
help Gives help on the use of commands within the ftp program
lcd Change the directory on your computer (the 'l' is for local)
lpwd Shows the present working directory (pwd) on your
computer (the 'l' is for local). Note: this may not
work on all machines. On a Unix machine, try !pwd
if lwpd doesn't work.
mget Copy multiple files from the remote computer to yours
pwd Shows the present working directory (pwd) on the
remote computer

Procedure

Anonymous FTP is a facility offered by many machines on the
Internet. This permits you to log in with the user name 'anonymous'
or the user name 'ftp'. When prompted for a password, type your e-mail
address -- it's not necessary, but it's a courtesy for those
sites that like to know who is making use of their facility. Be
courteous. Some sites require a valid e-mail address, others don't.

You can then look around and retrieve files. (Most anonymous ftp
sites do not permit people to store files). Note that when you
retrieve files, you have to know where the files are going to
end up on your machine. This is where the 'lpwd' command comes
in handy. Also note that when you have transferred a file that
you want to use on your PC, but you run ftp from a Unix machine
(or a similar mainframe or network machine), you will have to ftp
the file from the Unix machine to your PC first (this is assuming
that you can't ftp to outside your company or campus from your PC,
otherwise you could have gotten the file directly to the PC).
This may sound silly, but sometimes people don't know where their
files are stored or a system administrator decides to give ftp
access to only a few systems.

Typically, a directory called 'pub' is where the interesting
things are stored. Some sites will have a file with a name
like ls-lR, that contains a complete list of the files on
that site. Otherwise, you can type ls -lR and get such a listing
-- for some sites, this can take a LONG time (the size of the
resulting file can be anywhere between approximately 2000 bytes
and 25Mb).

When retrieving non-text files, you must use binary mode,
otherwise the file gets messed up. To do this, use the
'binary' command. (It's safe to set this for text files, but
the result might look a bit different from an ASCII transfer)
If the site at the other end is non-Unix, you may need to
use some other mode -- see the documents or README files
for that site and for FTP (common other modes, are LZ for
VAX Multinet servers, tenex or image for some others).

The simplest way to initiate FTP would be to give the command
'ftp '. The is the remote
system you are connecting to, either a name like garbo.uwasa.fi,
if you have an entry in /etc/hosts or are accessing a Domain
Name Server or the Internet address 193.166.120.5 for Garbo. If
that last sentence doesn't seem to make sense just try: ftp
garbo.uwasa.fi or ftp 193.166.120.5 and look what happens.
After a short wait, you will be prompted for your username. If
you do not have an account on the remote system, some systems
allow you to use 'anonymous'. This gives you a restricted
access path (meaning that you can only run certain commands
like 'dir' or 'ls' and are allowed only access to certain
directories like 'pub').

You would then be prompted for a password. Some systems will
tell you to send your real identity as the password. What you
type doesn't matter in most cases, but it is suggested to give
your e-mail address. This as a courtesy to the archive maintainers,
who would like to know who's using their system. Other systems
need a password of 'guest', or something similar.
DO NOT TYPE A PASSWORD THAT YOU USE ON YOUR OWN SYSTEM!

After that, you should receive the FTP prompt ( usually ftp> )
and have access. You can get a directory of files by giving a
'dir' command. If the remote system is Unix-based and dir does
not work, try 'ls -l' for an MS-DOS like output.
On Garbo, there is a file available in the default anonymous ftp
directory that explains what Garbo is and where files are located.
Look for 00-index.txt or README files or some similar name.

Command
----------
ftp test.com

username : anonymous
password : guest or your email id

VI Editor Introduction

Introduction

The VI editor is a screen-based editor used by many Unix users. The VI editor has powerful features to aid programmers, but many beginning users avoid using VI because the different features overwhelm them. This tutorial is written to help beginning users get accustomed to using the VI editor, but also contains sections relevant to regular users of VI as well. Examples are provided, and the best way to learn is to try these examples, and think of your own examples as well... There's no better way than to experience things yourself.

Conventions

In this tutorial, the following convention will be used:

^X denotes a control character. For example, if you see: ^d in the tutorial, that means you hold down the control key and then type the corresponding letter. For this example, you would hold down the control key and then type d.

Before You Begin

The VI editor uses the full screen, so it needs to know what kind of terminal you have. When you log in, wiliki should ask you what terminal you have. The prompt looks like this:

 TERM = (vt100)

If you know your terminal is a vt100 (or an emulator that can do vt100), just hit return for the terminal type when you log in. If you have an hp terminal, type "hp" for the terminal type and hit return. If you are not sure what kind of terminal you have, ask a lab monitor, or have someone help you set the correct terminal type.

If you make an error when you log in and type the wrong terminal type, don't panic and log out. You can type the following commands to fix the settings:

    First, tell your shell what type of terminal you have. (If you're not sure what your shell is, type this command to see what shell you have: echo $SHELL.) For the examples given, the terminal type is "vt100". Substitute it with whatever terminal type you have. For C shell (/bin/csh), the command is this:

            set term=vt100
    For Bourne Shell (/bin/sh) or Korn Shell (/bin/ksh), the commands are the following:
            export TERM
    TERM=vt100
    Next, reset your terminal with this command:
            tset

Now that the terminal type is (hopefully) correctly set, you are ready to get started with VI.

Starting the VI Editor

The VI editor lets a user create new files or edit existing files. The command to start the VI editor is vi, followed by the filename. For example to edit a file called temporary, you would type vi temporary and then return. You can start VI without a filename, but when you want to save your work, you will have to tell VI which filename to save it into later.

When you start VI for the first time, you will see a screen filled with tildes (A tilde looks like this: ~) on the left side of the screen. Any blank lines beyond the end of the file are shown this way. At the bottom of your screen, the filename should be shown, if you specified an existing file, and the size of the file will be shown as well, like this:

"filename" 21 lines, 385 characters
If the file you specified does not exist, then it will tell you that it is a new file, like this:
"newfile" [New file]
If you started VI without a filename, the bottom line of the screen will just be blank when VI starts. If the screen does not show you these expected results, your terminal type may be set wrong. Just type :q and return to get out of VI, and fix your terminal type. If you don't know how, ask a lab monitor.

Getting Out of VI

Now that you know how to get into VI, it would be a good idea to know how to get out of it. The VI editor has two modes and in order to get out of VI, you have to be in command mode. Hit the key labeled "Escape" or "Esc" (If your terminal does not have such a key, then try ^[, or control-[.) to get into command mode. If you were already in the command mode when you hit "Escape", don't worry. It might beep, but you will still be in the command mode.

The command to quit out of VI is :q. Once in command mode, type colon, and 'q', followed by return. If your file has been modified in any way, the editor will warn you of this, and not let you quit. To ignore this message, the command to quit out of VI without saving is :q!. This lets you exit VI without saving any of the changes.

Of course, normally in an editor, you would want to save the changes you have made. The command to save the contents of the editor is :w. You can combine the above command with the quit command, or :wq. You can specify a different file name to save to by specifying the name after the :w. For example, if you wanted to save the file you were working as another filename called filename2, you would type: w filename2 and return.

Another way to save your changes and exit out of VI is the ZZ command. When in command mode, type ZZ and it will do the equivalent of :wq. If any changes were made to the file, it will be saved. This is the easiest way to leave the editor, with only two keystrokes.

The Two Modes of VI

The first thing most users learn about the VI editor is that it has two modes: command and insert. The command mode allows the entry of commands to manipulate text. These commands are usually one or two characters long, and can be entered with few keystrokes. The insert mode puts anything typed on the keyboard into the current file.

VI starts out in command mode. There are several commands that put the VI editor into insert mode. The most commonly used commands to get into insert mode are a and i. These two commands are described below. Once you are in insert mode, you get out of it by hitting the escape key. If your terminal does not have an escape key, ^[ should work (control-[). You can hit escape two times in a row and VI would definitely be in command mode. Hitting escape while you are already in command mode doesn't take the editor out of command mode. It may beep to tell you that you are already in that mode.

How to Type Commands in Command Mode

The command mode commands are normally in this format: (Optional arguments are given in the brackets)

    [count] command [where]
Most commands are one character long, including those which use control characters. The commands described in this section are those which are used most commonly the VI editor.

The count is entered as a number beginning with any character from 1 to 9. For example, the x command deletes a character under the cursor. If you type 23x while in command mode, it will delete 23 characters.

Some commands use an optional where parameter, where you can specify how many lines or how much of the document the command affects, the where parameter can also be any command that moves the cursor.

Some Simple VI Commands

Here is a simple set of commands to get a beginning VI user started. There are many other convenient commands, which will be discussed in later sections.

a
enter insert mode, the characters typed in will be inserted after the current cursor position. If you specify a count, all the text that had been inserted will be repeated that many times.
h
move the cursor to the left one character position.
i
enter insert mode, the characters typed in will be inserted before the current cursor position. If you specify a count, all the text that had been inserted will be repeated that many times.
j
move the cursor down one line.
k
move the cursor up one line.
l
move the cursor to the right one character position.
r
replace one character under the cursor. Specify count to replace a number of characters
u
undo the last change to the file. Typing u again will re-do the change.
x
delete character under the cursor. Count specifies how many characters to delete. The characters will be deleted after the cursor.

Text Buffers in VI

The VI editor has 36 buffers for storing pieces of text, and also a general purpose buffer. Any time a block of text is deleted or yanked from the file, it gets placed into the general purpose buffer. Most users of VI rarely use the other buffers, and can get along without the other buffers. The block of text is also stored in another buffer as well, if it is specified. The buffer is specified using the " command. After typing ", a letter or digit specifying the buffer must be entered. For example, the command: "mdd uses the buffer m, and the last two characters stand for delete current line. Similarly, text can be pasted in with the p or P command. "mp pastes the contents of buffer m after the current cursor position. For any of the commands used in the next two sections, these buffers can be specified for temporary storage of words or paragraphs.

Cutting and Yanking

The command commonly used command for cutting is d. This command deletes text from the file. The command is preceded by an optional count and followed by a movement specification. If you double the command by typing dd, it deletes the current line. Here are some combinations of these:

d^
deletes from current cursor position to the beginning of the line.
d$
deletes from current cursor position to the end of the line.
dw
deletes from current cursor position to the end of the word.
3dd
deletes three lines from current cursor position downwards.

There is also the y command which operates similarly to the d command which take text from the file without deleting the text.

Pasting

The commands to paste are p and P. The only differ in the position relative to the cursor where they paste. p pastes the specified or general buffer after the cursor position, while P pastes the specified or general buffer before the cursor position. Specifying count before the paste command pastes text the specified number of times.

Indenting Your Code and Checking

The VI editor has features to help programmers format their code neatly. There is a variable that to set up the indentation for each level of nesting in code. For example, the command to set the shift width to 4 characters is :set sw=4.

The following commands indent your lines or remove the indentation, and can be specified with count:

<<
Shifts the current line to the left by one shift width.
>>
Shifts the current line to the right by one shift width.

The VI editor also has a helpful feature which checks your source code for any hanging parentheses or braces. The % command will look for the left parenthesis or brace corresponding to a particular right parenthesis or brace and vice versa. Place the cursor onto a parenthesis or brace and type % to move the cursor to the corresponding parenthesis or brace. This is useful to check for unclosed parentheses or braces. If a parenthesis or brace exists without a matching parenthesis or brace, VI will beep at you to indicate that no matching symbol was found.

Word and Character Searching

The VI editor has two kinds of searches: string and character. For a string search, the / and ? commands are used. When you start these commands, the command just typed will be shown on the bottom line, where you type the particular string to look for. These two commands differ only in the direction where the search takes place. The / command searches forwards (downwards) in the file, while the ? command searches backwards (upwards) in the file. The n and N commands repeat the previous search command in the same or opposite direction, respectively. Some characters have special meanings to VI, so they must be preceded by a backslash (\) to be included as part of the search expression.

Special characters:

^
Beginning of the line. (At the beginning of a search expression.)
.
Matches a single character.
*
Matches zero or more of the previous character.
$
End of the line (At the end of the search expression.)
[
Starts a set of matching, or non-matching expressions... For example: /f[iae]t matches either of these: fit fat fet In this form, it matches anything except these: /a[^bcd] will not match any of these, but anything with an a and another letter: ab ac ad
<
Put in an expression escaped with the backslash to find the ending or beginning of a word. For example: /\ should find only word the, but not words like these: there and other.
>
See the '<' character description above.

The character search searches within one line to find a character entered after the command. The f and F commands search for a character on the current line only. f searches forwards and F searches backwards and the cursor moves to the position of the found character.

The t and T commands search for a character on the current line only, but for t, the cursor moves to the position before the character, and T searches the line backwards to the position after the character.

These two sets of commands can be repeated using the ; or , command, where ; repeats the last character search command in the same direction, while , repeats the command in the reverse direction.

Settings for VI (and EX)

You can customize the way VI behaves upon start up. There are several edit options which are available using the :set command, these are the VI and EX editor options available on Wiliki: (You can get this list by typing :set all and then return in command mode)

noautoindent magic noshowmatch
autoprint mesg noshowmode
noautowrite nomodelines noslowopen
nobeautify nonumber tabstop=8
directory=/tmp nonovice taglength=0
nodoubleescape nooptimize tags=tags /usr/lib/tags
noedcompatible paragraphs=IPLPPPQPP LIpplpipnpbp term=xterm
noerrorbells prompt noterse
noexrc noreadonly timeout
flash redraw timeoutlen=500
hardtabs=8 remap ttytype=xterm
noignorecase report=5 warn
keyboardedit scroll=11 window=23
keyboardedit! sections=NHSHH HUuhsh+c wrapscan
nolisp shell=/bin/csh wrapmargin=0
nolist shiftwidth=8 nowriteany

Some of these options have values set with the equals sign '=' in it, while others are either set or not set. (These on or off type of options are called Boolean, and have "no" in front of them to indicate that they are not set.) The options shown here are the options that are set without any customization. Descriptions of some of these are given below, with an abbreviation. For example, the command set autoindent, you can type :set autoindent or :set ai. To unset it, you can type :set noautoindent or :set noai.

autoindent (ai)
This option sets the editor so that lines following an indented line will have the same indentation as the previous line. If you want to back over this indentation, you can type ^D at the very first character position. This ^D works in the insert mode, and not in command mode. Also, the width of the indentations can be set with shiftwidth, explained below.
exrc
The .exrc file in the current directory is read during startup. This has to be set either in the environment variable EXINIT or in the .exrc file in your home directory.
mesg
Turn off messages if this option is unset using :set nomesg, so that nobody can bother you while using the editor.
number (nu)
Displays lines with line numbers on the left side.
shiftwidth (sw)
This option takes a value, and determines the width of a software tabstop. (The software tabstop is used for the << and >> commands.) For example, you would set a shift width of 4 with this command: :set sw=4.
showmode (smd)
This option is used to show the actual mode of the editor that you are in. If you are in insert mode, the bottom line of the screen will say INPUT MODE.
warn
This option warns you if you have modified the file, but haven't saved it yet.
window (wi)
This option sets up the number of lines on the window that VI uses. For example, to set the VI editor to use only 12 lines of your screen (because your modem is slow) you would use this: :set wi=12.
wrapscan (ws)
This option affects the behavior of the word search. If wrapscan is set, if the word is not found at the bottom of the file, it will try to search for it at the beginning.
wrapmargin (wm)
If this option has a value greater than zero, the editor will automatically "word wrap". That is, if you get to within that many spaces of the left margin, the word will wrap to the next line, without having to type return. For example, to set the wrap margin to two characters, you would type this: :set wm=2.

Abbreviations and Mapping Keys to Other Keys

One EX editor command that is useful in the VI editor is the abbreviate command. This lets you set up abbreviations for specific strings. The command looks like this: :ab string thing to substitute for. For example, if you had to type the name, "Humuhumunukunukuapua`a" but you didn't want to type the whole name, you could use an abbreviation for it. For this example, the command is entered like this:
:ab 9u Humuhumunukunukuapua`a
Now, whenever you type 9u as a separate word, VI will type in the entire word(s) specified. If you typed in 9university, it will not substitute the word.

To remove a previously defined abbreviation, the command is unabbreviate. To remove the previous example, the command would be ":una 9u" To get your listing of abbreviations, simply just type :ab without any definitions.

Another EX editor command that is useful for customization is the mapping command. There are two kinds of mapping commands. One for command mode, and the other for insert mode. These two commands are :map and :map! respectively. The mapping works similarly to the abbreviation, and you give it a key sequence and give it another key sequence to substitute it with. (The substituted key sequences are usually VI commands.)

The EXINIT Environment Variable and the .exrc file

There are two ways to customize the VI editor. If you create a file called .exrc in your home directory, all the commands in there will be read when VI starts up. The other method is to set an environment variable called EXINIT. The options will be set in your shell's setup file. If you use /bin/csh (C-Shell), the command is as follows, and is put in the .cshrc file:

    setenv EXINIT '...'
If you use /bin/sh or /bin/ksh, the command is as follows, and is put into the .profile file:
    export EXINIT
EXINIT='...'
Don't put in ... as the example says. In this space put the commands that you want to set up. For example, if you want to have auto indent, line numbering, and the wrap margin of three characters, then the setenv command (for C shell) looks like this:
    setenv EXINIT 'set ai nu wm=3'

If you want to put more than one command in the setenv EXINIT thing, separate the commands with a vertical bar (|). For example, to map the 'g' command to the 'G' character in command mode, the command is :map g G, and combined with the above command, you get this:

setenv EXINIT 'set ai nu wm=3|map g G'

If you want to create the file called .exrc, you can put exactly the same things in the file as shown in the quotes after the EXINIT.

Recovering Your Work When Something Goes Wrong with Your Terminal

The VI editor edits a temporary copy of your file, and after the editing is complete, or when you tell it to save, it puts the contents of the temporary copy into the original file. If something goes wrong while you are editing your file, the VI editor will attempt to save whatever work you had in progress, and store it for later recovery. (Note: If VI dies while you were working on any file, it sends you an email message on how to recover it. The -r option stands for recovery. If you were editing the file vitalinfo, and you accidentally got logged out, then the -r option of the 'vi' editor should help. The command would look somewhat like this: vi -r vitalinfo After using the -r option once, though, you MUST save what you have recovered to the actual file... The -r option only works once per failed VI session.

Warning About Using VI on the Workstations

There are two things to be aware of when using the workstations: Editing the same file many times at once, and changing the size of the screen.

Because VI edits a copy of your original file and saves the contents of that copy into the original file, if you are logged on more than once and are editing the same file more than once using VI, if you save on one window and then you save on the other window, the changes made to the file on the first save would be overwritten. Make sure that you only run one copy of VI per file.

If you use a terminal program from a workstation, you can change the size of the screen by dragging the sides of the window. If the size is not working properly, the command to type is this:

    eval `resize`
If that doesn't work the command would be this:
    eval `/usr/bin/X11/resize`
If the size is wrong, the editor will not operate correctly. If you have any problems with the screen size, ask the monitors in the computer lab for help setting the sizes correctly.

Summary of VI commands

This list is a summary of VI commands, categorized by function. There may be other commands available, so check the on-line manual on VI. For easy reference, you can save this file as text and delete any commands you don't think you would use and print out the resulting shorter file.

Cutting and Pasting/Deleting text

"
Specify a buffer to be used any of the commands using buffers. Follow the " with a letter or a number, which corresponds to a buffer.
D
Delete to the end of the line from the current cursor position.
P
Paste the specified buffer before the current cursor position or line. If no buffer is specified (with the " command.) then 'P' uses the general buffer.
X
Delete the character before the cursor.
Y
Yank the current line into the specified buffer. If no buffer is specified, then the general buffer is used.
d
Delete until where. "dd" deletes the current line. A count deletes that many lines. Whatever is deleted is placed into the buffer specified with the " command. If no buffer is specified, then the general buffer is used.
p
Paste the specified buffer after the current cursor position or line. If no buffer is specified (with the " command.) then 'p' uses the general buffer.
x
Delete character under the cursor. A count tells how many characters to delete. The characters will be deleted after the cursor.
y
Yank until , putting the result into a buffer. "yy" yanks the current line. a count yanks that many lines. The buffer can be specified with the " command. If no buffer is specified, then the general buffer is used.

Inserting New Text

A
Append at the end of the current line.
I
Insert from the beginning of a line.
O
(letter oh) Enter insert mode in a new line above the current cursor position.
a
Enter insert mode, the characters typed in will be inserted after the current cursor position. A count inserts all the text that had been inserted that many times.
i
Enter insert mode, the characters typed in will be inserted before the current cursor position. A count inserts all the text that had been inserted that many times.
o
Enter insert mode in a new line below the current cursor position.

Moving the Cursor Within the File

^B
Scroll backwards one page. A count scrolls that many pages.
^D
Scroll forwards half a window. A count scrolls that many lines.
^F
Scroll forwards one page. A count scrolls that many pages.
^H
Move the cursor one space to the left. A count moves that many spaces.
^J
Move the cursor down one line in the same column. A count moves that many lines down.
^M
Move to the first character on the next line.
^N
Move the cursor down one line in the same column. A count moves that many lines down.
^P
Move the cursor up one line in the same column. A count moves that many lines up.
^U
Scroll backwards half a window. A count scrolls that many lines.
$
Move the cursor to the end of the current line. A count moves to the end of the following lines.
%
Move the cursor to the matching parenthesis or brace.
^
Move the cursor to the first non-whitespace character.
(
Move the cursor to the beginning of a sentence.
)
Move the cursor to the beginning of the next sentence.
{
Move the cursor to the preceding paragraph.
}
Move the cursor to the next paragraph.
|
Move the cursor to the column specified by the count.
+
Move the cursor to the first non-whitespace character in the next line.
-
Move the cursor to the first non-whitespace character in the previous line.
_
Move the cursor to the first non-whitespace character in the current line.
0
(Zero) Move the cursor to the first column of the current line.
B
Move the cursor back one word, skipping over punctuation.
E
Move forward to the end of a word, skipping over punctuation.
G
Go to the line number specified as the count. If no count is given, then go to the end of the file.
H
Move the cursor to the first non-whitespace character on the top of the screen.
L
Move the cursor to the first non-whitespace character on the bottom of the screen.
M
Move the cursor to the first non-whitespace character on the middle of the screen.
W
Move forward to the beginning of a word, skipping over punctuation.
b
Move the cursor back one word. If the cursor is in the middle of a word, move the cursor to the first character of that word.
e
Move the cursor forward one word. If the cursor is in the middle of a word, move the cursor to the last character of that word.
h
Move the cursor to the left one character position.
j
Move the cursor down one line.
k
Move the cursor up one line.
l
Move the cursor to the right one character position.
w
Move the cursor forward one word. If the cursor is in the middle of a word, move the cursor to the first character of the next word.

Moving the Cursor Around the Screen

^E
Scroll forwards one line. A count scrolls that many lines.
^Y
Scroll backwards one line. A count scrolls that many lines.
z
Redraw the screen with the following options. "z" puts the current line on the top of the screen; "z." puts the current line on the center of the screen; and "z-" puts the current line on the bottom of the screen. If you specify a count before the 'z' command, it changes the current line to the line specified. For example, "16z." puts line 16 on the center of the screen.

Replacing Text

C
Change to the end of the line from the current cursor position.
R
Replace characters on the screen with a set of characters entered, ending with the Escape key.
S
Change an entire line.
c
Change until . "cc" changes the current line. A count changes that many lines.
r
Replace one character under the cursor. Specify a count to replace a number of characters.
s
Substitute one character under the cursor, and go into insert mode. Specify a count to substitute a number of characters. A dollar sign ($) will be put at the last character to be substituted.

Searching for Text or Characters

,
Repeat the last f, F, t or T command in the reverse direction.
/
Search the file downwards for the string specified after the /.
;
Repeat the last f, F, t or T command.
?
Search the file upwards for the string specified after the ?.
F
Search the current line backwards for the character specified after the 'F' command. If found, move the cursor to the position.
N
Repeat the last search given by '/' or '?', except in the reverse direction.
T
Search the current line backwards for the character specified after the 'T' command, and move to the column after the if it's found.
f
Search the current line for the character specified after the 'f' command. If found, move the cursor to the position.
n
Repeat last search given by '/' or '?'.
t
Search the current line for the character specified after the 't' command, and move to the column before the character if it's found.

Manipulating Character/Line Formatting

~
Switch the case of the character under the cursor.
<
Shift the lines up to where to the left by one shiftwidth. "<<" shifts the current line to the left, and can be specified with a count.
>
Shift the lines up to where to the right by one shiftwidth. ">>" shifts the current line to the right, and can be specified with a count.
J
Join the current line with the next one. A count joins that many lines.

Saving and Quitting

^\
Quit out of "VI" mode and go into "EX" mode. The EX editor is the line editor VI is build upon. The EX command to get back into VI is ":vi".
Q
Quit out of "VI" mode and go into "EX" mode. The ex editor is a line-by-line editor. The EX command to get back into VI is ":vi".
ZZ
Exit the editor, saving if any changes were made.

Miscellany

^G
Show the current filename and the status.
^L
Clear and redraw the screen.
^R
Redraw the screen removing false lines.
^[
Escape key. Cancels partially formed command.
^^
Go back to the last file edited.
!
Execute a shell. If a is specified, the program which is executed using ! uses the specified line(s) as standard input, and will replace those lines with the standard output of the program executed. "!!" executes a program using the current line as input. For example, "!4jsort" will take five lines from the current cursor position and execute sort. After typing the command, there will be a single exclamation point where you can type the command in.
&
Repeat the previous ":s" command.
.
Repeat the last command that modified the file.
:
Begin typing an EX editor command. The command is executed once the user types return. (See section below.)
@
Type the command stored in the specified buffer.
U
Restore the current line to the state it was in before the cursor entered the line.
m
Mark the current position with the character specified after the 'm' command.
u
Undo the last change to the file. Typing 'u' again will re-do the change.

EX Commands

The VI editor is built upon another editor, called EX. The EX editor only edits by line. From the VI editor you use the : command to start entering an EX command. This list given here is not complete, but the commands given are the more commonly used. If more than one line is to be modified by certain commands (such as ":s" and ":w" ) the range must be specified before the command. For example, to substitute lines 3 through 15, the command is ":3,15s/from/this/g".

:ab string strings
Abbreviation. If a word is typed in VI corresponding to string1, the editor automatically inserts the corresponding words. For example, the abbreviation ":ab usa United States of America" would insert the words, "United States of America" whenever the word "usa" is typed in.
:map keys new_seq
Mapping. This lets you map a key or a sequence of keys to another key or a sequence of keys.
:q
Quit VI. If there have been changes made, the editor will issue a warning message.
:q!
Quit VI without saving changes.
:s/pattern/to_pattern/options
Substitute. This substitutes the specified pattern with the string in the to_pattern. Without options, it only substitutes the first occurence of the pattern. If a 'g' is specified, then all occurences are substituted. For example, the command ":1,$s/Dwayne/Dwight/g" substitutes all occurences of "Dwayne" to "Dwight".
:set [all]
Sets some customizing options to VI and EX. The ":set all" command gives all the possible options. (See the section on customizing VI for some options.)
:una string
Removes the abbreviation previously defined by ":ab".
:unm keys
Removes the remove mapping defined by ":map".
:vi filename
Starts editing a new file. If changes have not been saved, the editor will give you a warning.
:w
Write out the current file.
:w filename
Write the buffer to the filename specified.
:w >> filename
Append the contents of the buffer to the filename.
:wq
Write the buffer and quit.
TIPS
-------

#vimtutor -->tutz about vi editor.

Find and replace a word

:g/file_to_replace/s//file_to_replace_with/g

Sunday, January 27, 2008

Unroutable eMail error in cpanel server

For the unrouteable mail domain error please check the following option in your WHM

1) remove the file eximmailtrap from /etc
2)edit the file /var/cpanel/cpanel.config and change eximmailtrap=1 to eximmailtrap=0
3) uncheck the option 'Track the origin of messages sent though the mail server by adding the X-Source headers (exim 4.34+ required)' from WHM >>Tweak Settings
4) uncheck the option 'Prevent the user "nobody" from sending out mail to remote addresses (PHP and CGI scripts generally run as nobody if you are not using PHPSuexec and Suexec respectively.)' from WHM >> Tweak Settings.

Helm Installation and Introduction

Helm Web Hosting Control System
===========================================

The Helm Web Hosting Control System is an extremely powerful hosting automation solution for Windows and Windows .NET servers. Helm is developed by WebHost Automation Ltd, a United Kingdom-based corporation. Their main website is:

http://www.webhostautomation.com

Prerequisites For a New Helm Installation


- Supported Windows Operating Systems

Helm supports the following Windows Server operating systems:

Windows Server 2003, Standard Edition
Windows Server 2003, Enterprise Edition
Windows Server 2003, Web Edition
Windows Server 2003, Datacenter Edition
Windows 2000 Server
Windows 2000 Advanced Server
Windows 2000 Datacenter Server

Please ensure one of the above server operating systems is installed prior to installing Helm

-Need to have the C: drive in Windows available

Helm (and a lot of other Windows applications) need to have the C: drive in Windows available. Do NOT change the drive letter from C: as this will cause issues. You can install Helm on any other drive on the same server, but there must always be a C: drive available on that server.

Also, the Default Share must be available on the folder. To check this, right-click the C: drive, and choose Sharing and Security. The setup should look like this:


-Windows groups/User names

The C: drive root must have the following Windows groups/User names on it, with full permissions for Helm to work:

Administrators (not just Administrator)
SYSTEM


-File and Print Sharing enabled


Helm needs the server to have File and Print Sharing enabled in order to contact certain services.



-IP Filtering to be disabled on the server

Helm requires IP Filtering to be disabled on the server as it causes conflicts with some of the communications that Helm makes.

1.) To make sure IP Filtering is disabled in Windows, go to:
Start > Control Panel > Network Connections

2.) Right click your active network connection and choose Properties. In the new window that opens, double click "Internet Protocol (TCP/IP)".

3.) In the second window that opened, click the "Advanced" button. This will open another window - go to the Options tab, and double click "TCP/IP filtering". A final window opens up - make sure that the "Enable TCP/IP Filtering (all adapters)" box is unchecked.


-Remote Registry Service needs to be enabled

The Remote Registry Service needs to be enabled on the control server, and any remote server you will be using with Helm.

1.) To do this, go to:
Start > Programs > Administrative Tools > Services.

2.) Scroll down until you see Remote Registry Service:

3.) Highlight it, right-click and choose Properties.

4.) In the "Startup Type" dropdown box, choose "Automatic". Then click the "Start" button. This will start the Remote Registry service and make sure it is started each time the server reboots.

5.) Make sure you repeat this process for each remote server you are controlling with Helm.


-Password Complexity

Helm generates passwords for the user accounts it creates (including FTP and FrontPage). This can conflict with the way Windows password complexity works. In order for Helm to successfully create domains, it is necessary for the Windows minimum password length to be set to zero.

1.) To do this, in Windows, go to:
Start > Control Panel > Administrative Tools > Local Security Policy > Account Policies > Password Policies

2.) You can double click an option in the right hand pane to change it.


-Active Server Pages (ASP) - Windows 2003

On a default install of Windows 2003, Active Server Pages are prohibited in IIS. Helm needs ASP to be enabled, as it uses ASP to run. Open IIS and in the left hand pane click Web Service Extensions.


-Required Software


You will need the following installed on your server in order to start offering basic services with Helm:

IIS (Internet Information Services - a Windows component)
FTP Server - 2 supported:
o Serv-U FTP
o Microsoft FTP
o Gene6 FTP
Mail Server - 4 supported:
o Merak Mail
o IMail (version 6, 7 and 8)
o MailEnable
o SmarterMail
o hMailServer
o MDaemon
DNS Server - 2 supported:
o Simple DNS
o Microsoft DNS


Installation
==============

In order to run Helm 4, you need to install the .NET 2.0 Framework. This is a framework which is downloadable from the Microsoft site.

You can download .NET 2.0 Framework from the below URL.

http://download.webhostautomation.net/MicrosoftDotNet2/dotnetfx.exe

Once downloaded, double click the executable to install the Framework.

1) If you haven't already done so, download the Helm installer from here:


http://helm.download.webhostautomation.net

2.) Double-click the install file you downloaded. Read and accept the license agreement, then fill in your name and your company name, then enter your license key. Your license key will have been sent to you when you either signed up for a trial account, or purchased a full license.

* Next step

Helm Control Server with MSDE:

Choosing this option will install Helm with MSDE (a cut-down version of SQL Server). If you do not have SQL Server on your machine, this is the option you should choose.




Helm Control Server:

Choosing this option will install just Helm on your server, with no database server. If you have SQL Server installed on your server, you should choose this option as Helm can then put your database into SQL Server. Alternatively, if you installed MSDE already and already have a Helm database, then there is no need to install MSDE again, so choose this option and in the next screen choose the Helm database you already have set up there.

Helm Remote Server:

If you just want to install the Remote Installer tool to allow Helm to manage a remote server, you should choose this option.


If you choose: Helm Control Server, then go on to Next step:


In the Server Name field, you will see the server that your Helm database is believed to be on. If this is incorrect, you can click the button and select the correct location of the Helm database.

If you are using SQL Server on a different machine than Helm to host the database, then you will need to provide SQL User Authentication details (the SA username and password), in order to connect to this remote machine.


NOTE :: Do NOT install old Helm updates on top of new ones. Doing so could corrupt your entire database, and may mean you having to drop that database and all data and recreating it from scratch. If you have errors, contact your support provider - do not overwrite new updates with old.


FEATURES

*Helm gives you the ability to send out messages via its internal messaging system to your customers.

*If you need to change your details for any reason, you can do this at the Administrator Main Menu as well. Simply click "Personal Details"

*Helm gives you the ability to generate reports for reseller, customer and domain bandwidth, and customer, reseller and domain bandwidth, and also export these reports to Microsoft Excel. There is also the ability to see "Who's On" currently

*Helm splits the way it offers services into two formats: plans and packages.

A "plan" is a template, a way of creating a number of settings that can be bundled and offered to resellers. Each customer has an instance of that plan, which is called a "package". Packages can be customized for each customer, whilst any alterations to the plan will affect all resellers that have packages which use that plan.



Steps to configure

* Add Reseller Plans
* You now need to assign the resources you created earlier to this new plan.
* You now need to set the plan to use each of the relevant resources you have created
* You now need to do the same for each of the other 3 resources - FTP, DNS and Mail
* Add server
* Add Machine IP addresses
* Enter the Services details for the server (Mail, FTP, Stats, and DNS)
* Enter name servers and the IP address.
* Create a reseller
* create a domain for the reseller
* Test by Adding Email and stats.



Restore and migration tool to move and repair your sites


Details of using the Helm Repair Tool, which allows you to repair lost accounts between Helm and FTP, IIS, DNS, statistics and mail. It also lets you easily move accounts in Helm to point at new software if you have recently switched mail or FTP servers.


Intelligent Restoration

Using the Helm Restore Tool, it is now possible for administrators to recover from complete server disasters. For any of the many different types of services Helm supports, the Helm Restore Tool will rebuild and repair missing and corrupt account information.

Powerful Server Migration


The Helm Restore Tool contains powerful migration technologies that allow administrators to migrate their hosting services between different physical servers!

Total Service Migration


The Helm Restore Tool lets you easily move accounts in Helm to point at new software if you have recently switched servers for FTP, DNS, statistics and mail. For example, if you are using MailEnable and want to move all your accounts in Helm to use Smartermail, then the Helm Restore Tool can help you do just that.







STEPS TO RESTORE


Open up the Helm Restore tool. By default this is located here:

C:\Program Files\WebHost Automation\Helm\Tools\HelmRestoreTool.exe

For example: removed a domain, can be seen in helm not in IIS, repair this domain and get it added back into IIS.


From the Restore Tool, choose the option to "Restore ` [Web Service name]' " where [Web Service name] is the name of the web service to which the domain is assigned. Since in this instance you know the only domain you want to restore is called sampledomain.com you can uncheck all other domains on the web service


If you check the Update DNS box, then Helm will recreate any missing DNS entries for that service. So for a web restore, it will recreate the www and * records.


If you check the Skip Failures box, then if error occure during the migrate or restore process, then the Restore Tool will continue on to the next domain. Otherwise, the process will terminate at the domain .


Click the "Migrate/Restore" button, and you will be prompted to confirm the action you are about to take. If you are sure, choose "Yes". The Helm Restore Tool will then shut down the Helm Control Panel website in IIS (to prevent any changes being made whilst the Restore Tool is running) and then restore the domain in IIS.


The web restore is now complete. You can use the Helm Restore Tool in this way to restore web, mail, FTP, DNS, Databases and Statistics.



MIGRATION


The Helm Restore Tool gives you the ability to migrate domains between different services.

You may want to move from using one mail server to a different one. Or you may want to keep the same software, but have it installed on a different server and move some or all of your domains over to use that server.

For Example: Let us assume you want to move from using one mail server (MailEnable) to using another mail server (hMailServer), on the same machine.

The first thing you need to do in Helm is to set up the new service that you will be migrating to (if you haven't done so already). So in the above example, you'll need to set up a hMailServer service in Helm for the service you are migrating to.


From the dropdown box of the The Helm Restore Tool, scroll down to the "Mail Services" section and choose the Migrate procedure that you want.

In the above case, the option chosen is

"Migrate `Default Mail Service on SERVER'=>`hMailServer Service on SERVERNAME'”:


You will see a list of all domains currently on the old service that can be moved to a new service. If you only want to move specific domains, then only check the boxes of those particular domains.


If you check the Update DNS box, then Helm will recreate any missing DNS entries for that service. So for the mail migration, it will recreate the "mail" record in DNS for the new service, unless you have specifically chosen the option for it not to in the mail service in Helm

Click the "Migrate/Restore" button. The Helm Restore Tool will go through each domain currently using the old service, and move it over to the new service:


Once the migration is complete, you can go into Helm and delete the old service if necessary, since it is no longer associated with any domains.


The migration is now complete. You can use the above example to migrate other services between servers in the same way.


The following services can be migrated:

Web
Mail
DNS
FTP
Statistics
Databases

Just use the above example to migrate any of the above services using the Helm Restore Tool!



ADDING PRIVATE NAME SERVERS

Helm supports personal DNS for resellers. This means that a reseller can have their own name servers for their domains that are different from the default name servers and other resellers name servers.

The first thing to do is to have the name servers setup up at the domain registrar. Name servers

Will require their own IP addresses to function correctly. This IPs will need to be added to the server hosting the DNS service and you will need to ensure that the DNS server software is listening on those IPs. Often the DNS server software will listen on all IPs for the server, however, some software doesn't like this and the IPs have to be set manually.

To set up the personal name servers, log in as an administrator, go to System Settings" > "Servers", and click on the server that is hosting the DNS service.


Click on the DNS service in the server's service list. At the bottom of the DNS service editor there will be a list of name servers. There should be the "Default" name server(s) already added from when you first created the service.


Click on "Add New" to add the resellers name services. Enter in the relevant information into form and keep "Default name server" unchecked. Click Save to continue. If you have the primary and secondary DNS service on different machines, you will need to add the secondary name server to the secondary DNS service.


To complete personal DNS, go to the resellers account in Helm and click "Account Settings" under their account. Click on "Global Settings" to get a list of their general Helm settings. On this page there is a Personal DNS Mask box. In this box enter the domain name used for the resellers new name servers.

For example.

If you have set up ns1.personaldns.com and ns2.personaldns.com then enter "personaldns.com" into the DNS mask. Click Save to save the changes. Make sure that the mask and the DNS Service name use the same name, or it won't work. When ever a new domain is now created, Helm will automatically assign these name servers to the domain. You will see them in the Advanced Settings area for the domain.



Move Helm and its database to a new server

To move Helm you can simply take a back-up of your HelmDB. Then install Helm on your new server, reset your licence key via your WHA account and then restore your backed up HelmDB.

However, if the IP references have changed you will need to alter all these in Helm. If you are able to assign the same IP's to the new server this would help you as then you would just need to back up IIS, mail, and the domains files and restore these on your new server without changing the HelmDB.

There is also currently no supported back-up or restore tool to handle moving of domains or DNS zones from one server to another. There is a tool for Web, Mail and FTP which will re-create accounts from the HelmDB using the new IPs if you alter these first.

This is called HelmRestoreTool.exe and is available in the Tools subfolder of your Helm installation folder.