xterm-256color: Unknown terminal type

Problem

If you connect to a Solaris by ssh from Linux or MacOSX you can get the following message when using vi:

# vi httpd.conf
xterm-256color: Unknown terminal type
I don't know what kind of terminal you are on - all I have is 'xterm-256color'.
[Using open mode]
"httpd.conf" 705 lines, 24071 characters
#
# This is the main Apache HTTP server configuration file. It contains the

Solution

Define the TERM environment variable:

# export TERM=xterm

Now you can execute vi:

# vi httpd.conf

This change is valid just for the current Terminal session. If you want to make it permanent you have to add that export to your ~/.bashrc file. If you want to make the change permanent for all the users you can edit the /etc/profile file or add a new file in /etc/profile.d/